Datasets:
Tasks:
Question Answering
Modalities:
Image
Formats:
imagefolder
Languages:
English
Size:
100K - 1M
ArXiv:
License:
Add files using upload-large-folder tool
Browse filesFiles changed (50)
- md/train/B1Kh0SVodY/B1Kh0SVodY.mdAdded+347
- md/train/B9t708KMr9d/B9t708KMr9d.mdAdded+279
- md/train/BJQRKzbA-/BJQRKzbA-.mdAdded+299
- md/train/Bkgq9ANKvB/Bkgq9ANKvB.mdAdded
- md/train/ByJbJwxCW/ByJbJwxCW.mdAdded+327
- md/train/ByOExmWAb/ByOExmWAb.mdAdded+381
- md/train/ByghKiC5YX/ByghKiC5YX.mdAdded
- md/train/ByxPYjC5KQ/ByxPYjC5KQ.mdAdded+477
- md/train/D04TGKz5rfF/D04TGKz5rfF.mdAdded+540
- md/train/GhMZNcr54zt/GhMZNcr54zt.mdAdded+201
- md/train/HJgJNCEKPr/HJgJNCEKPr.mdAdded+286
- md/train/Hk8rlUqge/Hk8rlUqge.mdAdded+284
- md/train/HkSOlP9lg/HkSOlP9lg.mdAdded+297
- md/train/Hke0K1HKwr/Hke0K1HKwr.mdAdded+302
- md/train/Hkl1iRNFwS/Hkl1iRNFwS.mdAdded+257
- md/train/HkljioCcFQ/HkljioCcFQ.mdAdded+441
- md/train/HktJec1RZ/HktJec1RZ.mdAdded+243
- md/train/HkxaFoC9KQ/HkxaFoC9KQ.mdAdded+314
- md/train/HyM8V2A9Km/HyM8V2A9Km.mdAdded+400
- md/train/HygOjhEYDH/HygOjhEYDH.mdAdded
- md/train/Hyl9xxHYPr/Hyl9xxHYPr.mdAdded
- md/train/HyxY6JHKwr/HyxY6JHKwr.mdAdded
- md/train/KG2RTUXXU7/KG2RTUXXU7.mdAdded
- md/train/NTEz-6wysdb/NTEz-6wysdb.mdAdded
- md/train/OEgDatKuz2O/OEgDatKuz2O.mdAdded
- md/train/QbVza2PKM7T/QbVza2PKM7T.mdAdded
- md/train/S1lhbnRqF7/S1lhbnRqF7.mdAdded
- md/train/SJZsR7kCZ/SJZsR7kCZ.mdAdded
- md/train/SJl7DsR5YQ/SJl7DsR5YQ.mdAdded
- md/train/SJyEH91A-/SJyEH91A-.mdAdded
- md/train/SkeRTsAcYm/SkeRTsAcYm.mdAdded
- md/train/SkfTIj0cKX/SkfTIj0cKX.mdAdded
- md/train/Skgxcn4YDS/Skgxcn4YDS.mdAdded
- md/train/SklVEnR5K7/SklVEnR5K7.mdAdded
- md/train/SklsBJHKDS/SklsBJHKDS.mdAdded
- md/train/SkxpxJBKwS/SkxpxJBKwS.mdAdded
- md/train/URc7gYBcjVn/URc7gYBcjVn.mdAdded
- md/train/aohkNJxjYJX/aohkNJxjYJX.mdAdded
- md/train/bqGK5PyI6-N/bqGK5PyI6-N.mdAdded
- md/train/cdlzxKUBr-A/cdlzxKUBr-A.mdAdded
- md/train/iVaPuvROtMm/iVaPuvROtMm.mdAdded
- md/train/qbH974jKUVy/qbH974jKUVy.mdAdded
- md/train/r1Ddp1-Rb/r1Ddp1-Rb.mdAdded
- md/train/r1gdj2EKPB/r1gdj2EKPB.mdAdded
- md/train/r1lUOzWCW/r1lUOzWCW.mdAdded
- md/train/r1lrAiA5Ym/r1lrAiA5Ym.mdAdded
- md/train/r1lyTjAqYX/r1lyTjAqYX.mdAdded
- md/train/rkgs0oAqFQ/rkgs0oAqFQ.mdAdded
- md/train/ry3iBFqgl/ry3iBFqgl.mdAdded
- md/train/rylDfnCqF7/rylDfnCqF7.mdAdded
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347# Learning curves of generic features maps for realistic datasets with a teacher-student model
Bruno Loureiro IdePHICS, EPFL, Lausanne
Cédric Gerbelot Lab. de Physique de l’École Normale Supérieure, Paris
Hugo Cui SPOC, EPFL, Lausanne
Sebastian Goldt SISSA, Trieste
Florent Krzakala IdePHICS, EPFL, Lausanne
Marc Mézard École Normale Supérieure, Paris
Lenka Zdeborová SPOC, EPFL, Lausanne
# Abstract
Teacher-student models provide a framework in which the typical-case performance of high-dimensional supervised learning can be described in closed form. The assumptions of Gaussian i.i.d. input data underlying the canonical teacher-student model may, however, be perceived as too restrictive to capture the behaviour of realistic data sets. In this paper, we introduce a Gaussian covariate generalisation of the model where the teacher and student can act on different spaces, generated with fixed, but generic feature maps. While still solvable in a closed form, this generalization is able to capture the learning curves for a broad range of realistic data sets, thus redeeming the potential of the teacher-student framework. Our contribution is then two-fold: first, we prove a rigorous formula for the asymptotic training loss and generalisation error. Second, we present a number of situations where the learning curve of the model captures the one of a realistic data set learned with kernel regression and classification, with out-of-the-box feature maps such as random projections or scattering transforms, or with pre-learned ones - such as the features learned by training multi-layer neural networks. We discuss both the power and the limitations of the framework.
# 1 Introduction
Teacher-student models are a popular framework to study the high-dimensional asymptotic performance of learning problems with synthetic data, and have been the subject of intense investigations spanning three decades [1–7]. In the wake of understanding the limitations of classical statistical learning approaches [8–10], this direction is witnessing a renewal of interest [10–15]. However, this framework is often assuming the input data to be Gaussian i.i.d., which is arguably too simplistic to be able to capture properties of realistic data. In this paper, we redeem this line of work by defining a Gaussian covariate model where the teacher and student act on different Gaussian correlated spaces with arbitrary covariance. We derive a rigorous asymptotic solution of this model generalizing the formulas found in the above mentioned classical works.
We then put forward a theory, supported by universality arguments and numerical experiments, that this model captures learning curves, i.e. the dependence of the training and test errors on the number of samples, for a generic class of feature maps applied to realistic datasets. These maps can be deterministic, random, or even learnt from the data. This analysis thus gives a unified framework to describe the learning curves of, for example, kernel regression and classification, the analysis of feature maps – random projections [16], neural tangent kernels [17], scattering transforms [18] – as well as the analysis of transfer learning performance on data generated by generative adversarial networks [19]. We also discuss limits of applicability of our results, by showing concrete situations where the learning curves of the Gaussian covariate model differ from the actual ones.
Model definition — The Gaussian covariate teacher-student model is defined via two vectors $\mathbf { \boldsymbol { \mathscr { u } } } \in \mathbb { R } ^ { p }$ and $\pmb { v } \in \mathbb { R } ^ { d }$ , with correlation matrices $\Psi \in \mathbb { R } ^ { p \times p } , \Omega \in \mathbb { R } ^ { d \times d }$ and $\Phi \in \mathbb { R } ^ { p \times d }$ , from which we draw $n$ independent samples:
$$\left[ { \pmb u } ^ { \mu } \right] \in \mathbb { R } ^ { p + d } \underset { \mathrm { i . i . d . } } { \sim } \mathcal { N } \left( 0 , \left[ \frac { \Psi } { \Phi ^ { \top } } \quad \frac { \Phi } { \Omega } \right] \right) , \qquad \ \mu = 1 , \cdots , n .$$
The labels $y ^ { \mu }$ are generated by a teacher function that is only using the vectors $\pmb { u } ^ { \mu }$ :
$$y ^ { \mu } = f _ { 0 } \left( \frac { 1 } { \sqrt { p } } \pmb { \theta } _ { 0 } ^ { \top } { \pmb u } ^ { \mu } \right) ,$$
where $f _ { 0 } : \mathbb { R } \to \mathbb { R }$ is a function that may include randomness such as, for instance, an additive Gaussian noise, and $\pmb \theta _ { 0 } \in \mathbb { R } ^ { p }$ is a vector of teacher-weights with finite norm which can be either random or deterministic. Learning is performed by the student with weights $\pmb { w }$ via empirical risk minimization that has access only to the features $v ^ { \mu }$ :
$$\pmb { \hat { w } } = \underset { \pmb { w } \in \mathbb { R } ^ { d } } { \arg \operatorname* { m i n } } \left[ \sum _ { \mu = 1 } ^ { n } g \left( \frac { \pmb { w } ^ { \top } \pmb { v } ^ { \mu } } { \sqrt { d } } , y ^ { \mu } \right) + r ( \pmb { w } ) \right] ,$$
where $r$ and $g$ are proper, convex, lower-semicontinuous functions of $\pmb { w } \in \mathbb { R } ^ { d }$ (e.g. $g$ can be a logistic or a square loss and $r$ a $\ell _ { p }$ $( p = 1 , 2 )$ regularization). The key quantities we want to compute in this model are the averaged training and generalisation errors for the estimator $\pmb { w }$ ,
$$\begin{array} { r } { \mathrm { ~ \xi ~ } _ { \mathrm { t r a i n . } } ( w ) \equiv \displaystyle \frac { 1 } { n } \sum _ { \mu = 1 } ^ { n } g \left( \frac { w ^ { \top } v ^ { \mu } } { \sqrt { d } } , y ^ { \mu } \right) \quad \mathrm { a n d } \quad \mathcal { E } _ { \mathrm { g e n . } } ( w ) \equiv \mathbb { E } \left[ \hat { g } \left( \hat { f } \left( \frac { v _ { \mathrm { n e w } } ^ { \top } w } { \sqrt { d } } \right) , f _ { 0 } \left( \frac { u _ { \mathrm { n e w } } ^ { \top } \theta _ { 0 } } { \sqrt { p } } \right) \right) \right] . } \end{array}$$
where $g$ is the loss function in eq. (3), $\hat { f }$ is a prediction function (e.g. $\hat { f } = \mathrm { s i g n }$ for a classification task), $\hat { g }$ is a performance measure (e.g. $\hat { \boldsymbol g } ( \hat { y } , y ) = ( \hat { y } - y ) ^ { 2 }$ for regression or $\hat { g } ( \hat { y } , y ) = \mathbb { P } ( \hat { y } \neq y )$ for classification) and $( \boldsymbol { \mathbf { \mathit { u } } } _ { \mathrm { n e w } } , \boldsymbol { \mathbf { \mathit { v } } } _ { \mathrm { n e w } } )$ is a fresh sample from the joint distribution of $\textbf { \em u }$ and $\textbf { { v } }$ .
# Our two main technical contributions are:
(C1) In Theorems 1 & 2, we give a rigorous closed-form characterisation of the properties of the estimator $\hat { \pmb { w } }$ for the Gaussian covariate model (1), and the corresponding training and generalisation errors in the high-dimensional limit. We prove our result using Gaussian comparison inequalities [20]; (C2) We show how the same expression can be obtained using the replica method from statistical physics [21]. This is of additional interest given the wide range of applications of the replica approach in machine learning and computer science [22]. In particular, this allows to put on a rigorous basis many results previously derived with the replica method.
Towards realistic data — In the second part of our paper, we argue that the above Gaussian covariate model (1) is generic enough to capture the learning behaviour of a broad range of realistic data. Let $\{ { \pmb x } ^ { \mu } \} _ { \mu = 1 } ^ { n }$ denote a data set with $n$ independent samples on $\boldsymbol { \mathcal { X } } \subset \mathbb { R } ^ { D }$ . Based on this input, the features $_ { u , v }$ are given by (potentially) elaborated transformations of $_ { \textbf { \em x } }$ , i.e.
$$\pmb { u } = \varphi _ { t } ( \pmb { x } ) \in \mathbb { R } ^ { p } \quad \mathrm { a n d } \quad \pmb { v } = \varphi _ { s } ( \pmb { x } ) \in \mathbb { R } ^ { d }$$
for given centred feature maps $\varphi _ { t } : \mathcal { X } \to \mathbb { R } ^ { p }$ and $\varphi _ { s } : \mathcal { X } \mathbb { R } ^ { d }$ , see Fig. 1. Uncentered features can be taken into account by shifting the covariances, but we focus on the centred case to lighten notation.
The Gaussian covariate model (1) is exact in the case where $_ { \textbf { \em x } }$ are Gaussian variables and the feature maps $( \varphi _ { s } , \varphi _ { s } )$ preserve the Gaussianity, for example linear features. In particular, this is the case for $\pmb { u } = \pmb { v } = \pmb { x }$ , which is the widely-studied vanilla teacher-student model [24]. The interest of the model (1) is that it also captures a range of cases in which the feature maps $\varphi _ { t }$ and $\varphi _ { s }$ are deterministic, or even learnt from the data. The covariance matrices $\Psi , \Phi$ , and $\Omega$ then represent different aspects of the data-generative process and learning model. The student (3) then corresponds to the last layer of the learning model. These observation can be distilled into the following conjecture:
 Figure 1: Left: Given a data set $\{ { \pmb x } ^ { \mu } \} _ { \mu = 1 } ^ { n }$ , teacher $\pmb { u } = \varphi _ { t } ( \pmb { x } )$ and student maps $\pmb { v } = \varphi _ { t } ( \pmb { x } )$ , we assume $[ { \pmb u } , { \pmb v } ]$ to be jointly Gaussian random variables and apply the results of the Gaussian covariate model (1). Right: Illustration on real data, here ridge regression on even vs odd MNIST digits, with regularisation $\lambda { = } 1 0 ^ { - 2 }$ . Full line is theory, points are simulations. We show the performance with no feature map (blue), random feature map with $\sigma = \operatorname { e r f } \delta$ & Gaussian projection (orange), the scattering transform with parameters $J = 3 , L = 8$ [18] (green), and of the limiting kernel of the random map [23] (red). The covariance $\Omega$ is empirically estimated from the full data set, while the other quantities appearing in the Theorem 1 are expressed directly as a function of the labels, see Section 3.4. Simulations are averaged over 10 independent runs.
Conjecture 1. (Gaussian equivalent model) For a wide class of data distributions $\{ { \pmb x } ^ { \mu } \} _ { \mu = 1 } ^ { n }$ , and features maps ${ \pmb u } = \varphi _ { t } ( { \pmb x } ) , { \pmb v } = \varphi _ { s } ( { \pmb x } )$ , the generalisation and training errors of estimator (3) are asymptotically captured by the equivalent Gaussian model $( I ) _ { : }$ , where $[ { \pmb u } , { \pmb v } ]$ are jointly Gaussian variables, and thus by the closed-form expressions of Theorem 1.
# The second part of our main contributions are:
(C3) In Sec. 3.3 we show that the theoretical predictions from (C1) captures the learning curves in non-trivial cases, e.g. when input data are generated using a trained generative adversarial network, while extracting both the feature maps from a neural network trained on real data.
(C4) In Sec. 3.4, we show empirically that for ridge regression the asymptotic formula of Theorem 1 can be applied directly to real data sets, even though the Gaussian hypothesis is not satisfied. This universality-like property is a consequence of Theorem 3 and is illustrated in Fig. 1 (right) where the real learning curve of several features maps learning the odd-versus-even digit task on MNIST is compared to the theoretical prediction.
Related work — Rigorous results for teacher-student models: The Gaussian covariate model (1) contains the vanilla teacher-student model as a special case where one takes $\textbf { \em u }$ and $\textbf { { v } }$ identical, with unique covariance matrix $\Omega$ . This special case has been extensively studied in the statistical physics community using the heuristic replica method [1–3, 24, 25]. Many recent rigorous results for such models can be rederived as a special case of our formula, e.g. refs. [10–15, 26–29]. Numerous of these results are based on the same proof technique as we employed here: the Gordon’s Gaussian min-max inequalities [20, 30, 31]. The asymptotic analysis of kernel ridge regression [32], of margin-based classification [33] also follow from our theorem. See also Appendix A.6 for the details on these connections. Other examples include models of the double descent phenomenon [34]. Closer to our work is the recent work of [35] on the random feature model. For ridge regression, there are also precise predictions thanks to random matrix theory [12, 36–41]. A related set of results was obtained in [42] for orthogonal random matrix models. The main technical novelty of our proof is the handling of a generic loss and regularisation, not only ridge, representing convex empirical risk minimization, for both classification and regression, with the generic correlation structure of the model (1).
Gaussian equivalence: A similar Gaussian conjecture has been discussed in a series of recent works, and some authors proved partial results in this direction [11, 12, 28, 35, 43–46]. Ref. [45] analyses a special case of the Gaussian model (corresponding to $\varphi _ { t } ~ = \mathrm { i d }$ here), and proves a Gaussian equivalence theorem (GET) for feature maps $\varphi _ { s }$ given by single-layer neural networks with fixed weights. They also show that for Gaussian data $\pmb { x } \sim \mathcal { N } ( \mathbf { 0 } , \mathrm { I } _ { D } )$ , feature maps of the form $\pmb { v } = \sigma ( \mathbf { W } \pmb { x } )$ (with some technical restriction on the weights) led to the jointly-Gaussian property for the two scalars $( \pmb { v } \cdot \pmb { w } , \pmb { u } \cdot \pmb { \theta } _ { 0 } )$ for almost any vector $\textbf { \em w }$ . However, their stringent assumptions on random teacher weights limited the scope of applications to unrealistic label models. A related line of work discussed similar universality through the lens of random matrix theory [47–49]. In particular, Seddik et al. [50] showed that, in our notations, vectors $[ u , v ]$ obtained from Gaussian inputs $\pmb { x } \sim \mathcal { N } ( \mathbf { 0 } , \mathrm { I } _ { D } )$ with Lipschitz feature maps satisfy a concentration property. In this case, again, one can expect the two scalars $\begin{array} { r } { ( \pmb { v } \cdot \pmb { w } , \pmb { u } \cdot \pmb { \theta } _ { 0 } ) } \end{array}$ to be jointly Gaussian with high-probability on $\textbf { \em w }$ . Remarkably, in the case of random feature maps, [46] could go beyond this central-limit-like behavior and established the universality of the Gaussian covariate model (1) for the actual learned weights $\hat { \pmb { w } }$ .
# 2 Main technical results
Our main technical result is a closed-form expression for the asymptotic training and generalisation errors (4) of the Gaussian covariate model introduced above. We start by presenting our result in the most relevant setting for the applications of interest in Section 3, which is the case of the $\ell _ { 2 }$ regularization. Next, we briefly present our result in larger generality, which includes non-asymptotic results for non-separable losses and regularizations.
We start by defining key quantities that we will use to characterize the estimator $\hat { \pmb { w } }$ . Let $\Omega =$ $\mathbf { S } ^ { \top } \mathrm { d i a g } ( \omega _ { i } ) \mathbf { \bar { S } }$ be the spectral decomposition of $\Omega$ . Let:
$$\rho \equiv \frac { 1 } { d } \pmb { \theta } _ { 0 } ^ { \top } \Psi \pmb { \theta } _ { 0 } \in \mathbb { R } , \qquad \quad \bar { \pmb { \theta } } \equiv \frac { { \bf S } \Phi ^ { \top } \pmb { \theta } _ { 0 } } { \sqrt { \rho } } \in \mathbb { R } ^ { d }$$
and define the joint empirical density $\hat { \mu } _ { d }$ between $( \omega _ { i } , \bar { \theta } _ { i } )$ :
$$\hat { \mu } _ { d } ( \omega , \bar { \theta } ) \equiv { \frac { 1 } { d } } \sum _ { i = 1 } ^ { d } \delta ( \omega - \omega _ { i } ) \delta ( \bar { \theta } - \bar { \theta } _ { i } ) .$$
Note that $\Phi ^ { \top } \pmb \theta _ { 0 }$ is the projection of the teacher weights on the student space, and therefore $\bar { \pmb { \theta } }$ is the rotated projection on the basis of the student covariance, rescaled by the teacher variance. Together with the student eigenvalues $\omega _ { i }$ , these are relevant statistics of the model, encoded here in the joint distribution $\hat { \mu } _ { d }$ .
Assumptions — Consider the high-dimensional limit in which the number of samples $n$ and the dimensions $p , d \mathrm { g o }$ to infinity with fixed ratios:
$$\alpha \equiv { \frac { n } { d } } , \mathrm { a n d } \gamma \equiv { \frac { p } { d } } .$$
Assume that the covariance matrices $\Psi , \Omega$ are positive-definite and that the Schur complement of the block covariance in equation (1) is positive semi-definite. Additionally, the spectral distributions of the matrices $\Phi , \Psi$ and $\Omega$ converge to distributions such that the limiting joint distribution $\mu$ is well-defined, and their maximum singular values are bounded with high probability as $n , p , d \to \infty$ . Finally, regularity assumptions are made on the loss and regularization functions mainly to ensure feasibility of the minimization problem. We assume that the cost function $r + g$ is coercive, i.e. $\begin{array} { r } { \operatorname* { l i m } _ { \| \pmb { w } \| _ { 2 } + \infty } ( r + g ) ( \pmb { w } ) = + \infty } \end{array}$ and that the following scaling condition holds : for all $n , d \in$ $\mathbb { N } , z \in \mathbb { R } ^ { n }$ and any constant $c > 0$ , there exist a finite, positive constant $C$ , such that, for any standard normal random vectors $\pmb { h } \in \mathbb { R } ^ { d }$ and $\pmb { g } \in \mathbb { R } ^ { n }$ :
$$\| z \| _ { 2 } \leqslant c \sqrt { n } \implies \operatorname* { s u p } _ { x \in \partial g ( z ) } \| x \| _ { 2 } \leqslant C \sqrt { n } , \qquad \frac { 1 } { d } \mathbb { E } \left[ r ( h ) \right] < + \infty , \qquad \frac { 1 } { n } \mathbb { E } \left[ g ( g ) \right] < + \infty$$
The relevance of these assumptions in a supervised machine learning context is discussed in Appendix B.1. We are now in a position to state our result.
Theorem 1. (Closed-form asymptotics for $\ell _ { 2 }$ regularization) In the asymptotic limit defined above, the training and generalisation errors (4) of the estimator $\hat { \textbf { \textit { w } } } \in \mathbb { R } ^ { \dot { d } }$ solving the empirical risk minimisation problem in eq. (3) with $\ell _ { 2 }$ regularization $\begin{array} { r } { r ( \pmb { w } ) = \frac { \lambda } { 2 } | | \pmb { w } | | _ { 2 } ^ { 2 } } \end{array}$ verify:
$$\begin{array} { r l } & { \mathcal { E } _ { \mathrm { t r a i n . } } ( \hat { w } ) \xrightarrow [ d \infty ] { P } \mathbb { E } _ { s , h \sim \mathcal { N } ( 0 , 1 ) } [ g ( p r o x _ { V ^ { \star } g ( \cdot , f _ { 0 } ( \sqrt { \rho } s ) ) } ( \frac { m ^ { \star } } { \sqrt { \rho } } s + \sqrt { q ^ { \star } - \frac { m ^ { \star ^ { 2 } } } { \rho } } h ) , f _ { 0 } ( \sqrt { \rho } s ) ) ] } \\ & { \mathcal { E } _ { \mathrm { g e n . } } ( \hat { w } ) \xrightarrow [ d \infty ] { P } \mathbb { E } _ { ( \nu , \lambda ) } [ \hat { g } ( \hat { f } ( \lambda ) , f _ { 0 } ( \nu ) ) ] } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad ( 1 6 ^ { d } ) } \end{array}$$
where prox stands for the proximal operator defined as
$$p r o x _ { V g ( . , y ) } ( x ) = \arg \operatorname* { m i n } _ { z } \{ g ( z , y ) + \frac { 1 } { 2 V } ( x - z ) ^ { 2 } \}$$
and where $( \nu , \lambda )$ are jointly Gaussian scalar variables:
$$( \nu , \lambda ) \sim \mathcal { N } \left( 0 , \left[ \rho \begin{array} { c c } { \rho } & { m ^ { \star } } \end{array} \right] \right) ,$$
and the overlap parameters $( V ^ { \star } , q ^ { \star } , m ^ { \star } )$ are prescribed by the unique fixed point of the following set of self-consistent equations:
$$\left\{ \begin{array} { l } { V = \mathbb { E } _ { ( \omega , \bar { \theta } ) \sim \mu } \left[ \frac { \omega } { \lambda + \hat { V } \omega } \right] } \\ { m = \frac { \hat { m } } { \sqrt { \gamma } } \mathbb { E } _ { ( \omega , \bar { \theta } ) \sim \mu } \left[ \frac { \theta } { \lambda + \hat { V } \omega } \right] } \\ { q = \mathbb { E } _ { ( \omega , \bar { \theta } ) \sim \mu } \left[ \frac { \hat { m } ^ { 2 } \bar { \theta } ^ { 2 } \omega + \hat { q } \omega ^ { 2 } } { \left( \lambda + \hat { V } \omega \right) ^ { 2 } } \right] } \end{array} \right. , \left\{ \begin{array} { l } { \hat { V } = \frac { \alpha } { V } ( 1 - \mathbb { E } _ { s , h \sim \mathcal { N } ( 0 , 1 ) } [ f _ { g } ^ { \prime } ( V , m , q ) ] ) } \\ { \hat { m } = \frac { 1 } { \sqrt { \rho \gamma } } \frac { \alpha } { V } \mathbb { E } _ { s , h \sim \mathcal { N } ( 0 , 1 ) } \left[ s f _ { g } ( V , m , q ) - \frac { m } { \sqrt { \rho } } f _ { g } ^ { \prime } ( V , m , q ) \right] } \\ { \hat { q } = \frac { \alpha } { V ^ { 2 } } \mathbb { E } _ { s , h \sim \mathcal { N } ( 0 , 1 ) } \left[ \left( \frac { m } { \sqrt { \rho } } s + \sqrt { q - \frac { m ^ { 2 } } { \rho } } h - f _ { g } ( V , m , q ) \right) ^ { 2 } \right] } \end{array} \right.$$
where we defined the scalar random functions $f _ { g } ( V , m , q ) ~ = ~ p r o x _ { V g ( . , f _ { 0 } ( \sqrt { \rho } s ) ) } ( \rho ^ { - 1 / 2 } m s ~ + ~$ $\sqrt { q - \rho ^ { - 1 } m ^ { 2 } } h )$ and $f _ { g } ^ { \prime } ( V , m , h ) = p r o x _ { V g ( . , f _ { 0 } ( \sqrt { \rho } s ) ) } ^ { \prime } ( \rho ^ { - 1 / 2 } m s + \sqrt { q - \rho ^ { - 1 } m ^ { 2 } } h )$ as the first derivative of the proximal operator.
Proof : This result is a consequence of Theorem 2, whose proof can be found in appendix B.
The parameters of the model $( \pmb \theta _ { 0 } , \Omega , \Phi , \Psi )$ only appear trough $\rho$ , eq. (6), and the asymptotic limit $\mu$ of the joint distribution eq. (7) and $( f _ { 0 } , \hat { f } , g , \lambda )$ . One can easily iterate the above equations to find their fixed point, and extract $( q ^ { * } , m ^ { * } )$ which appear in the expressions for the training and generalisation errors $( \mathcal { E } _ { \mathrm { t r a i n } } ^ { \star } , \mathcal { E } _ { \mathrm { g e n } } ^ { \star } )$ , see eq. (4). Note that $( q ^ { \star } , m ^ { \star } )$ have an intuitive interpretation in terms of the estimator $\hat { \pmb w } \in \mathbb { R } ^ { d }$ :
$$\boldsymbol { q } ^ { \star } \equiv \frac { 1 } { d } \hat { \boldsymbol { w } } ^ { \top } \boldsymbol { \Omega } \hat { \boldsymbol { w } } , m ^ { \star } \equiv \frac { 1 } { \sqrt { d p } } \boldsymbol { \theta } _ { 0 } ^ { \top } \Phi \hat { \boldsymbol { w } }$$
Or in words: $m ^ { \star }$ is the correlation between the estimator projected in the teacher space, while $q ^ { \star }$ is the reweighted norm of the estimator by the covariance $\Omega$ . The parameter $V ^ { * }$ also has a concrete interpretation $:$ it parametrizes the deformation that must be applied to a Gaussian field specified by the solution of the fixed point equations to obtain the asymptotic behaviour of $\hat { \mathbf { z } }$ . It prescribes the degree of non-linearity given to the linear output by the chosen loss function. This is coherent with the robust regression viewpoint, where one introduces non-square losses to deal with the potential non-linearity of the generative model. $\hat { V } ^ { * }$ plays a similar role for the estimator wˆ through the proximal operator of the regularisation, see Theorem 4 and 5 in the Appendix. Two cases are of particular relevance for the experiments that follow. The first is the case of ridge regression, in which $f _ { 0 } ( x ) = { \hat { f } } ( x )$ and both the loss $g$ and the performance measure $\hat { g }$ are taken to be the meansquared error $\mathrm { m s e } ( y , \hat { y } ) = \textstyle { \frac { 1 } { 2 } } ( y - \hat { y } ) ^ { 2 }$ , and the asymptotic errors are given by the simple closed-form expression:
$$\mathcal { E } _ { \mathrm { g e n } } ^ { \star } = \rho + q ^ { \star } - 2 m ^ { \star } , \qquad \mathcal { E } _ { \mathrm { t r a i n } } ^ { \star } = \frac { \mathcal { E } _ { \mathrm { g e n } } ^ { \star } } { ( 1 + V ^ { \star } ) ^ { 2 } } ,$$
The second case of interest is the one of a binary classification task, for which $f _ { 0 } ( x ) = { \hat { f } } ( x ) =$ $\mathrm { s i g n } ( x )$ , and we choose the performance measure to be the classification error $\hat { g } ( y , \hat { y } ) = \mathbb { P } ( y \neq \hat { y } )$ . In the same notation as before, the asymptotic generalisation error in this case reads:
$$\mathcal { E } _ { \mathrm { g e n } } ^ { \star } = \frac { 1 } { \pi } \cos ^ { - 1 } \left( \frac { m ^ { \star } } { \sqrt { \rho q ^ { \star } } } \right) ,$$
$\mathcal { E } _ { \mathrm { t r a i n } } ^ { \star }$ depends on the choice of ll of the binary classificat $g$ - which we will take to be the logistic lossn experiments. $g ( y , x ) = \log { ( 1 + e ^ { - x y } ) }$
As mentioned above, this paper includes stronger technical results including finite size corrections and precise characterization of the distribution of the estimator $\hat { \pmb { w } }$ , for generic, non-separable loss and regularization $g$ and $r$ . This type of distributional statement is encountered for special cases of the model in related works such as [28, 29, 51]. Define $\boldsymbol { \mathcal { V } } \in \mathbb { R } ^ { n \times d }$ as the matrix of concatenated samples used by the student. Informally, in high-dimension, the estimator $\hat { \pmb w }$ and $\begin{array} { r } { \hat { z } = \frac { 1 } { \sqrt { d } } \mathcal { V } \hat { w } } \end{array}$ roughly behave as non-linear transforms of Gaussian random variables centered around the teacher vector $\theta _ { 0 }$ (or its projection on the covariance spaces) as follows:
$${ \boldsymbol w } ^ { * } = \Omega ^ { - 1 / 2 } \frac { \mathrm { p r o x } } { \bar { \nu } ^ { * } r ( \Omega ^ { - 1 / 2 } . ) } \left( \frac { 1 } { \hat { V } ^ { * } } ( \hat { m } ^ { * } t + \sqrt { \hat { q } ^ { * } } g ) \right) , \boldsymbol z ^ { * } = \operatorname * { p r o x } _ { V ^ { * } g ( . , \boldsymbol z ) } \left( \frac { m ^ { * } } { \sqrt { \rho } } \boldsymbol s + \sqrt { \boldsymbol q ^ { * } - \frac { ( m ^ { * } ) ^ { 2 } } { \rho } } \boldsymbol h \right) .$$
where $s , h \sim \mathcal { N } ( 0 , \mathrm { I } _ { n } )$ and $\mathbf { \mathscr { g } } \sim \mathcal { N } ( 0 , \mathrm { I } _ { d } )$ are random vectors independent of the other quantities, $t =$ $\Omega ^ { - 1 / 2 } \Phi ^ { \top } \pmb { \theta } _ { 0 }$ , $\pmb { y } = \pmb { f } _ { 0 } \left( \sqrt { \rho } \pmb { s } \right)$ , and $( V ^ { * } , \hat { V } ^ { * } , q ^ { * } , \hat { q } ^ { * } , m ^ { * } , \hat { m } ^ { * } )$ is the unique solution to the fixed point equations presented in Lemma 12 of appendix B. Those fixed point equations are the generalization of (13) to generic, non-separable loss function and regularization. The formal concentration of measure result can then be stated in the following way:
Theorem 2. (Non-asymptotic version, generic loss and regularization) Under Assumption $_ { ( B . I ) }$ , consider any optimal solution $\hat { \pmb { w } }$ to 3. Then, there exist constants $C , c , c ^ { \prime } > 0$ such that, for any Lipschitz function $\phi _ { 1 } : \mathbb { R } ^ { d } \mathbb { R }$ , and separable, pseudo-Lipschitz function $\phi _ { 2 } : \mathbb { R } ^ { n } \to \mathbb { R }$ and any $0 < \epsilon < c ^ { \prime }$ :
$$\mathbb { P } \left( \left| \phi _ { 1 } \left( \frac { \hat { w } } { \sqrt { d } } \right) - \mathbb { E } \phi _ { 1 } \left( \frac { w ^ { * } } { \sqrt { d } } \right) \right| \geqslant \epsilon \right) \leqslant \frac { C } { \epsilon ^ { 2 } } e ^ { - c n \epsilon ^ { 4 } } , \mathbb { P } \left( \left| \phi _ { 2 } \left( \frac { \hat { z } } { \sqrt { n } } \right) - \mathbb { E } \phi _ { 2 } \left( \frac { z ^ { * } } { \sqrt { n } } \right) \right| \geqslant \epsilon \right) \leqslant \frac { C } { \epsilon ^ { 2 } } e ^ { - c n \epsilon ^ { 4 } } .$$
Note that in this form, the dimensions $n , p , d$ still appear explicitly, as we are characterizing the convergence of the estimator’s distribution for large but finite dimension. The clearer, one-dimensional statements are recovered by taking the $n , p , d \infty$ limit with separable functions and an $\ell _ { 2 }$ regularization. Other simplified formulas can also be obtained from our general result in the case of an $\ell _ { 1 }$ penalty, but since this breaks rotational invariance, they do look more involved than the $\ell _ { 2 }$ case. From Theorem 2, one can deduce the expressions of a number of observables, represented by the test functions $\phi _ { 1 } , \phi _ { 2 }$ , characterizing the performance of $\hat { \pmb { w } }$ , for instance the training and generalization error. A more detailed statement, along with the proof, is given in appendix B.
# 3 Applications of the Gaussian model
We now discuss how the theorems above are applied to characterise the learning curves for a range of concrete cases. We present a number of cases – some rather surprising – for which Conjecture 1 seems valid, and point out some where it is not. An out-of-the-box iterator for all the cases studied hereafter is provided in the GitHub repository for this manuscript at https: //github.com/IdePHICS/GCMProject.
# 3.1 Random kitchen sink with Gaussian data
If we choose random feature maps $\varphi _ { s } ( \pmb { x } ) = \sigma \left( \mathrm { F } \pmb { x } \right)$ for a random matrix $\mathrm { F }$ and a chosen scalar function $\sigma$ acting component-wise, we obtain the random kitchen sink model [16]. This model has seen a surge of interest recently, and a sharp asymptotic analysis was provided in the particular case of uncorrelated Gaussian data $\pmb { x } \sim \mathcal { N } ( \mathbf { 0 } , \tilde { \mathrm { I } } _ { D } )$ and $\varphi _ { t } ( \pmb { x } ) = \pmb { x }$ in [11, 12] for ridge regression and generalised by [43, 46] for generic convex losses. Both results can be framed as a Gaussian covariate model with:
$$\Psi = { \bf I } _ { p } , \Phi = \kappa _ { 1 } \mathrm { \bf F } ^ { \top } , \Omega = \kappa _ { 0 } ^ { 2 } { \bf 1 } _ { d } { \bf 1 } _ { d } ^ { \top } + \kappa _ { 1 } ^ { 2 } \frac { \mathrm { \bf F } \mathrm { \bf F } ^ { \top } } { d } + \kappa _ { \star } ^ { 2 } { \bf I } _ { d } ,$$
where $\mathbf { 1 } _ { d } \in \mathbb { R } ^ { d }$ is the all-one vector and the constants $( \kappa _ { 0 } , \kappa _ { 1 } , \kappa _ { \star } )$ are related to the non-linearity $\sigma$
$$\begin{array} { r } { \kappa _ { 0 } = \mathbb { E } _ { z \sim \mathcal { N } ( 0 , 1 ) } \left[ \sigma ( z ) \right] , \quad \kappa _ { 1 } = \mathbb { E } _ { z \sim \mathcal { N } ( 0 , 1 ) } \left[ z \sigma ( z ) \right] , \quad \kappa _ { \star } = \sqrt { \mathbb { E } _ { z \sim \mathcal { N } ( 0 , 1 ) } \left[ \sigma ( z ) ^ { 2 } \right] - \kappa _ { 0 } ^ { 2 } - \kappa _ { 1 } ^ { 2 } } . } \end{array}$$
In this case, the averages over $\mu$ in eq. (13) can be directly expressed in terms of the Stieltjes transform associated with the spectral density of $\mathrm { F F } ^ { \top }$ . Note, however, that our present framework can accommodate more involved random sinks models, such as when the teacher features are also a random feature model or multi-layer random architectures.
# 3.2 Kernel methods with Gaussian data
 Figure 2: Learning in kernel space: Teacher and student live in the same (Hilbert) feature space $\pmb { v } = \pmb { u } \in \mathbb { R } ^ { d }$ with $d \gg n$ , and the performance only depends on the relative decay between the student spectrum $\omega _ { i } = d i ^ { - 2 }$ (the capacity) and the teacher weights in feature space $\theta _ { 0 i } ^ { 2 } \bar { \omega _ { i } } = \dot { d } i ^ { - a }$ (the source). Top: a task with sign teacher (in kernel space), fitted with a max-margin support vector machine (logistic regression with vanishing regularisation [52]). Bottom: a task with linear teacher (in kernel space) fitted via kernel ridge regression with vanishing regularisation. Points are simulation that matches the theory (lines). Simulations are averaged over 10 independent runs.
Another direct application of our formalism is to kernel methods. Kernel methods admit a dual representation in terms of optimization over feature space [53]. The connection is given by Mercer’s theorem, which provides an eigen-decomposition of the kernel and of the target function in the feature basis, effectively mapping kernel regression to a teacherstudent problem on feature space. The classical way of studying the performance of kernel methods [54, 55] is then to directly analyse the performance of convex learning in this space. In our notation, the teacher and student feature maps are equal, and we thus set $p = d , \Psi = \Phi = \Omega = \mathrm { d i a g } ( \omega _ { \mathrm { i } } )$ where $\omega _ { i }$ are the eigenvalues of the kernel and we take the teacher weights $\pmb { \theta } _ { 0 }$ to be the decomposition of the target function in the kernel feature basis.
There are many results in classical learning theory on this problem for the case of ridge regression (where the teacher is usually called "the source" and the eigenvalues of the kernel matrix the "capacity", see e.g. [54, 56]). However, these are worst case approaches, where no assumption is made on the true distribution of the data. In contrast, here we follow a typical case analysis, assuming Gaussianity in feature space. Through Theorem 1, this allows us to go beyond the restriction of the ridge loss. An example for logistic loss is in Fig. 2.
For the particular case of kernel ridge regression, Th. 1 provides a rigorous proof of the formula conjectured in [32]. App. A.6 presents an explicit mapping to their results. Hard-margin Support Vector Machines (SVMs) have also been studied using the heuristic replica method from statistical physics in [57, 58]. In our framework, this corresponds to the hinge loss $g ( x , y ) = \operatorname* { m a x } ( 0 , 1 - y x )$ when $\lambda 0 ^ { + }$ . Our theorem thus puts also these works on rigorous grounds, and extends them to more general losses and regularization.
# 3.3 GAN-generated data and learned teachers
To approach more realistic data sets, we now consider the case in which the input data $\mathbf { \boldsymbol { x } } \in \mathcal { X }$ is given by a generative neural network $\begin{array} { r } { \pmb { x } = \pmb { \mathcal { G } } ( \pmb { z } ) } \end{array}$ , where $_ z$ is a Gaussian i.i.d. latent vector. Therefore, the covariates $[ { \pmb u } , { \pmb v } ]$ are the result of the following Markov chain:
$$z \underset { \mathcal { G } } { \mapsto } x \in \mathcal { X } \underset { \varphi _ { t } } { \mapsto } u \in \mathbb { R } ^ { p } , \qquad z \underset { \mathcal { G } } { \mapsto } x \in \mathcal { X } \underset { \varphi _ { s } } { \mapsto } v \in \mathbb { R } ^ { d } .$$
With a model for the covariates, the missing ingredient is the teacher weights $\pmb \theta _ { 0 } \in \mathbb { R } ^ { p }$ , which determine the label assignment: $\boldsymbol { y } = f _ { 0 } ( \boldsymbol { \mathbf { u } } ^ { \intercal } \bar { \boldsymbol { \theta } } _ { 0 } )$ . In the experiments that follow, we fit the teacher weights from the original data set in which the generative model $\mathcal { G }$ was trained. Different choices for the fitting yield different teacher weights, and the quality of label assignment can be accessed by the performance of the fit on the test set. The set $\left( \varphi _ { t } , \varphi _ { s } , \mathcal { G } , \theta _ { 0 } \right)$ defines the data generative process. For predicting the learning curves from the iterative eqs. (13) we need to sample from the spectral measure $\mu$ , which amounts to estimating the population covariances $( \Psi , \Phi , \Omega )$ . This is done from the generative process in eq. (19) with a Monte Carlo sampling algorithm. This pipeline is explained in detail in Appendix D. An open source implementation of the algorithms used in the experiments is available online at https://github.com/IdePHICS/GCMProject.
Fig. 3 shows an example of the learning curves resulting from the pipeline discussed above in a logistic regression task on data generated by a GAN trained on CIFAR10 images. More concretely, we used a pre-trained five-layer deep convolutional GAN (dcGAN) from [59], which maps 100 dimensional i.i.d. Gaussian noise into $k = 3 2 \times 3 2 \times 3$ realistic looking CIFAR10-like images: $\mathcal { G } : \boldsymbol { z } \in \mathbb { R } ^ { 1 0 0 } \mapsto \boldsymbol { x } \in \mathbb { R } ^ { 3 2 \times 3 2 \times 3 }$ . To generate labels, we trained a simple fully-connected four-layer neural network on the real CIFAR10 data set, on a odd $( y = + 1 )$ ) vs. even $( y = - 1$ ) task, achieving $\sim 7 5 \%$ classification accuracy on the test set. The teacher weights $\pmb \theta _ { 0 } \in \mathbb { R } ^ { p }$ were taken from the last layer of the network, and the teacher feature map $\varphi _ { t }$ from the three previous layers. For the student model, we trained a completely independent fully connected 3-layer neural network on the dcGAN-generated CIFAR10-like images and took snapshots of the feature maps $\varphi _ { s } ^ { i }$ induced by the 2-first layers during the first $i \in \{ 0 , 5 , 5 0 , 2 0 0 \}$ epochs of training. Finally, once $\left( \mathcal { G } , \varphi _ { t } , \varphi _ { s } ^ { i } , \theta _ { 0 } \right)$ have been fixed, we estimated the covariances $( \Psi , \Phi , \Omega )$ with a Monte Carlo algorithm. Details of the architectures used and of the training procedure can be found in Appendix. D.1.
 Figure 3: Left: generalisation classification error (top) and (unregularised) training loss (bottom) vs the sample complexity $\alpha = n / d$ for logistic regression on a learned feature map trained on dcGAN-generated CIFAR10-like images labelled by a teacher fully-connected neural network (see Appendix D.1 for architecture details), with vanishing $\ell _ { 2 }$ regularisation. The different curves compare featured maps at different epochs of training. The theoretical predictions based on the Gaussian covariate model (full lines) are in very good agreement with the actual performance (points). Right: Test classification error (top) and (unregularised) training loss, (bottom) for logistic regression as a function of the number of samples $n$ for an animal vs not-animal binary classification task with $\ell _ { 2 }$ regularization $\lambda = 1 0 ^ { - 2 }$ , comparing real CIFAR10 grey-scale images (blue) with dcGAN-generated CIFAR10-like gray-scale images (red). The real-data learning curve was estimated, just as in Figs. 4 from the population covariances on the full data set, and it is not in agreement with the theory in this case. On the very right we depict the histograms of the variable $\begin{array} { r } { \frac { 1 } { \sqrt { d } } \pmb { v } ^ { \top } \hat { \pmb { w } } } \end{array}$ for a fixed number of samples $n = 2 d = 2 0 4 8$ and the respective theoretical predictions (solid line). Simulations are averaged over 10 independent runs.
Fig. 3 depicts the resulting learning curves obtained by training the last layer of the student. Interestingly, the performance of the feature map at epoch 0 (random initialisation) beats the performance of the learned features during early phases of training in this experiment. Another interesting behaviour is given by the separability threshold of the learned features, i.e. the number of samples for which the training loss becomes larger than 0 in logistic regression. At epoch 50 the learned features are separable at lower sample complexity $\alpha = n / d$ than at epoch 200 - even though in the later the training and generalisation performances are better.
# 3.4 Learning from real data sets
Applying teacher/students to a real data set — Given that the learning curves of realistic-looking inputs can be captured by the Gaussian covariate model, it is fair to ask whether the same might be true for real data sets. To test this idea, we first need to cast the real data set into the teacher-student formalism, and then compute the covariance matrices $\Omega , \Psi , \Phi$ and teacher vector $\pmb { \theta } _ { 0 }$ required by model (1).
Let $\{ x ^ { \mu } , y ^ { \mu } \} _ { \mu = 1 } ^ { n _ { \mathrm { t o t } } }$ denote a real data set, e.g. MNIST or Fashion-MNIST for concreteness, where $n _ { \mathrm { t o t } } = 7 \times 1 0 ^ { 4 }$ , $\pmb { x } ^ { \mu } \in \mathbb { R } ^ { D }$ with $D = 7 8 4$ . Without loss of generality, we can assume the data is centred. To generate the teacher, let $\pmb { u } ^ { \mu } = \varphi _ { t } ( \pmb { x } ^ { \mu } ) \in \mathbb { R } ^ { p }$ be a feature map such that data is invertible in feature space, i.e. that $y ^ { \mu } = \pmb \theta _ { 0 } ^ { \top } { \pmb u } ^ { \mu }$ for some teacher weights $\pmb \theta _ { 0 } \in \mathbb { R } ^ { p }$ , which should be computed from the samples. Similarly, let $\mathbf { \bar { \boldsymbol { v } } } ^ { \mu } = \varphi _ { s } ( \mathbf { \boldsymbol { x } } ^ { \mu } ) \in \mathbb { R } ^ { d }$ be a feature map we are interested in studying. Then, we can estimate the population covariances $( \Psi , \Phi , \Omega )$ empirically from the entire data set as:
$$\Psi = \sum _ { \mu = 1 } ^ { n _ { \mathrm { t o t } } } { \frac { u ^ { \mu } { \pmb u } ^ { \mu } ^ { \top } } { n _ { \mathrm { t o t } } } } , \qquad \Phi = \sum _ { \mu = 1 } ^ { n _ { \mathrm { t o t } } } { \frac { u ^ { \mu } \pmb v ^ { \mu } ^ { \top } } { n _ { \mathrm { t o t } } } } , \qquad \Omega = \sum _ { \mu = 1 } ^ { n _ { \mathrm { t o t } } } { \frac { v ^ { \mu } \pmb v ^ { \mu } ^ { \top } } { n _ { \mathrm { t o t } } } } .$$
At this point, we have all we need to run the self-consistent equations (13). The issue with this approach is that there is not a unique teacher map $\varphi _ { t }$ and teacher vector $\pmb { \theta } _ { 0 }$ that fit the true labels. However, we can show that all interpolating linear teachers are equivalent:
Theorem 3. (Universality of linear teachers) For any teacher feature map $\varphi _ { t }$ , and for any $\pmb { \theta } _ { 0 }$ that interpolates the data so that $\mathbf { \bar { \boldsymbol { y } } } ^ { \mu } = \pmb { \theta } _ { 0 } ^ { \top } \pmb { u } ^ { \mu } \forall \mu$ , the asymptotic predictions of model $( l )$ are equivalent. Proof. It follows from the fact that the teacher weights and covariances only appear in eq. (13) through $\begin{array} { r } { \rho = \frac { 1 } { p } \pmb { \theta } _ { 0 } ^ { \top } \Psi \pmb { \theta } _ { 0 } } \end{array}$ and the projection $\Phi ^ { \top } \pmb \theta _ { 0 }$ . Using the estimation (20) and the assumption that it exists $y ^ { \mu } = \pmb { \theta } _ { 0 } ^ { \top } \pmb { u } ^ { \mu }$ , one can write these quantities directly from the labels $y ^ { \mu }$ :
$$\rho = \frac { 1 } { n _ { \mathrm { t o t } } } \sum _ { \mu = 1 } ^ { n _ { \mathrm { t o t } } } \left( y ^ { \mu } \right) ^ { 2 } , \qquad \Phi ^ { \top } \pmb { \theta } _ { 0 } = \frac { 1 } { n _ { \mathrm { t o t } } } \sum _ { \mu = 1 } ^ { n _ { \mathrm { t o t } } } y ^ { \mu } \pmb { v } ^ { \mu } .$$
For linear interpolating teachers, results are thus independent of the choice of the teacher.
Although this result might seen surprising at first sight, it is quite intuitive. Indeed, the information about the teacher model only enters the Gaussian covariate model (1) through the statistics of $\pmb { u } ^ { \top } \pmb { \theta } _ { 0 }$ . For a linear teacher $f _ { 0 } ( x ) = x$ , this is precisely given by the labels.
 Figure 4: Test and training mean-squared errors eqs. (15) as a function of the number of samples $n$ for ridge regression. The Fashion-MNIST data set, with vanishing regularisation $\lambda = 1 0 ^ { - 5 }$ . In this plot, the student feature map $\varphi _ { s }$ is a 3-layer fully-connected neural network with $d \ : = \ : 2 3 5 2$ hidden neurons trained on the full data set with the square loss. Different curves correspond to the feature map obtained at different stages of training. Simulations are averaged over 10 independent runs. Further details on the simulations are described in Appendix D.1
# Ridge Regression with linear teachers —
We now test the prediction of model (1) on real data sets, and show that it is surprisingly effective in predicting the learning curves, at least for the ridge regression task. We have trained a 3-layer fully connected neural network with ReLU activations on the full Fashion-MNIST data set to distinguish clothing used above vs. below the waist [60]. The student feature map $\varphi _ { s } : \mathbb { R } ^ { 7 8 4 } \to \mathbb { R } ^ { \bar { d } }$ is obtained by removing the last layer, see Appendix D.1 for a detailed description. In Fig. 4 we show the test and training errors of the ridge estimator on a sub-sample of $n \ < \ n _ { \mathrm { t o t } }$ on the Fashion-MNIST images. We observe remarkable agreement between the learning curve obtained from simulations and the theoretical prediction by the matching Gaussian covariate model. Note that for the square loss and for $\lambda \ll 1$ , the worst performance peak is located at the point in which the linear system becomes invertible. Curiously, Fig. 4 shows that the fully-connected network progressively learns a low-rank representation of the data as training proceeds. This can be directly verified by counting the number of zero eigenvalues of $\Omega$ , which go from a full-rank matrix to a matrix of rank 380 after 200 epochs of training.
Fig. 1 (right) shows a similar experiment on the MNIST data set, but for different out-of-the-box feature maps, such as random features and the scattering transform [61], and we chose the number of random features $d = 1 9 5 3$ to match the number of features from the scattering transform. Note the characteristic double-descent behaviour [9, 25, 62], and the accurate prediction of the peak where the interpolation transition occurs. We note in Appendix D.1 that for both Figs. 4 and 1, for a number of samples $n$ closer to $n _ { \mathrm { t o t } }$ we start to see deviations between the real learning curve and the theory. This is to be expected since in the teacher-student framework the student can, in principle, express the same function as the teacher if it recovers its weights exactly. Recovering the teacher weights becomes possible with a large training set. In that case, its test error will be zero. However, in our setup the test error on real data remains finite even if more training data is added, leading to the discrepancy between teacher-student learning curve and real data, see Appendix D.1 for further discussion.
Why is the Gaussian model so effective for describing learning with data that are not Gaussian? The point is that ridge regression is sensitive only to second order statistics, and not to the full distribution of the data. It is a classical property (see Appendix E) that the training and generalisation errors are only a function of the spectrum of the empirical and population covariances, and of their products. Random matrix theory teaches us that such quantities are very robust, and their asymptotic behaviour is universal for a broad class of distributions of $[ u , v ]$ [49, 63–65]. The asymptotic behavior of kernel matrices has indeed been the subject of intense scrutiny [11, 47, 48, 50, 66, 67]. Indeed, a universality result akin to Theorem 3 was noted in [41] in the specific case of kernel methods. We thus expect the validity of model (1) for ridge regression, with a linear teacher, to go way beyond the Gaussian assumption.
Beyond ridge regression — The same strategy fails beyond ridge regression and mean-squared test error. This suggests a limit in the application of model (1) to real (non-Gaussian) data to the universal linear teacher. To illustrate this, consider the setting of Figs. 4, and compare the model predictions for the binary classification error instead of the $\ell _ { 2 }$ one. There is a clear mismatch between the simulated performance and prediction given by the theory (see Appendix D.1) due to the fact that the classification error does not depends only on the first two moments.
We present an additional experiment in Fig. 3. We compare the learning curves of logistic regression on a classification task on the real CIFAR10 images with the real labels versus the one on dcGANgenerated CIFAR10-like images and teacher generated labels from Sec. 3.3. While the Gaussian theory captures well the behaviour of the later, it fails on the former. A histogram of the distribution of the product $\mathbf { \Delta } u ^ { \top } \hat { \mathbf { \Gamma } } w$ for a fixed number of samples illustrates well the deviation from the prediction of the theory with the real case, in particular on the tails of the distribution. The difference between GAN generated data (that fits the Gaussian theory) and real data is clear. Given that for classification problems there exists a number of choices of "sign" teachers and feature maps that give the exact same labels as in the data set, an interesting open question is: is there a teacher that allows to reproduce the learning curves more accurately? This question is left for future works.
# Acknowledgements
We thank Romain Couillet, Cosme Louart, Loucas Pillaud-Vivien, Matthieu Wyart, Federica Gerace, Luca Saglietti and Yue Lu for discussions. We are grateful to Kabir Aladin Chandrasekher, Ashwin Pananjady and Christos Thrampoulidis for pointing out discrepancies in the finite size rates and insightful related discussions. We acknowledge funding from the ERC under the European Union’s Horizon 2020 Research and Innovation Programme Grant Agreement 714608-SMiLe, and from the French National Research Agency grants ANR-17-CE23-0023-01 PAIL.
References [1] Hyunjune Sebastian Seung, Haim Sompolinsky, and Naftali Tishby. Statistical mechanics of learning from examples. Physical review A, 45(8):6056, 1992. [2] Timothy LH Watkin, Albrecht Rau, and Michael Biehl. The statistical mechanics of learning a rule. Reviews of Modern Physics, 65(2):499, 1993. [3] Andreas Engel and Christian Van den Broeck. Statistical mechanics of learning. Cambridge University Press, 2001. [4] David L Donoho, Arian Maleki, and Andrea Montanari. Message-passing algorithms for compressed sensing. Proceedings of the National Academy of Sciences, 106(45):18914–18919, 2009. [5] Noureddine El Karoui, Derek Bean, Peter J Bickel, Chinghway Lim, and Bin Yu. On robust regression with high-dimensional predictors. Proceedings of the National Academy of Sciences, 110(36):14557–14562, 2013. [6] Lenka Zdeborová and Florent Krzakala. Statistical physics of inference: Thresholds and algorithms. Advances in Physics, 65(5):453–552, 2016. [7] David Donoho and Andrea Montanari. High dimensional robust m-estimation: Asymptotic variance via approximate message passing. Probability Theory and Related Fields, 166(3- 4):935–969, 2016. [8] C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017. [9] Mikhail Belkin, Daniel Hsu, Siyuan Ma, and Soumik Mandal. Reconciling modern machinelearning practice and the classical bias–variance trade-off. Proceedings of the National Academy of Sciences, 116(32):15849–15854, 2019. [10] Mikhail Belkin, Daniel Hsu, and Ji Xu. Two models of double descent for weak features. SIAM Journal on Mathematics of Data Science, 2(4):1167–1180, 2020. [11] Song Mei and Andrea Montanari. The generalization error of random features regression: Precise asymptotics and double descent curve. arXiv preprint arXiv:1908.05355, 2019. [12] Trevor Hastie, Andrea Montanari, Saharon Rosset, and Ryan J Tibshirani. Surprises in highdimensional ridgeless least squares interpolation. arXiv preprint arXiv:1903.08560, 2019. [13] Emmanuel J Candès, Pragya Sur, et al. The phase transition for the existence of the maximum likelihood estimate in high-dimensional logistic regression. The Annals of Statistics, 48(1):27– 42, 2020. [14] Benjamin Aubin, Florent Krzakala, Yue M Lu, and Lenka Zdeborová. Generalization error in high-dimensional perceptrons: Approaching bayes error with convex optimization. In Advances in Neural Information Processing Systems, volume 33, 2020. [15] Fariborz Salehi, Ehsan Abbasi, and Babak Hassibi. The performance analysis of generalized margin maximizers on separable data. In International Conference on Machine Learning, pages 8417–8426. PMLR, 2020. [16] Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Advances in neural information processing systems, pages 1177–1184, 2008. [17] Arthur Jacot, Franck Gabriel, and Clément Hongler. Neural tangent kernel: Convergence and generalization in neural networks. In Advances in neural information processing systems, pages 8571–8580, 2018. [18] Mathieu Andreux, Tomás Angles, Georgios Exarchakis, Roberto Leonarduzzi, Gaspar Rochette, Louis Thiry, John Zarka, Stéphane Mallat, Joakim Andén, Eugene Belilovsky, et al. Kymatio: Scattering transforms in python. Journal of Machine Learning Research, 21(60):1–6, 2020. [19] Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks, 2014. [20] Yehoram Gordon. Some inequalities for gaussian processes and applications. Israel Journal of Mathematics, 50(4):265–289, 1985. [21] Marc Mézard, Giorgio Parisi, and Miguel Virasoro. Spin glass theory and beyond: An Introduction to the Replica Method and Its Applications, volume 9. World Scientific Publishing Company, 1987. [22] Marc Mézard and Andrea Montanari. Information, physics, and computation. Oxford University Press, 2009. [23] Christopher K. I. Williams. Computing with infinite networks. In Proceedings of the 9th International Conference on Neural Information Processing Systems, NIPS’96, page 295–301, Cambridge, MA, USA, 1996. MIT Press. [24] Elizabeth Gardner and Bernard Derrida. Three unfinished works on the optimal storage capacity of networks. Journal of Physics A: Mathematical and General, 22(12):1983, 1989. [25] Manfred Opper and Wolfgang Kinzel. Statistical mechanics of generalization. In Models of neural networks III, pages 151–209. Springer, 1996. [26] Behrooz Ghorbani, Song Mei, Theodor Misiakiewicz, and Andrea Montanari. When do neural networks outperform kernel methods? In Advances in Neural Information Processing Systems, volume 33, 2020. [27] Christos Thrampoulidis, Ehsan Abbasi, and Babak Hassibi. Precise error analysis of regularized $m$ -estimators in high dimensions. IEEE Transactions on Information Theory, 64(8):5592–5628, 2018. [28] Andrea Montanari, Feng Ruan, Youngtak Sohn, and Jun Yan. The generalization error of max-margin linear classifiers: High-dimensional asymptotics in the overparametrized regime. arXiv preprint arXiv:1911.01544, 2019. [29] Michael Celentano, Andrea Montanari, and Yuting Wei. The lasso with general gaussian designs with applications to hypothesis testing. arXiv preprint arXiv:2007.13716, 2020. [30] Mihailo Stojnic. A framework to characterize performance of lasso algorithms. arXiv preprint arXiv:1303.7291, 2013. [31] Samet Oymak, Christos Thrampoulidis, and Babak Hassibi. The squared-error of generalized lasso: A precise analysis. In 2013 51st Annual Allerton Conference on Communication, Control, and Computing (Allerton), pages 1002–1009. IEEE, 2013. [32] Blake Bordelon, Abdulkadir Canatar, and Cengiz Pehlevan. Spectrum dependent learning curves in kernel regression and wide neural networks. In International Conference on Machine Learning, pages 1024–1034. PMLR, 2020. [33] Hanwen Huang and Qinglong Yang. Large scale analysis of generalization error in learning using margin based classification methods. Journal of Statistical Mechanics: Theory and Experiment, 2020(10):103407, 2020. [34] Partha P Mitra. Understanding overfitting peaks in generalization error: Analytical risk curves for $l _ { - 2 }$ and $l _ { - } 1$ penalized interpolation. arXiv preprint arXiv:1906.03667, 2019. [35] Oussama Dhifallah and Yue M Lu. A precise performance analysis of learning with random features. arXiv preprint arXiv:2008.11904, 2020. [36] Edgar Dobriban, Stefan Wager, et al. High-dimensional asymptotics of prediction: Ridge regression and classification. The Annals of Statistics, 46(1):247–279, 2018. [37] Denny Wu and Ji Xu. On the optimal weighted $\ell _ { 2 }$ regularization in overparameterized linear regression. In Advances in Neural Information Processing Systems, volume 33, 2020. [38] Zhenyu Liao, Romain Couillet, and Michael W Mahoney. A random matrix analysis of random fourier features: beyond the gaussian kernel, a precise phase transition, and the corresponding double descent. In Advances in Neural Information Processing Systems, volume 33, 2020. [39] Fanghui Liu, Zhenyu Liao, and Johan AK Suykens. Kernel regression in high dimension: Refined analysis beyond double descent. arXiv preprint arXiv:2010.02681, 2020. [40] Peter L. Bartlett, Philip M. Long, Gábor Lugosi, and Alexander Tsigler. Benign overfitting in linear regression. Proceedings of the National Academy of Sciences, 117(48):30063–30070, 2020. [41] Arthur Jacot, Berfin ¸Sim¸sek, Francesco Spadaro, Clément Hongler, and Franck Gabriel. Kernel alignment risk estimator: Risk prediction from training data. arXiv preprint arXiv:2006.09796, 2020. [42] Cédric Gerbelot, Alia Abbara, and Florent Krzakala. Asymptotic errors for high-dimensional convex penalized linear regression beyond gaussian matrices. In Conference on Learning Theory, pages 1682–1713. PMLR, 2020. [43] F. Gerace, B. Loureiro, F. Krzakala, M. Mézard, and L. Zdeborová. Generalisation error in learning with random features and the hidden manifold model. In 37th International Conference on Machine Learning, 2020. [44] S. Goldt, M. Mézard, F. Krzakala, and L. Zdeborová. Modeling the influence of data structure on learning in neural networks: The hidden manifold model. Phys. Rev. X, 10(4):041044, 2020. [45] Sebastian Goldt, Bruno Loureiro, Galen Reeves, Marc Mézard, Florent Krzakala, and Lenka Zdeborová. The gaussian equivalence of generative models for learning with two-layer neural networks. In Mathematical and Scientific Machine Learning, 2021. [46] Hong Hu and Yue M Lu. Universality laws for high-dimensional learning with random features. arXiv preprint arXiv:2009.07669, 2020. [47] Noureddine El Karoui et al. The spectrum of kernel random matrices. Annals of statistics, 38(1):1–50, 2010. [48] Jeffrey Pennington and Pratik Worah. Nonlinear random matrix theory for deep learning. In Advances in Neural Information Processing Systems, volume 30, pages 2637–2646, 2017. [49] Cosme Louart and Romain Couillet. Concentration of measure and large random matrices with an application to sample covariance matrices. arXiv preprint arXiv:1805.08295, 2018. [50] Mohamed El Amine Seddik, Cosme Louart, Mohamed Tamaazousti, and Romain Couillet. Random matrix theory proves that deep learning representations of gan-data behave as gaussian mixtures. In International Conference on Machine Learning, pages 8573–8582. PMLR, 2020. [51] Léo Miolane and Andrea Montanari. The distribution of the lasso: Uniform control over sparse balls and adaptive parameter tuning. arXiv preprint arXiv:1811.01212, 2018. [52] Saharon Rosset, Ji Zhu, and Trevor Hastie. Margin maximizing loss functions. In NIPS, pages 1237–1244, 2003. [53] B. Scholkopf and A.J. Smola. Learning with Kernels: Support Vector Machines, Regularization, Optimization, and Beyond. Adaptive Computation and Machine Learning. MIT Press, 2018. [54] Ingo Steinwart, Don R Hush, Clint Scovel, et al. Optimal rates for regularized least squares regression. In COLT, pages 79–93, 2009. [55] Andrea Caponnetto and Ernesto De Vito. Optimal rates for the regularized least-squares algorithm. Foundations of Computational Mathematics, 7(3):331–368, 2007. [56] Loucas Pillaud-Vivien, Alessandro Rudi, and Francis Bach. Statistical optimality of stochastic gradient descent on hard learning problems through multiple passes. In Advances in Neural Information Processing Systems, volume 31, pages 8114–8124, 2018. [57] Rainer Dietrich, Manfred Opper, and Haim Sompolinsky. Statistical mechanics of support vector networks. Phys. Rev. Lett., 82:2975–2978, Apr 1999. [58] M. Opper and R. Urbanczik. Universal learning curves of support vector machines. Phys. Rev. Lett., 86:4410–4413, May 2001. [59] A. Radford, L. Metz, and S. Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016. [60] Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017. [61] J. Bruna and S. Mallat. Invariant scattering convolution networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(8):1872–1886, 2013. [62] Stefano Spigler, Mario Geiger, Stéphane d’Ascoli, Levent Sagun, Giulio Biroli, and Matthieu Wyart. A jamming transition from under-to over-parametrization affects generalization in deep learning. Journal of Physics A: Mathematical and Theoretical, 52(47):474001, 2019. [63] Zhidong Bai and Wang Zhou. Large sample covariance matrices without independence structures in columns. Statistica Sinica, pages 425–442, 2008. [64] Olivier Ledoit and Sandrine Péché. Eigenvectors of some large sample covariance matrix ensembles. Probability Theory and Related Fields, 151(1):233–264, 2011. [65] Noureddine El Karoui et al. Concentration of measure and spectra of random matrices: Applications to correlation matrices, elliptical distributions and beyond. Annals of Applied Probability, 19(6):2362–2405, 2009. [66] Xiuyuan Cheng and Amit Singer. The spectrum of random inner-product kernel matrices. Random Matrices: Theory and Applications, 2(04):1350010, 2013. [67] Zhou Fan and Andrea Montanari. The spectral norm of random inner-product kernel matrices. Probability Theory and Related Fields, 173(1):27–85, 2019. [68] Heinz H Bauschke, Patrick L Combettes, et al. Convex analysis and monotone operator theory in Hilbert spaces, volume 408. Springer, 2011. [69] Stéphane Boucheron, Gábor Lugosi, and Pascal Massart. Concentration inequalities: A nonasymptotic theory of independence. Oxford university press, 2013. [70] Yanting Ma, Cynthia Rush, and Dror Baron. Analysis of approximate message passing with a class of non-separable denoisers. In 2017 IEEE International Symposium on Information Theory (ISIT), pages 231–235. IEEE, 2017. [71] Roman Vershynin. Introduction to the non-asymptotic analysis of random matrices. In Y. Eldar and G. Kutyniok., editors, Compressed Sensing, Theory and Applications. Cambridge University Press, 2012. [72] Rick Durrett. Probability: theory and examples, volume 49. Cambridge university press, 2019. [73] Per Kragh Andersen and Richard D Gill. Cox’s regression model for counting processes: a large sample study. The annals of statistics, pages 1100–1120, 1982. [74] Roman Vershynin. High-dimensional probability: An introduction with applications in data science, volume 47. Cambridge university press, 2018. [75] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. 2015 IEEE International Conference on Computer Vision (ICCV), pages 1026–1034, 2015. [76] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference for Learning Representations, volume 3, 2015. [77] Greg W Anderson, Alice Guionnet, and Ofer Zeitouni. An introduction to random matrices. Number 118. Cambridge university press, 2010. [78] Vladimir Alexandrovich Marchenko and Leonid Andreevich Pastur. Distribution of eigenvalues for some sets of random matrices. Matematicheskii Sbornik, 114(4):507–536, 1967. [79] Djalil Chafaï and Konstantin Tikhomirov. On the convergence of the extremal eigenvalues of empirical covariance matrices with dependence. Probability Theory and Related Fields, 170(3):847–889, 2018. [80] Walid Hachem, Philippe Loubaton, Jamal Najim, et al. Deterministic equivalents for certain functionals of large random matrices. The Annals of Applied Probability, 17(3):875–930, 2007.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279# MASKED LABEL PREDICTION: UNIFIED MESSAGEPASSING MODEL FOR SEMI-SUPERVISED CLASSIFICA-TION
Anonymous authors Paper under double-blind review
# ABSTRACT
Graph neural network (GNN) and label propagation algorithm (LPA) are both message passing algorithms, which have achieved superior performance in semisupervised classification. GNN performs feature propagation by a neural network to make predictions, while LPA uses label propagation across graph adjacency matrix to get results. However, there is still no good way to combine these two kinds of algorithms. In this paper, we proposed a new Unified Message Passaging Model (UniMP) that can incorporate feature propagation and label propagation with a shared message passing network, providing a better performance in semisupervised classification. First, we adopt a Graph Transformer jointly label embedding to propagate both the feature and label information. Second, to train UniMP without overfitting in self-loop label information, we propose a masked label prediction strategy, in which some percentage of training labels are simply masked at random, and then predicted. UniMP conceptually unifies feature propagation and label propagation and be empirically powerful. It obtains new state-of-the-art semi-supervised classification results in Open Graph Benchmark (OGB).
# 1 INTRODUCTION
There are various scenarios in the world, e.g., recommending related news and products, discovering new drugs, or predicting social relations, which can be described as graph structures. Many methods have been proposed to optimize these graph-based problems and achieved significant success in many related domains such as predicting the properties of nodes (Yang et al., 2016; Kipf & Welling, 2016), links (Grover & Leskovec, 2016; Battaglia et al., 2018), and graphs (Duvenaud et al., 2015; Niepert et al., 2016; Bojchevski et al., 2018).
In the task of semi-supervised node classification, we are required to learn with labeled examples and then make predictions for those unlabeled ones. To better classify the nodes’ labels in the graph, based on the Laplacian smoothing assumption (Li et al., 2018; Xu et al., 2018b), the message passing models were proposed to aggregate the information from its connected neighbors in the graph, acquiring enough facts to produce a more robust prediction for unlabeled nodes. Generally, there are two kinds of practical methods to implement message passing model, the Graph Neural Networks (GNNs) (Kipf & Welling, 2016; Hamilton et al., 2017; Xu et al., 2018b; Liao et al., 2019; Xu et al., 2018a; Qu et al., 2019) and the Label Propagation Algorithms (LPAs) (Zhu, 2005; Zhu et al., 2003; Zhang & Lee, 2007; Wang & Zhang, 2007; Karasuyama & Mamitsuka, 2013; Gong et al., 2016; Liu et al., 2019). GNNs combine graph structures by propagating and aggregating nodes features through several neural layers, which get predictions from feature propagation. While LPAs make predictions for unlabeled instances by label propagation iteratively.
Since GNN and LPA are based on the same assumption, making semi-supervised classifications by information propagation, there is an intuition that incorporating them together for boosting performance. Some superior studies have proposed their graph models based on it. For example, APPNP (Klicpera et al., 2019) and TPN (Liu et al., 2019) integrate GNN and LPA by concatenating them together, and GCN-LPA (Wang & Leskovec, 2019) uses LPA to regularize their GCN model. However, as shown in Tabel 1, aforementioned methods still can not incorporate GNN and LPA within a message passing model, propagating feature and label in both training and prediction procedure.
Table 1: Comparision between message passing models
<table><tr><td colspan="2">Training</td><td colspan="2">Prediction</td></tr><tr><td>Feature</td><td>Label</td><td>Feature</td><td>Label</td></tr><tr><td>LPA</td><td></td><td>√</td><td>√</td></tr><tr><td>GCN</td><td>√</td><td>√</td><td></td></tr><tr><td>APPNP</td><td>√</td><td></td><td>一</td></tr><tr><td>GCN-LPA</td><td>√</td><td>√</td><td>√</td></tr><tr><td>UniMP (Ours)</td><td>√</td><td>√</td><td>√ 4</td></tr></table>
To unify the feature and label propagation, there are mainly two issues needed to be addressed:
Aggregating feature and label information. Since node feature is represented by embeddings, while node label is a one-hot vector. They are not in the same vector space. In addition, there are different between their message passing ways, GNNs can propagate the information by diverse neural structures likes GraphSAGE (Hamilton et al., 2017), GCN (Kipf & Welling, 2016) and GAT (Velickovi ˇ c et al., 2017). But LPAs can only pass the label message by graph adjacency matrix. ´
Supervised training. Supervised training a model with feature and label propagation will overfit in self-loop label information inevitably, which makes the label leakage in training time and causes poor performance in prediction.
In this work, inspired by several advantages developments (Vaswani et al., 2017; Wang et al., 2018; Devlin et al., 2018) in Natural Language Processing (NLP), we propose a new Unified Message Passing model (UniMP) with masked label prediction that can settle the aforementioned issues. UniMP is a multi-layer Graph Transformer, jointly using label embedding to transform nodes labels into the same vector space as nodes features. It propagates nodes features like the previous attention based GNNs (Velickovi ˇ c et al., 2017; Zhang et al., 2018). Meanwhile, its multi-head attentions are ´ used as the transition matrix for propagating labels vectors. Therefore, each node can aggregate both features and labels information from its neighbors. To supervised training UniMP without overfitting in self-loop label information, we draw lessons from masked word prediction in BERT (Devlin et al., 2018) and propose a masked label prediction strategy, which randomly masks some training instances’ label embedding vectors and then predicts them. This training method perfectly simulates the procedure of transducing labels information from labeled to unlabeled examples in the graph.
We conduct experiments on three semi-supervised classification datasets in the Open Graph Benchmark (OGB), where our new methods achieve novel state-of-the-art results in all tasks, gaining $8 2 . 5 6 \%$ ACC in ogbn-products, $8 6 . 4 2 \%$ ROC-AUC in ogbn-proteins and $7 3 . 1 1 \%$ ACC in ogbnarxiv. We also conduct the ablation studies for the models with different inputs to prove the effectiveness of our unified method. In addition, we make the most thorough analysis of how the label propagation boosts our model’s performance.
# 2 METHOD
We first introduce our notation about graph. We denote a graph as $G = ( V , E )$ , where $V$ denotes the nodes in the graph with $| V | = n$ and $E$ denotes edges with $| E | = m$ . The nodes are described by the feature matrix $X \in \mathbb { R } ^ { n \times f }$ | |, which usually are dense vectors with $f$ dimension, and the target class matrix $Y \in \mathbb { R } ^ { n \times c }$ , with the number of classes $c$ . The adjacency matrix $A = [ a _ { i , j } ] \in \mathbb { R } ^ { n \times n }$ is used to describe graph $G$ , and the diagonal degree matrix is denoted by $D = \mathrm { d i a g } ( d _ { 1 } , d _ { 2 } , . . . , d _ { n } )$ , where $\begin{array} { r } { d _ { i } = \sum _ { j } \bar { a } _ { i j } } \end{array}$ is the degree of node $i$ . A normalized adjacency matrix is defined as $D ^ { - 1 } A$ or $D ^ { - { \frac { 1 } { 2 } } } A D ^ { - { \frac { 1 } { 2 } } }$ , and we adopt the first definition in this paper.
# 2.1 FEATURE PROPAGATION AND LABEL PROPAGATION
In semi-supervised node classification, based on the Laplacian smoothing assumption, the GNN transforms and propagates nodes features $X$ across the graph by several layers, including linear layers and nonlinear activation to build the approximation of the mapping: $X Y$ . The feature
 Figure 1: The architecture of our UniMP.
propagation scheme of GNN in layer $l$ is:
$$\begin{array} { c } { { H ^ { ( l + 1 ) } = \sigma ( D ^ { - 1 } A H ^ { ( l ) } W ^ { ( l ) } ) } } \\ { { \nonumber } } \\ { { Y = f _ { o u t } ( H ^ { ( L ) } ) } } \end{array}$$
where the $\sigma$ is an activation function, $W ^ { ( l ) }$ is the trainable weight in the $l$ -th layer, and the $H ^ { ( l ) }$ is the $l$ -th layer representations of nodes. $H ^ { ( 0 ) }$ is equal to node input features $X$ . Finally, a $f _ { o u t }$ output layer is applied on the final representation to make prediction for $Y$ .
As for LPA, it also assumes the labels between connected nodes are smoothing and propagates the labels iteratively across the graph. Given an initial label matrix $\hat { Y } ^ { ( 0 ) }$ , which consists of one-hot label indicator vectors $\hat { y } _ { i } ^ { 0 }$ for the labeled nodes or zeros vectors for the unlabeled. A simple iteration equation of LPA is formulated as following:
$$\hat { Y } ^ { ( l + 1 ) } = D ^ { - 1 } A \hat { Y } ^ { ( l ) }$$
Labels are propagated from each other nodes through a normalized adjacency matrix $D ^ { - 1 } A$ .
# 2.2 UNIFIED MESSAGE PASSING MODEL
As shown in Figure 1, we employ a Graph Transformer, jointly using label embedding to construct our unified message passing model for combining the aforementioned feature and label propagation together.
Graph Transformer. Since Transformer (Vaswani et al., 2017) has been proved being powerful in NLP, we employ its vanilla multi-head attention into gcase of edge features. Specifically, given nodes features $\dot { H ^ { ( l ) } } = \{ h _ { 1 } ^ { ( \bar { l } ) } , h _ { 2 } ^ { ( l ) } , . . . , h _ { n } ^ { ( \bar { l } ) } \}$ to account the, we calculate multi-head attention for each edge from $j$ to as following:
$$\begin{array} { r l } & { q _ { c , i } ^ { ( l ) } = W _ { c , q } ^ { ( l ) } h _ { i } ^ { ( l ) } + b _ { c , q } ^ { ( l ) } } \\ & { k _ { c , j } ^ { ( l ) } = W _ { c , k } ^ { ( l ) } h _ { j } ^ { ( l ) } + b _ { c , k } ^ { ( l ) } } \\ & { e _ { c , i j } = W _ { c , e } e _ { i j } + b _ { c , e } } \\ & { \alpha _ { c , i j } ^ { ( l ) } = \frac { \langle q _ { c , i } ^ { ( l ) } , k _ { c , j } ^ { ( l ) } + e _ { c , i j } \rangle } { \sum _ { u \in \mathcal { N } ( i ) } \langle q _ { c , i } ^ { ( l ) } , k _ { c , u } ^ { ( l ) } + e _ { c , i u } \rangle } } \end{array}$$
where $\begin{array} { r } { \langle q , k \rangle = \exp ( \frac { q ^ { T } k } { \sqrt { d } } ) } \end{array}$ is exponential scale dot-product function and $d$ is the hidden size of each head. For the $c$ -th head attention, we firstly transform the source feature $h _ { i } ^ { ( l ) }$ and distant feature $h _ { j } ^ { ( l ) }$ into query vector q(l)c,i $q _ { c , i } ^ { ( l ) } \in \mathbb { R } ^ { d }$ Rdand key vector k(l)c,j $k _ { c , j } ^ { ( l ) } \in \mathbb { R } ^ { d }$ respectively using different trainable parameters ${ W } _ { c , q } ^ { ( l ) } , { W } _ { c , k } ^ { ( l ) } , b _ { c , q } ^ { ( l ) } , b _ { c , k } ^ { ( l ) }$ . The provided edge features $e _ { i j }$ will be encoded and added into key vector as additional information for each layer.
After getting the graph multi-head attention, we make a message aggregation from the distant $j$ to the source $i$ :
$$\begin{array} { l } { { \displaystyle v _ { c , j } ^ { ( l ) } = W _ { c , v } ^ { ( l ) } h _ { j } ^ { ( l ) } + b _ { c , v } ^ { ( l ) } } } \\ { { \displaystyle \hat { h } _ { i } ^ { ( l ) } = \left\| \int _ { c = 1 } ^ { C } \bigl [ \sum _ { j \in \mathcal { N } ( i ) } \alpha _ { c , i j } ^ { ( l ) } ( v _ { c , j } ^ { ( l ) } + e _ { c , i j } ) \bigr ] \right. } } \\ { { \displaystyle r _ { i } ^ { ( l ) } = W _ { r } ^ { ( l ) } h _ { i } ^ { ( l ) } + b _ { r } ^ { ( l ) } } } \\ { { \displaystyle \left. \beta _ { i } ^ { ( l ) } = \mathrm { s i g m o i d } ( W _ { g } ^ { ( l ) } [ \hat { h } _ { i } ^ { ( l ) } ; r _ { i } ^ { ( l ) } ; \hat { h } _ { i } ^ { ( l ) } - r _ { i } ^ { ( l ) } ] ) \right. } } \\ { { \displaystyle h _ { i } ^ { ( l + 1 ) } = \mathrm { R e L U } ( \mathrm { L a y e r N o r m } ( ( 1 - \beta _ { i } ^ { ( l ) } ) \hat { h } _ { i } ^ { ( l ) } + \beta _ { i } ^ { ( l ) } r _ { i } ^ { ( l ) } ) ) } } \end{array}$$
where the $\parallel$ is the concatenation operation for $C$ head attention. Comparing with the Equation 1, multi-head attention matrix replaces the original normalized adjacency matrix as transition matrix for message passing. The distant feature $h _ { j }$ is transformed to $v _ { c , j } ~ \in ~ \mathbb { R } ^ { d }$ for weighted sum. In addition, inspired by (Li et al., 2019; Chen et al., 2020) to prevent oversmoothing, we propose a gated residual connections between layers by ri ∈ Rd and β(l)i $\beta _ { i } ^ { ( \bar { l } ) } \in \mathbb { R } ^ { 1 }$ .
Specially, similar to GAT, if we apply the Graph Transformer on the output layer, we will employ averaging for multi-head output as following:
$$\hat { h } _ { i } ^ { ( l ) } = \frac { 1 } { C } \sum _ { c = 1 } ^ { C } [ \sum _ { j \in \mathcal { N } ( i ) } \alpha _ { c , i j } ^ { ( l ) } ( v _ { c , j } ^ { ( l ) } + e _ { c , i j } ^ { ( l ) } ) ]$$
Label Embedding and Propagation. We propose to embed the partially observed labels information into the same space as nodes features: $\hat { Y } ^ { \prime } \in \mathbb { R } ^ { n \times c } \hat { Y } _ { e } \in \mathbf { \bar { \mathbb { R } } } ^ { n \times f }$ , which consist of the label embedding vector for labeled nodes and zeros vectors for the unlabeled. And then, we combine the label propagation into Graph Transformer by simply adding the nodes features and labels features together as propagation features $( H ^ { 0 } = X + \hat { Y } _ { e } ) \in \mathbb { R } ^ { n \times f }$ . We can prove that by mapping partiallylabeled $\hat { Y }$ and nodes features $X$ into the same space and adding them up, our model is unifying both label propagation and feature propagation within a shared message passing framework. Let’s take $\hat { Y } _ { e } = \hat { Y } W _ { e }$ and $A ^ { * }$ to be normalized adjacency matrix $D ^ { - 1 } A$ or the attention matrix from our Graph Transformer like Equation 3. Then we can find that:
$$\begin{array} { c } { { H ^ { ( 0 ) } = X + \hat { Y } W _ { c } } } \\ { { H ^ { ( l + 1 ) } = \sigma ( ( ( 1 - \beta ) A ^ { * } + \beta I ) H ^ { ( l ) } W ^ { ( l ) } ) } } \end{array}$$
where $\beta$ can be the gated function like Equation 4 or a pre-defined hyper-parameters like APPNP (Klicpera et al., 2019). For simplification, we let $\sigma$ function as identity function, then we can get:
$$\begin{array} { r l } & { H ^ { ( l ) } = ( ( 1 - \beta ) A ^ { * } + \beta I ) ^ { l } ( X + \hat { Y } W _ { c } ) W ^ { ( 1 ) } W ^ { ( 2 ) } \ldots W ^ { ( l ) } } \\ & { \qquad = ( ( 1 - \beta ) A ^ { * } + \beta I ) ^ { l } X W + ( ( 1 - \beta ) A ^ { * } + \beta I ) ^ { l } \hat { Y } W _ { c } W } \end{array}$$
where $W = W ^ { ( 1 ) } W ^ { ( 2 ) } \ldots W ^ { ( l ) }$ . Then we can find that our model can be approximately decomposed into feature propagation $( ( 1 - \beta ) A ^ { * } + \beta I ) ^ { l } X W$ and label propagation $( ( 1 - \beta ) \mathsf { \bar { A } } ^ { * } +$ $\beta I ) ^ { l } \hat { Y } W _ { c } W$ .
# 3 MASKED LABEL PREDICTION
Previous works on GNNs seldom consider using the partially observed labels $\hat { Y }$ in both training and inference stages. They only take those labels information as ground truth target to supervised train
their model’s parameters $\theta$ with given $X$ and $A$ :
$$\underset { \theta } { \arg \operatorname* { m a x } } \quad \log p _ { \theta } ( \hat { Y } | X , A ) = \sum _ { i = 1 } ^ { \hat { V } } \log p _ { \theta } ( \hat { y } _ { i } | X , A )$$
where $\hat { V }$ represents the partial nodes with labels. However, our UniMP model propagates nodes features and labels to make prediction: $p ( y | X , \hat { Y } , A )$ . Simply using above objective for our model will make the label leakage in the training stage, causing poor performance in inference. Learning from BERT, which masks input words and makes prediction for them to pretrain their model (masked word prediction), we propose a masked label prediction strategy to train our model. During training, at each step, we corrupt the $\hat { Y }$ into $\tilde { Y }$ by randomly masking a portion of node labels to zeros and keep the others remain, which is controlled by a hyper-parameter called label rate. Let those masked labels be $\bar { Y }$ , our objective function is to predict $\bar { Y }$ with given $X$ , $\tilde { Y }$ and $A$ :
$${ \underset { \theta } { \operatorname { a r g m a x } } } \quad \log p _ { \theta } ( { \bar { Y } } | X , { \tilde { Y } } , A ) = \sum _ { i = 1 } ^ { \bar { V } } \log p _ { \theta } ( { \bar { y } } _ { i } | X , { \tilde { Y } } , A )$$
where $\bar { V }$ represents those nodes with masked labels. In this way, we can train our model without the leakage of self-loop labels information. And during inference, we will employ all $\hat { Y }$ as input labels to predict the remaining unlabeled nodes.
# 4 EXPERIMENTS
We propose a Unified Message Passing Model (UniMP) for semi-supervised node classification, which incorporates the feature and label propagation jointly by a Graph Transformer and employ a masked label prediction strategy to optimize it. We conduct the experiments on the Node Property Prediction of Open Graph Benchmark (OGBN), which includes several various challenging and large-scale datasets for semi-supervised classification, splitted in the procedure that closely matches the real-world application Hu et al. (2020). To verified our models effectiveness, we compare our model with others State-Of-The-Art models (SOTAs) in ogbn-products, ogbn-proteins and ogbnarxiv three OGBN datasets. We also provide more experiments and comprehensive studies to show our motivation more intuitively, and how LPA improves our model to achieve better results.
# 4.1 DATASETS AND EXPERIMENTAL SETTINGS
Table 2: Dataset statistics of OGB node property prediction
<table><tr><td>Name</td><td>Node</td><td>Edges</td><td>Tasks</td><td>Split Rate</td><td>Split Type</td><td>Task Type</td><td>Metric</td></tr><tr><td>ogbn-products</td><td>2,449,029</td><td>61,859,140</td><td>1</td><td>8\02\88</td><td>Sales rank</td><td>Multi-class class</td><td>Accuracy</td></tr><tr><td>ogbn-proteins</td><td>132,534</td><td>39,561,252</td><td>112</td><td>65\16\19</td><td>Species</td><td>Binary class</td><td>ROC-AUC</td></tr><tr><td>ogbn-arxiv</td><td>169,343</td><td>1,166,243</td><td>1</td><td>78\08\14</td><td>Time</td><td>Multi-class class</td><td>Accuracy</td></tr></table>
Datasets. Most of the frequently-used graph datasets are extremely small compared to graphs found in real applications. And the performance of GNNs on these datasets is often unstable due to several issues including their small-scale nature, non-negligible duplication or leakage rates, unrealistic data splits (Dwivedi et al., 2020; Hu et al., 2020). Consequently, we conduct our experiments on the recently released datasets of Open Graph Benchmark (OGB) (Hu et al., 2020), which overcome the main drawbacks of commonly used datasets and thus are much more realistic and challenging. OGB datasets cover a variety of real-world applications and span several important domains ranging from social and information networks to biological networks, molecular graphs, and knowledge graphs. They also span a variety of predictions tasks at the level of nodes, graphs, and links/edges. As shown in table 2, in this work, we performed our experiments on the three OGBN datasets with different sizes and tasks for getting credible result, including ogbn-products about 47 products categories classification with given 100-dimensional nodes features , ogbn-proteins about 112 kinds of proteins function prediction with given 8-dimensional edges features and ogbn-arxiv about 40- class topics classification with given 128 dimension nodes features. More details about these datasets are provided in Appendix A.
Implementation Details. As mentioned above, these datasets are different from each other in sizes or tasks. So we evaluate our model on them with different sampling methods like previous studies (Li et al., 2020), getting credible comparison results. In ogbn-products dataset, we use NeighborSampling with $s i z e = 1 0$ for each layer to sample the subgraph during training and use full-batch for inference. In ogbn-proteins dataset, we use Random Partition to split the dense graph into subgraph to train and test our model. The number of partitions is 9 for training and 5 for test. As for small-size ogbn-arxiv dataset, we just apply full batch for both training and test. We set the hyper-parameter of our model for each dataset in Table 3, and the label rate means the percentage of labels we preserve during applying masked label prediction strategy. We use Adam optimizer with $l r = 0 . 0 0 1$ to train our model. Specially, we set weight decay to 0.0005 for our model in small-size ogbn-arxiv dataset to prevent overfitting. More details about the tuned hyper-parameters are provided in Appendix B.
Table 3: The hyper-paramerter setting of our model
<table><tr><td colspan="2">ogbn-products</td><td>ogbn-proteins</td><td>ogbn-arxiv</td></tr><tr><td>sampling_method</td><td>NeighborSampling</td><td>RandomPartition</td><td>Full-batch</td></tr><tr><td>num_layers</td><td>3</td><td>7</td><td>3</td></tr><tr><td>hidden_size</td><td>128</td><td>64</td><td>128</td></tr><tr><td>num_heads</td><td>4</td><td>4</td><td>2</td></tr><tr><td>dropout</td><td>0.3</td><td>0.1</td><td>0.3</td></tr><tr><td>lr</td><td>0.001</td><td>0.001</td><td>0.001</td></tr><tr><td>weight_decay</td><td>*</td><td>*</td><td>0.0005</td></tr><tr><td>label_rate</td><td>0.625</td><td>0.5</td><td>0.625</td></tr></table>
# 4.2 COMPARISON WITH SOTAS
Baseline and other comparative SOTAs are provided by OGB leaderboard. Some of the including results are conducted officially by authors from original papers, while the others are re-implemented by communities. And all these results are guaranteed to be reproducible with open source codes. Following the requirement of OGB, we run our experimental results for each dataset 10 times and report the mean and standard deviation. As shown in Tabel 4, Tabel 5, and Tabel 6, our unified model outperform all other comparative models in three OGBN datasets. Since most of the compared models only consider optimizing their models for the features propagation, these results demonstrate that incorporating label propagation into GNN models can bring significant improvements. Specifically, we gain $8 2 . 5 6 \%$ ACC in ogbn-products, $8 6 . 4 2 \%$ ROC-AUC in ogbn-proteins, which achieves about $0 . 6 \mathrm { - } 1 . 6 \%$ absolute improvements compared to the newly SOTA methods like DeeperGCN (Li et al., 2020). In ogbn-arxiv, our method gains $7 3 . 1 1 \%$ ACC, achieve $0 . 3 7 \%$ absolute improvements compared to GCNII (Chen et al., 2020), whose parameters are four times larger than ours.
Table 4: Results for ogbn-products
<table><tr><td>Model</td><td>Test Accuracy</td><td>Validation Accuracy</td><td>Params</td></tr><tr><td>GCN-Cluster (Chiang et al.,2019)</td><td>0.7897±0.0036</td><td>0.9212± 0.0009</td><td>206,895</td></tr><tr><td>GAT-Cluster</td><td>0.7923 ± 0.0078</td><td>0.8985 ± 0.0022</td><td>1, 540,848</td></tr><tr><td>GAT-NeighborSampling</td><td>0.7945 ±0.0059</td><td></td><td>1, 751, 574</td></tr><tr><td>GraphSAINT (Zeng et al.,2019)</td><td>0.8027 ± 0.0026</td><td></td><td>331,661</td></tr><tr><td>DeeperGCN (Li et al., 2020)</td><td>0.8090 ±0.0020</td><td>0.9238 ± 0.0009</td><td>253,743</td></tr><tr><td>UniMP</td><td>0.8256 士 0.0031</td><td>0.9308 ± 0.0017</td><td>1,475,605</td></tr></table>
Table 5: Results for ogbn-proteins
<table><tr><td>Model</td><td>Test ROC-AUC</td><td>Validation ROC-AUC</td><td>Params</td></tr><tr><td>GaAN (Zhang et al., 2018)</td><td>0.7803±0.0073</td><td></td><td>=</td></tr><tr><td>GeniePath-BS (Liu et al.,2020b)</td><td>0.7825 ± 0.0035</td><td></td><td>316,754</td></tr><tr><td>MWE-DGCN</td><td>0.8436 ± 0.0065</td><td>0.8973± 0.0057</td><td>538,544</td></tr><tr><td>DeepGCN (Li et al., 2019)</td><td>0.8496 ± 0.0028</td><td>0.8921 ± 0.0011</td><td>2,374,456</td></tr><tr><td>DeeperGCN (Li et al.,2020)</td><td>0.8580 ± 0.0017</td><td>0.9106 ± 0.0016</td><td>2,374,568</td></tr><tr><td>UniMP</td><td>0.8642 士 0.0008</td><td>0.9175 ± 0.0007</td><td>1,909,104</td></tr></table>
Table 6: Results for ogbn-arxiv 4.3 ABLATION STUDIES ON GRAPH TRANSFORMER AND MASKED LABEL PREDICTION
<table><tr><td>Model</td><td>Test Accuracy</td><td>Validation Accuracy</td><td>Params</td></tr><tr><td>DeeperGCN (Li et al.,2020)</td><td>0.7192 ± 0.0016</td><td>0.7262± 0.0014</td><td>1,471, 506</td></tr><tr><td>GaAN (Zhang et al., 2018)</td><td>0.7197 ± 0.0024</td><td>1</td><td>1, 471, 506</td></tr><tr><td>DAGNN (Liu et al., 2020a)</td><td>0.7209 ±0.0025</td><td></td><td>1,751,574</td></tr><tr><td>JKNet (Xu et al., 2018b)</td><td>0.7219 ±0.0021</td><td>0.7335 ± 0.0007</td><td>331,661</td></tr><tr><td>GCNII (Chen et al., 2020)</td><td>0.7274 :±0.0016</td><td>-</td><td>2,148,648</td></tr><tr><td>UniMP</td><td>0.7311 土 0.0021</td><td>0.7450± 0.0005</td><td>473,489</td></tr></table>
In this section, we will conduct extensive studies to identify the improvements from different components of our unified model. To get a fair comparison, we re-implement classical GNN methods like GCN and GAT, following the same sampling methods and model setting shown in Table 3. The hidden size of GCN is head num\*hidden size since it doesn’t have head attention. We also change different inputs for our models to study the effectiveness of feature and label propagation.
As shown in Tabel 7, it’s surprising that only $\hat { \mathbf Y }$ and A, GNNs still work well in all three datasets, outperforming those MLP model only given $\mathbf { X }$ . This implies that one’s label relies heavily on its neighborhood instead of itself feature. For models with $\mathbf { X }$ and A as inputs like most GNNs do, they are more likely to remember the labels of training set through approximations, which is inaccurate. It’s a waste of information in semi-supervised classification when prediction without incorporating the annotated label $\hat { \mathbf Y }$ information from training sets, which are preciser than the model’s approximations for training data. In addition, with different input settings, our improved Graph Transformer can outperform GAT, GCN in most cases.
Table 7: Ablation studies on models with different inputs.
<table><tr><td rowspan="2">Inputs</td><td rowspan="2">Model</td><td colspan="3">Datasets</td></tr><tr><td>ogbn-products Test ACC</td><td>ogbn-proteins Test ROC-AUC</td><td>ogbn-arxiv Test ACC</td></tr><tr><td>X</td><td>MLP</td><td>0.6106±0.0008</td><td>0.7204±0.0048</td><td>0.5765± 0.0012</td></tr><tr><td rowspan="3">X,A</td><td>GCN</td><td>0.7851± 0.0011</td><td>0.8265±0.0008</td><td>0.7218± 0.0014</td></tr><tr><td>GAT</td><td>0.8002 ± 0.0063</td><td>0.8376 ± 0.0007</td><td>0.7246 ± 0.0013</td></tr><tr><td>Transformer</td><td>0.8137 ± 0.0047</td><td>0.8347 ± 0.0014</td><td>0.7292 ± 0.0010</td></tr><tr><td rowspan="3">A,Y</td><td>GCN</td><td>0.7832± 0.0013</td><td>0.8083±0.0021</td><td>0.7018±0.0009</td></tr><tr><td>GAT</td><td>0.7751 ± 0.0054</td><td>0.8247 ± 0.0033</td><td>0.7055 ± 0.0012</td></tr><tr><td>Transformer</td><td>0.7987 ± 0.0104</td><td>0.8160 ± 0.0007</td><td>0.7090±0.0007</td></tr><tr><td rowspan="3">X,A,Y</td><td>GCN</td><td>0.7987± 0.0104</td><td>0.8247±0.0032</td><td>0.7264±0.0003</td></tr><tr><td>GAT</td><td>0.8193 ± 0.0017</td><td>0.8556 ± 0.0009</td><td>0.7278 ± 0.0009</td></tr><tr><td>Transformer</td><td>0.8269 ± 0.0009</td><td>0.8560± 0.0003</td><td>0.7332 士 :0.0014</td></tr></table>
† In ogbn-proteins, nodes features are not provided initially. We average the edge features as their nodes features and drop the edge features for fair comparison in this experiment. which is slightly different from Table 5. X is the nodes features, A is the graph adjacent matrix and $\hat { \mathbf Y }$ is the observed labels. We run these models three times and report their means and stds.
 Figure 2: Exploration of how label coverage affects label propagation.
One of our motivations for using label propagation is that labels can carry additional informative feature which cannot be replaced by the model’s approximation. However, the relation between the coverage of labeled data and the impact of label propagation for our model still be uncertain. Therefore, we conduct more experiments in ogbn-arxiv to investigate their relationship in several different scenarios:
• In Figure 2a, we train UniMP using $\mathbf { X } , \hat { \mathbf { Y } } , \mathbf { A }$ as inputs. We tune the training label rate which is the hyper-parameter of masked label prediction task and display the validation and test accuracy. Our model achieves better performance when label rate is about 0.625. Figure 2b describes the correlation between the proportion of training data and the effectiveness of label propagation. We fix the label rate with 0.625. The only change is the training data proportion. It’s a common sense that with the increase of training data, the performance is gradually improving. And the model with label propagation can have greater benefits from increasing labeled data proportion. • In the training stage, our model always masks a part of the training label and tries to recover them. But in the inference stage, our model utilizes all training labels for predictions, which is slightly inconsistent with the one in training. In Figure 2c, we fix our trained models and perform label propagation with different label rate in inference. It’s found that when lower the label rate during prediction, UniMP might have worse performance (less than 0.70) than the baseline (about 0.72). However, when the label rate climbs up, the performance can boost up to 0.73. • In Figure 2d, we calculate accuracy for unlabeled nodes with a different number of neighbors. The experimental result shows that nodes with more neighbors have higher accuracy. And the model with label propagation can always have improvements even with different numbers of training neighbors.
 Figure 3: Correlation between accuracy and margin similarity between neighbors.
Wang & Leskovec (2019) have theoretically proved that using the LPA for GCN during training can enable nodes within the same class/label to connect more strongly, increasing the accuracy (ACC) of model’s prediction. Our model can be seen as an upgraded version of them, using LPA in both training and testing time. Therefore, we try to experimentally prove the above idea based on our model. We use the Margin Similarity Function to reflect the connection tightness of the nodes with same class (the higher scores, the stronger connection they are, and more details in Appendix C). We conduct the experiments on ogbn-arxiv. And as shown in Figure 3, the ACC of models’ prediction is proportional to Margin Similarity. Unifying feature and label propagation can further strengthen their connection, improving their ACC. Moreover, our Graph Transformer outperforms GAT in both connection tightness and ACC with different inputs.
# 5 CONCLUSION
We first propose a unified message passing model, UniMP, which jointly performs feature propagation and label propagation within a Graph Transformer to make the semi-supervised classification. Furthermore, we propose a masked label prediction method to supervised training our model, preventing it from overfitting in self-loop label information. Experimental results show that UniMP outperforms the previous state-of-the-art models on three main OGBN datasets: ogbn-products, ogbn-proteins and ogbn-arxiv by a large margin, and ablation studies demonstrate the effectiveness of unifying feature propagation and label propagation.
# REFERENCES
Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
Aleksandar Bojchevski, Oleksandr Shchur, Daniel Zugner, and Stephan G ¨ unnemann. Netgan: Gen- ¨ erating graphs via random walks. arXiv preprint arXiv:1803.00816, 2018.
Ming Chen, Zhewei Wei, Zengfeng Huang, Bolin Ding, and Yaliang Li. Simple and deep graph convolutional networks. arXiv preprint arXiv:2007.02133, 2020.
Wei-Lin Chiang, Xuanqing Liu, Si Si, Yang Li, Samy Bengio, and Cho-Jui Hsieh. Cluster-gcn: An efficient algorithm for training deep and large graph convolutional networks. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 257–266, 2019.
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
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 Advances in neural information processing systems, pp. 2224–2232, 2015.
Vijay Prakash Dwivedi, Chaitanya K Joshi, Thomas Laurent, Yoshua Bengio, and Xavier Bresson. Benchmarking graph neural networks. arXiv preprint arXiv:2003.00982, 2020.
Chen Gong, Dacheng Tao, Wei Liu, Liu Liu, and Jie Yang. Label propagation via teaching-tolearn and learning-to-teach. IEEE transactions on neural networks and learning systems, 28(6): 1452–1465, 2016.
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, 2016.
Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in neural information processing systems, pp. 1024–1034, 2017.
Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. Open graph benchmark: Datasets for machine learning on graphs. arXiv preprint arXiv:2005.00687, 2020.
Masayuki Karasuyama and Hiroshi Mamitsuka. Manifold-based similarity adaptation for label propagation. In Advances in neural information processing systems, pp. 1547–1555, 2013.
Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
Johannes Klicpera, Aleksandar Bojchevski, and Stephan Gunnemann. Predict then propagate: Graph neural networks meet personalized pagerank. arXiv: Learning, 2019.
Guohao Li, Matthias Muller, Ali Thabet, and Bernard Ghanem. Deepgcns: Can gcns go as deep as cnns? In Proceedings of the IEEE International Conference on Computer Vision, pp. 9267–9276, 2019.
Guohao Li, Chenxin Xiong, Ali Thabet, and Bernard Ghanem. Deepergcn: All you need to train deeper gcns. arXiv preprint arXiv:2006.07739, 2020.
Qimai Li, Zhichao Han, and Xiaoming Wu. Deeper insights into graph convolutional networks for semi-supervised learning. Neural Computation, pp. 3538–3545, 2018.
Renjie Liao, Zhizhen Zhao, Raquel Urtasun, and Richard S Zemel. Lanczosnet: Multi-scale deep graph convolutional networks. arXiv preprint arXiv:1901.01484, 2019.
Meng Liu, Hongyang Gao, and Shuiwang Ji. Towards deeper graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 338–348, 2020a.
Yanbin Liu, Juho Lee, Minseop Park, Saehoon Kim, Eunho Yang, Sung Ju Hwang, and Yi Yang. Learning to propagate labels: Transductive propagation network for few-shot learning. arXiv: Learning, 2019.
Ziqi Liu, Zhengwei Wu, Zhiqiang Zhang, Jun Zhou, Shuang Yang, Le Song, and Yuan Qi. Bandit samplers for training graph neural networks. arXiv preprint arXiv:2006.05806, 2020b.
Mathias Niepert, Mohamed Ahmed, and Konstantin Kutzkov. Learning convolutional neural networks for graphs. In International conference on machine learning, pp. 2014–2023, 2016.
Meng Qu, Yoshua Bengio, and Jian Tang. Gmnn: Graph markov neural networks. arXiv preprint arXiv:1905.06214, 2019.
Yifan Sun, Changmao Cheng, Yuhan Zhang, Chi Zhang, Liang Zheng, Zhongdao Wang, and Yichen Wei. Circle loss: A unified perspective of pair similarity optimization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6398–6407, 2020.
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.
Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
Fei Wang and Changshui Zhang. Label propagation through linear neighborhoods. IEEE Transactions on Knowledge and Data Engineering, 20(1):55–67, 2007.
Guoyin Wang, Chunyuan Li, Wenlin Wang, Yizhe Zhang, Dinghan Shen, Xinyuan Zhang, Ricardo Henao, and Lawrence Carin. Joint embedding of words and labels for text classification. arXiv preprint arXiv:1805.04174, 2018.
Hongwei Wang and Jure Leskovec. Unifying graph convolutional neural networks and label propagation. arXiv: Learning, 2019.
Kuansan Wang, Zhihong Shen, Chiyuan Huang, Chieh-Han Wu, Yuxiao Dong, and Anshul Kanakia. Microsoft academic graph: When experts are not enough. Quantitative Science Studies, 1(1):396– 413, 2020.
Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018a.
Keyulu Xu, Chengtao Li, Yonglong Tian, Tomohiro Sonobe, Ken-ichi Kawarabayashi, and Stefanie Jegelka. Representation learning on graphs with jumping knowledge networks. arXiv preprint arXiv:1806.03536, 2018b.
Zhilin Yang, William Cohen, and Ruslan Salakhudinov. Revisiting semi-supervised learning with graph embeddings. In International conference on machine learning, pp. 40–48. PMLR, 2016.
Hanqing Zeng, Hongkuan Zhou, Ajitesh Srivastava, Rajgopal Kannan, and Viktor Prasanna. Graphsaint: Graph sampling based inductive learning method. arXiv preprint arXiv:1907.04931, 2019.
Jiani Zhang, Xingjian Shi, Junyuan Xie, Hao Ma, Irwin King, and Dit-Yan Yeung. Gaan: Gated attention networks for learning on large and spatiotemporal graphs. arXiv preprint arXiv:1803.07294, 2018.
Xinhua Zhang and Wee S Lee. Hyperparameter learning for graph based semi-supervised learning algorithms. In Advances in neural information processing systems, pp. 1585–1592, 2007.
Xiaojin Zhu, Zoubin Ghahramani, and John D Lafferty. Semi-supervised learning using gaussian fields and harmonic functions. In Proceedings of the 20th International conference on Machine learning (ICML-03), pp. 912–919, 2003.
Xiaojin Jerry Zhu. Semi-supervised learning literature survey. Technical report, University of Wisconsin-Madison Department of Computer Sciences, 2005.
# A DATASETS DETAILS
ogbn-products. As shown in Table 2, ogb-products is an undirected and unweighted graph, representing an Amazon product co-purchasing network. The goal of this task is to predict the category of a product in a multi-class classification setup, where the 47 top-level categories are used for target labels. To match the real-world application, it conducts a splitting on the dataset based on sales ranking, where the top $10 \%$ for training, next top $2 \%$ for validation, and the rest for testing.
ogbn-proteins. As shown in Table 2, ogbn-proteins dataset is an undirected, weighted, and typed (according to species) graph. Nodes represent proteins, and edges indicate different types of biologically meaningful associations between proteins, e.g., physical interactions, co-expression or homology. The task is to predict the presence of protein functions in a multi-label binary classification setup, where there are 112 kinds of labels to predict in total. The performance is measured by the average of ROC-AUC scores across the 112 tasks. It conducts the splitting by species.
ogbn-arxiv. As shown in Table 2, ogbn-arxiv dataset is a directed graph, representing the citation network between all Computer Science (CS) arXiv papers indexed by MAG (Wang et al., 2020). The task is to predict the 40 subject areas of arXiv CS papers, e.g., cs.AI, cs.LG, and cs.OS, which are manually determined by the paper’s authors and arXiv moderators. This dataset were splitted by time.
# B HYPER-PARAMETERS TUNED ON UNIMP MODEL
There are the hyper-parameters we tuned on our unified model for comparison with other SOTA results, where the asterisks denote the hyper-parameters we eventually selected.
Table 8: The tuned hyperparamerters of our model
<table><tr><td></td><td>ogbn-prdouct</td><td>ogbn-proteins</td><td>ogbn-arxiv</td></tr><tr><td>sampling_method</td><td>NeighborSampling</td><td>RandomPartition</td><td>Full-batch</td></tr><tr><td>num_layers</td><td>[3*,4]</td><td>[3,5,7*,9]</td><td>[3*,4]</td></tr><tr><td>hidden_size</td><td>[128*, 256]</td><td>[32, 64*,128]</td><td>[128*, 256]</td></tr><tr><td>num_heads</td><td>[4*,2]</td><td>[6, 4*,2]</td><td>[2*,1]</td></tr><tr><td>dropout</td><td>[0.3*]</td><td>[0,0.1*, 0.3]</td><td>[0.1,0.3*]</td></tr><tr><td>lr</td><td>[0.01, 0.001*]</td><td>[0.01,0.001*]</td><td>[0.1, 0.001*]</td></tr><tr><td>weight_decay</td><td>-</td><td>-</td><td>[0,0.0005*]</td></tr><tr><td>label_rate</td><td>[0.625*]</td><td>[0.375, 0.5*, 0.625]</td><td>[0.125, 0.25, 0.375, 0.5, 0.625*, 0.75, 0.875]</td></tr></table>
# C MARGIN SIMILARITY FUNCTION
Given an attention weight $\alpha _ { i j }$ from GAT or Graph Transformer, which can represent the connection tightness between source node $i$ and distance node $j$ , we employ the Circle Loss (Sun et al., 2020) and make a slight change on it to build our Margin Similarity Function (MSF), measuring the connection tightness between the neighbors nodes with same labels. For each center node $i$ and its neighbors $j , \bar { k } \in \mathcal { N } ( i )$ , we take the measurement task as a pair similarity problem in which the center node’s neighbors with same label are positive samples and the others are negative samples, calculating their connection tightness as following:
$$M S F = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log \left( 1 + \sum _ { j \in \mathcal { N } ( i ) _ { p o s } , k \in \mathcal { N } ( i ) _ { n e g } } e ^ { \alpha _ { i , j } } - e ^ { \alpha _ { i , k } } \right)$$123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299# HIERARCHICAL REPRESENTATIONS FOR EFFICIENT ARCHITECTURE SEARCH
Hanxiao Liu∗ Carnegie Mellon University hanxiaol@cs.cmu.edu
Karen Simonyan, Oriol Vinyals, Chrisantha Fernando, Koray Kavukcuoglu DeepMind {simonyan,vinyals,chrisantha,korayk}@google.com
# ABSTRACT
We explore efficient neural architecture search methods and show that a simple yet powerful evolutionary algorithm can discover new architectures with excellent performance. Our approach combines a novel hierarchical genetic representation scheme that imitates the modularized design pattern commonly adopted by human experts, and an expressive search space that supports complex topologies. Our algorithm efficiently discovers architectures that outperform a large number of manually designed models for image classification, obtaining top-1 error of $3 . 6 \%$ on CIFAR-10 and $2 0 . 3 \%$ when transferred to ImageNet, which is competitive with the best existing neural architecture search approaches. We also present results using random search, achieving $0 . 3 \%$ less top-1 accuracy on CIFAR-10 and $0 . 1 \%$ less on ImageNet whilst reducing the search time from 36 hours down to 1 hour.
# 1 INTRODUCTION
Discovering high-performance neural network architectures required years of extensive research by human experts through trial and error. As far as the image classification task is concerned, state-ofthe-art convolutional neural networks are going beyond deep, chain-structured layout (Simonyan & Zisserman, 2014; He et al., 2016a) towards increasingly more complex, graph-structured topologies (Szegedy et al., 2015; 2016; 2017; Larsson et al., 2016; Xie et al., 2016; Huang et al., 2016). The combinatorial explosion in the design space makes handcrafted architectures not only expensive to obtain, but also likely to be suboptimal in performance.
Recently, there has been a surge of interest in using algorithms to automate the manual process of architecture design. Their goal can be described as finding the optimal architecture in a given search space such that the validation accuracy is maximized on the given task. Representative architecture search algorithms can be categorized as random with weights prediction (Brock et al., 2017), Monte Carlo Tree Search (Negrinho & Gordon, 2017), evolution (Stanley & Miikkulainen, 2002; Xie & Yuille, 2017; Miikkulainen et al., 2017; Real et al., 2017), and reinforcement learning (Baker et al., 2016; Zoph & Le, 2016; Zoph et al., 2017; Zhong et al., 2017), among which reinforcement learning approaches have demonstrated the strongest empirical performance so far.
Architecture search can be computationally very intensive as each evaluation typically requires training a neural network. Therefore, it is common to restrict the search space to reduce complexity and increase efficiency of architecture search. Various constraints that have been used include: growing a convolutional “backbone” with skip connections (Real et al., 2017), a linear sequence of filter banks (Brock et al., 2017), or a directed graph where every node has exactly two predecessors (Zoph et al., 2017). In this work we constrain the search space by imposing a hierarchical network structure, while allowing flexible network topologies (directed acyclic graphs) at each level of the hierarchy. Starting from a small set of primitives such as convolutional and pooling operations at the bottom level of the hierarchy, higher-level computation graphs, or motifs, are formed by using lower-level motifs as their building blocks. The motifs at the top of the hierarchy are stacked multiple times to form the final neural network. This approach enables search algorithms to implement powerful hierarchical modules where any change in the motifs is propagated across the whole network immediately. This is analogous to the modularized design patterns used in many handcrafted architectures, e.g. VGGNet (Simonyan & Zisserman, 2014), ResNet (He et al., 2016a), and Inception (Szegedy et al., 2016) are all comprised of building blocks. In our case, a hierarchical architecture is discovered through evolutionary or random search.
The evolution of neural architectures was studied as a sub-task of neuroevolution (Holland, 1975; Miller et al., 1989; Yao, 1999; Stanley & Miikkulainen, 2002; Floreano et al., 2008), where the topology of a neural network is simultaneously evolved along with its weights and hyperparameters. The benefits of indirect encoding schemes, such as multi-scale representations, have historically been discussed in Gruau et al. (1994); Kitano (1990); Stanley (2007); Stanley et al. (2009). Despite these pioneer studies, evolutionary or random architecture search has not been investigated at larger scale on image classification benchmarks until recently (Real et al., 2017; Miikkulainen et al., 2017; Xie & Yuille, 2017; Brock et al., 2017; Negrinho & Gordon, 2017). Our work shows that the power of simple search methods can be substantially enhanced using well-designed search spaces.
Our experimental setup resembles Zoph et al. (2017), where an architecture found using reinforcement learning obtained the state-of-the-art performance on ImageNet. Our work reveals that random or evolutionary methods, which so far have been seen as less efficient, can scale and achieve competitive performance on this task if combined with a powerful architecture representation, whilst utilizing significantly less computational resources.
To summarize, our main contributions are:
1. We introduce hierarchical representations for describing neural network architectures. 2. We show that competitive architectures for image classification can be obtained even with simplistic random search, which demonstrates the importance of search space construction. 3. We present a scalable variant of evolutionary search which further improves the results and achieves the best published results1 among evolutionary architecture search techniques.
# 2 ARCHITECTURE REPRESENTATIONS
We first describe flat representations of neural architectures (Sect. 2.1), where each architecture is represented as a single directed acyclic graph of primitive operations. Then we move on to hierarchical representations (Sect. 2.2) where smaller graph motifs are used as building blocks to form larger motifs. Primitive operations are discussed in Sect. 2.3.
# 2.1 FLAT ARCHITECTURE REPRESENTATION
We consider a family of neural network architectures represented by a single-source, single-sink computation graph that transforms the input at the source to the output at the sink. Each node of the graph corresponds to a feature map, and each directed edge is associated with some primitive operation (e.g. convolution, pooling, etc.) that transforms the feature map in the input node and passes it to the output node.
Formally, an architecture is defined by the representation $( G , o )$ , consisting of two ingredients:
1. A set of available operations $\pmb { o } = \{ o _ { 1 } , o _ { 2 } , \dots \}$ . 2. An adjacency matrix $G$ specifying the neural network graph of operations, where $G _ { i j } = k$ means that the $k$ -th operation $o _ { k }$ is to be placed between nodes $i$ and $j$ .
The architecture is obtained by assembling operations $^ o$ according to the adjacency matrix $G$
$$a r c h = a s s e m b l e ( G , \pmb { o } )$$
 Figure 1: An example of a three-level hierarchical architecture representation. The bottom row shows how level-1 primitive operations $o _ { 1 } ^ { ( 1 ) } , o _ { 2 } ^ { ( 1 ) } , o _ { 3 } ^ { ( 1 ) }$ o( ) are assembled into a level-2 motif o(2)1 . The top row shows how level-2 motifs $o _ { 1 } ^ { ( 2 ) } , o _ { 2 } ^ { ( 2 ) } , o _ { 3 } ^ { ( 2 ) }$ are then assembled into a level-3 motif $o _ { 1 } ^ { ( 3 ) }$
in a way that the resulting neural network sequentially computes the feature map $x _ { i }$ of each node $i$ from the feature maps $x _ { j }$ of its predecessor nodes $j$ following the topological ordering:
$$x _ { i } = m e r g e \left[ \left\{ o _ { G _ { i j } } ( x _ { j } ) \right\} _ { j < i } \right] , \quad i = 2 , \ldots , \left| { \cal G } \right|$$
Here, $| G |$ is the number of nodes in a graph, and merge is an operation combining multiple feature maps into one, which in our experiments was implemented as depthwise concatenation. An alternative option of element-wise addition is less flexible as it requires the incoming feature maps to contain the same number of channels, and is strictly subsumed by concatenation if the resulting $x _ { i }$ is immediately followed by a $1 \times 1$ convolution.
# 2.2 HIERARCHICAL ARCHITECTURE REPRESENTATION
The key idea of the hierarchical architecture representation is to have several motifs at different levels of hierarchy, where lower-level motifs are used as building blocks (operations) during the construction of higher-level motifs.
Consider a hierarchy of $L$ levels where the $\ell$ -th level contains $M _ { \ell }$ motifs. The highest-level $\ell = L$ contains only a single motif corresponding to the full architecture, and the lowest level $\ell = 1$ is the set of primitive operations. We recursively define $o _ { m } ^ { ( \ell ) }$ , the $m$ -th motif in level $\ell$ , as the composition of lower-level motifs $\pmb { o } ^ { ( \ell - 1 ) } = \bigl \{ o _ { 1 } ^ { ( \ell - 1 ) } , o _ { 2 } ^ { ( \ell - 1 ) } , . . . , o _ { M _ { ( \ell - 1 ) } } ^ { ( \ell - 1 ) } \bigr \}$ according to its network structure $G _ { m } ^ { ( \ell ) }$
$$o _ { m } ^ { ( \ell ) } = a s s e m b l e \left( G _ { m } ^ { ( \ell ) } , o ^ { ( \ell - 1 ) } \right) , \quad \forall \ell = 2 , \ldots , L$$
A hierarchical architecture representation is therefore defined by $\left( \big \{ \{ G _ { m } ^ { ( \ell ) } \} _ { m = 1 } ^ { M _ { \ell } } \big \} _ { \ell = 2 } ^ { L } , o ^ { ( 1 ) } \right)$ , as it is assembly process is illustrated in Fig. 1.
# 2.3 PRIMITIVE OPERATIONS
We consider the following six primitives at the bottom level of the hierarchy $\ell = 1 , M _ { \ell } = 6 )$ :
• $1 \times 1$ convolution of $C$ channels • $3 \times 3$ depthwise convolution • $3 \times 3$ separable convolution of $C$ channels • $3 \times 3$ max-pooling
• $3 \times 3$ average-pooling • identity
If applicable, all primitives are of stride one and the convolved feature maps are padded to preserve their spatial resolution. All convolutional operations are followed by batch normalization and ReLU activation (Ioffe & Szegedy, 2015); their number of channels is fixed to a constant $C$ . We note that convolutions with larger receptive fields and more channels can be expressed as motifs of such primitives. Indeed, large receptive fields can be obtained by stacking $3 \times 3$ convolutions in a chain structure (Simonyan & Zisserman, 2014), and wider convolutions with more channels can be obtained by merging the outputs of multiple convolutions through depthwise concatenation.
We also introduce a special none op, which indicates that there is no edge between nodes $i$ and $j$ . It is added to the pool of operations at each level.
# 3 EVOLUTIONARY ARCHITECTURE SEARCH
Evolutionary search over neural network architectures can be performed by treating the representations of Sect. 2 as genotypes. We first introduce an action space for mutating hierarchical genotypes (Sect. 3.1), as well as a diversification-based scheme to obtain the initial population (Sect. 3.2). We then describe tournament selection and random search in Sect. 3.3, and our distributed implementation in Sect. 3.4.
# 3.1 MUTATION
A single mutation of a hierarchical genotype consists of the following sequence of actions:
1. Sample a target non-primitive level $\ell \geq 2$ . 2. Sample a target motif $m$ in the target level. 3. Sample a random successor node $i$ in the target motif. 4. Sample a random predecessor node $j$ in the target motif. 5. Replace the current operation $o _ { k } ^ { ( \ell - 1 ) }$ between $j$ and $i$ with a randomly sampled operation $o _ { k ^ { \prime } } ^ { ( \ell - 1 ) }$
In the case of flat genotypes which consist of two levels (one of which is the fixed level of primitives), the first step is omitted and $\ell$ is set to 2. The mutation can be summarized as:
$$[ G _ { m } ^ { ( \ell ) } ] _ { i j } = k ^ { \prime }$$
where $\ell , m , i , j , k ^ { \prime }$ are randomly sampled from uniform distributions over their respective domains. Notably, the above mutation process is powerful enough to perform various modifications on the target motif, such as:
1. Add a new edge: if $o _ { k } ^ { ( \ell - 1 ) } = n o n e$ and $o _ { k ^ { \prime } } ^ { ( \ell - 1 ) } \neq n o n e .$ 2. Alter an existing edge: if $o _ { k } ^ { ( \ell - 1 ) } \neq n o n e$ and $o _ { k ^ { \prime } } ^ { ( \ell - 1 ) } \neq n o n e$ and $o _ { k ^ { \prime } } ^ { ( \ell - 1 ) } \neq o _ { k } ^ { ( \ell - 1 ) }$ 3. Remove an existing edge: if $o _ { k } ^ { ( \ell - 1 ) } \neq n o n e$ and if $o _ { \boldsymbol { k } ^ { \prime } } ^ { ( \ell - 1 ) } = n o n e$
# 3.2 INITIALIZATION
To initialize the population of genotypes, we use the following strategy:
1. Create a “trivial” genotype where each motif is set to a chain of identity mappings. 2. Diversify the genotype by applying a large number (e.g. 1000) of random mutations.
In contrast to several previous works where genotypes are initialized by trivial networks (Stanley & Miikkulainen, 2002; Real et al., 2017), the above diversification-based scheme not only offers a
Input: Data queue $\mathcal { Q }$ containing initial genotypes; Memory table $\mathcal { M }$ recording evaluated genotypes and their fitness. while True do if HASIDLEWORKER() then genotype $\gets$ ASYNCTOURNAMENTSELECT $( \mathcal { M } )$ genotype $^ \prime \gets$ MUTATE(genotype) $\mathcal { Q } \mathcal { Q } \cup g e n o t y p e ^ { \prime }$
# Algorithm 2: ASYNCEVO Asynchronous Evolution (Worker)
Input: Training set $\tau$ , validation set $\nu$ ; Shared memory table $\mathcal { M }$ and data queue $\mathcal { Q }$ . while True do if $| \mathcal { Q } | > 0$ then genotype $ \mathcal { Q }$ .pop() $a r c h \gets \mathrm { A s s E M B L E } ( q e n o t y p e )$ ) $m o d e l \gets \mathrm { T R A I N } ( a r c h , \mathcal { T } )$ f itness ← EVALUATE(model, V) M ← M ∪ (genotype, f itness)
good initial coverage of the search space with non-trivial architectures, but also helps to avoid an additional bias introduced by handcrafted initialization routines. In fact, this strategy ensures initial architectures are reasonably well-performing even without any search, as suggested by our random sample results in Table 1.
# 3.3 SEARCH ALGORITHMS
Our evolutionary search algorithm is based on tournament selection (Goldberg & Deb, 1991). Starting from an initial population of random genotypes, tournament selection provides a mechanism to pick promising genotypes from the population, and to place its mutated offspring back into the population. By repeating this process, the quality of the population keeps being refined over time. We always train a model from scratch for a fixed number of iterations, and we refer to the training and evaluation of a single model as an evolution step. The genotype with the highest fitness (validation accuracy) among the entire population is selected as the final output after a fixed amount of time.
A tournament is formed by a random set of genotypes sampled from the current effective population, among which the individual with the highest fitness value wins the tournament. The selection pressure is controlled by the tournament size, which is set to $5 \%$ of the population size in our case. We do not remove any genotypes from the population, allowing it to grow with time, maintaining architecture diversity. Our evolution algorithm is similar to the binary tournament selection used in a recent large-scale evolutionary method (Real et al., 2017).
We also investigated random search, a simpler strategy which has not been sufficiently explored in the literature, as an alternative to evolution. In this case, a population of genotypes is generated randomly, the fitness is computed for each genotype in the same way as done in evolution, and the genotype with the highest fitness is selected as the final output. The main advantage of this method is that it can be run in parallel over the entire population, substantially reducing the search time.
# 3.4 IMPLEMENTATION
Our distributed implementation is asynchronous, consisting of a single controller responsible for performing evolution over the genotypes, and a set of workers responsible for their evaluation. Both parties have access to a shared tabular memory $\mathcal { M }$ recording the population of genotypes and their fitness, as well as a data queue $\mathcal { Q }$ containing the genotypes with unknown fitness which should be evaluated.
Specifically, the controller will perform tournament selection of a genotype from $\mathcal { M }$ whenever a worker becomes available, followed by the mutation of the selected genotype and its insertion into $\mathcal { Q }$ for fitness evaluation (Algorithm 1). A worker will pick up an unevaluated genotype from $\mathcal { Q }$ whenever there is one available, assemble it into an architecture, carry out training and validation, and then record the validation accuracy (fitness) in $\mathcal { M }$ (Algorithm 2). Architectures are trained from scratch for a fixed number of steps with random weight initialization. We do not rely on weight inheritance as in (Real et al., 2017), though incorporating it into our system is possible. Note that during architecture evolution no synchronization is required, and all workers are fully occupied.
# 4 EXPERIMENTS AND RESULTS
# 4.1 EXPERIMENTAL SETUP
In our experiments, we use the proposed search framework to learn the architecture of a convolutional cell, rather than the entire model. The reason is that we would like to be able to quickly compute the fitness of the candidate architecture and then transfer it to a larger model, which is achieved by using less cells for fitness computation and more cells for full model evaluation. A similar approach has recently been used in (Zoph et al., 2017; Zhong et al., 2017).
Architecture search is carried out entirely on the CIFAR-10 training set, which we split into two sub-sets of 40K training and 10K validation images. Candidate models are trained on the training subset, and evaluated on the validation subset to obtain the fitness. Once the search process is over, the selected cell is plugged into a large model which is trained on the combination of training and validation sub-sets, and the accuracy is reported on the CIFAR-10 test set. We note that the test set is never used for model selection, and it is only used for final model evaluation. We also evaluate the cells, learned on CIFAR-10, in a large-scale setting on the ImageNet challenge dataset (Sect. 4.3).
 Figure 2: Image classification models constructed using the cells optimized with architecture search. Top-left: small model used during architecture search on CIFAR-10. Top-right: large CIFAR-10 model used for learned cell evaluation. Bottom: ImageNet model used for learned cell evaluation.
For CIFAR-10 experiments we use a model which consists of $3 \times 3$ convolution with $c _ { 0 }$ channels, followed by 3 groups of learned convolutional cells, each group containing $N$ cells. After each cell (with $c$ input channels) we insert $3 \times 3$ separable convolution which has stride 2 and $2 c$ channels if it is the last cell of the group, and stride 1 and $c$ channels otherwise. The purpose of these convolutions is to control the number of channels as well as reduce the spatial resolution. The last cell is followed by global average pooling and a linear softmax layer.
For fitness computation we use a smaller model with $c _ { 0 } = 1 6$ and $N = 1$ , shown in Fig. 2 (top-left). It is trained using SGD with 0.9 momentum for 5000 steps, starting with the learning rate 0.1, which is reduced by 10x after 4000 and 4500 steps. The batch size is 256, and the weight decay value is $3 \cdot 1 0 ^ { - 4 }$ . We employ standard training data augmentation where a $2 4 \times 2 4$ crop is randomly sampled from a $3 2 \times 3 2$ image, followed by random horizontal flipping. The evaluation is performed on the full size $3 2 \times 3 2$ image.
A note on variance. We found that the variance due to optimization was non-negligible, and we believe that reporting it is important for performing a fair comparison and assessing model capabilities. When training CIFAR models, we have observed standard deviation of up to $0 . 2 \%$ using the exact same setup. The solution we adopted was to compute the fitness as the average accuracy over 4 training-evaluation runs.
For the evaluation of the learned cell architecture on CIFAR-10, we use a larger model with $c _ { 0 } =$ 64 and $N = 2$ , shown in Fig. 2 (top-right). The larger model is trained for 80K steps, starting with a learning rate 0.1, which is reduced by 10x after 40K, 60K, and 70K steps. The rest of the training settings are the same as used for fitness computation. We report mean and standard deviation computed over 5 training-evaluation runs.
For the evaluation on the ILSVRC ImageNet challenge dataset (Russakovsky et al., 2015), we use an architecture similar to the one used for CIFAR, with the following changes. An input $2 9 9 \times 2 9 9$ image is passed through two convolutional layers with 32 and 64 channels and stride 2 each. It is followed by 4 groups of convolutional cells where the first group contains a single cell (and has $c _ { 0 } = 6 4$ input channels), and the remaining three groups have $N = 2$ cells each (Fig. 2, bottom). We use SGD with momentum which is run for 200K steps, starting with a learning rate of 0.1, which is reduced by $1 0 \mathrm { x }$ after 100K, 150K, and 175K steps. The batch size is 1024, and weight decay is $1 0 ^ { - 4 }$ . We did not use auxiliary losses, weight averaging, label smoothing or path dropout empirically found effective in (Zoph et al., 2017). The training augmentation is the same as in (Szegedy et al., 2016), and consists in random crops, horizontal flips and brightness and contrast changes. We report the single-crop top-1 and top-5 error on the ILSVRC validation set.
 4.2 ARCHITECTURE SEARCH ON CIFAR-10 Figure 3: Fitness and number of parameters vs evolution step for flat and hierarchical representations. Left: fitness of a genotype generated at each evolution step. Middle: maximum fitness across all genotypes generated before each evolution step. Right: number of parameters in the small CIFAR-10 model constructed using the genotype generated at each evolution step.
We run the evolution on flat and hierarchical genotypes for 7000 steps using 200 GPU workers. The initial size of the randomly initialized population is 200, which later grows as a result of tournament selection and mutation (Sect. 3). For the hierarchical representation, we use three levels $ { \boldsymbol { L } } = 3$ ), with $M _ { 1 } = 6 , M _ { 2 } = 6 , M _ { 3 } = 1$ . Each of the level-2 motifs is a graph with $| G ^ { ( 2 ) } | = 4$ nodes, and the level-3 motif is a graph with $| G ^ { ( 3 ) } | = 5$ nodes. Each level-2 motif is followed by a $1 \times 1$ convolution with the same number of channels as on the motif input to reduce the number of parameters. For the flat representation, we used a graph with 11 nodes to achieve a comparable number of edges.
The evolution process is visualized in Fig. 3. The left plot shows the fitness of the genotype generated at each step of evolution: the fitness grows fast initially, and plateaus over time. The middle plot shows the best fitness observed by each evolution step. Since the first 200 steps correspond to a random initialization and mutation starts after that, the best architecture found at step 200 corresponds to the output of random search over 200 architectures.
Fig. 3 (right) shows the number of parameters in the small network (used for fitness computation), constructed using the genotype produced at each step. Notably, flat genotypes achieve higher fitness, but at the cost of larger parameter count. We thus also consider a parameter-constrained variant of the flat genotype, where only the genotypes with the number of parameters under a fixed threshold are permitted; the threshold is chosen so that the flat genotype has a similar number of parameters to the hierarchical one. In this setting hierarchical and flat genotypes achieve similar fitness.
To demonstrate that improvement in fitness of the hierarchical architecture is correlated with the improvement in the accuracy of the corresponding large model trained till convergence, we plot the relative accuracy improvements in Fig. 4.
 Figure 4: Accuracy improvement over the course of evolution, measured with respect to the first random genotype. The small model is the model used for fitness computation during evolution (its absolute fitness value is shown with the red curve in Fig. 3 (middle)). The large model is the model where the evolved cell architecture is deployed for training and evaluation.
As far as the architecture search time is concerned, it takes 1 hour to compute the fitness of one architecture on a single P100 GPU (which involves 4 rounds of training and evaluation). Using 200 GPUs, it thus takes 1 hour to perform random search over 200 architectures and 1.5 days to do the evolutionary search with 7000 steps. This is significantly faster than 11 days using 250 GPUs reported by (Real et al., 2017) and 4 days using 450 GPUs reported by (Zoph et al., 2017).
<table><tr><td>Search Method</td><td>CIFAR-10 error (%)</td><td>ImageNet Top-1/Top-5 error (%)</td></tr><tr><td>Flat repr-n, random architecture</td><td>4.56 ± 0.11</td><td>21.4/5.8</td></tr><tr><td>Flat repr-n,random search (2O0 samples)</td><td>4.02 ± 0.11</td><td>20.8/5.7</td></tr><tr><td>Flat repr-n,evolution (70o0 samples)</td><td>3.92 ±0.06</td><td>20.6/5.6</td></tr><tr><td>Flat repr-n,parameter-constrained,evolution (7ooo samples)</td><td>4.17 ± 0.08</td><td>21.2/5.8</td></tr><tr><td>Hier. repr-n, random architecture</td><td>4.21 ± 0.11</td><td>21.5/5.8</td></tr><tr><td>Hier. repr-n,random search (2O0 samples)</td><td>4.04±0.2</td><td>20.4/5.3</td></tr><tr><td>Hier.repr-n,random search (7ooo samples)</td><td>3.91 ± 0.15</td><td>21.0/5.5</td></tr><tr><td>Hier. repr-n, evolution (70oO samples)</td><td>3.75 ±0.12</td><td>20.3/5.2</td></tr></table>
Table 1: Classification results on the CIFAR-10 test set and ILSVRC validation set obtained using the architectures found using various representations and search methods.
# 4.3 ARCHITECTURE EVALUATION ON CIFAR-10 AND IMAGENET
We now turn to the evaluation of architectures found using random and evolutionary search on CIFAR-10 and ImageNet. The results are presented in Table 1.
First, we note that randomly sampled architectures already perform surprisingly well, which we attribute to the representation power of our architecture spaces. Second, random search over 200 architectures achieves very competitive results on both CIFAR-10 and ImageNet, which is remarkable considering it took 1 hour to carry out. This demonstrates that well-constructed architecture representations, coupled with diversified sampling and simple search form a simple but strong baseline for architecture search. Our best results are achieved using evolution over hierarchical representations: $3 . 7 5 \% \pm 0 . 1 2 \%$ classification error on the CIFAR-10 test set (using $c _ { 0 } = 6 4$ channels), which is further improved to $3 . 6 3 \% \pm 0 . 1 0 \%$ with more channels $c _ { 0 } = 1 2 8 )$ ). On the ImageNet validation set, we achieve $2 0 . 3 \%$ top-1 classification error and $5 . 2 \%$ top-5 error. We put these results in the context of the state of the art in Tables 2 and 3. We achieve the best published results on CIFAR-10 using evolutionary architecture search, and also demonstrate competitive performance compared to the best published methods on both CIFAR-10 and ImageNet. Our ImageNet model has 64M parameters, which is comparable to Inception-ResNet-v2 (55.8M) but larger than NASNet-A (22.6M).
Table 2: Classification error on the CIFAR-10 test set obtained using state-of-the-art models as well as the best-performing architecture found using the proposed architecture search framework. Existing models are grouped as (from top to bottom): handcrafted architectures, architectures found using reinforcement learning, and architectures found using random or evolutionary search.
<table><tr><td>Model</td><td>Error (%)</td></tr><tr><td>ResNet-1001 + pre-activation (He et al., 2016b)</td><td>4.62</td></tr><tr><td>Wide ResNet-40-10 + dropout (Zagoruyko & Komodakis,2016)</td><td>3.8</td></tr><tr><td>DenseNet (k=24) (Huang et al.,2016)</td><td>3.74</td></tr><tr><td>DenseNet-BC (k=40) (Huang et al.,2016)</td><td>3.46</td></tr><tr><td>MetaQNN (Baker et al., 2016)</td><td>6.92</td></tr><tr><td>NAS v3 (Zoph & Le,2016)</td><td>3.65</td></tr><tr><td>Block-QNN-A (Zhong et al., 2017)</td><td>3.60</td></tr><tr><td>NASNet-A (Zoph et al., 2017)</td><td>3.41</td></tr><tr><td>Evolving DNN (Miikkulainen et al., 2017)</td><td>7.3</td></tr><tr><td>Genetic CNN(Xie & Yuille,2017)</td><td>7.10</td></tr><tr><td>Large-scale Evolution (Real et al., 2017)</td><td>5.4</td></tr><tr><td>SMASH (Brock et al., 2017)</td><td>4.03</td></tr><tr><td>Evolutionary search,hier. repr.,Co = 64</td><td>3.75 ± 0.12</td></tr><tr><td>Evolutionary search,hier. repr.,Co = 128</td><td>3.63 ± 0.10</td></tr></table>
<table><tr><td>Model</td><td>Top-1 error (%)</td><td>Top-5 error (%)</td></tr><tr><td>Inception-v3 (Szegedy et al., 2016)</td><td>21.2</td><td>5.6</td></tr><tr><td>Xception (Chollet,2016)</td><td>21.0</td><td>5.5</td></tr><tr><td>Inception-ResNet-v2 (Szegedy et al., 2017)</td><td>19.9</td><td>4.9</td></tr><tr><td>NASNet-A (Zoph et al., 2017)</td><td>19.2</td><td>4.7</td></tr><tr><td>Evolutionary search, hier. repr., Co = 64</td><td>20.3</td><td>5.2</td></tr></table>
Table 3: Classification error on the ImageNet validation set obtained using state-of-the-art models as well as the best-performing architecture found using our framework.
The evolved hierarchical cell is visualized in Appendix A, which shows that architecture search have discovered a number of skip connections. For example, the cell contains a direct skip connection between input and output: nodes 1 and 5 are connected by Motif 4, which in turn contains a direct connection between input and output. The cell also contains several internal skip connections, through Motif 5 (which again comes with an input-to-output skip connection similar to Motif 4).
# 5 CONCLUSION
We have presented an efficient evolutionary method that identifies high-performing neural architectures based on a novel hierarchical representation scheme, where smaller operations are used as the building blocks to form the larger ones. Notably, we show that strong results can be obtained even using simplistic search algorithms, such as evolution or random search, when coupled with a well-designed architecture representation. Our best architecture yields the state-of-the-art result on
CIFAR-10 among evolutionary methods and successfully scales to ImageNet with highly competitive performance.
# ACKNOWLEDGEMENTS
The authors thank Jacob Menick, Pushmeet Kohli, Yujia Li, Simon Osindero, and many other colleagues at DeepMind for helpful comments and discussions.
# REFERENCES
Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. arXiv preprint arXiv:1611.02167, 2016.
Andrew Brock, Theodore Lim, JM Ritchie, and Nick Weston. Smash: One-shot model architecture search through hypernetworks. arXiv preprint arXiv:1708.05344, 2017.
Franc¸ois Chollet. Xception: Deep learning with depthwise separable convolutions. arXiv preprint arXiv:1610.02357, 2016.
Dario Floreano, Peter Durr, and Claudio Mattiussi. Neuroevolution: from architectures to learning. ¨ Evolutionary Intelligence, 1(1):47–62, 2008.
David E Goldberg and Kalyanmoy Deb. A comparative analysis of selection schemes used in genetic algorithms. Foundations of genetic algorithms, 1:69–93, 1991.
Frdric Gruau, L’universite Claude Bernard lyon I, Of A Diplome De Doctorat, M. Jacques Demongeot, Examinators M. Michel Cosnard, M. Jacques Mazoyer, M. Pierre Peretto, and M. Darell Whitley. Neural network synthesis using cellular encoding and the genetic algorithm., 1994.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016a.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision, pp. 630–645. Springer, 2016b.
John Henry Holland. Adaptation in natural and artificial systems: an introductory analysis with applications to biology, control, and artificial intelligence. MIT press, 1975.
Gao Huang, Zhuang Liu, Kilian Q Weinberger, and Laurens van der Maaten. Densely connected convolutional networks. arXiv preprint arXiv:1608.06993, 2016.
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.
Hiroaki Kitano. Designing neural networks using genetic algorithms with graph generation system. Complex systems, 4(4):461–476, 1990.
Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Fractalnet: Ultra-deep neural networks without residuals. arXiv preprint arXiv:1605.07648, 2016.
Risto Miikkulainen, Jason Liang, Elliot Meyerson, Aditya Rawal, Dan Fink, Olivier Francon, Bala Raju, Arshak Navruzyan, Nigel Duffy, and Babak Hodjat. Evolving deep neural networks. arXiv preprint arXiv:1703.00548, 2017.
Geoffrey F Miller, Peter M Todd, and Shailesh U Hegde. Designing neural networks using genetic algorithms. In ICGA, volume 89, pp. 379–384, 1989.
Renato Negrinho and Geoff Gordon. Deeparchitect: Automatically designing and training deep architectures. arXiv preprint arXiv:1704.08792, 2017.
Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon Suematsu, Quoc Le, and Alex Kurakin. Large-scale evolution of image classifiers. arXiv preprint arXiv:1703.01041, 2017.
Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V Le. Regularized evolution for image classifier architecture search. arXiv preprint arXiv:1802.01548, 2018.
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael S. Bernstein, Alexander C. Berg, and Fei-Fei Li. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
Kenneth O Stanley. Compositional pattern producing networks: A novel abstraction of development. Genetic programming and evolvable machines, 8(2):131–162, 2007.
Kenneth O Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary computation, 10(2):99–127, 2002.
Kenneth O Stanley, David B D’Ambrosio, and Jason Gauci. A hypercube-based encoding for evolving large-scale neural networks. Artificial life, 15(2):185–212, 2009.
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.
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.
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.
Lingxi Xie and Alan Yuille. Genetic cnn. arXiv preprint arXiv:1703.01513, 2017.
Saining Xie, Ross Girshick, Piotr Dollr, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. arXiv preprint arXiv:1611.05431, 2016.
Xin Yao. Evolving artificial neural networks. Proceedings of the IEEE, 87(9):1423–1447, 1999.
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
Zhao Zhong, Junjie Yan, and Cheng-Lin Liu. Practical network blocks design with q-learning. arXiv preprint arXiv:1708.05552, 2017.
Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V Le. Learning transferable architectures for scalable image recognition. arXiv preprint arXiv:1707.07012, 2017.
# A ARCHITECTURE VISUALIZATION
Visualization of the learned cell and motifs of our best-performing hierarchical architecture. Note that only motifs 1,3,4,5 are used to construct the cell, among which motifs 3 and 5 are dominating.
 Figure 5: Cell
 Figure 6: Motif 1
 Figure 7: Motif 2
 Figure 8: Motif 3
 Figure 9: Motif 4
 Figure 10: Motif 5
 Figure 11: Motif 6123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327# RELATIONAL MULTI-INSTANCE LEARNING FOR CONCEPT ANNOTATION FROM MEDICAL TIME SERIES
Anonymous authors Paper under double-blind review
# ABSTRACT
Recent advances in computing technology and sensor design have made it easier to collect longitudinal or time series data from patients, resulting in a gigantic amount of available medical data. Most of the medical time series lack annotations or even when the annotations are available they could be subjective and prone to human errors. Earlier works have developed natural language processing techniques to extract concept annotations and/or clinical narratives from doctor notes. However, these approaches are slow and do not use the accompanying medical time series data. To address this issue, we introduce the problem of concept annotation for the medical time series data, i.e., the task of predicting and localizing medical concepts by using the time series data as input. We propose Relational Multi-Instance Learning (RMIL) - a deep Multi Instance Learning framework based on recurrent neural networks, which uses pooling functions and attention mechanisms for the concept annotation tasks. Empirical results on medical datasets show that our proposed models outperform various multi-instance learning models.
# 1 INTRODUCTION
Clinicians have limited time (e.g., only a few minutes (Howie et al., 1999)) to study and treat each patient. However, they are overloaded with a lot of patient data from multiple sources and in various formats, such as patient medical history and doctor’s notes in free-flowing text, vitals and monitoring data which are captured as time series, and prescriptions and drugs which appear as medical codes including ICD-9 (Organization & Corporation, 1998), LOINC codes (Forrey et al., 1996), etc. This rich information should be summarized and available to clinicians in easily digestible format for faster diagnosis and treatment. Graphical visualizations (Plaisant et al., 1998) are a popular approach to show patient data to doctors. However, recent studies have shown that graphical visualisations are not always helpful for clinicians’ decision-making (Law et al., 2005; Van Der Meulen et al., 2010). Text summaries on the other hand are widely embraced and are usually adopted in practice (Scott et al., 2013). Most existing systems use natural language processing techniques (Afantenos et al., 2005; Giordano et al., 2015) to generate summaries from doctor notes which include test results, discharge reports, observational notes, etc. While these systems are useful, they only use one source of data, i.e., doctor’s notes which might have noisy and erroneous entries, for text summarization. On the other hand, electronic health records have other sources of patient data such as vital signs, monitoring sensors, and lab results in the form of multivariate time-series, which can be more accurate and may contain rich information about patient’s conditions. Few existing patient summarization systems actually extract information directly from these time series for concept prediction and/or summarization. Generating simple text summaries such as trends from time series has been investigated before (Sripada et al., 2003) but is marginally useful since these trends are not mapped to the medical concepts which clinicians can quickly comprehend. Recent works (Pham et al., 2016; Choi et al., 2016a;b; Lipton et al., 2015; Che et al., 2016) have successfully shown that clinical events and outcomes can be predicted using medical codes or clinical time series data. However, directly obtaining medical concept annotations and summaries from the time series data is still an open question.
In this work, we introduce the concept annotation task as the problem of predicting and localizing the medical concepts by modeling the related medical time series data. Figure 1 illustrates a concept annotation example where medical time series data such as heart rate, $\mathrm { p H }$ and blood gas pressure are given, and the goal is to predict the time series of concepts such as intubation, extubation and resuscitate. To solve concept annotation problem, we formulate it as a Multi-Instance Learning (MIL) problem (Dietterich et al., 1997) and propose a deep learning based framework called Relational MultiInstance Learning (RMIL). RMIL uses Recurrent Neural Networks (RNNs) to model multivariate time series data, leverages instance relations via attention mechanisms, and provides concept predictions using pooling functions.
 Figure 1: Medical time series to concept annotations.
The main contributions of our work are the following. We present a unified view of the MIL approaches for time series data using RNN models with different pooling functions and attention mechanisms. We show that our RMIL model is capable of learning a good classifier for concept detection (bag label predictions) and concept localization tasks (instance label prediction), even though it is only trained using bag labels. We demonstrate that RMIL obtains promising results on real-world medical datasets and outperforms popular MIL approaches.
The rest of the paper is structured as follows. In the following section, we briefly discuss the related works. Afterwards, we describe MIL framework and describe how RNN can be combined with multi-instance learning framework to obtain our proposed RMIL. In Sections 4 and 5, we present experimental results and conclusions respectively. In the appendix, we demonstrate anomaly detection as another application of our RMIL framework.
# 2 RELATED WORK
Discovering concept annotations from the multivariate time series is a relatively new problem in medical domain with limited prior work. In this section, we will first highlight the related works on annotation tasks and then review related works on multi-instance learning.
Concept Annotation In medical domain, concept annotation is usually addressed in the clinical narrative mining and biomedical text mining literature (Aggarwal & Zhai, 2012; Cohen & Hersh, 2005; Zweigenbaum et al., 2007; Vincze et al., 2008). In other domains such as web-mining and computer vision, the concept annotation is usually analogous to semantic annotation (Kiryakov et al., 2004), image annotation (Jeon et al., 2003), object localization (Lampert et al., 2008) and image captioning (Karpathy et al., 2014).
Clinical Narratives Mining Automated discovery of temporal relations from clinical narratives (Savova et al., 2009; Zhou et al., 2006; Albright et al., 2013) and doctor notes (Plaisant et al., 1996) to uncover the patterns of disease progression is an important research problem in clinical informatics. Recent efforts such as SemEval competitions (Bethard et al., 2016) have been conducted to study this problem and evaluate/benchmark clinical information extraction systems $\mathrm { X u }$ et al., 2010). These competitions focus on discrete, well-defined tasks which allow for rapid, reliable and repeatable evaluations. However, they only consider identifying and extracting temporal relations from clinical notes and do not use the accompanying medical time series data.
Image Annotation and Captioning Successful object recognition systems have been developed in the past few decades for image annotation, object detection and localization in images and videos. ImageNet (Deng et al., 2009) and PASCAL challenges (Everingham et al., 2010) have greatly accelerated the research in this area. Image captioning and visual-to-text translation, which are more generalized image annotation tasks, have been recently studied in several works (Karpathy et al., 2014; Kojima et al., 2002; Mao et al., 2014; Yu et al., 2016) where the goal is to find a text caption for a given image. Deep learning models such as RNN and sequence-to-sequence models (Sutskever et al., 2014) have achieved excellent results for image annotation/captioning tasks.
Multi-Instance Learning Multi-Instance Learning (MIL), a well known researched topic in machine learning, was first introduced by Dietterich et al. (1997) as a form of weakly supervised learning for drug activity prediction. MIL frameworks have since been applied to many other domains including image and text annotations (Chen & Wang, 2004; Soleimani & Miller, 2017). Andrews et al. (2003) adapted Support Vector Machines (SVM) to the MIL framework and introduced miSVM and MISVM for optimizing instance-level and bag-level classifications respectively. Zhou & Zhang (2007) further extended MIL and proposed MIMLSVM for tackling multi-label problems. Zhou et al. (2009) introduced miGraph and MIGraph to model the structure in each bag. Zhang et al. (2011); Guan et al. (2016) also proposed MIL framework for structure data by leveraging the relational structures at the bag and instance levels. Generative model based MIL frameworks such as Multi-Instance Mixture Model (MIMM)(Foulds & Smyth, 2011), and Dirichlet Process Mixture of Guassians (DPMIL) (Kandemir & Hamprecht, 2014) have also been proposed for binary multi-instance classification. Guan et al. (2016) used an autoregressive hidden Markov model and proposed an MIL framework for activity recognition in time-series data. Garcez & Zaverucha (2012) used recurrent neural networks to combine instance-level preprocessing and bag-level classification in MIL setting. Comprehensive reviews of MIL approaches are provided in Amores (2013); Herrera et al. (2016); Soleimani & Miller (2017). Recently, deep learning models have been successfully applied for MIL framework (Zhu et al., 2017; Wu et al., 2015; Huang et al., 2013; Yan et al., 2016; Kotzias et al., 2014; Kraus et al., 2016) and these approaches are generally termed as deep multi-instance learning models. Most of these works use either convolutional neural networks or deep neural networks in their MIL framework for image annotation, labeling, segmentation or classification tasks. Despite the popularity of deep models for MIL, there are few works which have extended deep MIL models for multivariate time series data. The goal of this paper is to propose and study deep multi-instance learning models for multivariate time series data.
# 3 METHODS
In this section, we will first describe the Multi-instance learning framework, and then present our problem formulation and our proposed relational multi-instance learning models.
# 3.1 MULTI-INSTANCE LEARNING
Multi-instance learning (MIL) is a form of weakly supervised learning where the training data is arranged in sets called bags, and a label is provided for the entire bag. The data points inside a bag are referred to as instances. In the MIL framework, instance labels are not provided during training. The main goal of MIL is to learn a model based on the instances in the bag and the label of the bag - to make bag-level and instance-level predictions. In this work, we only focus on the classification task in MIL, leaving out other learning tasks such as regression. Generally, two broad assumptions can be used to model the relationship between instance label and bag label. In the standard MIL assumption (Dietterich et al., 1997), the bag label is negative if all the instances in the bag have a negative label, and the bag label is positive if at-least one of the instances in the bag has a positive label. Following the notations of Carbonneau et al. (2017), let $X$ denote a bag with $N$ feature vector instances i.e., $\bar { X } = \{ x _ { 1 } , . . . , x _ { N } \}$ . Let each instance $x _ { i }$ in feature space $\mathcal { X }$ be mapped to a class by some process $f : \mathcal { X } \{ 0 , 1 \}$ , where 0 and 1 correspond to negative and positive labels respectively. The bag classifier, also know as the aggregator function, $g ( X )$ is defined by:
$$g ( X ) = { \left\{ \begin{array} { l l } { 1 } & { \quad { \mathrm { i f } } \exists x \in X : f ( X ) = 1 ; } \\ { 0 } & { \quad { \mathrm { o t h e r w i s e } } } \end{array} \right. }$$
The standard assumption is quite restrictive for some problem settings, where the positive bags cannot be identified by a single instance. Thus, this assumption can be relaxed to a collective assumption
which says that several positive instances in a bag are necessary to assign a positive label to that bag. In this case, a bag classifier is given by:
$$g ( X ) = { \left\{ \begin{array} { l l } { 1 } & { \quad { \mathrm { i f } } \ \sum _ { x \in X } f ( X ) \geq \theta ; } \\ { 0 } & { \quad { \mathrm { o t h e r w i s e } } } \end{array} \right. }$$
where $\theta$ is a threshold which indicates the minimum number of instances with positive labels that should be present in a bag to assign a positive label to that bag Weidmann et al. (2003). As discussed in section 2, a plethora of works have adapted machine learning models to the MIL setting to optimize instance-level and/or bag-level predictions.
# 3.2 PROBLEM FORMULATION
We formulate the concept annotation task as the detection and localization of concepts given the medical time series data. Let each patient $i \in \{ 1 , . . , N \}$ be associated with a medical time series (also referred to as feature time series) denoted by $\pmb { X } _ { i } \in \mathbb { R } ^ { T \times D }$ , where $D$ denotes the number of features (such as heart rate, blood pressure) and $T$ denotes the length of time series observations (i.e., amount of time a patient is monitored). Let $\mathcal { C }$ denote the set of all the concepts associated with the $N$ patients, and $\bar { Y _ { i } } \in \left\{ 0 , 1 \right\} ^ { K }$ denote the concepts associated with $i ^ { t h }$ patient where $K = | \mathcal { C } |$ . Let $C _ { i } \in \{ 0 , 1 \} ^ { T \times K }$ denote the concept time series of $X _ { i }$ with $C _ { i } ^ { j k } = 1$ when concept $k$ is present at time-stamp $j$ . In multi-instance learning settings, we treat each time series $X _ { i }$ as one bag, and the observation at each time step $j$ i.e. $\boldsymbol { X } _ { i } ^ { j } \in \mathbb { R } ^ { D }$ as an instance in that bag. We are interested in the following tasks:
• Concept prediction task: for patient $i$ , given $X _ { i }$ , predict $\mathbf { Y } _ { i }$ . • Concept localization task: for patient $i$ , given $X _ { i }$ , predict $C _ { i }$ .
Notice that during training phase, only the input $X _ { i }$ and prediction label $\mathbf { Y } _ { i }$ are available. Though $C _ { i }$ is not known, we usually have some assumptions about the relationship of prediction and localization labels. In this work, $\begin{array} { r } { Y _ { i } ^ { k } = \mathcal { T } \left( \sum _ { 1 \leq j \leq T } C _ { i } ^ { j k } \geq \eta \right) } \end{array}$ , where $\mathcal { T }$ is an indicator function and $\eta$ is a constant which depends on the MIL assumption. For example, in our concept annotation tasks we make the standard assumption, i.e we assume $\eta = 1$ , i.e. the time series label (bag label) for a concept is positive if that concept is present at any one time-stamp (at-least one instance has positive label).
# 3.3 RELATIONAL MULTI-INSTANCE LEARNING FRAMEWORK
Inspired by the recent success of recurrent neural networks in sequence modeling Bahdanau et al. (2014); Sutskever et al. (2014) and classification tasks Krizhevsky et al. (2012); Simonyan & Zisserman (2014), we adapt these models to the MIL framework to model multivariate time series data for concept annotation tasks. We denote all the variables at every time step as an instance and the entire multivariate time series as a bag. Unlike the traditional MIL setting, where the instances within a bag are independent of each other, in our case, the instances have relationships (namely temporal dependencies) among them. To model these dependencies, we propose to combine RNN models such as Long-Short Term Memory Neural Networks (LSTM) and Sequence-to-Sequence models with MIL, and propose our Relational Multi-Instance Learning framework, abbreviated as RMIL. RMIL takes in multivariate time series as input and outputs concept annotations. In RMIL, the outputs of RNN model provide the instance label predictions (i.e. solution for concept localization task) and the aggregation of the instance labels using aggregators such as pooling layer provides the bag label predictions (i.e. solution for concept prediction task). We propose different pooling functions and attention mechanisms which can be easily incorporated into our RMIL to improve the concept annotations.
Pooling Layers for RMIL The bag-level prediction is obtained by using an aggregation gathering on all instance-level predictions. The aggregator function $g ( \cdot ) : \left[ 0 , 1 \right] ^ { T } \mapsto \left[ 0 , 1 \right]$ in RMIL can be modeled using the pooling layers. Without loss of generality we assume that RNN model computes a mapping from the feature time series to the concept time series for each of the concept $k \in \mathcal { C }$ . Let us denote the probability of an instance $j$ belonging to concept $k$ as $p _ { j k }$ . Then, the bag level probability for a concept $k$ is given by $P _ { k } = g ( p _ { 1 k } , p _ { 2 k } , . . . , p _ { T k } )$ . The role of aggregator function $g ( \cdot )$ is to combine the instance probabilities from each class specific feature map $\{ p _ { j k } \}$ into a single bag probability $P _ { k }$ . Several pooling mechanisms shown in Table 1 have been introduced in MIL and deep learning literature which can be used in our RMIL. In Table $1 , r , a , b _ { k }$ , and $r _ { k }$ are parameters which can be fixed or are learned during training, and $\sigma ( \cdot )$ denotes the sigmoid function.
Table 1: Pooling functions for RMIL.
<table><tr><td rowspan=1 colspan=1>Pooling Functions</td></tr><tr><td rowspan=1 colspan=1>Noisy-OR poolingPk = g({𝑝jκ})=1-II(1- Pjk)(Zhang et al., 2006)</td></tr><tr><td rowspan=1 colspan=1>Log-sum-exponention (LSE) Pk =g({𝑝jk}))=1log(↓∑jexp(rPjκ))(Ramon & De Raedt, 2000)</td></tr><tr><td rowspan=1 colspan=1>Generalized Mean (GM) Pk =g({𝑝jx})=(∑jjκ)1/r(Keeler et al., 1991)</td></tr><tr><td rowspan=1 colspan=1>Integrated segmentation Px=g({pjx})=(∑-x)Pjk)/(1+∑jr-)Pjkand recognition (ISR)(Keeler et al.,1991)</td></tr><tr><td rowspan=1 colspan=1>Noisy-AND pooling P=g{pj})=((∑/-b)-ab)(Kraus et al., 2016) σ(a(1-bk))-σ(-abk)</td></tr><tr><td rowspan=1 colspan=1>Max pooling Pk = g({pjk}) = maxj (Pjk)</td></tr><tr><td rowspan=1 colspan=1>Softmax pooling Pk =g({𝑝jk})=(∑jPjκ exp(rkpjκ))/(∑,exp(rkPjk))</td></tr></table>
Attention Mechanism for RMIL Instances within each bag have temporal relations between them. We can use attention mechanism to focus on some of the instances and their relations to improve their instance-level predictions. In order to make predictions at time $j$ , the hidden state $\boldsymbol { h } _ { j } \in \bar { \mathbb { R } } ^ { Q }$ of RNN can be used, where $Q$ is the hidden state dimension. However, relevant information may be captured by hidden states at other time steps as well. Thus, we may want to introduce an attention vector or matrix $( a )$ to leverage information of hidden states $\pmb { H } = \left( \hat { \pmb { h } } _ { 1 } , \cdot \cdot \cdot , \pmb { h } _ { T } \right) ^ { \top } \in \mathbb { R } ^ { T \times Q }$ from all time steps. Let us denote the output after attention as $\tilde { H } \in \mathbb { R } ^ { T \times Q }$ . The attention matrix can then be modeled using $\tilde { \cal H }$ in various ways as listed below.
Feature-based Attention One idea is to design the attention matrix based on the feature and its time-stamp. Let us define a feature-based attention matrix as $\pmb { A } = \left( \pmb { a } _ { 1 } , \cdot \cdot \cdot , \pmb { a } _ { T } \right) ^ { \top } \in \mathbb { R } ^ { T \times Q }$ . For each $j = 1 , \cdots , T$ , we have
$$\mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { }$$
and $\tilde { H } = A \odot H$ , where $\odot$ and $\oslash$ are element-wise multiplication and division, respectively and $\ b { W } = \left( \ b { w } _ { 1 } , \cdot \cdot \cdot , \ b { w } _ { T } \right) ^ { \top } \in \mathbb { R } ^ { T \times T }$ is the weight matrix which can be learned during training. We call this Attention- $F$ mechanism. We can simplify this attention by averaging the attentions for all hidden dimensions by taking $\begin{array} { r } { a _ { j q } 1 / Q \cdot \sum _ { 1 \leq q ^ { \prime } \leq Q } { a _ { j q ^ { \prime } } } } \end{array}$ . We will denote this as Attention- $F S$ mechanism.
Time-based Attention Attention model (Ma et al., 2017) can be designed to capture the relation between the current time step $j$ and previous time steps $j ^ { \prime } \le j$ , by solely relying on previous hidden states $h _ { j ^ { \prime } }$ . We can define a time-based attention matrix as $\check { A } \in \mathbb { R } ^ { T \times \check { T } }$ . For each $j$ and $j ^ { \prime }$ in $[ 1 , \cdots , T ]$ , we have
$$a _ { j , j ^ { \prime } } = \left\{ \begin{array} { l l } { \left( \exp \left( \boldsymbol { w ^ { \intercal } } h _ { j ^ { \prime } } \right) \right) / \left( \displaystyle \sum _ { 1 \leq j ^ { \prime \prime } \leq j } \exp \left( \boldsymbol { w ^ { \intercal } } h _ { j ^ { \prime \prime } } \right) \right) , } & { j ^ { \prime } \leq j ; } \\ { 0 , } & { \mathrm { o t h e r w i l } } \end{array} \right.$$
and ${ \tilde { H } } = A \cdot H$ , where ${ \pmb w } \in \mathbb { R } ^ { D }$ is the weight vector to learn. We use Attention- $T$ to represent Time-based attention mechanism.
Interaction-based Attention The time-based attention can be further improved by considering both the previous and current hidden states $h _ { j ^ { \prime } }$ and $h _ { j }$ (Ma et al., 2017). In this case, we have
$$\begin{array} { r } { \nu _ { j , j ^ { \prime } } = \left\{ \begin{array} { l l } { \left( \exp \left( v ^ { \top } \operatorname { t a n h } ( W _ { 1 } h _ { j } + W _ { 2 } h _ { j ^ { \prime } } ) \right) \right) / \left( \displaystyle \sum _ { 1 \leq j ^ { \prime \prime } \leq j } \exp \left( v ^ { \top } \operatorname { t a n h } ( W _ { 1 } h _ { j } + W _ { 2 } h _ { j ^ { \prime \prime } } ) \right) \right) , } & { j ^ { \prime } \leq j ; } \\ { 0 , \quad \quad \mathrm { o t h e r w i s e } } \end{array} \right. } \end{array}$$
and similarly ${ \tilde { H } } = A \cdot H$ . Here, we need to learn $\pmb { v } \in \mathbb { R } ^ { S } , \pmb { W _ { 1 } } \in \mathbb { R } ^ { S \times Q } , \pmb { W _ { 2 } } \in \mathbb { R } ^ { S \times Q }$ , and we choose $S = Q / 2$ . A simplified version of interaction-based attention can be obtained if we use vector ${ \pmb w } _ { 1 } \in \mathbb { R } ^ { Q } , { \pmb w } _ { 2 } \in \mathbb { R } ^ { Q }$ instead of matrices $W _ { 1 } , W _ { 2 }$ and by setting ${ \pmb v } = { \bf 1 }$ in the above equation. We use Attention- ${ \bf \nabla } \cdot { \cal I }$ and Attention- $. I S$ to represent Interaction-based attention mechanism and simplified version of interaction-based attention mechanism respectively.
The above attention mechanisms usually help both prediction and localization tasks.
# 4 EXPERIMENTS
Here, we demonstrate the performance of our proposed RMIL models on concept annotation tasks i.e. concept prediction and localization tasks, using a real-world health-care dataset and compare its performance to the popular multi-instance learning approaches. In addition, we discuss the impact of using pooling functions and attention mechanism in our RMIL framework.
# 4.1 DATASET DESCRIPTIONS AND EXPERIMENTAL DESIGN
To evaluate our RMIL, we ran experiments on MIMIC-III RESP datasets whose statistics is shown in Table 2.
MIMIC-III RESP Dataset MIMIC-III is a public dataset (Johnson et al., 2016) which has 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 work, we extracted 21 feature time series from more than 2,000 adult patients who were diagnosed with a respiratory disorder such as Acute Hypoxemic Respiratory Failure (AHRF) (Khemani et al., 2009) at the time of admission. These 21 features are respiratory based features such as peak inspiratory pressure (PIP) and arterial partial pressure of oxygen (PaO2) and were collected during the first 3 days after admission. The feature time series has 4 time stamps and the first time stamp corresponds to the admission time. We denote this dataset as MIMIC-III RESP dataset. In addition, we also generated another feature time series with more time stamps whose results is shown in the appendix.
Table 2: MIMIC-III RESP dataset.
<table><tr><td>MIMIC-IIIRESP</td></tr><tr><td># of samples (N)</td><td>2014</td></tr><tr><td># of variables (D)</td><td>21</td></tr><tr><td># of time steps</td><td>4</td></tr><tr><td># of concepts</td><td>26</td></tr></table>
Concept Annotations The medical time series data of MIMIC-III dataset does not come with the concept annotations, however the medical concepts are available in the doctor notes of the MIMIC-III database. To obtain the concept annotations, we extract the concept time series from the doctor notes using the NOTEEVENTS table of MIMIC-III database. The total number of doctor notes is 2,083,180, out of which $9 8 . 1 5 \%$ of notes (2,044,634 notes) have no timestamp and $1 . 8 5 \%$ of notes (38,546 notes) have timestamps associated with them. The total number of unique concepts in the doctor notes in the first 3 days data is 6,197. To obtain concept time series for each patient with respiratory disorder such as AHRF, we first identified respiratory-related concepts from the medical literature (Antonelli et al., 2001; Khemani et al., 2009), and obtained their medical codes from the Unified Medical Language System (UMLS) dictionary (Bodenreider, 2004). Then, we mined the patient’s doctor notes from NOTEEVENTS table to extract all the possible medical concepts related to the respiratory system and its disorder. In total, we chose top 26 respiratory concepts to generate concept time series which has the same number of time stamps as feature time series.
Table 3: Concept annotation results on MIMIC-III RESP dataset. Max-pooling function was used in all RMIL models.
<table><tr><td rowspan="2" colspan="2"></td><td colspan="2">Prediction</td><td colspan="2">Localization</td></tr><tr><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td></tr><tr><td rowspan="6">RMIL Models</td><td>S2S</td><td>0.858</td><td>0.756</td><td>0.788</td><td>0.431</td></tr><tr><td>S2S with Attention I</td><td>0.858</td><td>0.758</td><td>0.793</td><td>0.433</td></tr><tr><td>LSTM</td><td>0.860</td><td>0.763</td><td>0.795</td><td>0.444</td></tr><tr><td>LSTM with Attention I</td><td>0.862</td><td>0.766</td><td>0.797</td><td>0.444</td></tr><tr><td>Bi-LSTM</td><td>0.864</td><td>0.769</td><td>0.789</td><td>0.415</td></tr><tr><td>Bi-LSTM with Attention I</td><td>0.864</td><td>0.769</td><td>0.796</td><td>0.420</td></tr><tr><td rowspan="4">MIL Models</td><td>CNN</td><td>0.857</td><td>0.756</td><td>0.785</td><td>0.397</td></tr><tr><td>CNN with Attention I</td><td>0.855</td><td>0.755</td><td>0.785</td><td>0.409</td></tr><tr><td>DPMIL</td><td>0.531</td><td>0.222</td><td>0.516</td><td>0.148</td></tr><tr><td>MISVM</td><td>0.751</td><td>0.613</td><td>0.706</td><td>0.333</td></tr></table>
# 4.2 COMPARISON AND IMPLEMENTATION DETAILS
We compare the performance of our proposed models to the popular MIL models such as MISVM (Andrews et al., 2003), DPMIL (Kandemir & Hamprecht, 2014) and Convolutional Neural Networks (CNN) Kraus et al. (2016), and CNN with attention. We categorize all the evaluated methods into two groups:
1. Multi-Instance Learning models (MIL): We treat MISVM, DPMIL, Convolutional Neural Networks (CNN), and CNN with Attention I as our baseline MIL models. 2. Relational Multi-Instance Learning models (RMIL): We evaluate the following deep learning models as part of our RMIL framework: (a) Long Short-Term Memory neural networks (LSTM) (Hochreiter & Schmidhuber, 1997) (b) Bi-directional LSTM (Bi-LSTM) (Graves et al., 2013) (c) Sequence to Sequence models (S2S) (Sutskever et al., 2014) (d) The above three RMIL models with different attention mechanisms (e) The above RMIL models with different pooling functions
For LSTM models, we use two LSTM layers and two dense layers. For S2S models, we use two LSTM layers for both the encoder and the decoder. For Bi-LSTM models, we use two bi-directional LSTM layers. All the models were constructed to have a comparable number of parameters. We train all the Deep learning models with the RMSProp optimization method and we use early stopping to find the best weights on the validation dataset. For baseline MIL models, we follow the suggestions of the corresponding papers to fine-tune the parameters. All the input variables in the training data are normalized to be 0 mean and 1 standard deviation. The inputs to all the models is the same feature time series data. We used Keras (Chollet, 2017) and Python to run the deep models and MISVM models. Matlab code from the original authors was used to obtain DPMIL results. We use the area under ROC (AUROC) and area under precision-recall curve (AUPRC) scores as our evaluation metrics and report the results from 5-fold cross validation for all the evaluated methods.
# 4.3 QUANTITATIVE RESULTS
Table 3 shows the concept annotation results on the MIMIC-III RESP dataset. From this table, we see that RMIL models outperform the non-deep multi-instance learning models by at least $8 \%$ for concept localization task, and by at least $10 \mathrm { - } 1 5 \%$ for concept prediction tasks in terms of AUROC and AUPRC. RMIL performs slightly better than CNN-based models on all the metrics. Among all the RMIL models, we find that LSTM model obtains slightly better overall results compared to the other models for localization task.
To study the impact of pooling and attention, we trained and evaluated LSTM models with different pooling functions and different attention mechanisms, which are described in Section 3. Tables 4 and 5 show the comparison results. From these tables, we observed that (i) all the attention mechanisms except feature-based attention perform similar to each other especially for the prediction task, and (ii) all the pooling functions other than ISR and Noisy-OR obtain similar overall performance. This
Table 4: Results on RMIL LSTM models with different pooling functions and with Attention-I mechanism.
<table><tr><td rowspan="2"></td><td colspan="2">Prediction</td><td colspan="2">Localization</td></tr><tr><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td></tr><tr><td>LSTM with ISR Pooling</td><td>0.862</td><td>0.765</td><td>0.733</td><td>0.375</td></tr><tr><td>LSTM with Noisy-AND Pooling</td><td>0.863</td><td>0.767</td><td>0.779</td><td>0.431</td></tr><tr><td>LSTM with Generalized Mean Pooling</td><td>0.863</td><td>0.767</td><td>0.796</td><td>0.450</td></tr><tr><td>LSTM with LSE Pooling</td><td>0.863</td><td>0.767</td><td>0.792</td><td>0.452</td></tr><tr><td>LSTM with Softmax Pooling</td><td>0.863</td><td>0.767</td><td>0.790</td><td>0.450</td></tr><tr><td>LSTM with Noisy-OR Pooling</td><td>0.860</td><td>0.762</td><td>0.703</td><td>0.318</td></tr><tr><td>LSTM with Max Pooling</td><td>0.862</td><td>0.766</td><td>0.797</td><td>0.444</td></tr></table>

(a) Ground truth annotations of intubation and extubation concepts.
 (b) Intubation and extubation concept prediction probabilities identified by attention-based LSTM. Figure 2: Ground truth and predicted concept annotation comparison. In 2(a) white block corresponds to absence of a concept and black block corresponds to presence of a concept. In 2(b), darker gray value indicates higher chance for presence of a concept. X-axis represents time steps, Y-axis corresponds to different patients.
demonstrates that choice of attention does not matter but choice of pooling has some impact in our RMIL framework.
Table 5: Results on RMIL LSTM models with different attention mechanisms and with max pooling.
<table><tr><td rowspan="2">Model</td><td colspan="2">Prediction</td><td colspan="2">Localization</td></tr><tr><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td></tr><tr><td>LSTM with Attention-T</td><td>0.864</td><td>0.768</td><td>0.796</td><td>0.445</td></tr><tr><td>LSTMwith Attention-IS</td><td>0.862</td><td>0.767</td><td>0.798</td><td>0.446</td></tr><tr><td>LSTM with Attention-I</td><td>0.862</td><td>0.766</td><td>0.797</td><td>0.444</td></tr><tr><td>LSTMwith Attention-FS</td><td>0.861</td><td>0.765</td><td>0.796</td><td>0.417</td></tr><tr><td>LSTM with Attention-F</td><td>0.861</td><td>0.764</td><td>0.780</td><td>0.408</td></tr><tr><td>LSTM with no attention</td><td>0.860</td><td>0.763</td><td>0.795</td><td>0.444</td></tr></table>
# 4.4 DISCUSSIONS
We can study the interpretability of concept localization by looking at the localization results of our RMIL models, even though the model is trained without the labels for localization. Figure 2 shows the ground truth annotations of two respiratory concepts - intubation and extubation concepts, and the prediction probabilities of these concepts obtained by our RMIL attention-based LSTM models. From figure 2(a) we can make the following observations, (i) intubation usually happens before extubation for the same patient, (ii) intubation and extubation could happen on the same day, and (iii) intubation and extubation occur commonly within the first 24 hours of admission. From the figure 2(b), we see that our RMIL attention based LSTM predicts that the probability of intubation happening on the first day of admission is higher (draker gray means higher probability of concept occurrence) and the probability of extubation happening within first day is lower. This indicates that the model has correctly learnt that intubation should appear before extubation. This also implicitly implies that the RMIL attention-based LSTM models have correctly learnt the instance-level relationships from the medical time series data with only bag-level labels.
# 5 SUMMARY
In this paper, we presented Relational Multi-Instance Learning - a deep multi-instance learning framework using recurrent neural networks for concept annotation from the medical time series data. Empirical results on medical dataset demonstrated that our proposed models outperform the popular state-of-the-art multi-instance learning approaches. Experiments with different pooling and attention mechanisms showed that while attention mechanism does not have a significant impact on model’s performance, certain pooling functions such as ISR and Noisy-OR can negatively impact the instance prediction results.
# REFERENCES
Stergos Afantenos, Vangelis Karkaletsis, and Panagiotis Stamatopoulos. Summarization from medical documents: a survey. Artificial intelligence in medicine, 33(2):157–177, 2005. Charu C Aggarwal and ChengXiang Zhai. Mining text data. Springer Science & Business Media, 2012. Daniel Albright, Arrick Lanfranchi, Anwen Fredriksen, William F Styler IV, Colin Warner, Jena D Hwang, Jinho D Choi, Dmitriy Dligach, Rodney D Nielsen, James Martin, et al. Towards comprehensive syntactic and semantic annotations of the clinical narrative. Journal of the American Medical Informatics Association, 20(5):922–930, 2013. Jaume Amores. Multiple instance classification: Review, taxonomy and comparative study. Artificial Intelligence, 201:81–105, 2013. Stuart Andrews, Ioannis Tsochantaridis, and Thomas Hofmann. Support vector machines for multipleinstance learning. In Advances in neural information processing systems, pp. 577–584, 2003. M Antonelli, G Conti, ML Moro, A Esquinas, G Gonzalez-Diaz, M Confalonieri, P Pelaia, T Principi, C Gregoretti, F Beltrame, et al. Predictors of failure of noninvasive positive pressure ventilation in patients with acute hypoxemic respiratory failure: a multi-center study. Intensive care medicine, 2001. Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014. Steven Bethard, Guergana Savova, Wei-Te Chen, Leon Derczynski, James Pustejovsky, and Marc Verhagen. Semeval-2016 task 12: Clinical tempeval. Proceedings of SemEval, pp. 1052–1062, 2016. Olivier Bodenreider. The unified medical language system (umls): integrating biomedical terminology. Nucleic acids research, 32(suppl_1):D267–D270, 2004. Alessandro Camerra, Themis Palpanas, Jin Shieh, and Eamonn Keogh. isax 2.0: Indexing and mining one billion time series. In Data Mining (ICDM), 2010 IEEE 10th International Conference on, pp. 58–67. IEEE, 2010. Ricardo JGB Campello, Davoud Moulavi, Arthur Zimek, and Jörg Sander. Hierarchical density estimates for data clustering, visualization, and outlier detection. ACM Transactions on Knowledge Discovery from Data (TKDD), 10(1):5, 2015. Marc-Andre Carbonneau, Veronika Cheplygina, Eric Granger, and Ghyslain Gagnon. Multiple instance learning: A survey of problem characteristics and applications. Pattern Recognition, 2017. Philip K Chan and Matthew V Mahoney. Modeling multiple time series for anomaly detection. In Data Mining, Fifth IEEE International Conference on, pp. 8–pp. IEEE, 2005. Varun Chandola, Arindam Banerjee, and Vipin Kumar. Anomaly detection: A survey. ACM computing surveys (CSUR), 41(3):15, 2009. Varun Chandola, Arindam Banerjee, and Vipin Kumar. Anomaly detection for discrete sequences: A survey. IEEE Transactions on Knowledge and Data Engineering, 24(5):823–839, 2012. Zhengping Che, Sanjay Purushotham, Kyunghyun Cho, David Sontag, and Yan Liu. Recurrent neural networks for multivariate time series with missing values. arXiv preprint arXiv:1606.01865, 2016. Yixin Chen and James Z Wang. Image categorization by learning and reasoning with regions. Journal of Machine Learning Research, 5(Aug):913–939, 2004. Edward Choi, Mohammad Taha Bahadori, Elizabeth Searles, Catherine Coffey, Michael Thompson, James Bost, Javier Tejedor-Sojo, and Jimeng Sun. Multi-layer representation learning for medical concepts. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1495–1504. ACM, 2016a. Youngduck Choi, Chill Yi-I Chiu, and David Sontag. Learning low-dimensional representations of medical concepts. AMIA Summits on Translational Science Proceedings, 2016:41, 2016b. François Chollet. Keras (2015). URL http://keras. io, 2017. Aaron M Cohen and William R Hersh. A survey of current work in biomedical text mining. Briefings in bioinformatics, 6(1):57–71, 2005. 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. Thomas G Dietterich, Richard H Lathrop, and Tomás Lozano-Pérez. Solving the multiple instance problem with axis-parallel rectangles. Artificial intelligence, 89(1):31–71, 1997. Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. International journal of computer vision, 88(2): 303–338, 2010. Arden W Forrey, Clement J Mcdonald, Georges DeMoor, Stanley M Huff, Dennis Leavelle, Diane Leland, Tom Fiers, Linda Charles, Brian Griffin, Frank Stalling, et al. Logical observation identifier names and codes (loinc) database: a public use set of codes and names for electronic reporting of clinical laboratory test results. Clinical Chemistry, 42(1):81–90, 1996. James Foulds and Padhraic Smyth. Multi-instance mixture models and semi-supervised learning. In Proceedings of the 2011 SIAM International Conference on Data Mining, pp. 606–617. SIAM, 2011. AS d’Avila Garcez and Gerson Zaverucha. Multi-instance learning using recurrent neural networks. In Neural Networks (IJCNN), The 2012 International Joint Conference on, pp. 1–6. IEEE, 2012. Daniela Giordano, Isaak Kavasidis, and Concetto Spampinato. Automatic summary creation by applying natural language processing on unstructured medical records. In International Conference on Computer Analysis of Images and Patterns, pp. 383–393. Springer, 2015. Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In Acoustics, speech and signal processing (icassp), 2013 ieee international conference on, pp. 6645–6649. IEEE, 2013. Xinze Guan, Raviv Raich, and Weng-Keen Wong. Efficient multi-instance learning for activity recognition from time series data using an auto-regressive hidden markov model. In International Conference on Machine Learning, pp. 2330–2339, 2016. Fabio Guigou, Pierre Collet, and Pierre Parrend. The artificial immune ecosystem: a bio-inspired metaalgorithm for boosting time series anomaly detection with expert input. In European Conference on the Applications of Evolutionary Computation, pp. 573–588. Springer, 2017. Manish Gupta, Jing Gao, Charu C Aggarwal, and Jiawei Han. Outlier detection for temporal data: A survey. IEEE Transactions on Knowledge and Data Engineering, 26(9):2250–2267, 2014. Francisco Herrera, Sebastián Ventura, Rafael Bello, Chris Cornelis, Amelia Zafra, Dánel SánchezTarragó, and Sarah Vluymans. Introduction. In Multiple Instance Learning, pp. 1–16. Springer, 2016. Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997. Victoria Hodge and Jim Austin. A survey of outlier detection methodologies. Artificial intelligence review, 22(2):85–126, 2004. John GR Howie, David J Heaney, Margaret Maxwell, Jeremy J Walker, George K Freeman, and Harbinder Rai. Quality at general practice consultations: cross sectional survey. Bmj, 319(7212): 738–743, 1999. Yan Huang, Wei Wang, Liang Wang, and Tieniu Tan. Multi-task deep neural network for multi-label learning. In Image Processing (ICIP), 2013 20th IEEE International Conference on, pp. 2897–2900. IEEE, 2013. Jiwoon Jeon, Victor Lavrenko, and Raghavan Manmatha. Automatic image annotation and retrieval using cross-media relevance models. In Proceedings of the 26th annual international ACM SIGIR conference on Research and development in informaion retrieval, pp. 119–126. ACM, 2003. 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. Michael Jones, Daniel Nikovski, Makoto Imamura, and Takahisa Hirata. Exemplar learning for extremely efficient anomaly detection in real-valued time series. Data Mining and Knowledge Discovery, 30(6):1427–1454, 2016. Melih Kandemir and Fred A Hamprecht. Instance label prediction by dirichlet process multiple instance learning. In UAI, pp. 380–389, 2014. Andrej Karpathy, George Toderici, Sanketh Shetty, Thomas Leung, Rahul Sukthankar, and Li Fei-Fei. Large-scale video classification with convolutional neural networks. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 1725–1732, 2014. James D Keeler, David E Rumelhart, and Wee Kheng Leow. Integrated segmentation and recognition of hand-printed numerals. In Advances in neural information processing systems, pp. 557–563, 1991. Robinder G Khemani, David Conti, Todd A Alonzo, Robert D Bart, and Christopher JL Newth. Effect of tidal volume in children with acute hypoxemic respiratory failure. Intensive care medicine, 35 (8):1428–1437, 2009. Atanas Kiryakov, Borislav Popov, Ivan Terziev, Dimitar Manov, and Damyan Ognyanoff. Semantic annotation, indexing, and retrieval. Web Semantics: Science, Services and Agents on the World Wide Web, 2(1):49–79, 2004. Atsuhiro Kojima, Takeshi Tamura, and Kunio Fukunaga. Natural language description of human activities from video images based on concept hierarchy of actions. International Journal of Computer Vision, 50(2):171–184, 2002. Dimitrios Kotzias, Misha Denil, Phil Blunsom, and Nando de Freitas. Deep multi-instance transfer learning. arXiv preprint arXiv:1411.3128, 2014. Oren Z Kraus, Jimmy Lei Ba, and Brendan J Frey. Classifying and segmenting microscopy images with deep multiple instance learning. Bioinformatics, 32(12):i52–i59, 2016. 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. Stephen C Kurachek, Christopher J Newth, Michael W Quasney, Tom Rice, Ramesh C Sachdeva, Neal R Patel, Jeanne Takano, Larry Easterling, Mathew Scanlon, Ndidiamaka Musa, et al. Extubation failure in pediatric intensive care: a multiple-center study of risk factors and outcomes. Critical care medicine, 31(11):2657–2664, 2003. Christoph H Lampert, Matthew B Blaschko, and Thomas Hofmann. Beyond sliding windows: Object localization by efficient subwindow search. In Computer Vision and Pattern Recognition, 2008. CVPR 2008. IEEE Conference on, pp. 1–8. IEEE, 2008. Anna S Law, Yvonne Freer, Jim Hunter, Robert H Logie, Neil McIntosh, and John Quinn. A comparison of graphical and textual presentations of time series data to support medical decision making in the neonatal intensive care unit. Journal of clinical monitoring and computing, 19(3): 183–194, 2005. Jessica Lin, Eamonn Keogh, Stefano Lonardi, and Bill Chiu. A symbolic representation of time series, with implications for streaming algorithms. In Proceedings of the 8th ACM SIGMOD workshop on Research issues in data mining and knowledge discovery, pp. 2–11. ACM, 2003. Zachary C Lipton, David C Kale, Charles Elkan, and Randall Wetzell. Learning to diagnose with lstm recurrent neural networks. arXiv preprint arXiv:1511.03677, 2015. Fenglong Ma, Radha Chitta, Jing Zhou, Quanzeng You, Tong Sun, and Jing Gao. Dipole: Diagnosis prediction in healthcare via attention-based bidirectional recurrent neural networks. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1903–1911. ACM, 2017. Junhua Mao, Wei Xu, Yi Yang, Jiang Wang, Zhiheng Huang, and Alan Yuille. Deep captioning with multimodal recurrent neural networks (m-rnn). arXiv preprint arXiv:1412.6632, 2014.
World Health Organization and Practice Management Information Corporation. ICD-9-CM: International Classification of Diseases, 9th Revision: Clinical Modification, volume 1. PMIC (Practice Management Information Corporation), 1998.
Trang Pham, Truyen Tran, Dinh Phung, and Svetha Venkatesh. Deepcare: A deep dynamic memory model for predictive medicine. In Advances in Knowledge Discovery and Data Mining, pp. 30–41. Springer, 2016.
Catherine Plaisant, Brett Milash, Anne Rose, Seth Widoff, and Ben Shneiderman. Lifelines: visualizing personal histories. In Proceedings of the SIGCHI conference on Human factors in computing systems, pp. 221–227. ACM, 1996.
Catherine Plaisant, Rich Mushlin, Aaron Snyder, Jia Li, Daniel Heller, and Ben Shneiderman. Lifelines: using visualization to enhance navigation and analysis of patient records. In Proceedings of the AMIA Symposium, pp. 76. American Medical Informatics Association, 1998.
Jan Ramon and Luc De Raedt. Multi instance neural networks. In Proceedings of the ICML-2000 workshop on attribute-value and relational learning, pp. 53–60, 2000.
Adrienne G Randolph, David Wypij, Shekhar T Venkataraman, James H Hanson, Rainer G Gedeit, Kathleen L Meert, Peter M Luckett, Peter Forbes, Michelle Lilley, John Thompson, et al. Effect of mechanical ventilator weaning protocols on respiratory outcomes in infants and children: a randomized controlled trial. Jama, 288(20):2561–2568, 2002.
Guergana Savova, Steven Bethard, Will Styler, James Martin, Martha Palmer, James Masanz, and Wayne Ward. Towards temporal relation discovery from the clinical narrative. In AMIA annual symposium proceedings, volume 2009, pp. 568. American Medical Informatics Association, 2009.
Donia Scott, Catalina Hallett, and Rachel Fettiplace. Data-to-text summarisation of patient records: Using computer-generated summaries to access patient histories. Patient education and counseling, 92(2):153–159, 2013.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
Hossein Soleimani and David J Miller. Semisupervised, multilabel, multi-instance learning for structured data. Neural computation, 2017.
Somayajulu G Sripada, Ehud Reiter, Jim Hunter, and Jin Yu. Generating english summaries of time series data using the gricean maxims. In Proceedings of the ninth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 187–196. ACM, 2003.
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.
Marian Van Der Meulen, Robert H Logie, Yvonne Freer, Cindy Sykes, Neil McIntosh, and Jim Hunter. When a graph is poorer than 100 words: A comparison of computerised natural language generation, human generated descriptions and graphical displays in neonatal intensive care. Applied Cognitive Psychology, 24(1):77–89, 2010.
Veronika Vincze, György Szarvas, Richárd Farkas, György Móra, and János Csirik. The bioscope corpus: biomedical texts annotated for uncertainty, negation and their scopes. BMC bioinformatics, 9(11):S9, 2008.
Xing Wang, Jessica Lin, Nital Patel, and Martin Braun. A self-learning and online algorithm for time series anomaly detection, with application in cpu manufacturing. In Proceedings of the 25th ACM International on Conference on Information and Knowledge Management, pp. 1823–1832. ACM, 2016.
Nils Weidmann, Eibe Frank, and Bernhard Pfahringer. A two-level learning method for generalized multi-instance problems. In European Conference on Machine Learning, pp. 468–479. Springer, 2003.
Brigham C Willis, Alan S Graham, Eunice Yoon, Randall C Wetzel, and Christopher JL Newth. Pressure-rate products and phase angles in children on minimal support ventilation and after extubation. Intensive care medicine, 31(12):1700–1705, 2005.
Jiajun Wu, Yinan Yu, Chang Huang, and Kai Yu. Deep multiple instance learning for image classification and auto-annotation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3460–3469, 2015.
Hua Xu, Shane P Stenner, Son Doan, Kevin B Johnson, Lemuel R Waitman, and Joshua C Denny. Medex: a medication information extraction system for clinical narratives. Journal of the American Medical Informatics Association, 17(1):19–24, 2010. Zhennan Yan, Yiqiang Zhan, Zhigang Peng, Shu Liao, Yoshihisa Shinagawa, Shaoting Zhang, Dimitris N Metaxas, and Xiang Sean Zhou. Multi-instance deep learning: Discover discriminative local anatomies for bodypart recognition. IEEE transactions on medical imaging, 35(5):1332–1343, 2016. Haonan Yu, Jiang Wang, Zhiheng Huang, Yi Yang, and Wei Xu. Video paragraph captioning using hierarchical recurrent neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4584–4593, 2016. Cha Zhang, John C Platt, and Paul A Viola. Multiple instance boosting for object detection. In Advances in neural information processing systems, pp. 1417–1424, 2006. Dan Zhang, Yan Liu, Luo Si, Jian Zhang, and Richard D Lawrence. Multiple instance learning on structured data. In Advances in Neural Information Processing Systems, pp. 145–153, 2011. Li Zhou, Genevieve B Melton, Simon Parsons, and George Hripcsak. A temporal constraint structure for extracting temporal information from clinical narrative. Journal of biomedical informatics, 39 (4):424–439, 2006. Zhi-Hua Zhou and Min-Ling Zhang. Multi-instance multi-label learning with application to scene classification. In Advances in neural information processing systems, pp. 1609–1616, 2007. Zhi-Hua Zhou, Yu-Yin Sun, and Yu-Feng Li. Multi-instance learning by treating instances as non-iid samples. In Proceedings of the 26th annual international conference on machine learning, pp. 1249–1256. ACM, 2009. Wentao Zhu, Qi Lou, Yeeleng Scott Vang, and Xiaohui Xie. Deep multi-instance networks with sparse label assignment for whole mammogram classification. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 603–611. Springer, 2017. Pierre Zweigenbaum, Dina Demner-Fushman, Hong Yu, and Kevin B Cohen. Frontiers of biomedical text mining: current progress. Briefings in bioinformatics, 8(5):358–375, 2007.
# 6 APPENDIX
# 6.1 MIMIC-III CONCEPT LIST
Table 6 show the concept list of the MIMIC-III RESP dataset used in our experiments.
6.2 ANOMALY DETECTION FOR TIME SERIES
Here, we will demonstrate anomaly detection from medical time series data as a use case application of our RMIL framework.
# 6.2.1 MOTIVATION AND RELATED WORK
Each year, more than 1,000,000 US adults and children are put on mechanical ventilation during their stays in ICU. However, lack of effective tools to aid with ventilator weaning and extubation (removal of the breathing tube) readiness assessment results in nearly half of the patients spending unnecessary days on ventilators (Randolph et al., 2002), and up to $20 \%$ of them having ventilators discontinued too soon (Kurachek et al., 2003). Spending unnecessary days on ventilators can lead to hospital-acquired infections while having ventilators discontinued too soon could require painful reintubation. A work-of-breathing measure called Pressure-Rate Product (PRP), calculated from esophageal pressure, has shown potential to be used as a guideline for ventilator weaning and extubation readiness assessment (Willis et al., 2005). However, PRP calculations are susceptible to sensor artifacts and breathing pattern anomalies. These anomalies limit realtime use of PRP for clinical decision making. Our goal is to automatically detect and remove these anomalies by using our proposed Relational Multi-instance learning models, thereby enabling real-time clinical decision making. Figure 3 shows the example of anomaly detection from the ventilator time series data. Here, anomalies appear due to patient factors (cough, movement) and instrument factors (probing, catherter drift), and should be automatically detected from the ventalitor monitoring time series data.
Table 6: MIMIC-III respiratory concept list.
<table><tr><td>Concept Number</td><td>Concept Name</td></tr><tr><td>1</td><td>Respiratory rate</td></tr><tr><td>2</td><td>Biomedical tube device</td></tr><tr><td>3</td><td>Analysis of arterial blood gases and ph</td></tr><tr><td>4</td><td>Ventilation,function (observable entity)</td></tr><tr><td>5</td><td>Medical history</td></tr><tr><td>6</td><td>Injury wounds</td></tr><tr><td>7</td><td>Body weights</td></tr><tr><td>8</td><td>Tidal volume</td></tr><tr><td>9</td><td>Inspired fraction of oxygen</td></tr><tr><td>10</td><td>Intubation</td></tr><tr><td>11</td><td>Positive end-expiratory pressure</td></tr><tr><td>12</td><td>Artificial airways</td></tr><tr><td>13</td><td>Bicarbonates</td></tr><tr><td>14</td><td>Tracheal extubation</td></tr><tr><td>15</td><td>Chest radiograph</td></tr><tr><td>16</td><td>Mean blood pressure</td></tr><tr><td>17</td><td>Oxygen measurement, partial pressure,arterial</td></tr><tr><td>18</td><td>Cardiac arrest</td></tr><tr><td>19</td><td>Peak inspiratory pressure</td></tr><tr><td>20</td><td>Biomechanical compliance</td></tr><tr><td>21</td><td>Tachycardia ventricular</td></tr><tr><td>22</td><td>Scoliosis</td></tr><tr><td>23</td><td>Acute lung injury</td></tr><tr><td>24</td><td>Partial pressure of carbon dioxide in arterial blood</td></tr><tr><td>25</td><td>Resuscitate</td></tr><tr><td>26</td><td>Sudden onset</td></tr></table>
# Ventilator Time Series
 Figure 3: Anomaly detection from ventilator time series data.
There is a long history and a rich body of research work on anomaly detection in time series data. See Hodge & Austin (2004); Chandola et al. (2009) for a quick survey on generic anomaly detection algorithms. Gupta et al. (2014) also author a survey on anomaly detection for time series data. In their follow-up survey, Chandola et al. (2012) gave a summary on discrete sequence anomaly detection algorithms. Unfortunately, techniques for time series anomaly detection are quite domain-specific. This is due to highly-varied nature of time series characteristics. In Chan & Mahoney (2005), a set of $k$ minimum bounding rectangles between each time step is used as a model of normal data generating distribution. In Camerra et al. (2010); Lin et al. (2003), continuous time series are converted to ordinal symbolic representation, allowing faster approximation of Euclidean distance between time series windows and early pruning. Then, anomaly detection can be performed by setting a threshold on distance value. Recently, Wang et al. (2016) proposes a self-learning method that learns clusters of constrained grammars based on ordinal symbolic approximation of time series value. Guigou et al. (2017) proposes incorporating experts into anomaly detection in a method inspired by immune system. In Jones et al. (2016), the authors propose extracting exemplars from Euclidean pairwise distance as a way to speed up anomaly detection algorithm. Most of these techniques for time series anomaly detection are quite domain-specific, and few of them model the anomaly detection problem in Multi-instance learning setting.
# 6.2.2 PROBLEM FORMULATION
We formulate the anomaly detection as concept annotation problem in MIL setting, where the bag corresponds to the medical time series data $X _ { i }$ and an instance is the features at a time-stamp, and the anomaly corresponds to a concept. Thus, the prediction (predicting $Y _ { i }$ ) and localizaton tasks (predicting $C _ { i }$ ) correspond to predicting the presence and location of the anomalies in the time series data. For anomaly detection, we assume $\begin{array} { r } { Y _ { i } ^ { k } = \mathcal { T } \left( \sum _ { 1 \leq j \leq T } C _ { i } ^ { j k } \geq \eta \right) } \end{array}$ , where $\eta$ is chosen as $\eta = 0 . 6 T$ and $T$ is the number of time series windows within the bag.
# 6.2.3 EXPERIMENTS
We conduct anomaly detection experiments on a PICU dataset described below.
PICU Dataset This dataset consists of 1,530 recorded 5- minute $2 0 0 – \mathrm { H z }$ sensor readings from 385 subjects collected at a leading children’s hospital by a team of research clinicians. Statistics of the dataset is shown in Table 7. The recordings are made on mechanically-ventilated patients in pediatrics ICU ward. Medical time series data collected from four sensors are used: flow volume spirometry, esophageal pressure sensor, and dual band respiratory inductance plethysmography. Each subject can be under one of four breathing conditions: ventilated with Continuous Positive Airway Pressure (CPAP), ventilated with Pressure Support (PS), 5 minutes after extubation, and 60 minutes after extubation. Along with the 4 sensor signals, clinicians verified binary anomaly label generated using hard-crafted state-of-the-art breathing anomaly detection algorithm is provided as ground truth.
Table 7: PICU dataset statistics.
<table><tr><td></td><td>PICU</td></tr><tr><td># of samples (N)</td><td>1530</td></tr><tr><td># of variables (D)</td><td>80</td></tr><tr><td># of time steps</td><td>60</td></tr><tr><td># of concepts</td><td>1</td></tr></table>
We annotate the concept of breathing anomaly in MIL framework by processing the dataset as follows. The sensor recordings are split into non-overlapping 5-second windows. In MIL framework, each window becomes an instance and each recording becomes a bag. For each sensor signal of each window, we extract 20 Mel-Frequency Cepstral Coefficients (MFCCs) to be used as features of each instance; thus, each instance has 80 features in total. For each instance, its anomaly label is set to positive if at least $20 \%$ of the window are labeled as anomaly. The bag anomaly label is set to positive if at least $60 \%$ of its instances are labeled as anomaly.
Table 8: Anomaly detection results on PICU dataset with different attention mechanisms and with max pooling.
<table><tr><td rowspan="2" colspan="2"></td><td colspan="2">Prediction</td><td colspan="2">Localization</td></tr><tr><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td></tr><tr><td rowspan="10">RMIL Models</td><td>S2S</td><td>0.741</td><td>0.797</td><td>0.532</td><td>0.707</td></tr><tr><td>S2S with Attention-I</td><td>0.732</td><td>0.787</td><td>0.511</td><td>0.694</td></tr><tr><td>S2S with Attention-F</td><td>0.730</td><td>0.789</td><td>0.519</td><td>0.689</td></tr><tr><td>LSTM</td><td>0.708</td><td>0.763</td><td>0.543</td><td>0.712</td></tr><tr><td>LSTM with Attention-I</td><td>0.690</td><td>0.767</td><td>0.513</td><td>0.682</td></tr><tr><td>LSTM with Attention-F</td><td>0.712</td><td>0.776</td><td>0.522</td><td>0.690</td></tr><tr><td>Bi-LSTM</td><td>0.729</td><td>0.784</td><td>0.562</td><td>0.725</td></tr><tr><td>Bi-LSTM with Attention-I</td><td>0.711</td><td>0.769</td><td>0.535</td><td>0.708</td></tr><tr><td>Bi-LSTM with Attention-F</td><td>0.736</td><td>0.790</td><td>0.539</td><td>0.704</td></tr><tr><td>Cluster-MIL*</td><td>0.590</td><td>0.620</td><td>0.530</td><td>0.670</td></tr><tr><td>MIL Models</td><td>MISVM</td><td>0.572</td><td>0.647</td><td>0.542</td><td>0.606</td></tr></table>
Results Table 8 shows the anomaly detection results using our RMIL models. We observe that (i) RMIL models mostly outperform the non-deep MIL models on both tasks, (ii) LSTM and Bi-LSTM based RMIL models obtain better overall results compared to the sequence-to-sequence models, and (iii) the attention mechanism does not help for localization task but sometimes obtains better results for the prediction task.
Remark: Cluster-MIL\* is a HDBSCAN clustering (Campello et al., 2015) based approach for anomaly detection. It uses both instance and bag labels for training, while other models only use bag labels for training.
# 6.3 ADDITIONAL RESULTS ON MIMIC-III RESP DATASET
We sampled the feature time series from MIMIC-III RESP dataset every 6 hours and generated a time series with more (12) time stamps. We call this MIMIC-III RESP-II dataset.
Table 9 shows the results of RMIL models on this dataset. We observe that (i) All the RMIL models have similar performance for prediction task, (ii) Bi-LSTM RMIL has better localization results compared to other the models.
Table 9: MIMIC-III RESP-II dataset with different attention mechanisms and with max pooling.
<table><tr><td rowspan="2" colspan="2"></td><td colspan="2">Prediction</td><td colspan="2">Localization</td></tr><tr><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td></tr><tr><td rowspan="9">RMIL Models</td><td>S2S</td><td>0.874</td><td>0.746</td><td>0.787</td><td>0.185</td></tr><tr><td>S2S with Attention-I</td><td>0.875</td><td>0.749</td><td>0.794</td><td>0.186</td></tr><tr><td>S2S with Attention-F</td><td>0.869</td><td>0.739</td><td>0.777</td><td>0.188</td></tr><tr><td>LSTM</td><td>0.875</td><td>0.749</td><td>0.776</td><td>0.177</td></tr><tr><td>LSTM with Attention-I</td><td>0.875</td><td>0.750</td><td>0.781</td><td>0.175</td></tr><tr><td>LSTM with Attention-F</td><td>0.872</td><td>0.742</td><td>0.771</td><td>0.177</td></tr><tr><td>Bi-LSTM</td><td>0.876</td><td>0.749</td><td>0.801</td><td>0.206</td></tr><tr><td>Bi-LSTM with Attention-I</td><td>0.875</td><td>0.750</td><td>0.803</td><td>0.204</td></tr><tr><td>Bi-LSTM with Attention-F</td><td>0.871</td><td>0.741</td><td>0.769</td><td>0.171</td></tr></table>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381# MASKGAN: BETTER TEXT GENERATION VIA FILLING IN THE
# William Fedus, Ian Goodfellow and Andrew M. Dai
liam.fedus@gmail.com, {goodfellow, adai}@google.com
# ABSTRACT
Neural text generation models are often autoregressive language models or seq2seq models. These models generate text by sampling words sequentially, with each word conditioned on the previous word, and are state-of-the-art for several machine translation and summarization benchmarks. These benchmarks are often defined by validation perplexity even though this is not a direct measure of the quality of the generated text. Additionally, these models are typically trained via maximum likelihood and teacher forcing. These methods are well-suited to optimizing perplexity but can result in poor sample quality since generating text requires conditioning on sequences of words that may have never been observed at training time. We propose to improve sample quality using Generative Adversarial Networks (GANs), which explicitly train the generator to produce high quality samples and have shown a lot of success in image generation. GANs were originally designed to output differentiable values, so discrete language generation is challenging for them. We claim that validation perplexity alone is not indicative of the quality of text generated by a model. We introduce an actor-critic conditional GAN that fills in missing text conditioned on the surrounding context. We show qualitatively and quantitatively, evidence that this produces more realistic conditional and unconditional text samples compared to a maximum likelihood trained model.
# 1 INTRODUCTION
Recurrent Neural Networks (RNNs) (Graves et al., 2012) are the most common generative model for sequences as well as for sequence labeling tasks. They have shown impressive results in language modeling (Mikolov et al., 2010), machine translation (Wu et al., 2016) and text classification (Miyato et al., 2017). Text is typically generated from these models by sampling from a distribution that is conditioned on the previous word and a hidden state that consists of a representation of the words generated so far. These are typically trained with maximum likelihood in an approach known as teacher forcing, where ground-truth words are fed back into the model to be conditioned on for generating the following parts of the sentence. This causes problems when, during sample generation, the model is often forced to condition on sequences that were never conditioned on at training time. This leads to unpredictable dynamics in the hidden state of the RNN. Methods such as Professor Forcing (Lamb et al., 2016) and Scheduled Sampling (Bengio et al., 2015) have been proposed to solve this issue. These approaches work indirectly by either causing the hidden state dynamics to become predictable (Professor Forcing) or by randomly conditioning on sampled words at training time, however, they do not directly specify a cost function on the output of the RNN that encourages high sample quality. Our proposed method does so.
Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) are a framework for training generative models in an adversarial setup, with a generator generating images that is trying to fool a discriminator that is trained to discriminate between real and synthetic images. GANs have had a lot of success in producing more realistic images than other approaches but they have only seen limited use for text sequences. This is due to the discrete nature of text making it infeasible to propagate the gradient from the discriminator back to the generator as in standard GAN training. We overcome this by using Reinforcement Learning (RL) to train the generator while the discriminator is still trained via maximum likelihood and stochastic gradient descent. GANs also commonly suffer from issues such as training instability and mode dropping, both of which are exacerbated in a textual setting. Mode dropping occurs when certain modalities in the training set are rarely generated by the generator, for example, leading all generated images of a volcano to be multiple variants of the same volcano. This becomes a significant problem in text generation since there are many complex modes in the data, ranging from bigrams to short phrases to longer idioms. Training stability is also an issue since unlike image generation, text is generated autoregressively and thus the loss from the discriminator is only observed after a complete sentence has been generated. This problem compounds when generating longer and longer sentences.
We reduce the impact of these problems by training our model on a text fill-in-the-blank or in-filling task. This is similar to the task proposed in Bowman et al. (2016) but we use a more robust setup. In this task, portions of a body of text are deleted or redacted. The goal of the model is to then infill the missing portions of text so that it is indistinguishable from the original data. While in-filling text, the model operates autoregressively over the tokens it has thus far filled in, as in standard language modeling, while conditioning on the true known context. If the entire body of text is redacted, then this reduces to language modeling.
Designing error attribution per time step has been noted to be important in prior natural language GAN research (Yu et al., 2017; Li et al., 2017). The text infilling task naturally achieves this consideration since our discriminator will evaluate each token and thus provide a fine-grained supervision signal to the generator. Consider, for instance, if the generator produces a sequence perfectly matching the data distribution over the first $t - 1$ time-steps, but then produces an outlier token $y _ { t }$ , $\left( x _ { 1 : t - 1 } y _ { t } \right)$ . Despite the entire sequence now being clearly synthetic as a result of the errant token, a discriminative model that produces a high loss signal to the outlier token, but not to the others, will likely yield a more informative error signal to the generator.
This research also opens further inquiry of conditional GAN models in the context of natural language.
In the following sections,
• We introduce a text generation model trained on in-filling (MaskGAN). • Consider the actor-critic architecture in extremely large action spaces. • Consider new evaluation metrics and the generation of synthetic training data.
# 2 RELATED WORK
Research into reliably extending GAN training to discrete spaces and discrete sequences has been a highly active area. GAN training in a continuous setting allows for fully differentiable computations, permitting gradients to be passed through the discriminator to the generator. Discrete elements break this differentiability, leading researchers to either avoid the issue and reformulate the problem, work in the continuous domain or to consider RL methods.
SeqGAN (Yu et al., 2017) trains a language model by using policy gradients to train the generator to fool a CNN-based discriminator that discriminates between real and synthetic text. Both the generator and discriminator are pretrained on real and fake data before the phase of training with policy gradients. During training they then do Monte Carlo rollouts in order to get a useful loss signal per word. Follow-up work then demonstrated text generation without pretraining with RNNs (Press et al., 2017). Additionally (Zhang et al., 2017) produced results with an RNN generator by matching high- dimensional latent representations.
Professor Forcing (Lamb et al., 2016) is an alternative to training an RNN with teacher forcing by using a discriminator to discriminate the hidden states of a generator RNN that is conditioned on real and synthetic samples. Since the discriminator only operates on hidden states, gradients can be passed through to the generator so that the hidden state dynamics at inference time follow those at training time.
GANs have been applied to dialogue generation (Li et al., 2017) showing improvements in adversarial evaluation and good results with human evaluation compared to a maximum likelihood trained baseline. Their method applies REINFORCE with Monte Carlo sampling on the generator.
Replacing the non-differentiable sampling operations with efficient gradient approximators (Jang et al., 2017)has not yet shown strong results with discrete GANs. Recent unbiased and low variance gradient estimate techniques such as Tucker et al. (2017) may prove more effective.
WGAN-GP (Gulrajani et al., 2017) avoids the issue of dealing with backpropagating through discrete nodes by generating text in a one-shot manner using a 1D convolutional network. Hjelm et al. (2017) proposes an algorithmic solution and uses a boundary-seeking GAN objective along with importance sampling to generate text. In Rajeswar et al. (2017), the discriminator operates directly on the continuous probabilistic output of the generator. However, to accomplish this, they recast the traditional autoregressive sampling of the text since the inputs to the RNN are predetermined. Che et al. (2017) instead optimize a lower-variance objective using the discriminator’s output, rather than the standard GAN objective.
Reinforcement learning methods have been explored successfully in natural language. Using a REINFORCE and cross entropy hybrid, MIXER, (Ranzato et al., 2015) directly optimized BLEU score and demonstrated improvements over baselines. More recently, actor-critic methods in natural language were explored in Bahdanau et al. (2017) where instead of having rewards supplied by a discriminator in an adversarial setting, the rewards are task-specific scores such as BLEU.
Conditional text generation via GAN training has been explored in Rajeswar et al. (2017); Li et al. (2017).
Our work is distinct in that we employ an actor-critic training procedure on a task designed to provide rewards at every time step (Li et al., 2017). We believe the in-filling may mitigate the problem of severe mode-collapse. This task is also harder for the discriminator which reduces the risk of the generator contending with a near-perfect discriminator. The critic in our method helps the generator converge more rapidly by reducing the high-variance of the gradient updates in an extremely high action-space environment when operating at word-level in natural language.
# 3 MASKGAN
# 3.1 NOTATION
Let $( x _ { t } , y _ { t } )$ denote pairs of input and target tokens. Let ${ \bf { < m > } }$ denote a masked token (where the original token is replaced with a hidden token) and let $\hat { x } _ { t }$ denote the filled-in token. Finally, $\tilde { x } _ { t }$ is a filled-in token passed to the discriminator which may be either real or fake.
# 3.2 ARCHITECTURE
The task of imputing missing tokens requires that our MaskGAN architecture condition on information from both the past and the future. We choose to use a seq2seq (Sutskever et al., 2014) architecture. Our generator consists of an encoding module and decoding module. For a discrete sequence ${ \pmb x } = ( x _ { 1 } , \cdots , x _ { T } )$ , a binary mask is generated (deterministically or stochastically) of the same length $\pmb { m } = ( m _ { 1 } , \cdots , m _ { T } )$ where each $\overline { { m _ { t } \mathrm { ~ \in ~ } \{ 0 , 1 \} } }$ , selects which tokens will remain. The token at time $t$ , $x _ { t }$ is then replaced with a special mask token ${ < } \mathbf { m } >$ if the mask is 0 and remains unchanged if the mask is 1.
The encoder reads in the masked sequence, which we denote as ${ \pmb m } ( { \pmb x } )$ , where the mask is applied element-wise. The encoder provides access to future context for the MaskGAN during decoding.
As in standard language-modeling, the decoder fills in the missing tokens auto-regressively, however, it is now conditioned on both the masked text ${ \pmb m } ( { \pmb x } )$ as well as what it has filled-in up to that point. The generator decomposes the distribution over the sequence into an ordered conditional sequence
$$\begin{array} { r l } & { P \left( \underset { \hat { x } _ { 1 } , \cdots , \hat { x } _ { T } | } { \smile } | m ( \pmb { x } ) \right) = \prod _ { t = 1 } ^ { T } P ( \hat { x } _ { t } | \hat { x } _ { 1 } , \cdots , \hat { x } _ { t - 1 } , \underset { m ( x ) } { \overset { \cdot } { m } } ) . } \\ & { \qquad G ( x _ { t } ) \equiv P ( \hat { x } _ { t } | \hat { x } _ { 1 } , \cdots , \hat { x } _ { t - 1 } , m ( \pmb { x } ) ) } \end{array}$$
The discriminator has an identical architecture to the generator1 except that the output is a scalar probability at each time point, rather than a distribution over the vocabulary size. The discriminator is given the filled-in sequence from the generator, but importantly, it is given the original real context $m ( x )$ . We give the discriminator the true context, otherwise, this algorithm has a critical failure mode. For instance, without this context, if the discriminator is given the filled-in sequence the director director guided the series, it will fail to reliably identify the director director bigram as fake text, despite this bigram potentially never appearing in the training corpus (aside from an errant typo). The reason is that it is ambiguous which of the two occurrences of director is fake; the \*associate $\star$ director guided the series or the director \*expertly\* guided the series are both potentially valid sequences. Without the context of which words are real, the discriminator was found to assign equal probability to both words. The result, of course, is an inaccurate learning signal to the generator which will not be correctly penalized for producing these bigrams. To prevent this, our discriminator $D _ { \phi }$ computes the probability of each token $\tilde { x } _ { t }$ being real given the true context of the masked sequence $m ( x )$ .
 Figure 1: seq2seq generator architecture. Blue boxes represent known tokens and purple boxes are imputed tokens. We demonstrate a sampling operation via the dotted line. The encoder reads in a masked sequence, where masked tokens are denoted by an underscore, and then the decoder imputes the missing tokens by using the encoder hidden states. In this example, the generator should fill in the alphabetical ordering, (a,b,c,d,e).
$$D _ { \phi } ( \tilde { x } _ { t } | \tilde { x } _ { 0 : T } , m ( { \boldsymbol { x } } ) ) = P ( \tilde { x } _ { t } = x _ { t } ^ { \mathrm { r e a l } } | \tilde { x } _ { 0 : T } , m ( { \boldsymbol { x } } ) )$$
In our formulation, the logarithm of the discriminator estimates are regarded as the reward
$$r _ { t } \equiv \log D _ { \phi } ( \tilde { x } _ { t } | \tilde { x } _ { 0 : T } , m ( x ) )$$
Our third network is the critic network, which is implemented as an additional head off the discriminator. The critic estimates the value function, which is the discounted total return of the filled-in sequence $\begin{array} { r } { R _ { t } = \sum _ { s = t } ^ { T } \gamma ^ { s } r _ { s } } \end{array}$ , where $\gamma$ is the discount factor at each position in the sequence.2
# 3.3 TRAINING
Our model is not fully-differentiable due to the sampling operations on the generator’s probability distribution to produce the next token. Therefore, to train the generator, we estimate the gradient with respect to its parameters $\theta$ via policy gradients (Sutton et al., 2000). Reinforcement learning was first employed to GANs for language modeling in Yu et al. (2017). Analogously, here the generator seeks to maximize the cumulative total reward $\begin{array} { r } { \bar { R } = \sum _ { t = 1 } ^ { T } R _ { t } } \end{array}$ . We optimize the parameters of the generator, $\theta$ , by performing gradient ascent on $\mathbb { E } _ { G ( \theta ) } [ R ]$ . Using one of the REINFORCE family of algorithms, we can find an unbiased estimator of this as $\nabla _ { \boldsymbol { \theta } } \mathbb { E } _ { G } [ R _ { t } ] = R _ { t } \nabla _ { \boldsymbol { \theta } } \log G _ { \boldsymbol { \theta } } ( \hat { x _ { t } } )$ . The variance of this gradient estimator may be reduced by using the learned value function as a baseline $b _ { t } = V ^ { G } ( x _ { 1 : t } )$ which is produced by the critic. This results in the generator gradient contribution for a single token $\hat { x } _ { t }$
$$\nabla _ { \theta } \mathbb { E } _ { G } [ R _ { t } ] = ( R _ { t } - b _ { t } ) \nabla _ { \theta } \log G _ { \theta } ( \hat { x _ { t } } )$$
In the nomenclature of RL, the quantity $\left( R _ { t } - b _ { t } \right)$ may be interpreted as an estimate of the advantage $A ( a _ { t } , s _ { t } ) = Q ( a _ { t } , s _ { t } ) - V ( s _ { t } )$ . Here, the action $a _ { t }$ is the token chosen by the generator $a _ { t } \equiv { \hat { x } } _ { t }$ and the state $s _ { t }$ are the current tokens produced up to that point $s _ { t } \equiv \hat { x } _ { 1 } , \cdots , \hat { x } _ { t - 1 }$ . This approach is an actor-critic architecture where $G$ determines the policy $\pi ( s _ { t } )$ and the baseline $b _ { t }$ is the critic (Sutton & Barto, 1998; Degris et al., 2012).
For this task, we design rewards at each time step for a single sequence in order to aid with credit assignment (Li et al., 2017). As a result, a token generated at time-step $t$ will influence the rewards received at that time step and subsequent time steps. Our gradient for the generator will include contributions for each token filled in order to maximize the discounted total return $\begin{array} { r } { R = \sum _ { t = 1 } ^ { T } R _ { t } } \end{array}$ .
The full generator gradient is given by Equation 6
$$\begin{array} { r l } & { \nabla _ { \theta } \mathbb { E } [ R ] = \mathbb { E } _ { \hat { x } _ { t } \sim G } \left[ \displaystyle \sum _ { t = 1 } ^ { T } ( R _ { t } - b _ { t } ) \nabla _ { \theta } \log ( G _ { \theta } ( \hat { x } _ { t } ) ) \right] } \\ & { \quad \quad \quad = \mathbb { E } _ { \hat { x } _ { t } \sim G } \left[ \displaystyle \sum _ { t = 1 } ^ { T } \left( \displaystyle \sum _ { s = t } ^ { T } \gamma ^ { s } r _ { s } - b _ { t } \right) \nabla _ { \theta } \log ( G _ { \theta } ( \hat { x } _ { t } ) ) \right] } \end{array}$$
Intuitively this shows that the gradient to the generator associated with producing $\hat { x } _ { t }$ will depend on all the discounted future rewards $( s \geq t )$ assigned by the discriminator. For a non-zero $\lambda$ discount factor, the generator will be penalized for greedily selecting a token that earns a high reward at that time-step alone. Then for one full sequence, we sum over all generated words $\hat { x } _ { t }$ for $t = 1 : T$ .
Finally, as in conventional GAN training, our discriminator will be updated according to the gradient
$$\nabla _ { \phi } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \left[ \log D ( x ^ { ( i ) } ) ] + \log ( 1 - D ( G ( z ^ { ( i ) } ) \right]$$
3.4 ALTERNATIVE APPROACHES FOR LONG SEQUENCES AND LARGE VOCABULARIES
As an aside for other avenues we explored, we highlight two particular problems of this task and plausible remedies. This task becomes more difficult with long sequences and with large vocabularies. To address the issue of extended sequence length, we modify the core algorithm with a dynamic task. We apply our algorithm up to a maximum sequence length $T$ , however, upon satisfying a convergence criterion, we then increment the maximum sequence length to $T + 1$ and continue training. This allows the model to build up an ability to capture dependencies over shorter sequences before moving to longer dependencies as a form of curriculum learning.
In order to alleviate issues of variance with REINFORCE methods in a large vocabulary size, we consider a simple modification. At each time-step, instead of generating a reward only on the sampled token, we instead seek to use the full information of the generator distribution. Before sampling, the generator produces a probability distribution over all tokens $G ( v ) \ \forall \ v \in \mathcal { V }$ . We compute the reward for each possible token $v$ , conditioned on what had been generated before. This incurs a computational penalty since the discriminator must now be used to predict over all tokens, but if performed efficiently, the potential reduction in variance could be beneficial.
# 3.5 METHOD DETAILS
Prior to training, we first perform pretraining. First we train a language model using standard maximum likelihood training. We then use the pretrained language model weights for the seq2seq encoder and decoder modules. With these language models, we now pretrain the seq2seq model on the in-filling task using maximum likelihood, in particular, the attention parameters as described in Luong et al. (2015). We select the model producing the lowest validation perplexity on the masked task via a hyperparameter sweep over 500 runs. Initial algorithms did not include a critic, but we found that the inclusion of the critic decreased the variance of our gradient estimates by an order of magnitude which substantially improved training.
# 4 EVALUATION
Evaluation of generative models continues to be an open-ended research question. We seek heuristic metrics that we believe will be correlated with human-evaluation. BLEU score (Papineni et al., 2002) is used extensively in machine translation where one can compare the quality of candidate translations from the reference. Motivated by this metric, we compute the number of unique $n$ -grams produced by the generator that occur in the validation corpus for small $n$ . Then we compute the geometric average over these metrics to get a unified view of the performance of the generator.
From our maximum-likelihood trained benchmark, we were able to find GAN hyperparameter configurations that led to small decreases in validation perplexity on $O ( 1 )$ −point. However, we found that these models did not yield considerable improvements to the sample quality so we abandoned trying to reduce validation perplexity. One of the biggest advantages of GAN-trained NLP models, is that the generator can produce alternative, yet realistic language samples, but not be unfairly penalized by not producing with high likelihood the single correct sequence. As the generator explores ‘off-manifold’ in the free-running mode, it may find alternative options that are valid, but do not maximize the probability of the underlying sequence. We therefore choose not to focus on architectures or hyperparameter configurations that led to small reductions in validation perplexity, but rather, searched for those that improved our heuristic evaluation metrics.
# 5 EXPERIMENTS
We present both conditional and unconditional samples generated on the PTB and IMDB data sets at word-level. MaskGAN refers to our GAN-trained variant and MaskMLE refers to our maximumlikelihood trained variant. Additional samples are supplied in Appendix B.
# 5.1 THE PENN TREEBANK (PTB)
The Penn Treebank dataset (Marcus et al., 1993) has a vocabulary of 10,000 unique words. The training set contains 930,000 words, the validation set contains 74,000 words and the test set contains 82,000 words. For our experiments, we train on the training partition.
We first pretrain the commonly-used variational LSTM language model with parameter dimensions common to MaskGAN following Gal & Ghahramani (2016) to a validation perplexity of 78. After then loading the weights from the language model into the MaskGAN generator we further pretrain with a masking rate of 0.5 (half the text blanked) to a validation perplexity of 55.3. Finally, we then pretrain the discriminator on the samples produced from the current generator and real training text.
# 5.1.1 CONDITIONAL SAMPLES
We produce samples conditioned on surrounding text in Table 1. Underlined sections of text are missing and have been filled in via either the MaskGAN or MaskMLE algorithm. Table 1: Conditional samples from PTB for both MaskGAN and MaskMLE models.
<table><tr><td>Ground Truth</td><td>the next day 's show <eos> interactive telephone technology has taken a new leap in <unk> and television programmers are</td></tr><tr><td>MaskGAN</td><td>the next day 's show <eos> interactive telephone technology has taken a new leap in its retail business <eos> a</td></tr><tr><td>MaskMLE</td><td>the next day 's show <eos> interactive telephone technology has taken a new leap in the complicate case of the</td></tr></table>
# 5.1.2 LANGUAGE MODEL (UNCONDITIONAL) SAMPLES
We may also run MaskGAN in an unconditional mode, where the entire context is blanked out, thus making it equivalent to a language model. We present a length-20 language model sample in Table 2 and additional samples are included in the Appendix. Table 2: Language model (unconditional) sample from PTB for MaskGAN.
<table><tr><td>MaskGAN</td><td>oct. N as the end of the year the resignations were approved <eos> the march N N <unk> was down</td></tr></table>
# 5.2 IMDB MOVIE DATASET
The IMDB dataset Maas et al. (2011) consists of 100,000 movie reviews taken from IMDB. Each review may contain several sentences. The dataset is divided into 25,000 labeled training instances, 25,000 labeled test instances and 50,000 unlabeled training instances. The label indicates the sentiment of the review and may be either positive or negative. We use the first 40 words of each review in the training set to train our models, which leads to a dataset of 3 million words.
Identical to the training process in PTB, we pretrain a language model to a validation perplexity of 105.6. After then loading the weights from the language model into the MaskGAN generator we further pretrain with masking rate of 0.5 (half the text blanked) to a validation perplexity of 87.1. Finally, we then pretrain the discriminator on the samples produced from the current generator and real training text.
# 5.2.1 CONDITIONAL SAMPLES
Here we compare MaskGAN and MaskMLE conditional language generation ability for the IMDB dataset. Table 3: Conditional samples from IMDB for both MaskGAN and MaskMLE models.
<table><tr><td>Ground Truth</td><td>Pitch Black was a complete shock to me when I first saw it back in 2000 In the previous years I</td></tr><tr><td>MaskGAN</td><td>Pitch Black was a complete shock to me when I first saw it back in 1979 I was really looking forward</td></tr><tr><td>MaskMLE</td><td>Black was a complete shock to me when I first saw it back in 1969 Ilive in New Zealand</td></tr></table>
# 5.2.2 LANGUAGE MODEL (UNCONDITIONAL) SAMPLES
As in the case with PTB, we generate IMDB samples unconditionally, equivalent to a language model. We present a length-40 sample in Table 4 and additional samples are included in the Appendix.
Table 4: Language model (unconditional) sample from IMDB for MaskGAN.
<table><tr><td>MaskGAN</td><td>Positive: Follow the Good Earth movie linked Vacation is a comedy that credited against the modern day era yarns which has helpful something to the modern day s best It is an interesting drama based on a story of the famed</td></tr></table>
# 5.3 PERPLEXITY OF GENERATED SAMPLES
As of this date, GAN training has not achieved state-of-the-art word level validation perplexity on the Penn Treebank dataset. Rather, the top performing models are still maximum-likelihood trained models, such as the recent architectures found via neural architecture search in Zoph & Le (2017). An extensive hyperparameter search with MaskGAN further supported that GAN training does not improve the validation perplexity results set via state-of-the-art models. However, we instead seek to understand the quality of the sample generation. As highlighted earlier, a fundamental problem of generating in free-running mode potentially leads to ‘off-manifold‘ sequences which can result in poor sample quality for teacher-forced models. We seek to quantitatively evaluate this dynamic present only during sampling. This is commonly done with BLEU but as shown by Wu et al. (2016), BLEU is not necessarily correlated with sample quality. We believe the correlation may be even less in the in-filling task since there are many potential valid in-fillings and BLEU would penalize valid ones.
Table 5: The perplexity is calculated using a pre-trained language model that is equivalent to the decoder (in terms of architecture and size) used in the MaskMLE and MaskGAN models. This language model was used to initialize both models.
<table><tr><td>Model</td><td>Perplexity of IMDB samples under a pretrained LM</td></tr><tr><td>MaskMLE</td><td>273.1 ± 3.5</td></tr><tr><td>MaskGAN</td><td>108.3 ± 3.5</td></tr></table>
Instead, we calculate the perplexity of the generated samples by MaskGAN and MaskMLE by using the language model that was used to initialize MaskGAN and MaskMLE. Both MaskGAN and MaskMLE produce samples autoregressively (free-running mode), building upon the previously sampled tokens to produce the distribution over the next.
The MaskGAN model produces samples which are more likely under the initial model than the MaskMLE model. The MaskMLE model generates improbable sentences, as assessed by the initial language model, during inference as compounding sampling errors result in a recurrent hidden states that are never seen during teacher forcing (Lamb et al., 2016). Conversely, the MaskGAN model operates in a free-running mode while training and this supports that it is more robust to these sampling perturbations.
# 5.4 MODE COLLAPSE
In contrast to image generation, mode collapse can be measured by directly calculating certain n-gram statistics. In this instance, we measure mode collapse by the percentage of unique n-grams in a set of 10,000 generated IMDB movie reviews. We unconditionally generate each sample (consisting of 40 words). This results in almost 400K total bi/tri/quad-grams.
Table 6: Diversity statistics within 1000 unconditional samples of PTB news snippets (20 words each).
<table><tr><td>Model</td><td>% Unique bigrams</td><td>% Unique trigrams</td><td> % Unique quadgrams</td></tr><tr><td>LM</td><td>40.6</td><td>75.2</td><td>91.9</td></tr><tr><td>MaskMLE</td><td>43.6</td><td>77.4</td><td>92.6</td></tr><tr><td>MaskGAN</td><td>38.2</td><td>70.7</td><td>88.2</td></tr></table>
The results in Table 6 show that MaskGAN does show some mode collapse, evidenced by the reduced number of unique quadgrams. However, all complete samples (taken as a sequence) for all the models are still unique. We also observed during RL training an initial small drop in perplexity on the ground-truth validation set but then a steady increase in perplexity as training progressed. Despite this, sample quality remained relatively consistent. The final samples were generated from a model that had a perplexity on the ground-truth of 400. We hypothesize that mode dropping is occurring near the tail end of sequences since generated samples are unlikely to generate all the previous words correctly in order to properly model the distribution over words at the tail. Theis et al. (2016) also shows how validation perplexity does not necessarily correlate with sample quality.
# 5.5 HUMAN EVALUATION
Ultimately, the evaluation of generative models is still best measured by unbiased human evaluation. Therefore, we evaluate the quality of the generated samples of our initial language model (LM), the MaskMLE model and the MaskGAN model in a blind heads-up comparison using Amazon Mechanical Turk. Note that these models have the same number of parameters at inference time. We pay raters to compare the quality of two extracts along 3 axes (grammaticality, topicality and overall quality). They are asked if the first extract, second extract or neither is higher quality.
Table 7: A Mechanical Turk blind heads-up evaluation between pairs of models trained on IMDB reviews. 100 reviews (each 40 words long) from each model are unconditionally sampled and randomized. Raters are asked which sample is preferred between each pair. 300 ratings were obtained for each model pair comparison.
<table><tr><td>Preferred Model</td><td>Grammaticality %</td><td>Topicality %</td><td> Overall %</td></tr><tr><td>LM</td><td>15.3</td><td>19.7</td><td>15.7</td></tr><tr><td>MaskGAN</td><td>59.7</td><td>58.3</td><td>58.0</td></tr><tr><td>LM</td><td>20.0</td><td>28.3</td><td>21.7</td></tr><tr><td>MaskMLE</td><td>42.7</td><td>43.7</td><td>40.3</td></tr><tr><td>MaskGAN</td><td>49.7</td><td>43.7</td><td>44.3</td></tr><tr><td>MaskMLE</td><td>18.7</td><td>20.3</td><td>18.3</td></tr><tr><td>Real samples</td><td>78.3</td><td>72.0</td><td>73.3</td></tr><tr><td>LM</td><td>6.7</td><td>7.0</td><td>6.3</td></tr><tr><td>Real samples</td><td>65.7</td><td>59.3</td><td>62.3</td></tr><tr><td>MaskGAN</td><td>18.0</td><td>20.0</td><td>16.7</td></tr></table>
Table 8: A Mechanical Turk blind heads-up evaluation between pairs of models trained on PTB. 100 news snippets (each 20 words long) from each model are unconditionally sampled and randomized. Raters are asked which sample is preferred between each pair. 300 ratings were obtained for each model pair comparison.
<table><tr><td>Preferred model</td><td>Grammaticality %</td><td> Topicality %</td><td>Overall %</td></tr><tr><td>LM</td><td>32.0</td><td>30.7</td><td>27.3</td></tr><tr><td>MaskGAN</td><td>41.0</td><td>39.0</td><td>35.3</td></tr><tr><td>LM</td><td>32.7</td><td>34.7</td><td>32.0</td></tr><tr><td>MaskMLE</td><td>37.3</td><td>33.3</td><td>31.3</td></tr><tr><td>MaskGAN</td><td>44.7</td><td>33.3</td><td>35.0</td></tr><tr><td>MaskMLE</td><td>28.0</td><td>28.3</td><td>26.3</td></tr><tr><td>SeqGAN</td><td>38.7</td><td>34.0</td><td>30.7</td></tr><tr><td>MaskMLE</td><td>33.3</td><td>28.3</td><td>27.3</td></tr><tr><td>SeqGAN</td><td>31.7</td><td>34.7</td><td>32.0</td></tr><tr><td>MaskGAN</td><td>43.3</td><td>37.3</td><td>37.0</td></tr></table>
The Mechanical Turk results show that MaskGAN generates superior human-looking samples to MaskMLE on the IMDB dataset. However, on the smaller PTB dataset (with 20 word instead of 40 word samples), the results are closer. We also show results with SeqGAN (trained with the same network size and vocabulary size) as MaskGAN, which show that MaskGAN produces superior samples to SeqGAN.
# 6 DISCUSSION
Our work further supports the case for matching the training and inference procedures in order to produce higher quality language samples. The MaskGAN algorithm directly achieves this through GAN-training and improved the generated samples as assessed by human evaluators.
In our experiments, we generally found training where contiguous blocks of words were masked produced better samples. One conjecture is that this allows the generator an opportunity to explore longer sequences in a free-running mode; in comparison, a random mask generally has shorter sequences of blanks to fill in, so the gain of GAN-training is not as substantial. We found that policy gradient methods were effective in conjunction with a learned critic, but the highly active research on training with discrete nodes may present even more stable training procedures.
We also found the use of attention was important for the in-filled words to be sufficiently conditioned on the input context. Without attention, the in-filling would fill in reasonable subsequences that became implausible in the context of the adjacent surrounding words. Given this, we suspect another promising avenue would be to consider GAN-training with attention-only models as in Vaswani et al. (2017).
In general we think the proposed contiguous in-filling task is a good approach to reduce mode collapse and help with training stability for textual GANs. We show that MaskGAN samples on a larger dataset (IMDB reviews) is significantly better than the corresponding tuned MaskMLE model as shown by human evaluation. We also show we can produce high-quality samples despite the MaskGAN model having much higher perplexity on the ground-truth test set.
# ACKNOWLEDGEMENTS
We would like to thank George Tucker, Jascha Sohl-Dickstein, Jon Shlens, Ryan Sepassi, Jasmine Collins, Irwan Bello, Barret Zoph, Gabe Pereyra, Eric Jang and the Google Brain team, particularly the first year residents who humored us listening and commenting on almost every conceivable variation of this core idea.
# REFERENCES
Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron Courville, and Yoshua Bengio. An actor-critic algorithm for sequence prediction. In International Conference on Learning Representations, 2017.
Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 1171–1179, 2015.
Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic ´ language model. Journal of machine learning research, 3(Feb):1137–1155, 2003.
Samuel R Bowman, Luke Vilnis, Oriol Vinyals, Andrew M Dai, Rafal Jozefowicz, and Samy Bengio. Generating sentences from a continuous space. In 20th SIGNLL Conference on Computational Natural Language Learning (CoNLL), 2016.
Tong Che, Yanran Li, Ruixiang Zhang, R Devon Hjelm, Wenjie Li, Yangqiu Song, and Yoshua Bengio. Maximum-likelihood augmented discrete generative adversarial networks. arXiv preprint arXiv:1702.07983, 2017.
Thomas Degris, Patrick M Pilarski, and Richard S Sutton. Model-free reinforcement learning with continuous action in practice. In American Control Conference (ACC), 2012, pp. 2177–2182. IEEE, 2012.
Yarin Gal and Zoubin Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. In Advances in Neural Information Processing Systems 29, pp. 1019–1027, 2016.
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.
Alex Graves et al. Supervised sequence labelling with recurrent neural networks, volume 385. Springer, 2012.
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. arXiv preprint arXiv:1704.00028, 2017.
R Devon Hjelm, Athul Paul Jacob, Tong Che, Kyunghyun Cho, and Yoshua Bengio. Boundaryseeking generative adversarial networks. arXiv preprint arXiv:1702.08431, 2017.
Hakan Inan, Khashayar Khosravi, and Richard Socher. Tying word vectors and word classifiers: A loss framework for language modeling. In International Conference on Learning Representations, 2017.
Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. In International Conference on Learning Representations, 2017.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
Alex Lamb, Anirudh Goyal, Ying Zhang, Saizheng Zhang, Aaron Courville, and Yoshua Bengio. Professor forcing: A new algorithm for training recurrent networks. In Advances In Neural Information Processing Systems, pp. 4601–4609, 2016.
Jiwei Li, Will Monroe, Tianlin Shi, Alan Ritter, and Dan Jurafsky. Adversarial learning for neural dialogue generation. In Conference on Empirical Methods in Natural Language Processing, 2017.
Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attention-based neural machine translation. In Conference on Empirical Methods in Natural Language Processing, pp. 1412–1421, 2015.
Andrew L Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew $\mathrm { ~ Y ~ N ~ g ~ } _ { }$ , and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies-Volume 1, pp. 142–150. Association for Computational Linguistics, 2011.
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.
Tomas Mikolov, Martin Karafiat, Lukas Burget, Jan Cernock ´ y, and Sanjeev Khudanpur. Recurrent \` neural network based language model. In Interspeech, volume 2, pp. 3, 2010.
Takeru Miyato, Andrew M Dai, and Ian Goodfellow. Virtual adversarial training for semi-supervised text classification. In International Conference on Learning Representations, volume 1050, pp. 25, 2017.
Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pp. 311–318. Association for Computational Linguistics, 2002.
Ofir Press and Lior Wolf. Using the output embedding to improve language models. In 15th Conference of the European Chapter of the Association for Computational Linguistics, pp. 157– 163, 2017.
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.
Sai Rajeswar, Sandeep Subramanian, Francis Dutil, Christopher Pal, and Aaron Courville. Adversarial generation of natural language. In 2nd Workshop on Representation Learning for NLP, 2017.
Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. arXiv preprint arXiv:1511.06732, 2015.
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.
Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction, volume 1. MIT press Cambridge, 1998.
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.
Lucas Theis, Aaron van den Oord, and Matthias Bethge. A note on the evaluation of generative ¨ models. In International Conference on Learning Representations, 2016.
George Tucker, Andriy Mnih, Chris J Maddison, Dieterich Lawson, and Jascha Sohl-Dickstein. Rebar: Low-variance, unbiased gradient estimates for discrete latent variable models. In 31st Conference on Neural Information Processing Systems (NIPS 2017), 2017.
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In 31st Conference on Neural Information Processing Systems (NIPS 2017), 2017.
Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. CoRR, abs/1609.08144, 2016. URL http://arxiv.org/abs/1609.08144.
Lantao Yu, Weinan Zhang, Jun Wang, and Yong Yu. SeqGAN: Sequence generative adversarial nets with policy gradient. In Association for the Advancement of Artificial Intelligence, pp. 2852–2858, 2017.
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.
Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. In International Conference on Learning Representations, 2017.
# A TRAINING DETAILS
Our model was trained with the Adam method for stochastic optimization (Kingma & Ba, 2015) with the default Tensorflow exponential decay rates of $\beta _ { 1 } = 0 . 9 9$ and $\beta _ { 2 } = 0 . 9 9 9$ . Our model uses 2-layers of 650 unit LSTMs for both the generator and discriminator, 650 dimensional word embeddings, variational dropout. We used Bayesian hyperparameter tuning to tune the variational dropout rate and learning rates for the generator, discriminator and critic. We perform 3 gradient descent steps on the discriminator for every step on the generator and critic.
We share the embedding and softmax weights of the generator as proposed in Bengio et al. (2003); Press & Wolf (2017); Inan et al. (2017). Furthermore, to improve convergence speed, we share the embeddings of the generator and the discriminator. Additionally, as noted in our architectural section, our critic shares all of the discriminator parameters with the exception of the separate output head to estimate the value. Both our generator and discriminator use variational recurrent dropout (Gal & Ghahramani, 2016).
# B ADDITIONAL SAMPLES
# B.1 THE PENN TREEBANK (PTB)
We present additional samples on PTB here.
B.1.1 CONDITIONAL SAMPLES
<table><tr><td>Ground Truth</td><td>the next day 's show <eos> interactive telephone technology has taken a new leap in <unk> and television programmers are</td></tr><tr><td rowspan="4">MaskGAN</td><td>the next day 's show <eos> interactive telephone technology has taken a new leap in its retail business <eos> a</td></tr><tr><td>the next day 's show <eos> interactive telephone technology has long dominated the <unk> of the nation 's largest economic</td></tr><tr><td>the next day 's show <eos> interactive telephone technology has</td></tr><tr><td>exercised a NN stake in the u.s. and france the next day 's show <eos> interactive telephone technology has taken</td></tr><tr><td rowspan="2">MaskMLE</td><td>a new leap in the complicate case of the the next day 's show <eos> interactive telephone technology has been</td></tr><tr><td><unk> in a number of clients 'estimates mountain-bike the next day 's show <eos> interactive telephone technology has instituted a week of <unk>by <unk> <unk> wis.auto</td></tr></table>
We also consider filling-in on non-continguous masks below.
B.1.2 LANGUAGE MODEL (UNCONDITIONAL) SAMPLES
<table><tr><td>Ground Truth</td><td>president of the united states ronald reagan delivered his <unk> address to the nation <eos> president reagan addressed several is- sues</td></tr><tr><td>MaskGAN</td><td>president of the united states and congress delivered his <unk> address to the nation <eos> mr. reagan addressed several issues</td></tr><tr><td>MaskMLE</td><td>president of the united states have been delivered his <unk> address to the nation <eos> mr. reagan addressed several issues</td></tr></table>
We present additional language model (unconditional) samples on PTB here. We modified SeqGAN to train and generate PTB samples using the same size architecture for the generator as in the MaskGAN generator and present samples here with MaskGAN samples.
<table><tr><td>MaskGAN</td><td>a <unk> basis despite the huge after-tax interest income <unk> from $ N million <eos> in west germany N N the world 's most corrupt organizations act as a multibillion-dollar</td></tr><tr><td>SeqGAN</td><td><unk> atmosphere or the metropolitan zone historic array with their are removed <eos> another takeover target lin 's directors attempted through october <unk> and british airways is allowed three funds</td></tr><tr><td></td><td>cineplex odeon corp.shares made fresh out of the group purchase one part of a revised class of <unk> british there are <unk> <unk> and <unk>about the <unk> seed <eos> they use pcs are <unk> and their performance <eos></td></tr></table>
# B.2 IMDB MOVIE DATASET
We present additional samples on IMDB here.
B.2.1 CONDITIONAL SAMPLES B.2.2 LANGUAGE MODEL (UNCONDITIONAL) SAMPLES
<table><tr><td>Ground Truth</td><td>Pitch Black was a complete shock to me when I first saw it back in 2000 In the previous years I</td></tr><tr><td rowspan="4">MaskGAN</td><td>Pitch Black was a complete shock to me when I frst saw it back in 1979 I was really looking forward</td></tr><tr><td>Pitch Black was a complete shock to me when I first saw it back in 1976 The promos were very well</td></tr><tr><td>Pitch Black was a complete shock to me when I first saw it back in the days when I was a</td></tr><tr><td>Black was a complete shock to me when I first saw it back in 1969 I live</td></tr><tr><td rowspan="4">MaskMLE</td><td>in New Zealand</td></tr><tr><td>Pitch Black was a complete shock to me when I first saw it back in 1951 It was funny All Interiors</td></tr><tr><td>Pitch Black was a complete shock to me when I first saw it back in the day and I was in</td></tr><tr><td></td></tr></table>
We present additional language model (unconditional) samples from MaskGAN on IMDB here.
Positive: Follow the Good Earth movie linked Vacation is a comedy that credited against the modern day era yarns which has helpful something to the modern day s best It is an interesting drama based on a story of the famed
Negative: I really can t understand what this movie falls like I was seeing it I m sorry to say that the only reason I watched it was because of the casting of the Emperor I was not expecting anything as
Negative: That s about so much time in time a film that persevered to become cast in a very good way I didn t realize that the book was made during the 70s The story was Manhattan the Allies were to
# C FAILURE MODES
Here we explore various failure modes of the MaskGAN model, which show up under certain bad hyperparameter settings.
# C.1 MODE COLLAPSE
As widely witnessed in GAN-training, we also find a common failure of mode collapse across various $n$ -gram levels. The mode collapse may not be as extreme to collapse at a 1-gram level (ddddddd· · · ) as described by Gulrajani et al. (2017), but it may manifest as grammatical, albeit, inanely repetitive phrases, for example,
It is a very funny film that is very funny It s a very funny movie and it s charming It
Of course the discriminator may discern this as an out-of-distribution sample, however, in certain failure modes, we observed the generator to move between common modes frequently present in the text.
# C.2 MATCHING SYNTAX AT BOUNDARIES
We notice that the MaskGAN architecture often struggles to produce syntactically correct sequences when there is a hard boundary where it must end. This is also a relatively challenging task for humans, because the filled in text must not only be contextual but also match syntactically at the boundary between the blank and where the text is present over a fixed number of words.
Cartoon is one of those films me when I first saw it back in 2000
As noted in this failure mode, the intersection between the filled in text and the present text is non grammatical.
# C.3 LOSS OF GLOBAL CONTEXT
Similar to failure modes present in GAN image generation, the produced samples often can lose global coherence, despite being sensible locally. We expect a larger capacity model can mitigate some of these issues.
This movie is terrible The plot is ludicrous The title is not more interesting and original This is a great movie Lord of the Rings was a great movie John Travolta is brilliant
# C.4 $n$ -GRAM METRICS MAY BE MISLEADING PROXIES
In the absence of a global scalar objective to optimize while training, we monitor various $n$ -gram language statistics to assess performance. However, these only are crude proxies of the quality of the produced samples.
 Figure 2: Particular failure mode succeeding in the optimization of a 4-gram metric at the extreme expense of validation perplexity. The resulting samples are shown below.
For instance, MaskGAN models that led to improvements of a particular $n$ -gram metric at the extreme expense of validation perplexity as seen in Figure 2 could devolve to a generator of very low sample diversity. Below, we produce several samples from this particular model which, despite the dramatically improved 4-gram metric, has lost diversity.
It is a great movie It s just a tragic story of a man who has been working on a home It s a great film that has a great premise but it s not funny It s just a silly film It s not the best movie I have seen in the series The story is simple and very clever but it
Capturing the complexities of natural language with these metrics alone is clearly insufficient.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477# IMPROVING GENERALIZATION AND STABILITY OF GENERATIVE ADVERSARIAL NETWORKS
Hoang Thanh-Tung hoangtha@deakin.edu.au
Truyen Tran truyen.tran@deakin.edu.au
Svetha Venkatesh svetha.venkatesh@deakin.edu.au
# ABSTRACT
Generative Adversarial Networks (GANs) are one of the most popular tools for learning complex high dimensional distributions. However, generalization properties of GANs have not been well understood. In this paper, we analyze the generalization of GANs in practical settings. We show that discriminators trained on discrete datasets with the original GAN loss have poor generalization capability and do not approximate the theoretically optimal discriminator. We propose a zero-centered gradient penalty for improving the generalization of the discriminator by pushing it toward the optimal discriminator. The penalty guarantees the generalization and convergence of GANs. Experiments on synthetic and large scale datasets verify our theoretical analysis.
# 1 INTRODUCTION
GANs (Goodfellow et al., 2014) are one of the most popular tools for modeling high dimensional data. The original GAN is, however, highly unstable and often suffers from mode collapse. Much of recent researches has focused on improving the stability of GANs (Radford et al., 2015; Arjovsky et al., 2017; Heusel et al., 2017; Miyato et al., 2018; Karras et al., 2018). On the theoretical aspect, Nagarajan & Kolter (2017) proved that gradient based training of the original GAN is locally stable. Heusel et al. (2017) further proved that GANs trained with Two Timescale Update Rule (TTUR) converge to local equilibria. However, the generalization of GANs at local equilibria is not discussed in depth in these papers.
Arora et al. (2017) showed that the generator can win by remembering a polynomial number of training examples. The result implies that a low capacity discriminator cannot detect the lack of diversity. Therefore, it cannot teach the generator to approximate the target distribution. In section 4, we discuss the generalization capability of high capacity discriminators. We show that high capacity discriminators trained with the original GAN loss tends to overfit to the mislabeled samples in training dataset, guiding the generator toward collapsed equilibria (i.e. equilibria where the generator has mode collapse).
Arora et al. (2018) proposed to measure the generalization capability of GAN by estimating the number of modes in the model distribution using the birthday paradox. Experiments on several datasets showed that the number of modes in the model distribution is several times greater than the number of training examples. The author concluded that although GANs might not be able to learn distributions, they do exhibit some level of generalization. Our analysis shows that poor generalization comes from the mismatch between discriminators trained on discrete finite datasets and the theoretically optimal discriminator. We propose a zero-centered gradient penalty for improving the generalization capability of (high capacity) discriminators. Our zero-centered gradient penalty pushes the discriminator toward the optimal one, making GAN to converge to equilibrium with good generalization capability.
Our contributions are as follow:
1. We show that discriminators trained with the original GAN loss have poor generalization capability. Poor generalization in the discriminator prevents the generator from learning the target distribution. 2. We show that the original GAN objective encourages gradient exploding in the discriminator. Gradient exploding in the discriminator can lead to mode collapse in the generator. 3. We propose a zero-centered gradient penalty (0-GP) for improving the generalization capability of the discriminator. We show that non-zero centered GP and the zero-centered GP proposed in Mescheder et al. (2018) cannot make the discriminator generalize. Our 0-GP helps GANs to converge to generalizable equilibria. Theoretical results are verified on real world datasets. 4. We show that 0-GP helps the discriminator to distribute its capacity more equally between regions of the space, effectively preventing mode collapse. Experiments on synthetic and real world datasets verify that 0-GP can prevent mode collapse. GANs with 0-GP is much more robust to changes in hyper parameters, optimizers, and network architectures than the original GAN and GANs with other gradient penalties.
Table 1 compares the key properties of our 0-GP with one centered GP (1-GP) (Gulrajani et al., 2017) and zero centered GP on real/fake samples only (0-GP-sample) (Mescheder et al., 2018).
# NOTATIONS
<table><tr><td>pr</td><td>the target distribution</td></tr><tr><td></td><td>the model distribution</td></tr><tr><td>Pg</td><td>the noise distribution</td></tr><tr><td>Pz</td><td>the dimensionality of a data sample (real or fake)</td></tr><tr><td>dx dz</td><td>the dimensionality of a noise sample</td></tr><tr><td></td><td></td></tr><tr><td>supp(p)</td><td>the support of distribution p a real sample</td></tr><tr><td>x~pr</td><td></td></tr><tr><td>z~pz y=G(z)</td><td>a noise vector drawn from the noise distribution pz a generated sample</td></tr><tr><td>Dr={x1,.., xn}</td><td>the set of n real samples</td></tr><tr><td>D()</td><td></td></tr><tr><td>={sy}</td><td>the set of m generated samples at step t</td></tr><tr><td>D(t)=D,UD(t) g</td><td>the training dataset at step t</td></tr></table>
# 2 RELATED WORKS
Gradient penalties are widely used in GANs literature. There are a plethora of works on using gradient penalty to improve the stability of GANs (Mescheder et al., 2018; Gulrajani et al., 2017; Petzka et al., 2018; Roth et al., 2017; Qi, 2017). However, these works mostly focused on making the training of GANs stable and convergent. Our work aims to improve the generalization capability of GANs via gradient regularization.
Arora et al. (2018) showed that the number of modes in the model distribution grows linearly with the size of the discriminator. The result implies that higher capacity discriminators are needed for better approximation of the target distribution. Zhang et al. (2018) studied the tradeoff between generalization and discrimination in GANs. The authors showed that generalization is guaranteed if the discriminator set is small enough. In practice, rich discriminators are usually used for better discriminative power. Our GP makes rich discriminators generalizable while remaining discriminative.
Although less mode collapse is not exactly the same as generalization, the ability to produce more diverse samples implies better generalization. There are a large number of papers on preventing mode collapse in GANs. Radford et al. (2015); Salimans et al. (2016) introduced a number of empirical tricks to help stabilizing GANs. Arjovsky & Bottou (2017) showed the importance of divergences in GAN training, leading to the introduction of Wasserstein GAN (Arjovsky et al., 2017). The use of weak divergence is further explored by Mroueh & Sercu (2017); Mroueh et al. (2018). Lucas et al. (2018) advocated the use of mixed-batches, mini-batches of real and fake data, to smooth out the loss surface. The method exploits the distributional information in a mini-batch to prevent mode collapse. VEEGAN (Srivastava et al., 2017) uses an inverse of the generator to map the data to the prior distribution. The mismatch between the inverse mapping and the prior is used to detect mode collapse. If the generator can remember the entire training set, then the inverse mapping can be arbitrarily close the the prior distribution. It suggests that VEEGAN might not be able to help GAN to generalize outside of the training dataset. Our method helps GANs to discover unseen regions of the target distribution, significantly improve the diversity of generated samples.
Table 1: Summary of different gradient penalties
<table><tr><td rowspan=1 colspan=1>GP</td><td rowspan=1 colspan=1>Formula</td><td rowspan=1 colspan=1>Improve gen-eralization</td><td rowspan=1 colspan=1>Preventgradexpoding</td><td rowspan=1 colspan=1>Convergenceguarantee</td></tr><tr><td rowspan=1 colspan=1>Our 0-GP</td><td rowspan=1 colspan=1>λEv∈c[l(VD)ull²], C fromytox</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>1-GP</td><td rowspan=1 colspan=1>XEx[(II(VD)xl 11)2],where 𝑥= ax+(1-α)y</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=1>0-GP-sample</td><td rowspan=1 colspan=1>XEv∈DII(VD)ull2]</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td></tr></table>
# 3 BACKGROUND
In the original GAN, the discriminator $D$ maximizes the following objective
$$\mathcal { L } = \mathbb { E } _ { { \pmb x } \sim p _ { r } } [ \log ( D ( { \pmb x } ) ) ] + \mathbb { E } _ { { \pmb z } \sim p _ { z } } [ \log ( 1 - D ( G ( { \pmb z } ) ) ) ]$$
Goodfellow et al. (2014) showed that if the density functions $p _ { g }$ and $p _ { r }$ are known, then for a fixed generator $G$ the optimal discriminator is
$$D ^ { * } ( \pmb { v } ) = \frac { p _ { r } ( \pmb { v } ) } { p _ { r } ( \pmb { v } ) + p _ { g } ( \pmb { v } ) } , \forall \pmb { v } \in s u p p ( p _ { r } ) \cup s u p p ( p _ { g } )$$
In the beginning of the training, $p _ { g }$ is very different from $p _ { r }$ so we have $p _ { r } ( { \pmb x } ) \gg p _ { g } ( { \pmb x } )$ , for $\mathbf { \boldsymbol { x } } \in \mathcal { D } _ { \boldsymbol { r } }$ and $p _ { g } ( \pmb { y } ) \gg \bar { p _ { r } } ( \pmb { y } )$ , for $\boldsymbol { y } \in \mathcal { D } _ { g }$ . Therefore, in the beginning of the training $D ^ { * } ( { \pmb x } ) \approx 1$ , for ${ \textbf { \em x } } \in$ $\mathcal { D } _ { r }$ and $D ^ { * } ( \pmb { y } ) \approx 0$ , for $\ b { y } \in \mathcal { D } _ { g }$ . As the training progresses, the generator will bring $p _ { g }$ closer to $p _ { r }$ . The game reaches the global equilibrium when $p _ { r } = p _ { g }$ . At the global equilibrium, $D ^ { \ast } ( v ) =$ ${ \frac { 1 } { 2 } } , \forall \pmb { v } \in s u p p ( p _ { r } ) \cup s u p p ( p _ { g } )$ . One important resulGAN algorithm, then f the original converges to er is that, if the discriminator. $p _ { g }$ $p _ { r }$
In practice, density functions are not known and the optimal discriminator is approximated by optimizing the classification performance of a parametric discriminator $D ( \cdot ; \pmb { \theta } _ { D } )$ on a discrete finite dataset $\mathcal { D } = \mathcal { D } _ { r } \cup \mathcal { D } _ { g }$ . We call a discriminator trained on a discrete finite dataset an empirical discriminator. The empirically optimal discriminator is denoted by $\hat { D } ^ { * }$ .
Arora et al. (2017) defined generalization of a divergence $d$ as follow: A divergence $d$ is said to have generalization error $\epsilon$ if
$$| d ( \mathcal { D } _ { g } , \mathcal { D } _ { r } ) - d ( p _ { g } , p _ { r } ) | \leq \epsilon$$
A discriminator $D$ defines a divergence between two distributions. The performance of a discriminator with good generalization capability on the training dataset should be similar to that on the entire data space. In practice, generalization capability of $D$ can be estimated by measuring the difference between its performance on the training dataset and a held-out dataset.
# 4 GENERALIZATION CAPABILITY OF DISCRIMINATORS
# 4.1 THE EMPIRICALLY OPTIMAL DISCRIMINATOR DOES NOT APPROXIMATE THE THEORETICALLY OPTIMAL DISCRIMINATOR
It has been observed that if the discriminator is too good at discriminating real and fake samples, the generator cannot learn effectively (Goodfellow et al., 2014; Arjovsky & Bottou, 2017). The phenomenon suggests that $\hat { D } ^ { * }$ does not well approximate $D ^ { * }$ , and does not guarantee the convergence of $p _ { g }$ to $p _ { r }$ . In the following, we clarify the mismatch between $\hat { D } ^ { * }$ and $D ^ { * }$ , and its implications.
 Figure 1: Value surfaces of discriminators trained for 10,000 iterations with different gradient penalties, on samples from two Gaussian distributions. The discriminator is a 2 hidden layer MLP with 64 hidden neurons.(a) No GP. (b) No GP with more samples. (c) One-centered GP (1-GP) with $\lambda = 1$ . (d) Zero-centered GP on real/fake samples only (0-GP-sample) with $\lambda = 1$ . (e) Our zero-centered GP with $\lambda = 1$ . (f) Theoretically optimal discriminator computed using Eqn. 2.
Proposition 1. The two datasets $\mathcal { D } _ { r }$ and $\mathcal { D } _ { g } ^ { ( t ) }$ are disjoint with probability 1 regardless of how close the two distributions $p _ { r }$ and $p _ { g } ^ { ( t ) }$ are.
Proof. See appendix A.
$\mathcal { D } _ { r }$ and $\mathcal { D } _ { g } ^ { ( t ) }$ are disjoint with probability 1 even when $p _ { g }$ and $p _ { r }$ are exactly the same. $\hat { D } ^ { * }$ perfectly classifies the real and the fake datasets, and $\hat { D } ^ { * } ( { \pmb x } ) = 1 , \forall { \pmb x } \in \mathcal { D } _ { r }$ , $\hat { D } ^ { * } ( \pmb { y } ) = 0 , \forall \pmb { y } \in \mathcal { D } _ { \pmb { g } } ^ { ( t ) }$ . The value of $\hat { D } ^ { * }$ on $\mathcal { D } ^ { ( t ) }$ does not depend on the distance between the two distributions and does not reflect the learning progress. The value of $\hat { D } ^ { * }$ on the training dataset approximates that of $D ^ { * }$ in the beginning of the learning process but not when the two distributions are close. When trained using gradient descent on a discrete finite dataset with the loss in Eqn. 1, the discriminator $D$ is pushed toward $\hat { D } ^ { * }$ , not $D ^ { * }$ . This behavior does not depend on the size of training set (see Fig. 1a, 1b), implying that the original GAN is not guaranteed to converge to the target distribution even when given enough data.
# 4.2 EMPIRICAL DISCRIMINATORS HAVE POOR GENERALIZATION CAPABILITY
When the generator gets better, generated samples are more similar to samples from the target distribution. However, regardless of their quality, generated samples are still labeled as fake in Eqn. 1. The training dataset $\mathcal { D }$ is a bad dataset as it contains many mislabeled examples. A discriminator trained on such dataset will overfit to the mislabeled examples and has poor generalization capability. It will misclassify unseen samples and cannot teach the generator to generate these samples.
Figure 1a and 1b demonstrate the problem on a synthetic dataset consisting of samples from two Gaussian distributions. The discriminator in Fig. 1a overfits to the small dataset and does not generalize to new samples in Fig. 1b. Although the discriminator in Fig. 1b was trained on a larger dataset which is sufficient to characterize the two distributions, it still overfits to the data and its value surface is very different from that of the theoretically optimal discriminator in Fig. 1f.
An overfitted discriminator does not guide the model distribution toward target distribution but toward the real samples in the dataset. This explains why the original GAN usually exhibits mode collapse behavior. Finding the empirically optimal discriminator using gradient descent usually requires many iterations. Heuristically, overfitting can be alleviated by limiting the number of discriminator updates per generator update. Goodfellow et al. (2014) recommended to update the discriminator once every generator update. In the next subsection, we show that limiting the number of discriminator updates per generator update prevents the discriminator from overfitting.
# 4.2.1 $\epsilon$ -OPTIMAL DISCRIMINATORS
$\hat { D } ^ { * }$ is costly to find and maintain. We consider here a weaker notion of optimality which can be achieved in practical settings.
Definition 1 ( $\cdot$ -optimal discriminator). Given two disjoint datasets $\mathcal { D } _ { r }$ and $\mathcal { D } _ { g }$ , and a number $\epsilon > 0$ , a discriminator $D$ is $\epsilon$ -optimal $i f$
$$\begin{array} { l l l } { { D ( { \pmb x } ) } } & { { \geq } } & { { \displaystyle \frac { 1 } { 2 } + \frac { \epsilon } { 2 } , \forall { \pmb x } \in \mathcal { D } _ { r } } } \\ { { D ( { \pmb y } ) } } & { { \leq } } & { { \displaystyle \frac { 1 } { 2 } - \frac { \epsilon } { 2 } , \forall { \pmb y } \in \mathcal { D } _ { g } } } \end{array}$$
As observed in Goodfellow et al. (2014), $\hat { D } ^ { * }$ does not generate usable gradient for the generator. Goodfellow et al. proposed the non-saturating loss for the generator to circumvent this vanishing gradient problem. For an $\epsilon$ -optimal discriminator, if $\epsilon$ is relatively small, then the gradient of the discriminator w.r.t. fake datapoints might not vanish and can be used to guide the model distribution toward the target distribution.
Proposition 2. Given two disjoint datasets $\mathcal { D } _ { r }$ and $\mathcal { D } _ { g }$ , and a number $\epsilon > 0$ , an $\epsilon$ -optimal discriminator $D _ { \epsilon }$ exists and can be constructed as a one hidden layer MLP with $\mathcal { O } ( d _ { x } ( m + n ) )$ parameters.
Proof. See appendix B.
Because deep networks are more powerful than shallow ones, the size of a deep $\epsilon$ -optimal discriminator can be much smaller than $\mathcal { O } ( d _ { x } ( m + n ) )$ . From the formula, the size of a shallow $\epsilon$ -optimal discriminator for real world datasets ranges from a few to hundreds of millions parameters. That is comparable to the size of discriminators used in practice. Arjovsky & Bottou (2017) showed that even when the generator can generate realistic samples, a discriminator that can perfectly classify real and fake samples can be found easily using gradient descent. The experiment verified that $\epsilon$ -optimal discriminator can be found using gradient descent in practical settings.
We observe that the norm of the gradient w.r.t. the discriminator’s parameters decreases as fakes samples approach real samples. If the discriminator’s learning rate is fixed, then the number of gradient descent steps that the discriminator has to take to reach $\epsilon$ -optimal state should increase.
Proposition 3. Alternating gradient descent with the same learning rate for discriminator and generator, and fixed number of discriminator updates per generator update (Fixed-Alt-GD) cannot maintain the (empirical) optimality of the discriminator.
Fixed-Alt-GD decreases the discriminative power of the discriminator to improve its generalization capability. The proof for linear case is given in appendix C.
In GANs trained with Two Timescale Update Rule (TTUR) (Heusel et al., 2017), the ratio between the learning rate of the discriminator and that of the generator goes to infinity as the iteration number goes to infinity. Therefore, the discriminator can learn much faster than the generator and might be able to maintain its optimality throughout the learning process.
# 4.2.2 GRADIENT EXPLODING IN $\epsilon$ -OPTIMAL DISCRIMINATORS
Let’s consider a simplified scenario where the real and the fake datasets each contains a single datapoint: $\mathcal { D } _ { r } = \{ { \pmb x } \}$ , $\mathcal { D } _ { g } ^ { ( t ) } = \{ \pmb { y } ^ { ( t ) } \}$ . Updating the generator according to the gradient from the discriminator will push $\mathbf { \boldsymbol { y } } ^ { ( t ) }$ toward $_ { \textbf { \em x } }$ . The absolute value of directional derivative of $D$ in the direction $\mathbf { \boldsymbol { u } } = \mathbf { \boldsymbol { x } } - \mathbf { \bar { y } } ^ { ( t ) }$ , at $_ { \textbf { \em x } }$ is
$$| ( \nabla _ { \pmb { u } } D ) _ { \pmb { x } } | = \operatorname* { l i m } _ { \pmb { y } ^ { ( t ) } \overset { \mathbf { u } } { } \pmb { x } } \frac { | D ( \pmb { x } ) - D ( \pmb { y } ^ { ( t ) } ) | } { \| \pmb { x } - \pmb { y } ^ { ( t ) } \| }$$
If $D$ is always $\epsilon$ -optimal, then $\begin{array} { r } { \left| D ( \pmb { x } ) - D ( \pmb { y } ^ { ( t ) } ) \right| \geq \epsilon , \forall t \in \mathbb { N } , } \end{array}$ , and
$$| ( \nabla _ { \pmb { u } } D ) _ { \pmb { x } } | \geq \operatorname* { l i m } _ { \pmb { y } ^ { ( t ) } \overset { \ b { u } } { } \pmb { x } } \frac { \epsilon } { \| \pmb { x } - \pmb { y } ^ { ( t ) } \| } = \infty$$
The directional derivate of the $\epsilon$ -optimal discriminator explodes as the fake datapoint approaches the real datapoint. Directional derivative exploding implies gradient exploding at datapoints on the line
 Figure 2: Gradient w.r.t. the input of the discriminator of a GAN trained with different gradient penalties. The vector associated with a datapoint $\textbf { { v } }$ points in the direction that increases the value of $\log \left( D ( \pmb { v } ) \right)$ the fastest. The discriminator is a 2 hidden layer MLP with 512 hidden neurons. The discriminator is updated once every generator update. SGD is used for optimization. (a), (b) No GP, iter. 1000 and 10,000. (c), (d) No GP with TTUR, iter. 1,000 and 10,000. (e) Our 0-GP with $\lambda = 1 0$ , iter. 10,000. (f), (g) Our 0-GP with TTUR and $\lambda = 1 0$ , iter. 10,000 and 20,000. (h) 1-GP with $\lambda = 1 0$ , iter. 10,000. (i) 0-GP-sample with $\lambda = 1 0$ , iter. 10,000.
segment connecting $_ { \textbf { \em x } }$ and $\mathbf { \boldsymbol { y } } ^ { ( t ) }$ . If in the next iteration, the generator produces a sample in a region where the gradient explodes, then the gradient w.r.t. the generator’s parameters explodes.
Let’s consider the following line integral
$$\int _ { \mathcal { C } } ( \nabla D ) _ { \pmb { v } } \cdot d \pmb { s } = D ( \pmb { x } ) - D ( \pmb { y } ^ { ( t ) } )$$
where $\mathcal { C }$ is the line segment from $\mathbf { \boldsymbol { y } } ^ { ( t ) }$ to $_ { \textbf { \em x } }$ . As the model distribution gets closer to the target distribution, the length of $\mathcal { C }$ should be non increasing. Therefore, maximizing $D ( \pmb { x } ) - D ( \pmb { y } ^ { ( t ) } )$ , or the discriminative power of $D$ , leads to the maximization of the directional derivative of $D$ in the direction $d s$ . The original GAN loss makes $D$ to maximize its discriminative power, encouraging gradient exploding to occur.
Gradient exploding happens in the discriminator trained with TTUR in Fig. 2c and 2d. Because TTUR can help the discriminator to maintain its optimality, gradient exploding happens and persists throughout the training process. Without TTUR, the discriminator cannot maintain its optimality so gradient exploding can happen sometimes during the training but does not persist (Fig. 2a and 2b). Because of the saturated regions in the sigmoid function used in neural network based discriminators, the gradient w.r.t. datapoints in the training set could vanishes. However, gradient exploding must happen at some datapoints on the path between a pair of samples, where the sigmoid function does not saturate. In Fig. 1a, gradient exploding happens near the decision boundary.
In practice, $\mathcal { D } _ { r }$ and $\mathcal { D } _ { g }$ contain many datapoints and the generator is updated using the average of gradients of the discriminator w.r.t. fake datapoints in the mini-batch. If a fake datapoint $\mathbf { { \boldsymbol { \psi } } } _ { 0 }$ is very close to a real datapoint $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ , the gradient $( \nabla D ) _ { y _ { 0 } }$ might explode. When the average gradient is computed over the mini-batch, $( \nabla D ) _ { y _ { 0 } }$ outweighs other gradients. The generator updated with this average gradient will move many fake datapoints in the direction of $( \nabla D ) _ { \boldsymbol { y } _ { 0 } }$ , toward $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ , making mode collapse visible.
# 5 IMPROVING GENERALIZATION CAPABILITY OF EMPIRICAL DISCRIMINATORS
Although the theoretically optimal discriminator $D ^ { * }$ is generalizable, the original GAN loss does not push empirical discriminators toward $D ^ { * }$ . We aim to improve the generalization capability of empirical discriminators by pushing them toward $D ^ { * }$ .
# 5.1 PUSHING EMPIRICAL DISCRIMINATORS TOWARD $D ^ { * }$
For any input $\pmb { v } \in s u p p ( p _ { r } ) \cup s u p p ( p _ { g } )$ , the value of $D ^ { \ast } ( v )$ goes to $\frac { 1 } { 2 }$ and the gradient $( \nabla D ) _ { v }$ goes to 0 as $p _ { g }$ approaches $p _ { r }$ . Consider again the line integral in Eqn. 4. As $D ^ { \ast } ( { \pmb x } )$ and $D ^ { \ast } ( y )$ approach $\frac { 1 } { 2 }$ for all $\pmb { x } \in s u p p ( p _ { r } )$ and $\pmb { y } \in s u p p ( p _ { g } )$ , we have
$$D ^ { * } ( { \pmb x } ) - D ^ { * } ( { \pmb y } ) = \int _ { { \mathcal { C } } } { ( \nabla D ^ { * } ) _ { \pmb v } \cdot d { \pmb s } } 0$$
for all pairs of $_ { \textbf { \em x } }$ and $\textbf { { y } }$ and all paths $\mathcal { C }$ from $\textbf { { y } }$ to $_ { \textbf { \em x } }$ . That means, the discriminative power of $D ^ { * }$ must decrease as the two distributions become more similar.
To push an empirical discriminator $D$ toward $D ^ { * }$ , we force $D$ to satisfy two requirements:
# 5.2 ZERO-CENTERED GRADIENT PENALTY
The first requirement can be implemented by sampling some datapoints $\pmb { v } \in s u p p ( p _ { r } ) \cup s u p p ( p _ { g } )$ and force $( \nabla D ) _ { v }$ to be 0. The second requirement can be implemented by sampling pairs of real and fake datapoints $( { \pmb x } , { \pmb y } )$ and force $D ( { \pmb x } ) - D ( { \pmb y } )$ to be 0. The two requirements can be added to the discriminator’s objective as follows
$$\hat { \mathcal { L } } = \mathcal { L } - \lambda _ { 1 } \mathbb { E } _ { v } [ \left\| ( \nabla D ) _ { v } \right\| ^ { 2 } ] - \lambda _ { 2 } \mathbb { E } _ { x , y } [ ( D ( \pmb { x } ) - D ( \pmb { y } ) ) ^ { 2 } ]$$
where $\mathcal { L }$ is the objective in Eqn. 1. However, as discussed in section 4.2.2, an $\epsilon$ -optimal discriminator can have zero gradient on the training dataset and have gradient exploding outside of the training dataset. The gradient norm could go to infinity even when $D ( { \pmb x } ) - D ( { \pmb y } )$ is small. Regulating the difference between $D ( { \pmb x } )$ and $D ( \pmb { y } )$ is not an efficient way to prevent gradient exploding.
We want to prevent gradient exploding on every path in $s u p p ( p _ { r } ) \cup s u p p ( p _ { g } )$ . Because $( \nabla D ^ { * } ) _ { \pmb { v } } $ 0 for all $\pmb { v } \in s u p p ( p _ { r } ) \cup s u p p ( p _ { g } )$ as $p _ { g }$ approach $p _ { r }$ , we could push the gradient w.r.t. every datapoint on every path $\mathcal { C } \in s u p p ( p _ { r } ) \cup s u p p ( p _ { g } )$ toward 0. We note that, if $( \nabla D ) _ { v } \to \mathbf { 0 } , \forall v \in \dot { c }$ then $\begin{array} { r } { \int _ { \mathcal { C } } ( \nabla D ) _ { \pmb { v } } \cdot \dot { d } \bar { \pmb { s } } 0 } \end{array}$ . Therefore, the two requirements can be enforced by a single zero-centered gradient penalty of the form
$$\lambda \mathbb { E } _ { v \in \mathcal { C } } [ \left. ( \nabla D ) _ { v } \right. ^ { 2 } ]$$
The remaining problem is how to find the path $\mathcal { C }$ from a fake to a real sample which lies inside $s u p p ( p _ { r } ) \cup \bar { s u p p } ( p _ { g } )$ . Because we do not have access to the full supports of $p _ { r }$ and $p _ { g }$ , and the supports of two distributions could be disjoint in the beginning of the training process, finding a path which lies completely inside the support is infeasible.
In the current implementation, we approximate $\mathcal { C }$ with the straight line connecting a pair of samples, although there is no guarantee that all datapoints on that straight line are in $s u p p ( p _ { r } ) \cup s u p p ( p _ { g } )$ . That results in the following objective
$$\mathcal { L } _ { 0 - G P } = \mathcal { L } - \lambda \mathbb { E } _ { \tilde { \pmb { x } } } [ \| ( \nabla D ) _ { \tilde { \pmb { x } } } \| ^ { 2 } ]$$
where $\tilde { \pmb { x } } = \alpha \pmb { x } + ( 1 - \alpha ) \pmb { y }$ , $\mathbf { \boldsymbol { x } } \sim p _ { r }$ , $\mathbf { \boldsymbol { y } } \sim p _ { g }$ , and $\alpha \sim \mathcal { U } ( 0 , 1 )$ 1. We describe a more sophisticated way of finding a better path in appendix $\mathrm { F }$ .
The larger $\lambda$ is, the stronger $( \nabla D ) _ { \tilde { \pmb { x } } }$ is pushed toward 0. If $\lambda$ is 0, then the discriminator will only focus on maximizing its discriminative power. If $\lambda$ approaches infinity, then the discriminator has maximum generalization capability and no discriminative power. $\lambda$ controls the tradeoff between discrimination and generalization in the discriminator.
# 5.3 GENERALIZATION CAPABILITY OF DIFFERENT GRADIENT PENALTIES
Mescheder et al. (2018) proposed to force the gradient w.r.t. datapoints in the real and/or fake dataset(s) to be 0 to make the training of GANs convergent. In section 4, we showed that for discrete training dataset, an empirically optimal discriminator $\hat { D } ^ { * }$ always exists and could be found by gradient descent. Although $( \nabla \hat { D } ^ { * } ) _ { \pmb { v } } = \mathbf { 0 } , \forall \ \pmb { v } \in \mathcal { D } .$ , $\hat { D } ^ { * }$ does not satisfy the requirement in Eqn. 5 and have gradient exploding when some fake datapoints approach a real datapoint. The discriminators in Fig. 1a, 1b, 1d, 2c and 2d have vanishingly small gradients on datapoints in the training dataset and very large gradients outside. They have poor generalization capability and cannot teach the generator to generate unseen real datapoints. Therefore, zero-centered gradient penalty on samples from $p _ { r }$ and $p _ { g }$ only cannot help improving the generalization of the discriminator.
Non-zero centered $G P s$ do not push an empirical discriminator toward $D ^ { * }$ because the gradient does not converge to 0. A commonly used non-zero centered GP is the one-centered GP (1-GP) (Gulrajani et al., 2017) which has the following form
$$\lambda \mathbb { E } _ { \tilde { \pmb { x } } } [ ( \| ( \nabla D ) _ { \tilde { \pmb { x } } } \| - 1 ) ^ { 2 } ]$$
where $\tilde { \pmb { x } } = \alpha \pmb { x } + ( 1 - \alpha ) \pmb { y }$ , $\mathbfit { x } \sim p _ { r }$ , ${ \mathbf { \nabla } } y \sim p _ { g }$ , and $\alpha \sim \mathcal { U } ( 0 , 1 )$ . Although the initial goal of 1-GP was to enforce Lipschitz constraint on the discriminator 2, Fedus et al. (2018) found that 1-GP prevents gradient exploding, making the original GAN more stable. 1-GP forces the norm of gradients w.r.t. datapoints on the line segment connecting $_ { \textbf { \em x } }$ and $\textbf { { y } }$ to be 1. If all gradients on the line segment have norm 1, then the line integral in Eqn. 4 could be as large as $\| { \pmb x } - { \pmb y } \|$ . Because the distance between random samples grows with the dimensionality, in high dimensional space $\| { \pmb x } - { \pmb y } \|$ is greater than 1 with high probability. The discriminator could maximize the value of the line integral without violating the Lipschitz constraint. The discriminator trained with 1-GP, therefore, can overfit to the training data and have poor generalization capability.
# 5.4 CONVERGENCE ANALYSIS FOR ZERO-CENTERED GRADIENT PENALTY
Mescheder et al. (2018) showed that zero-centered GP on real and/or fake samples (0-GP-sample) makes GANs convergent. The penalty is based on the convergence analysis for the Dirac GAN, an 1-dimensional linear GAN which learns the Dirac distribution. The intuition is that when $p _ { g }$ is the same as $p _ { r }$ , the gradient of the discriminator w.r.t. the fake datapoints (which are also real datapoints) should be 0 so that generator will not move away when being updated using this gradient. If the gradient from the discriminator is not 0, then the generator will oscillate around the equilibrium.
Our GP forces the gradient w.r.t. all datapoints on the line segment between a pair of samples (including the two endpoints) to be 0. As a result, our GP also prevents the generator from oscillating. Therefore, our GP has the same convergence guarantee as the 0-GP-sample.
# 5.5 ZERO-CENTERED GRADIENT PENALTY IMPROVES CAPACITY DISTRIBUTION
Discriminators trained with the original GAN loss tends to focus on the region of the where fake samples are close to real samples, ignoring other regions. The phenomenon can be seen in Fig. 2a, 2b, 2c, 2d, 2h and 2i. Gradients in the region where fake samples are concentrated are large while gradients in other regions, including regions where real samples are located, are very small. The generator cannot discover and generate real datapoints in regions where the gradient vanishes.
When trained with the objective in Eqn. 6, the discriminator will have to balance between maximizing $\mathcal { L }$ and minimizing the GP. For finite $\lambda$ , the GP term will not be exactly 0. Let $\gamma = \lambda \mathbb { E } _ { \tilde { \pmb { x } } } [ \| ( \nabla D ) _ { \tilde { \pmb { x } } } \| ^ { 2 } ]$ . Among discriminators with the same value of $\gamma$ , gradient descent will find the discriminator that maximizes $\mathcal { L }$ . As discussed in section 4.2.2, maximizing $\mathcal { L }$ leads to the maximization of norms of gradients on the path from $\textbf { { y } }$ to $_ { \textbf { \em x } }$ . The discriminator should maximize the value $\eta = \mathbb { E } _ { \tilde { \pmb { x } } } [ \| ( \nabla D ) _ { \tilde { \pmb { x } } } \| ]$ . If $\gamma$ is fixed then $\eta$ is maximized when $\| \nabla D _ { \tilde { \pmb { x } } ^ { ( i ) } } \| = \| \nabla D _ { \tilde { \pmb { x } } ^ { ( j ) } } \| , \forall i , j$ (Cauchy-Schwarz inequality). Therefore, our zero-centered GP encourages the gradients at different regions of the real data space to have the same norm. The capacity of $D$ is distributed more equally between regions of the real data space, effectively reduce mode collapse. The effect can be seen in Fig. 2e and 2f.
1-GP encourages $| \| \nabla D _ { \tilde { \mathbf { x } } ^ { ( i ) } } \| - 1 | = | \| \nabla D _ { \tilde { \mathbf { x } } ^ { ( j ) } } \| - 1 | , \forall ~ i , j$ . That allows gradient norms to be smaller than 1 in some regions and larger than 1 in some other regions. The problem can be seen in Fig. 2h.
# 6 EXPERIMENTS
The code is made available at https://github.com/htt210/ GeneralizationAndStabilityInGANs.
# 6.1 ZERO-CENTERED GRADIENT PENALTY PREVENTS OVERFITTING
To test the effectiveness of gradient penalties in preventing overfitting, we designed a dataset with real and fake samples coming from two Gaussian distributions and trained a MLP based discriminator on that dataset. The result is shown in Fig. 1. As predicted in section 5.3, 0-GP-sample does not help to improve generalization. 1-GP helps to improve generalization. The value surface in Fig. 1c is smoother than that in Fig. 1a. However, as discussed in section 5.3, 1-GP cannot help much in higher dimensional space where the pair-wise distances are large. The discriminator trained with our 0-GP has the best generalization capability, with a value surface which is the most similar to that of the theoretically optimal one.
We increased the number of discriminator updates per generator update to 5 to see the effect of GPs in preventing overfitting. On the MNIST dataset, GAN without GP and with other GPs cannot learn anything after 10,000 iterations. GAN with our 0-GP can still learn normally and start produce recognizable digits after only 1,000 iterations. The result confirms that our GP is effective in preventing overfitting in the discriminator.
# 6.2 ZERO-CENTERED GRADIENT PENALTY IMPROVES GENERALIZATION AND ROBUSTNESS OF GANS
# SYNTHETIC DATA
We tested different gradient penalties on a number of synthetic datasets to compare their effectiveness. The first dataset is a mixture of 8 Gaussians. The dataset is scaled up by a factor of 10 to simulate the situation in high dimensional space where random samples are far from each other. The result is shown in Fig. 2. GANs with other gradient penalties all fail to learn the distribution and exhibit mode collapse problem to different extents. GAN with our 0-GP (GAN-0-GP) can successfully learn the distribution. Furthermore, GAN-0-GP can generate datapoints on the circle, demonstrating good generalization capability. The original GAN collapses to some disconnected modes and cannot perform smooth interpolation between modes: small change in the input result in large, unpredictable change in the output. GAN with zero-centered GP on real/fake samples only also exhibits the same ”mode jumping” behavior. The behavior suggests that these GANs tend to remember the training dataset and have poor generalization capability. Fig. 9 in appendix D demonstrates the problem on MNIST dataset.
We observe that GAN-0-GP behaves similar to Wasserstein GAN as it first learns the overall structure of the distribution and then focuses on the modes. An evolution sequence of GAN-0-GP is shown in Fig. 5 in appendix D. Results on other synthetic datasets are shown in appendix D.
# MNIST DATASET
The result on MNIST dataset is shown in Fig. 3. After 1,000 iterations, all other GANs exhibit mode collapse or cannot learn anything. GAN-0-GP is robust to changes in hyper parameters such
 Figure 3: Result on MNIST. The networks have the same architectures with networks used in synthetic experiment. Batch normalization (Ioffe & Szegedy, 2015) was not used. Adam optimizer (Kingma & Ba, 2014) with $\beta _ { 1 } = 0 . 5$ , $\beta _ { 2 } = 0 . 9$ was used. (a) No GP, iter. 1,000. (b) 0-GP-sample, $\lambda = 1 0 0$ , iter. 1,000. (c) 1-GP, $\lambda = 1 0 0$ , iter. 1,000. (d), (e) 0-GP, $\lambda = 1 0 0$ , iter. 1,000 and 10,000.
 Figure 4: Inception score (Salimans et al., 2016) on ImageNet of GAN-0-GP, GAN-0-GP-sample, and WGAN-GP. The code for this experiment is adapted from Mescheder et al. (2018). We used $\lambda = 1 0$ for all GANs as recommended by Mescheder et al. The critic in WGAN-GP was updated 5 times per generator update. To improve convergence, we used TTUR with learning rates of 0.0001 and 0.0003 for the generator and discriminator, respectively.
as learning rate and optimizers. When Adam is initialized with large $\beta _ { 1 }$ , e.g. 0.9, GANs with other GPs cannot learn anything after many iterations. More samples are given in appendix D.
We observe that higher value of $\lambda$ improves the diversity of generated samples. For $\lambda = 5 0$ , we observe some similar looking samples in the generated data. This is consistent with our conjecture that larger $\lambda$ leads to better generalization.
# IMAGENET
When trained on ImangeNet (Deng et al., 2009), GAN-0-GP can produce high quality samples from all 1,000 classes. We compared our method with GAN with 0-GP-sample and WGAN-GP. GAN-0- GP-sample is able to produce samples of state of the art quality without using progressive growing trick (Karras et al., 2018). The result in Fig. 4 shows that our method consistently outperforms GAN-0-GP-sample. GAN-0-GP and GAN-0-GP-sample outperform WGAN-GP by a large margin. Image samples are given in appendix D.
# 7 CONCLUSION
In this paper, we clarify the reason behind the poor generalization capability of GAN. We show that the original GAN loss does not guide the discriminator and the generator toward a generalizable equilibrium. We propose a zero-centered gradient penalty which pushes empirical discriminators toward the optimal discriminator with good generalization capability. Our gradient penalty provides better generalization and convergence guarantee than other gradient penalties. Experiments on diverse datasets verify that our method significantly improves the generalization and stability of GANs.
# REFERENCES
M. Arjovsky and L. Bottou. Towards Principled Methods for Training Generative Adversarial Networks. ArXiv e-prints, January 2017.
Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 214–223, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR.
Sanjeev Arora, Rong Ge, Yingyu Liang, Tengyu Ma, and Yi Zhang. Generalization and equilibrium in generative adversarial nets (GANs). In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 224–232, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR.
Sanjeev Arora, Andrej Risteski, and Yi Zhang. Do GANs learn the distribution? some theory and empirics. In International Conference on Learning Representations, 2018.
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.
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, 2018.
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 2672–2680. Curran Associates, Inc., 2014.
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein gans. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 5767–5777. Curran Associates, Inc., 2017.
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 6626–6637. Curran Associates, Inc., 2017.
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 448–456, Lille, France, 07–09 Jul 2015. PMLR.
Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In International Conference on Learning Representations, 2018.
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
Thomas Lucas, Corentin Tallec, Yann Ollivier, and Jakob Verbeek. Mixed batches and symmetric discriminators for GAN training. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 2844–2853, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR.
Lars Mescheder, Andreas Geiger, and Sebastian Nowozin. Which training methods for GANs do actually converge? In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 3478–3487, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR.
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In International Conference on Learning Representations, 2018.
Youssef Mroueh and Tom Sercu. Fisher gan. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 2513–2523. Curran Associates, Inc., 2017.
Youssef Mroueh, Chun-Liang Li, Tom Sercu, Anant Raj, and Yu Cheng. Sobolev GAN. In International Conference on Learning Representations, 2018.
Vaishnavh Nagarajan and J. Zico Kolter. Gradient descent gan optimization is locally stable. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 5585–5595. Curran Associates, Inc., 2017.
Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
Henning Petzka, Asja Fischer, and Denis Lukovnikov. On the regularization of wasserstein GANs. In International Conference on Learning Representations, 2018.
G.-J. Qi. Loss-Sensitive Generative Adversarial Networks on Lipschitz Densities. ArXiv e-prints, January 2017.
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. CoRR, abs/1511.06434, 2015.
Kevin Roth, Aurelien Lucchi, Sebastian Nowozin, and Thomas Hofmann. Stabilizing training of generative adversarial networks through regularization. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 2018–2028. Curran Associates, Inc., 2017.
Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, Xi Chen, and Xi Chen. Improved techniques for training gans. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 2234–2242. Curran Associates, Inc., 2016.
Akash Srivastava, Lazar Valkoz, Chris Russell, Michael U. Gutmann, and Charles Sutton. Veegan: Reducing mode collapse in gans using implicit variational learning. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 3308–3318. Curran Associates, Inc., 2017.
Jiqing Wu, Zhiwu Huang, Janine Thoma, Dinesh Acharya, and Luc Van Gool. Wasserstein divergence for gans. In Vittorio Ferrari, Martial Hebert, Cristian Sminchisescu, and Yair Weiss (eds.), Computer Vision – ECCV 2018, pp. 673–688, Cham, 2018. Springer International Publishing. ISBN 978-3-030-01228-1.
Pengchuan Zhang, Qiang Liu, Dengyong Zhou, Tao Xu, and Xiaodong He. On the discriminationgeneralization tradeoff in GANs. In International Conference on Learning Representations, 2018.
# A PROOF FOR PROPOSITION 1
For continuous random variable $V$ , $\mathbb { P } ( V = v ) = 0$ for any $\pmb { v }$ . The probability of finding a noise vector $_ z$ such that $G ( z )$ is exactly equal to a real datapoint $\textbf { \em x } \in \ \mathcal { D } _ { r }$ via random sampling is 0. Therefore, the probability of a real datapoint $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ being in the fake dataset $\mathcal { D } _ { g }$ is 0. Similarly, the probability of any fake datapoint being in the real dataset is 0.
$$\begin{array} { r c l } { \mathbb { P } ( { \pmb x } \in \mathcal { D } _ { g } ^ { ( t ) } ) } & { = } & { 0 , \forall { \pmb x } \in \mathcal { D } _ { r } , t \in \mathbb { N } } \\ { \mathbb { P } ( { \pmb y } \in \mathcal { D } _ { r } ) } & { = } & { 0 , \forall { \pmb y } \in \mathcal { D } _ { g } ^ { ( t ) } , t \in \mathbb { N } } \\ { \mathbb { P } ( \mathcal { D } _ { r } \cap \mathcal { D } _ { g } ^ { ( t ) } = \emptyset ) } & { = } & { 1 , \forall t \in \mathbb { N } } \end{array}$$
Furthermore, due to the curse of dimensionality, the probability of sampling a datapoint which is close to another datapoint in high dimensional space also decrease exponentially. The distances between datapoints are larger in higher dimensional space. That suggests that it is easier to separate $\mathcal { D } _ { r }$ and $\mathcal { D } _ { g } ^ { ( t ) }$ in higher dimensional space.
# B CONSTRUCTING $\epsilon$ -OPTIMAL DISCRIMINATORS
To make the construction process simpler, let’s assume that samples are normalized:
$$\| { \pmb x } _ { i } \| = \| { \pmb y } _ { j } \| = 1 , \forall { \pmb x } _ { i } \in \mathcal { D } _ { r } , { \pmb y } _ { j } \in \mathcal { D } _ { g }$$
Let’s use the following new notations for real and fake samples:
$$\begin{array} { r c l } { { \mathcal { D } } } & { { = } } & { { \mathcal { D } _ { \boldsymbol { r } } \cup \mathcal { D } _ { \boldsymbol { g } } = \{ \pmb { v } _ { 1 } , . . . , \pmb { v } _ { m + n } \} } } \\ { { \ \pmb { v } _ { i } } } & { { = } } & { { \left\{ \begin{array} { l l } { { \pmb { x } _ { i } , \mathrm { f o r } i = 1 , . . . , n } } \\ { { \pmb { y } _ { i - n } , \mathrm { f o r } i = n + 1 , . . . , n + m } } \end{array} \right. } } \end{array}$$
We construct the $\epsilon$ -optimal discriminator $D$ as a MLP with 1 hidden layer. Let $W _ { 1 } \in \mathbb { R } ^ { ( m + n ) \times d _ { x } }$ and $W _ { 2 } \in \mathbb { R } ^ { m + n }$ be the weight matrices of $D$ . The total number of parameters in $D$ is $d _ { x } ( m +$ $n ) + ( m + n ) = \mathcal { O } ( d _ { x } ( m + n ) )$ . We set the value of $W _ { 1 }$ as
$$\begin{array} { r c l } { W _ { 1 } } & { = } & { k \left[ \begin{array} { c } { { \pmb v } _ { 1 } ^ { \top } } \\ { \vdots } \\ { \vdots } \\ { { \pmb v } _ { n + m } ^ { \top } } \end{array} \right] } \end{array}$$
and $W _ { 2 }$ as
$$\begin{array} { l c l } { { W _ { 2 , i } } } & { { = } } & { { \displaystyle \frac { 1 } { 2 } + \frac { \epsilon } { 2 } + \alpha , \mathrm { f o r } i = 1 , . . . , n } } \\ { { } } & { { } } & { { } } \\ { { W _ { 2 , i } } } & { { = } } & { { \displaystyle \frac { 1 } { 2 } - \frac { \epsilon } { 2 } - \alpha , \mathrm { f o r } i = n + 1 , . . . , n + m } } \\ { { \alpha } } & { { > } } & { { 0 } } \end{array}$$
Given an input $v \in \mathcal { D }$ , the output is computed as:
$$D ( \pmb { v } ) = \pmb { W } _ { 2 } ^ { \top } \sigma ( \pmb { W } _ { 1 } \pmb { v } )$$
where $\sigma$ is the softmax function. Let $\mathbf { \Delta } a = W _ { 1 } \mathbf { \Delta } v$ , we have
$$a _ { i } = k { \pmb v } _ { i } ^ { \top } { \pmb v } = \left\{ k , \begin{array} { l l } { k , } & { \mathrm { i f ~ } { \pmb v } = { \pmb v } _ { i } } \\ { < k , } & { \mathrm { i f ~ } { \pmb v } \ne { \pmb v } _ { i } } \end{array} \right.$$
As $k \infty$ , $\sigma ( { \cal W } _ { 1 } { \pmb v } _ { i } )$ becomes a one-hot vector with the $i$ -th element being 1, all other elements being 0. Thus, for large enough $k$ , for any $\boldsymbol { v } _ { j } \in \mathcal { D }$ , the output of the network is
$$\begin{array} { r } { D ( \pmb { v } _ { j } ) = \pmb { W } _ { 2 } ^ { \top } \sigma ( \pmb { W } _ { 1 } \pmb { v } _ { j } ) \approx \pmb { W } _ { 2 , j } = \left\{ \begin{array} { l l } { > \frac { 1 } { 2 } + \frac { \epsilon } { 2 } , \mathrm { f o r } j = 1 , . . . , n } \\ { < \frac { 1 } { 2 } - \frac { \epsilon } { 2 } , \mathrm { f o r } j = n + 1 , . . . , n + m } \end{array} \right. } \end{array}$$
$D$ is a $\epsilon$ -optimal discriminator for dataset $\mathcal { D }$ .
# C FIXED-ALT-GD CANNOT MAINTAIN THE OPTIMALITY OF $\epsilon$ -DISCRIMINATORS
Let’s consider the case where the real and the fake dataset each contain a single datapoint $\mathcal { D } _ { r } = \{ { \pmb x } \}$ , $\mathcal { D } _ { g } ^ { ( t ) } = \mathbf { \mathscr { y } } ^ { ( t ) }$ , and the discriminator and the generator are linear:
$$\begin{array} { r l r } { D ( { \pmb v } ) } & { { } = } & { { \pmb \theta } _ { D } ^ { \top } { \pmb v } } \\ { G ( { \pmb z } ) } & { { } = } & { { \pmb \theta } _ { G } { \pmb z } } \end{array}$$
and the objective is also linear (Wasserstein GAN’s objective):
$$\begin{array} { r c l } { \mathscr { L } _ { \mathcal { W } } } & { = } & { \mathbb { E } _ { { \pmb { x } } \in \mathcal { D } _ { r } } [ D ( { \pmb { x } } ) ] - \mathbb { E } _ { { \pmb { y } } \in \mathcal { D } _ { g } ^ { ( t ) } } [ D ( \pmb { y } ) ] } \\ & { = } & { D ( { \pmb { x } } ) - D ( { \pmb { y } } ^ { ( t ) } ) } \end{array}$$
The same learning rate $\alpha$ is used for $D$ and $G$ .
At step $t$ , the discriminator is $\epsilon$ -optimal
$$\begin{array} { r c l } { { \displaystyle { \cal D } ( { \pmb x } ) - { \cal D } ( { \pmb y } ^ { ( t ) } ) } } & { { = } } & { { \pmb \theta _ { \cal D } ^ { \top } \left( { \pmb x } - { \pmb y } ^ { ( t ) } \right) \geq \epsilon } } \\ { { \| { \pmb \theta } _ { \cal D } \| } } & { { \geq } } & { { \displaystyle \frac { \epsilon } { \| { \pmb x } - { \pmb y } ^ { ( t ) } \| } } } \end{array}$$
The gradients w.r.t. $\theta _ { D }$ and $\theta _ { G }$ are
$$\begin{array} { r c l } { \displaystyle \frac { \partial \mathcal { L } } { \partial \theta _ { D } } } & { = } & { \pmb { x } - \pmb { y } ^ { ( t ) } } \\ { \displaystyle \frac { \partial \mathcal { L } } { \partial \pmb { \theta } _ { G } } } & { = } & { \displaystyle \frac { \partial \mathcal { L } } { \partial \pmb { y } ^ { ( t ) } } \times \pmb { z } ^ { \top } } \\ & { = } & { \pmb { \theta } _ { D } \times \pmb { z } ^ { \top } } \end{array}$$
If the learning rate $\alpha$ is small enough, $\| x - y ^ { ( t ) } \|$ should decrease as $t$ increases. As the empirical fake distribution converges to the empirical real distribution, $\| { \pmb x } - { \pmb y } ^ { ( t ) } \| 0$ . The norm of gradient w.r.t. $\pmb { \theta } _ { D }$ , therefore, decreases as $t$ increases and vanishes when the two empirical distributions are the same. From Eqn. 10, we see that, in order to maintain $D$ ’s $\epsilon$ -optimality when $\| x - y ^ { ( t ) } \|$ decreases, $\| \pmb \theta _ { D } \|$ has to increase. From Eqn. 10 and 12, we see that the gradient w.r.t. $\theta _ { G }$ grows as the two empirical distributions are more similar. As $\| { \pmb x } - { \pmb y } ^ { ( t ) } \| 0$ ,
$${ \frac { \left\| { \frac { \partial { \mathcal { L } } _ { w } } { \partial \theta _ { D } } } \right\| } { \left\| { \frac { \partial { \mathcal { L } } _ { w } } { \partial \theta _ { G } } } \right\| } } \to 0$$
Because the same learning rate $\alpha$ is used for both $G$ and $D , G$ will learn much faster than $D$ . Furthermore, because $\| \mathbfcal { x } - \mathbfcal { y } ^ { ( t ) } \|$ decreases as $t$ increases, the difference
$$\frac { \epsilon } { \left\| x - y ^ { ( t + 1 ) } \right\| } - \frac { \epsilon } { \left\| x - y ^ { ( t ) } \right\| }$$
increases with $t$ . The number of gradient steps that $D$ has to take to reach the next $\epsilon$ -optimal state increases, and goes to infinity as $\| \pmb { x } - \pmb { y } ^ { ( t ) } \| _ { . } ^ { - } 0$ . Therefore, gradient descent with fixed number of updates to $\theta _ { D }$ cannot maintain the optimality of $D$ .
The derivation for the objective in Eqn. 1 is similar.
# D RESULTS ON DIFFERENT DATASETS
 Figure 5: Evolution of GAN-0-GP with $\lambda = 1 0 0$ on 8 Gaussians dataset.
 Figure 6: GANs trained with different gradient penalty on swissroll dataset. Although GAN-1-GP is able to learn the distribution, the gradient field has bad pattern. GAN-1-GP is more sensitive to change in hyper parameters and optimizers. GAN-1-GP fails to learn the scaled up version of the distribution.
 Figure 7: Result on MNIST. Adam was initialized with $\beta _ { 1 } = 0 . 5 , \beta _ { 2 } = 0 . 9$ . (a) No GP, iteration 10,000. (b) Zero-centered GP on real samples only with $\lambda = 1 0 0$ , iteration 10,000. (c) One-centered GP with $\lambda = 1 0 0$ , iteration 10,000. (d) Our zero-centered GP with $\lambda = 1 0 0$ , iteration 10,000.
 Figure 8: Result on MNIST. Adam was initialized with $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 9$ . (a) Zero-centered GP on real samples only with $\lambda = 1 0 0$ , iteration 10,000. (b) Our zero-centered GP with $\lambda = 1 0 0$ , iteration 10,000.
 Figure 9: Linear latent space interpolation between two random samples. (a) GAN with 0-GPsample cannot perform smooth interpolation between modes. Small changes in input latent variable result in big difference in the output (red boxes). The result suggest that 0-GP-sample makes GANs to remember the training dataset and do not generalize to the region between samples in the training dataset. (b) GAN with our 0-GP can perform smooth interpolation between modes. The behavior implies that GANs with our 0-GP have better generalization.
 (a) All categories
 Figure 10: Samples from GAN-0-GP trained on ImageNet.
# E IMPLEMENTATION DETAILS
We used Pytorch (Paszke et al., 2017) for development.
# E.1 SYNTHETIC AND MNIST DATASETS
Generator architecture in synthetic and MNIST experiments
<table><tr><td rowspan=1 colspan=1>Fullyconnected layer2 × nhidden</td></tr><tr><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>Fullyconnectedlayer nhidden × nhidden</td></tr><tr><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>Fullyconnected layernhidden× nhidden</td></tr><tr><td rowspan=1 colspan=1>←</td></tr><tr><td rowspan=1 colspan=1>Fullyconnected layer nhidden × 2</td></tr></table>
Discriminator architecture in synthetic and MNIST experiments
<table><tr><td rowspan=1 colspan=1>Fullyconnected layer 2× nhidden</td></tr><tr><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>Fully connected layer nhidden × nhidden</td></tr><tr><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>Fully connected layer nhidden × nhidden</td></tr><tr><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>Fullyconnected layer nhidden ×1</td></tr><tr><td rowspan=1 colspan=1>↓</td></tr><tr><td rowspan=1 colspan=1>Sigmoid</td></tr></table>
Hyper parameters for synthetic and MNIST experiments
<table><tr><td>Learning rate</td><td>0.003forboth Gand D</td></tr><tr><td>Learning rateTTUR</td><td>0.003for G,0.009 for D</td></tr></table>
# E.2 IMAGENET
The entire ImageNet dataset with all 1000 classes was used in the experiment. Because of our hardware limits, we used images of size $6 4 \times 6 4$ . We used the code from Mescheder et al. (2018), available at https://github.com/LMescheder/GAN stability, for our experiment. Generator and Discriminator are ResNets, each contains 5 residual blocks. All GANs in our experiment have the same architectures and hyper parameters. The configuration for WGAN-GP5 is as follows.
generator: name: resnet2 kwargs: nfilter: 32 nfilter_max: 512 embed_size: 128 discriminator: name: resnet2 kwargs: nfilter: 32 nfilter_max: 512 embed_size: 128 z_dist: type: gauss dim: 128 training: out_dir: ../output/imagenet_wgangp5_TTUR gan_type: wgan reg_type: wgangp reg_param: 10. batch_size: 64 nworkers: 32 take_model_average: true model_average_beta: 0.999 model_average_reinit: false monitoring: tensorboard sample_every: 1000 sample_nlabels: 20 inception_every: 10000 save_every: 900 backup_every: 100000 restart_every: -1 optimizer: adam lr_g: 0.0001 lr_d: 0.0003 lr_anneal: 1. lr_anneal_every: 150000 d_steps: 5 equalize_lr: false
# F FINDING A BETTER PATH BETWEEN A PAIR OF SAMPLES
Because the set of real data is unlikely to be convex, a linear interpolation between two datapoints is unlikely to be in the set. For example, the weighted average of two real images is often not a real image. If the generator is good enough then its output is likely to be on the real data manifold. A path $\mathcal { C }$ from $\textbf { { y } }$ to $_ { \textbf { \em x } }$ can be found by transforming the straight line between the two corresponding latent codes, to the data space using the generator $G$ . To get the latent code of real datapoints, we use an encoder $E$ which is trained to map real data to normally distributed latent codes. The pseudo code of the path finding algorithm is shown in Alg. 1.
Data: an encoder $E$ ; a pair of samples $\pmb { x } , \pmb { y } = G ( z )$ ; Result: interpolated datapoint $\tilde { \pmb x }$ 1 Get the latent code of $_ { \textbf { \em x } }$ : $z _ { x } = E ( { \pmb x } )$ 2 Calculate the interpolated latent code: $\tilde { z } = \alpha z _ { x } + ( 1 - \alpha ) z$ 3 Generate the interpolated datapoint: ${ \tilde { \pmb x } } = G ( { \tilde { z } } )$ Algorithm 1: Path finding algorithm123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540# A FREQUENCY DOMAIN ANALYSIS OF GRADIENTBASED ADVERSARIAL EXAMPLES
Anonymous authors Paper under double-blind review
# ABSTRACT
It is well known that deep neural networks are vulnerable to adversarial examples. We attempt to understand adversarial examples from the perspective of frequency analysis. Several works have empirically shown that the gradient-based adversarial attacks perform differently in the low-frequency and high-frequency part of the input data. But there is still a lack of theoretical justification of these phenomena. In this work, we both theoretically and empirically show that the adversarial perturbations gradually increase the concentration in the low-frequency domain of the spectrum during the training process of the model parameters. And the log-spectrum difference of the adversarial examples and clean image is more concentrated in the high-frequency part than the low-frequency part. We also find out that the ratio of the high-frequency and the low-frequency part in the adversarial perturbation is much larger than that in the corresponding natural image. Inspired by these important theoretical findings, we apply low-pass filter to potential adversarial examples before feeding them to the model. The results show that this preprocessing can significantly improve the robustness of the model.
# 1 INTRODUCTION
Recently, deep neural networks (DNN) have achieved great success in the field of image processing, but it was found that DNNs are vulnerable to some synthetic data called adversarial examples ((Szegedy et al., 2013), (Kurakin et al., 2016)). Adversarial examples are natural samples plus adversarial perturbations, and the perturbations between natural samples and adversarial examples are imperceptible to human but able to fool the model. Typically, generating an adversarial example can be considered as finding an example in an $\epsilon$ -ball around a natural image that could be misclassified by the classifier. Recent studies designed Fast Gradient Sign Method (FGSM, (Goodfellow et al., 2014)), Fast Gradient Method (FGM, (Miyato et al., 2016)), Projected Gradient Descent (PGD, (Madry et al., 2017)) and other algorithms (Carlini & Wagner (2017), (Su et al., 2019), (Xiao et al., 2018), (Kurakin et al., 2016), (Chen et al., 2017)) to attack the model.
Since the phenomenon of adversarial examples was discovered, many related works have made progress to study why they exist. Several works studied this phenomenon from the perspective of feature representation. Ilyas et al. (2019) divided the features into non-robust ones that are responsible for the model’s vulnerability to adversarial examples, and robust ones that are close to human perception. Further, they showed that adversarial vulnerability arises from non-robust features that are useful for correct classification.
Another way to characterize adversarial examples is to investigate them in the frequency domain via Fourier transform. Wang et al. (2020a) divided an image into low-frequency component (LFC) and high-frequency component (HFC) and they empirically showed that human can only perceive LFC, but convolutional neural networks can obtain useful information from both LFC and HFC. Yin et al. (2019) filters out the input data with low-pass or high-pass filters to study the sensitivity of the additive noise with different frequencies. Wang et al. (2020b) claimed that existing adversarial attacks mainly concentrate in the high-frequency part. Sharma et al. (2019) found that when perturbations are constrained to the low-frequency subspace, they are generated faster and are more transferable, and will be effective to fool the defended models, but not for clean models.
All of these works showed that spectrum in frequency domain is an reasonable way to study the adversarial examples.
However, there is a lack of theoretical understanding about the dynamics of the adversarial perturbations in frequency domain along the training process of the model parameters. In this work, we focus on the frequency domain of the adversarial perturbations to explore the spectral properties of the adversarial examples generated by FGM (Miyato et al., 2016) and PGD (Madry et al., 2017).
In this work, we give a theoretical analysis in frequency domain of natural images for the adversarial examples.
• For a two-layer neural network with non-linear activation function, we prove that adversarial perturbations by FGM and $l _ { 2 }$ -PGD attacks gradually increase the concentration in the low-frequency part of the spectrum during the training process over model parameters. Meanwhile, the log-spectrum difference of the adversarial examples (the definition will be clarified in Section 2.2) will be more concentrated in the high-frequency part than the low-frequency part. • Furthermore, we show that the ratio of the high-frequency and the low-frequency part in the adversarial perturbation is much larger than that in the corresponding clean image.
Empirically,
• we design several experiments on the two-layer model and Resnet-32 with CIFAR-10 to verify the above findings. Based on these phenomena, we filter out the high-frequency part of the adversarial examples before feeding them to the model to improve the robustness. Compared with the adversarially trained model with the same architecture, our method achieves comparable robustness with the similar computational cost of normal training and almost no loss of accuracy.
The rest of the paper is organized as follows: In Section 2, we present preliminaries and some theoretical analysis on the calculation of the spectrum and log-spectrum. Then we provide our main results about the frequency domain analysis of gradient-based adversarial examples in Section 3. Furthermore, some experiments for supporting our theoretical findings are shown in Section 4. Finally we conclude our work and conduct a discussion about the future work in Section 5. All the details about the proof and experiments are shown in the Appendix.
# 2 BACKGROUND
# 2.1 PRELIMINARIES
Notations We use $\{ 0 , 1 , . . . , d \}$ to denote the set of all integers between 0 and $d$ and use $\| \cdot \| _ { p }$ to denote $l _ { p }$ norm. Specifically, we denote by $\| \cdot \|$ the $l _ { 2 }$ norm. For a $d$ -dimensional vector $_ { \textbf { \em x } }$ , we use $x _ { \mu }$ to denote its $\mu$ -th component with index starting at 0. For a scalar function $f ( { \pmb x } )$ $) \colon { \mathbb { R } ^ { d } } \mapsto { \mathbb { R } }$ , $\nabla _ { \pmb { x } } f$ and $\partial _ { \mu } f$ denote the gradient vector and its $\mu$ -th component. We let $\operatorname { s g n } ( x ) = 1$ for $x > 0$ and $- 1$ for $x < 0$ . Normal training refers to training on the original training data for learning the optimal weights for the neural networks. $\tilde { { \pmb x } } = \mathcal { F } ( { \pmb x } )$ denotes the Discrete Fourier Transform (DFT) of $_ { \textbf { \em x } }$ .
Discrete Fourier Transform The $k$ -th frequency component $\tilde { g } [ k ]$ of one-dimensional DFT of a vector $\textbf { { g } }$ is defined by
$$\tilde { g } [ k ] = \mathcal { F } ( g ) [ k ] = \sum _ { \mu = 0 } ^ { d - 1 } g _ { \mu } e ^ { i k \frac { 2 \pi } { d } \mu } ,$$
where $k \in \{ - d / 2 , - d / 2 + 1 , . . . , d / 2 \}$ if $d$ is even and $k \in \{ - ( d - 1 ) / 2 , . . . , ( d - 1 ) / 2 \}$ if $d$ is odd. For convenience, we always consider an odd $d$ and one can easily generalize the case to even dimensions. For an integer cut-off (cutoff frequency) $k _ { r } \in ( 0 , ( d - 1 ) / 2 )$ , the Low Frequency Components (LFC) and High Frequency Components (HFC) of $\tilde { g }$ are denoted by
$$\begin{array} { r } { \tilde { g } _ { l } [ k ] = \left\{ \begin{array} { l l } { \tilde { g } [ k ] } & { \mathrm { i f } - k _ { c } \leq k \leq k _ { c } , } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} \right. \quad \tilde { g } _ { h } [ k ] = \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f } - k _ { c } \leq k \leq k _ { c } , } \\ { \tilde { g } [ k ] } & { \mathrm { o t h e r w i s e } . } \end{array} \right. } \end{array}$$
Then the frequency space $\mathbb { R } ^ { d }$ can be decomposed as $S _ { l } \oplus S _ { h }$ where $\tilde { g } _ { l } \in S _ { l }$ and $\tilde { g } _ { h } \in S _ { h }$ . Let $N _ { \tilde { g } } =$ $\sqrt { \Sigma _ { k = - d / 2 } ^ { d / 2 } | \tilde { g } [ k ] | ^ { 2 } }$ , then the ratio of a frequency component with respect to the whole frequency spectrum is denoted by
$$\tau ( \tilde { g } [ k ] ) = \frac { | \tilde { g } [ k ] | ^ { 2 } } { N _ { \tilde { g } } ^ { 2 } }$$
and the ratio of LFC is denoted by
$$\tau ( \tilde { g } \in S _ { l } ) = \sum _ { k = - k _ { c } } ^ { k _ { c } } \frac { | \tilde { g } [ k ] | ^ { 2 } } { N _ { \tilde { g } } ^ { 2 } } .$$
Setup In this paper, we consider a two-layer neural network $f : \mathbb { R } ^ { d } \mapsto \mathbb { R }$
$$f ( \pmb { x } , \pmb { \theta } ) = \sum _ { r = 1 } ^ { m } a _ { r } \sigma ( \pmb { w } _ { r } ^ { T } \pmb { x } )$$
where $\sigma$ is an activation function, $\mathbf { \boldsymbol { a } } = ( a _ { 1 } , a _ { 2 } , . . . , a _ { m } ) ^ { T }$ is an $m$ -dimensional vector and ${ \pmb w } _ { r }$ ’s are $d$ -dimensional weight vectors.
Van der Schaaf & van Hateren (1996) showed that natural images obey a power law in the frequency domain. Therefore, to make our settings closer to widely studied image related tasks, we also assume our input $_ { \textbf { \em x } }$ obey the power law
$$| \tilde { \mathbf { x } } [ k ] | \propto k ^ { - \alpha }$$
to imitate LFC-concentrated images, where the constant $\alpha \geq 1$ and $| \tilde { \pmb { x } } [ 0 ] | = \alpha _ { 0 }$ is another constant. Besides, we choose the cut-off $k _ { c }$ in such a way that
$$\sum _ { k = 1 } ^ { k _ { c } } \frac { 1 } { k ^ { 2 \alpha } } + \alpha _ { 0 } ^ { 2 } > \sum _ { k = k _ { c } + 1 } ^ { ( d - 1 ) / 2 } \frac { 1 } { k ^ { 2 \alpha } } ,$$
which indicates that $\tau ( \tilde { \pmb { x } } \in S _ { l } ) > \tau ( \tilde { \pmb { x } } \in S _ { h } )$ and can be easily satisfied for a small $k _ { c }$
Gradient-based adversarial attack For a loss function $\ell$ , we find $l _ { p }$ -norm $\epsilon$ -bounded adversarial perturbations by solving the optimization problem
$$\operatorname* { m a x } _ { \| \pmb { \delta } \| _ { p } \leq \epsilon } \ell ( f ( \pmb { x } + \pmb { \delta } ) , y ) ,$$
where $( \pmb { x } , y ) \in \mathbb { R } ^ { d } \times \mathbb { R }$ is $d$ -dimensional input and output following the joint distribution $\mathcal { D }$ .
To solve the above optimization problem, Goodfellow et al. (2014) proposed FGSM, an attack for an $l _ { \infty }$ -bounded adversary, and computed an adversarial example as $\begin{array} { r } { \pmb { x } _ { \mathrm { a d v } } = \pmb { x } + \epsilon \mathrm { s g n } \left( \nabla _ { \pmb { x } } \ell ( \theta , \pmb { x } , y ) \right) } \end{array}$ . Miyato et al. (2016) proposed FGM with an l2-bounded adversary, xadv = x + ∇x\`(x,y)k∇x\`(x,y)k2 . Madry et al. (2017) introduced PGD which training adversarial examples in an iterative way that $\boldsymbol { x } ^ { t + 1 } =$ Πx+S (xt + α sgn (∇x\`(θ, x, y))) or xt+1 = Πx+S (xt + α ∇x\`(x,y)k∇x\`(x,y)k2 )
To simplify the analysis, we make the following assumptions on the normal training process:
Assumption 1 There exist $\beta ^ { \prime } , \beta > 0$ such that $\beta ^ { \prime } \leq | \partial \ell / \partial f | \leq \beta .$ .
Assumption 2 If $\begin{array} { r } { \ell = \frac { 1 } { 2 } \left( y - f ( \pmb { x } , \pmb { \theta } ) \right) ^ { 2 } } \end{array}$ , $\vert \partial \ell / \partial f \vert$ should be a small quantity such that $\vert \partial \ell / \partial f \vert =$ $\epsilon ^ { 1 + v }$ if the network is well trained in the end stage of normal training, where $0 < v < 1$ .
Assumption 3 There exist $\lambda , \gamma > 0$ such that $0 \leq \sigma ^ { \prime } \leq \lambda$ and $0 \leq \sigma ^ { \prime \prime } \leq \gamma ^ { 1 }$ .
Assumption 4 $a _ { r }$ ’s are i.i.d drawn from a distribution2 and will not be updated during the training.
Wang et al. (2020a) considered the log-spectrum of an image: $2 0 * \log \left( | \mathcal { F } ( \pmb { x } ) | \right)$ , where $_ { \textbf { \em x } }$ is a $2 d$ - dimensional matrix representing an image. One way to calculate the ”log-spectrum difference of the adversarial examples” is to consider the difference between the log-spectrum of the adversarial and natural image and as follows,
$$2 0 * \left| \log ( | \mathcal { F } ( \mathbf { x } + \delta ) | ) - \log ( | \mathcal { F } ( \mathbf { x } ) | ) \right| \approx 2 0 * \left| \log ( 1 + \frac { | \mathcal { F } ( \delta ) | } { | \mathcal { F } ( \mathbf { x } ) | } ) \right| \approx 2 0 * \frac { | \mathcal { F } ( \delta ) | } { | \mathcal { F } ( \mathbf { x } ) | } .$$
We can observe that this quantity is approximately proportional to the ratio of the perturbation’s over the natural image’s frequency. Moreover, the average Relative Change in discrete cosine Transforms (RCT) in (Wang et al., 2020b)) approximately equals to it. Fig. 5 empirically shows that this ratio is large for high frequency component but small for low frequency one. However, Van der Schaaf & van Hateren (1996) claimed that the LFC of $\mathcal { F } ( x )$ is much bigger than its HFC, and the right side of Eq. 3 is inversely proportional to $\mathcal { F } ( x )$ . The denominator of the right side of Eq.(3) in low-frequency part is much larger than it in high frequency part, so it may be imprudent to consider the frequency distribution of the adversarial perturbations only based on the ratio in the right side of Eq.(3).
Yin et al. (2019) provided another spectral measurement for adversarial examples. They considered the ”spectrum of the adversarial perturbation” $| \mathcal { F } ( \delta ) |$ , which directly reflects the distribution of adversarial perturbations in the frequency domain. Unfortunately, they claimed that ‘The adversarial perturbations for the normally trained model are uniformly distributed across frequency components’ without sufficient empirical and theoretical justification. In this work, we provide a totally different theoretical finding that the adversarial perturbations for the normally trained model are gradually concentrated in the low-frequency domain, further verified by extensive experiments.
Fig. 1 visually shows the calculation methods of the spectrum of perturbations $\mathcal { F } ( \delta )$ and the logspectrum difference of adversarial examples $\begin{array} { r } { | \log ( | \mathcal { F } ( \pmb { x } + \pmb { \delta } ) | ) - \log ( | \mathcal { F } ( \pmb { x } ) | \approx \frac { | \mathcal { F } ( \pmb { \delta } ) | } { | \mathcal { F } ( \pmb { x } ) | } } \end{array}$ .
# 3 MAIN RESULTS
In Section 3.1, we show that, for a well trained two-layer neural network described in Eq.(1) with LFC-concentrated inputs, $l _ { 2 }$ - norm adversarial perturbations generated by FGM (Theorem 1) prefer to concentrate in the low frequency domain. Section 3.2 theoretically proves the HFC-concentration of the logspectrum difference of adversarial examples. Section 3.3 attempts to demonstrate the effectiveness of masking the HFC of the adversarial examples to improve model’s robustness despite that perturbations can concentrate in the low frequency domain. All technical proofs are deferred to Appendix A. Results on $l _ { 2 }$ PGD perturbations are presented in Appendix B.
In this work, we consider the two-layer neural networks and the loss function $\ell \_ =$ ${ \scriptstyle { \frac { 1 } { 2 } } } \left( y - f ( \pmb { x } , \pmb { \theta } ) \right) ^ { 2 }$ . For any $_ { \textbf { \em x } }$ in this setting, we have
$$\frac { \partial f } { \partial a _ { r } } = \sigma ( { \boldsymbol { w } } _ { r } ^ { T } { \boldsymbol { \mathbf { x } } } ) , \quad \frac { \partial f } { \partial { \boldsymbol { w } } _ { r } } = a _ { r } ^ { \prime } { \boldsymbol { \mathbf { x } } } , \quad \nabla _ { \boldsymbol { x } } f = \sum _ { r } a _ { r } ^ { \prime } { \boldsymbol { w } } _ { r } ,$$
 Figure 1: Visualization of spectrum and logspectrum for adversarial attacks . Section 3.1 focuses on the center picture $\mathcal { F } ( \delta )$ to prove that the LFC ratio of $\mathcal { F } ( \delta )$ is increasing. Section 3.2 focuses on the third-line center picture $\vert \log ( \vert \mathcal { F } ( x +$ $\delta ) | ) - \log ( | \mathcal { F } ( x | ) |$ , and shows that its LFC is smaller than its HFC.
where $a _ { r } ^ { \prime } = a _ { r } \sigma ^ { \prime } ( \pmb { w } _ { r } ^ { T } \pmb { x } )$ and $\pmb { a } ^ { \prime } = ( a _ { 1 } ^ { \prime } , a _ { 2 } ^ { \prime } , . . . , a _ { m } ^ { \prime } )$ . At the $( t + 1 )$ -th step of gradient descent in the normal training process of the classifier, weight $\pmb { w }$ is updated as
$$\pmb { w } _ { r } ^ { ( t + 1 ) } = \pmb { w } _ { r } ^ { ( t ) } - \eta \frac { \partial \ell } { \partial f } ^ { ( t ) } a _ { r } ^ { \prime ( t ) } \pmb { x } .$$
We use $L _ { x }$ and $H _ { x }$ to denote the LFC and HFC of the clean input
$$L _ { x } = \sum _ { k = 0 } ^ { k _ { c } } | \tilde { \pmb { x } } [ k ] | ^ { 2 } \mathrm { a n d } H _ { x } = \sum _ { k = k _ { c } + 1 } ^ { ( d - 1 ) / 2 } | \tilde { \pmb { x } } [ k ] | ^ { 2 } .$$
3.1 SPECTRAL TRAJECTORIES OF $l _ { 2 }$ -NORM FGM PERTURBATIONS
Consider the $l _ { 2 }$ -norm FGM perturbation $\delta$ and its DFT $\tilde { \delta } [ k ]$
$$\delta = \epsilon \frac { \frac { \partial \ell } { \partial f } \nabla _ { \pmb { x } } f } { \big \| \frac { \partial \ell } { \partial f } \nabla _ { \pmb { x } } f \big \| } , \quad \tilde { \delta } [ k ] = \epsilon \mathrm { s g n } \left( \frac { \partial \ell } { \partial f } \right) \frac { 1 } { \big \| \nabla _ { \pmb { x } } f \big \| } \widetilde { \nabla } f [ k ] ,$$
where $\widetilde { \nabla f } [ k ] = \mathcal { F } \left( \nabla _ { x } f \right) [ k ]$ . Since the coefficient before $\widetilde { \nabla f } [ \boldsymbol { k } ]$ in (6) is same for different frequencies $k$ , we only need to analyze the spectrum of $\widetilde { \nabla f [ k ] }$ to investigate the ratio of certain frequency component over the whole frequency spectrum, i.e.
$$\tau \left( \tilde { \delta } [ k ] \right) = \tau \left( \widetilde { \nabla f } [ k ] \right) .$$
In this subsection, we explore the evolving of $\tau ( \tilde { \delta } [ k ] )$ along the normal training process. For a randomly initialized network, the FGM-attack perturbation will not have bias towards either HFC or LFC. We attack this model with FGM at each step of the normal training to study the trajectory of these perturbations in the frequency domain. According to Eq.(4), $\nabla _ { x } f$ is updated to the order of $\eta$ at the $( t + 1 )$ -th step as
$$\nabla _ { \pmb { x } } f ^ { ( t + 1 ) } = \sum _ { r = 1 } ^ { m } ( 1 - \eta _ { r } ^ { ( t ) } ) a _ { r } ^ { \prime ( t ) } \pmb { w } _ { r } ^ { ( t ) } - \tilde { \eta } ^ { ( t ) } \pmb { x } + \mathcal { O } ( \eta ^ { 2 } ) ,$$
where $\begin{array} { r } { \eta _ { r } ^ { ( t ) } = \eta a _ { r } \| \pmb { x } \| ^ { 2 } \frac { \partial \ell } { \partial f } ^ { ( t ) } \sigma ^ { \prime \prime ( t ) } ( \pmb { w } _ { r } ^ { ( t ) T } \pmb { x } ) } \end{array}$ and $\begin{array} { r } { \tilde { \eta } ^ { ( t ) } = \eta \frac { \partial \ell } { \partial f } ^ { ( t ) } \| \pmb { a } ^ { \prime ( t ) } \| ^ { 2 } } \end{array}$ are composite learning rates for easing our notation. For ReLU activation function $\sigma ( x ) = \operatorname* { m a x } ( 0 , x )$ , we have that $\eta _ { r } ^ { ( t ) } = \frac { } { }$ $\mathbb { E } _ { i \in \{ 1 , 2 , \dots , m \} } [ \eta _ { i } ^ { ( t ) } ]$ , therefore, considering that Softplus has similar shape as ReLU, we derive that $\eta _ { r } ^ { ( t ) } = \bar { \eta } ^ { ( t ) } + \mathcal { O } ( \eta ^ { 2 } )$ , where $\begin{array} { r } { \bar { \eta } ^ { ( t ) } = \eta \| \pmb { x } \| ^ { 2 } \frac { \partial \ell } { \partial f } ^ { ( t ) } \mathbb { E } _ { r \in \{ 1 , 2 , \ldots , m \} } \left[ a _ { r } \sigma ^ { \prime \prime ( t ) } ( \pmb { w } _ { r } ^ { ( t ) T } \pmb { x } ) \right] } \end{array}$ . In this way, the $1 d$ -DFT of $\nabla _ { \pmb { x } } f ^ { ( t + 1 ) }$ has the following form,
$$\widetilde { \nabla f } ^ { ( t + 1 ) } [ k ] = ( 1 - \bar { \eta } ^ { ( t ) } ) \widetilde { \nabla f } ^ { ( t ) } [ k ] - \tilde { \eta } ^ { ( t ) } \tilde { x } [ k ] .$$
We are now ready to study the trajectory of $\tau ( \tilde { \delta } [ k ] )$ along the training step $t$ . Let $\triangle \varphi _ { k } ^ { ( t ) }$ denote the difference of phases between $\widetilde { \nabla f } ^ { ( t ) } [ k ]$ and ${ \tilde { \mathbf { x } } } [ k ]$ for frequency $k$ at the $t$ -th step. And for ease of notation, denote
$$\triangle \tau _ { l } ^ { ( t ) } \triangleq - 2 \sum _ { k = 0 } ^ { k _ { c } } \vert \widehat { \nabla } f ^ { ( t ) } [ k ] \vert | \tilde { x } [ k ] | \cos \left( \triangle \varphi _ { k } ^ { ( t ) } \right) , \quad \triangle \tau _ { h } ^ { ( t ) } \triangleq - 2 \sum _ { k = k _ { c } + 1 } ^ { ( d - 1 ) / 2 } \vert \widehat { \nabla } f ^ { ( t ) } [ k ] \vert | \tilde { x } [ k ] | \cos \left( \triangle \varphi _ { k } ^ { ( t ) } \right) ,$$
where $\tilde { \eta } ^ { ( t ) } \triangle \tau _ { l } ^ { ( t ) }$ and $\tilde { \eta } ^ { ( t ) } \triangle \tau _ { h } ^ { ( t ) }$ are approximately changed amounts for LFC and HFC of $| \widetilde { \nabla f } ^ { ( t ) } | ^ { 2 }$ at the $t$ -th step of the normal training of the network, respectively. Since the network is randomly initialized and the clean inputs $_ { \textbf { \em x } }$ are highly concentrated in the low frequency domain, we always study the case where $\tau ( \tilde { \pmb \delta } ^ { ( 0 ) } \in S _ { l } ) < \tau ( \tilde { \pmb x } \in S _ { l } )$ . We now, taking Eq.(7) into consideration , present our main theorem about $l _ { 2 }$ norm FGM perturbations as follows.
Theorem 1 (The spectral trajectory of $l _ { 2 }$ FGM perturbation) During the training process of the two-layer neural network $f ( x )$ in $( l )$ , the $l _ { 2 }$ norm FGM adversarial perturbation will change its ratio of LFC, $\tau ( \tilde { \delta } \in S _ { l } )$ , at the $( t + 1 )$ -th step as follows,
$$\tau ( \tilde { \pmb \delta } ^ { ( t + 1 ) } \in S _ { l } ) = \tau ( \tilde { \pmb \delta } ^ { ( t ) } \in S _ { l } ) + \tilde { \eta } ^ { ( t ) } \frac { \Delta \tau _ { l } ^ { ( t ) } \tau \left( \tilde { \pmb \delta } ^ { ( t ) } \in S _ { h } \right) - \bigtriangleup \tau _ { h } ^ { ( t ) } \tau \left( \tilde { \pmb \delta } ^ { ( t ) } \in S _ { l } \right) } { \sum _ { k = 0 } ^ { ( d - 1 ) / 2 } | \widetilde { \nabla f } ^ { ( t + 1 ) } [ k ] | ^ { 2 } } ;$$
there will be a $t _ { 1 }$ s.t. $\forall t \geq t _ { 1 }$ , we have
$$\tau ( \tilde { \delta } ^ { ( t + 1 ) } \in S _ { l } ) > \tau ( \tilde { \delta } ^ { ( t ) } \in S _ { l } ) .$$
Remark According to theorem 1, during the normal training process for a randomly initialized network with LFC-concentrated input, there will be a $t _ { 0 }$ s.t. $\forall t \geq t _ { 0 }$ , we have $\triangle \tau _ { l } ^ { ( i ) } > \triangle \tau _ { h } ^ { ( t ) }$ , and $\tau \left( \tilde { \delta } ^ { ( t + 1 ) } \in S _ { l } \right) \ > \ \tau \left( \tilde { \delta } ^ { ( t ) } \in S _ { l } \right)$ if $\tau \left( \tilde { \delta } ^ { ( t ) } \in S _ { l } \right) \ < \ \tau \left( \tilde { \delta } ^ { ( t ) } \in S _ { h } \right)$ . For ReLU activation function, starting with $\tau ( \tilde { \delta } ^ { ( 0 ) } \ \in \ S _ { l } ) \ = \ 1 / 2 \ - \ \zeta$ and $\triangle \tau _ { l } ^ { ( 0 ) } ~ = ~ \triangle \tau _ { h } ^ { ( 0 ) } + b \zeta$ , we have $\begin{array} { r } { t _ { 0 } ~ = ~ \operatorname* { m a x } \bigg \{ 0 , - \frac { b \zeta } { n \eta \beta ^ { \prime } ( L _ { x } - H _ { x } ) } \bigg \} } \end{array}$ , where $\begin{array} { r } { n \ = \ \operatorname* { m i n } _ { t \in [ 0 , t _ { 0 } ] } \Vert \pmb { a } ^ { \prime ( t ) } \Vert ^ { 2 } } \end{array}$ l h . Besides, given such a network trained with at least $t _ { 0 }$ steps, there will be a $t _ { 1 } ~ > ~ t _ { 0 }$ such that $\triangle \tau _ { l } ^ { ( t _ { 1 } ) } \tau \left( \tilde { \pmb { \delta } } ^ { ( t _ { 1 } ) } \in S _ { h } \right) \ \geq$ $\triangle \tau _ { h } ^ { ( t _ { 1 } ) } \tau \left( \tilde { \delta } ^ { ( t _ { 1 } ) } \in S _ { l } \right)$ and FGM perturbation will increase its ratio of LFC for all $t > t _ { 1 }$ no matter whether it is smaller than $1 / 2$ . Finally, if $\tau \left( \tilde { \pmb \delta } ^ { ( t _ { 2 } ) } \in S _ { l } \right) > \tau \left( \tilde { \pmb \delta } ^ { ( t _ { 2 } ) } \in S _ { h } \right)$ for some $t _ { 2 } > t _ { 0 }$ , this relation will hold for any $t \geq t _ { 2 }$ .
# 3.2 HIGH-FREQUENCY CONCENTRATION FOR LOG-SPECTRUM DIFFERENCE OFADVERSARIAL EXAMPLES
In this subsection, we explore spectral trajectories of log-spectrum difference of $l _ { 2 }$ FGM adversarial examples
$$R _ { k } ^ { ( t ) } = \frac { \left| \widetilde { \nabla f } ^ { ( t ) } [ k ] \right| } { \left| \tilde { \mathbf { \ b { x } } } [ k ] \right| } \propto \frac { \left| \tilde { \mathbf { \delta } } ^ { ( t ) } [ k ] \right| } { \left| \tilde { \mathbf { \ b { x } } } [ k ] \right| }$$
along normal training step $t$ as in Section 3.1 to study their HFC-concentration phenomenon. Since $\widehat { \nabla f } ^ { ( 0 ) } [ k ] |$ for a randomly initialized network (1) has no bias towards high frequency or low frequency while $| \tilde { \mathbf { x } } | \propto k ^ { - \alpha }$ , we adopt the following setting
$$R _ { k } ^ { ( 0 ) } \propto k ^ { \alpha }$$
without loss of generality and present below our result on the log-spectrum difference of the adversarial examples.
Theorework in (Concent, for any log spectrum differewhich satisfies that $l _ { 2 }$ GM perturbatio, there exists a of the net-such that $( l )$ $k > k ^ { \prime } > 0$ $R _ { k } ^ { ( 0 ) } > R _ { k ^ { \prime } } ^ { ( 0 ) }$ $t ^ { \prime }$ $R _ { k } ^ { ( t ) } > R _ { k ^ { \prime } } ^ { ( t ) }$ for all $t < t ^ { \prime }$ steps of the normal training. For ReLU activation function, we have
$$t ^ { \prime } = \frac { R _ { k } ^ { ( 0 ) } \cos ( \triangle \varphi _ { k } ^ { ( 0 ) } ) - R _ { k ^ { \prime } } ^ { ( 0 ) } \cos ( \triangle \varphi _ { k ^ { \prime } } ^ { ( 0 ) } ) } { \eta \beta \| \pmb { a } \| ^ { 2 } } ,$$
while if the initialization satisfies that $R _ { k } ^ { ( 0 ) } \cos ( \triangle \varphi _ { k } ^ { ( 0 ) } ) \leq R _ { k ^ { \prime } } ^ { ( 0 ) } \cos ( \triangle \varphi _ { k ^ { \prime } } ^ { ( 0 ) } )$ then $t ^ { \prime } = \infty$
The theorem shows that although $\tilde { \delta }$ itself can concentrate in the low frequency domain, it does not concentrate as dense in the low frequency domain as the inputs $\tilde { \pmb x }$ which obey the power law. Therefore, the log-spectrum difference (i.e. equivalent to spectrum of the ratio of the perturbation to the clean data) of adversarial examples will express a HFC-concentrated phenomenon instead (Fig.1).
# 3.3 MASKING HFC OF THE ADVERSARIAL EXAMPLES TO IMPROVE ROBUSTNESS
In this subsection, we compare the ratio of LFC of the adversarial perturbations $\tau ( \tilde { \delta } \in S _ { l } )$ and the ratio of LFC of original images $\tau ( \tilde { \mathbfit { x } } \in S _ { l } )$ .
Theorem 3 (Comparison on the LFC ratio of clean data and perturbations) For $l _ { 2 }$ FGM perturbation of the two-layer neural network in $( l )$ , at the $t$ -th step of normal training, let $\zeta = \tau ( \tilde { \pmb { x } } \in$ $S l ) - \tau ( \tilde { \delta } ^ { ( 0 ) } \in S _ { l } ) > 0 ;$ , then we will have $\tau ( \tilde { \pmb \delta } ^ { ( t ) } \in S _ { l } ) < \tau ( \tilde { \pmb x } \in S _ { l } )$ for all $t > 0$ if the initilization of the netowrk satisfies that
$$\triangle \tau _ { l } ^ { ( 0 ) } < \tau ( \tilde { \pmb { x } } \in S _ { l } ) ( \triangle \tau _ { l } ^ { ( 0 ) } + \triangle \tau _ { h } ^ { ( 0 ) } ) .$$
Remark When both $\triangle \tau _ { l } ^ { ( 0 ) }$ and 4τ (0)h are positive, condition (12) states that the ratio of low frequency component of 4τ (0)l $\triangle \tau _ { l } ^ { ( 0 ) } + \triangle \tau _ { h } ^ { ( 0 ) }$ is smaller than that of clean data, which can be easily satisfied for a randomly initialized network. The ratio of LFC of the perturbations $\delta$ will be less than that of clean data $_ { \textbf { \em x } }$ if the condition Eq.(12) is satisfied for $l _ { 2 }$ FGM perturbations during the normal training process. Masking the HFC of an adversarial example $\boldsymbol { x } + \boldsymbol { \delta }$ will then erase more amount of the perturbation than that of the clean data which leads to a new ”not-perturbed-much” adversarial example. As a result, one can expect the improvement for robustness of the model, as demonstrated in Section 4.3 later.
# 4 EXPERIMENT
In this section, we conduct several experiments to validate our theoretical conclusions.
Setup. We use the Resnet-32 (He et al., 2016), a fully connected network as the last layer and cross entropy loss, and train all the parameters on the CIFAR-10 dataset with Adam optimizer (Kingma & Ba, 2014). We use PGD-attack with $\epsilon = 8 / 2 5 5 , 4 0$ iterations and step size $\xi = 4 / 2 5 5$ .
We supplement more experiments in Appendix C to fill the gap between our theory and more complicated settings: we use the MSE loss and keep other conditions unchanged to resolve the discrepancy of loss function; experiments to support our theorems on two-layer neural network with fixed outer-layer parameters are also provided.
# 4.1 THE INCREASE OF LFC CONCENTRATION
In this part, we empirically verify the theorem in Section 3.1, to show that adversarial perturbations gradually concentrate more in the low-frequency part of the spectrum during the training process. Consider a neural network with random initialization, each time before updating all the parameters of neural network, we randomly sample 100 images and apply the $l _ { 2 }$ FGM / PGD attack to them. For each iteration in PGD attack, we calculate their ratios of LFC and plot them in Fig. 2. It shows that the LFC ratios of the perturbations $\tau ( \tilde { \delta } \in S _ { l } )$ are gradually increasing along the normal training.
 Figure 2: The LFC ratio of the adversarial perturbations in the training process. (a) The attack method is $l _ { 2 }$ FGM. (b) The attack method is $l _ { 2 }$ PGD
 Figure 3: The spectrum of adversarial perturbations. The first line is the original examples in CIFAR10 dataset. The second line is the spectrum of the adversarial perturbations corresponding to the above images.
For a sufficiently trained neural network, we choose an image, use PGD-attack to obtain its adversarial examples and perturbations, and calculate its spectrum. We randomly select 10 images in the test set and show the original images and the spectrum of perturbations in Fig. 3. We also randomly select 1000 images in the test set and average their spectrum to show the expectation of the spectrum in Fig. 4(a). They show that the spectrum of adversarial perturbations are more concentrated in the low-frequency domain after a sufficient training. Ortiz-Jimenez et al. (2020) show that the distance to the boundary (margin) in different frequency bands is heavily dependent of the distribution used for training, which also supports our claims.
 Figure 4: The expectation of: (a) the spectrum of adversarial perturbations; (b) the log-spectrum difference of adversarial examples.
# 4.2 HFC CONCENTRATION OF LOG-SPECTRUM DIFFERENCE
We first use PGD-attack to get the adversarial example of a image for a sufficiently trained neural network. We then make the log-spectrum of the original image and its adversarial example and calculate the difference of their log-spectrum (Fig.5). Fig.4(b) displays the expectation of the spectrum for 1000 random images in the test set. They both show that the log-spectrum difference of adversarial examples is generally concentrated around.
 Figure 5: The log-spectrum difference of adversarial examples. In each $3 \times 2$ -image part, the first line is the original example, the adversarial example attacked by PGD in a normally trained Resnet-32 and the perturbation. The second line is the log-spectrum of the original example, the log-spectrum of the adversarial example and the difference of the two log-spectrum.
# 4.3 LOW-PASS FILTER IMPROVES ROBUSTNESS
In this part, we empirically show how a low-pass filter (which filters out HFC of the inputs) can improve the robustness of the model with a cheat sheet in the sense that the attacker does not know the existence of the filter while the model is aware of the frequency distribution of the gradient-based adversarial examples.
The procedure of our low-pass filter basically has three steps: performing DFT on the inputs, then masking their high frequency components (set as 0) in the frequency domain and finally performing inverse DFT on them to give the desired inputs with only low frequency components preserved.
We evaluate two types of accuracy. One is filtering the clean images out of high frequencies and feed them into the model to test accuracy, named as ”no-attack accuracy”. The other is firstly PGD-attacking the input images in the normally trained model, and then check the test accuracy of filtered adversarial images, called “PGD-attack accuracy”.
Here, we use data augmentation to train the model to the best. We show the results in Fig. 6. As the cut-off increases, the no-attack accuracy gradually increases, and the PGD-attack accuracy first increases and then decreases. The highest robustness achieves $5 1 . 7 \%$ when the cut-off $k = 1 2$ and its robustness accuracy is $8 1 . 7 \%$ . And the normal accuracy (no filter, no attack) is $9 3 . 0 3 \%$ . We also adversarially train the model with PGD-attacks. Its normal accuracy is $79 \%$ and PGD-attack accuracy is $48 \%$ without the filtering. Our low-pass filter model not only performs better on both no-attack accuracy and PGD-attack accuracy, but also does not need computationally expensive adversarial training.
 Figure 6: Normally trained model’s performance and robustness after a low-pass filter with cut-off from 1 to 22.
Theorem 3 provides a reasonable explanation for the above results. When the cut-off is low, the filter masks most of the original image and the adversarial perturbation, so both of the no-attack and PGD-attack models perform not well. When the cut-off is proper, there remains enough information of original images but little of perturbations, so the PGD attacker cannot fool the model thoroughly. Therefore, with a suitable cut-off, the low-pass filter can indeed improve the model’s robustness without computationally expensive adversarial training.
# 5 CONCLUSION
We investigate the adversarial examples through the lens of frequency analysis. Our work both theoretically and empirically clarifies the definition of log-spectrum difference of the adversarial examples in existing literature. Besides, we devote to understanding the spectral trajectories of adversarial examples: $l _ { 2 }$ FGM perturbations gradually increase the concentration in the low-frequency part of the spectrum but their ratios of LFC will never exceed that of clean data during the training process over model parameters. Inspired by these findings, we find that a low-pass filter can improve the robustness of the model and give a reasonable explanation for this phenomenon.
Future work can focus on analysis of other perturbations in the frequency domain such as FGSM and $l _ { \infty }$ PGD perturbations or providing theoretical understanding of the phenomenon that the ratio of the LFC of the perturbation for adversarially trained model is much higher than that for normally trained model (Appendix D).
# REFERENCES
Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 ieee symposium on security and privacy (sp), pp. 39–57. IEEE, 2017.
Xinyun Chen, Chang Liu, Bo Li, Kimberly Lu, and Dawn Song. Targeted backdoor attacks on deep learning systems using data poisoning. arXiv preprint arXiv:1712.05526, 2017.
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
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.
Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras, Logan Engstrom, Brandon Tran, and Aleksander Madry. Adversarial examples are not bugs, they are features. In Advances in Neural Information Processing Systems, pp. 125–136, 2019.
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
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.
Takeru Miyato, Andrew M Dai, and Ian Goodfellow. Adversarial training methods for semisupervised text classification. arXiv preprint arXiv:1605.07725, 2016.
Guillermo Ortiz-Jimenez, Apostolos Modas, Seyed-Mohsen Moosavi-Dezfooli, and Pascal Frossard. Hold me tight! influence of discriminative features on deep network boundaries. arXiv preprint arXiv:2002.06349, 2020.
Yash Sharma, Gavin Weiguang Ding, and Marcus A Brubaker. On the effectiveness of low frequency perturbations. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pp. 3389–3396. AAAI Press, 2019.
Jiawei Su, Danilo Vasconcellos Vargas, and Kouichi Sakurai. One pixel attack for fooling deep neural networks. IEEE Transactions on Evolutionary Computation, 23(5):828–841, 2019.
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.
van A Van der Schaaf and JH van van Hateren. Modelling the power spectra of natural images: statistics and information. Vision research, 36(17):2759–2770, 1996.
Haohan Wang, Xindi Wu, Zeyi Huang, and Eric P Xing. High-frequency component helps explain the generalization of convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8684–8694, 2020a.
Zifan Wang, Yilin Yang, Ankit Shrivastava, Varun Rawal, and Zihao Ding. Towards frequency-based explanation for robust cnn. arXiv preprint arXiv:2005.03141, 2020b.
Chaowei Xiao, Bo Li, Jun-Yan Zhu, Warren He, Mingyan Liu, and Dawn Song. Generating adversarial examples with adversarial networks. arXiv preprint arXiv:1801.02610, 2018.
Dong Yin, Raphael Gontijo Lopes, Jon Shlens, Ekin Dogus Cubuk, and Justin Gilmer. A fourier perspective on model robustness in computer vision. In Advances in Neural Information Processing Systems, pp. 13276–13286, 2019.
# A PROOFS
# A.1 PROOF OF THEOREM 1
According to (8), the update of $\tau ( \tilde { \delta } [ k ] )$ for $k$ -th frequency component of $l _ { 2 }$ norm FGM adversarial perturbation at the $( t + 1 )$ -th step is proportional to
$$\begin{array} { r } { ( 1 - 2 \bar { \eta } _ { 2 } ^ { ( t ) } ) \lvert \widetilde { \nabla } f ^ { ( t ) } [ k ] \rvert ^ { 2 } - 2 \tilde { \eta } ^ { ( t ) } \lvert \widetilde { \nabla } f ^ { ( t ) } [ k ] \rvert | \tilde { x } [ k ] | \cos \left( \triangle \varphi _ { k } ^ { ( t ) } \right) . } \end{array}$$
We adopt the following representations to see trends of $\cos \left( \triangle \varphi _ { k } ^ { ( t ) } \right)$ through the training process:
$$\begin{array} { r l r } { { \widetilde { \nabla f } ^ { ( t ) } [ k ] : = \overrightarrow { c _ { ( t ) } } = ( | c _ { ( t ) } | \cos \theta , | c _ { ( t ) } | \sin \theta ) } } \\ & { } & { \tilde { x } [ k ] : = \overrightarrow { x _ { ( k ) } } = ( | x _ { ( k ) } | \cos \zeta , | x _ { ( k ) } | \sin \zeta ) , } \end{array}$$
$| \widetilde { \nabla f } ^ { ( t + 1 ) } [ k ] | | \widetilde { \pmb { x } } [ k ] | \cos \left( \triangle \varphi _ { k } ^ { ( t ) } \right)$ will have the form of
$$\left. \overrightarrow { c _ { ( t + 1 ) } } , \overrightarrow { x _ { ( k ) } } \right. = ( 1 - \bar { \eta } ^ { ( t ) } ) \left. \overrightarrow { c _ { ( t ) } } , \overrightarrow { x _ { ( k ) } } \right. - \tilde { \eta } ^ { ( t ) } | x _ { ( k ) } | ^ { 2 } + \mathcal { O } ( \eta ^ { 2 } )$$
at the $( t + 1 )$ -th step. At the $( t + 1 )$ -th step, we have
$$\triangle \tau _ { l } ^ { ( t + 1 ) } - \triangle \tau _ { h } ^ { ( t + 1 ) } = ( 1 - \bar { \eta } ^ { ( t ) } ) ( \triangle \tau _ { l } ^ { ( t ) } - \triangle \tau _ { h } ^ { ( t ) } ) + \tilde { \eta } ^ { ( t ) } ( L _ { x } - H _ { x } ) ,$$
which means that if $\triangle \tau _ { l } ^ { ( t ) } > \triangle \tau _ { h } ^ { ( t ) }$ then we must have $\triangle \tau _ { l } ^ { ( t ^ { \prime } ) } > \triangle \tau _ { h } ^ { ( t ^ { \prime } ) }$ for all $t ^ { \prime } \geq t$ . Besides, l hthere must be a step which leads to this condition since $\begin{array} { r } { H ^ { ( t ) } = \sum _ { k = k _ { c } + 1 } ^ { ( d - 1 ) / 2 } | \widetilde { \nabla f } [ k ] | ^ { 2 } } \end{array}$ . At the $( t + 1 )$ -th step, the changed amount of . Let $\begin{array} { r } { \ddot { L } ^ { ( t ) } = \sum _ { k = 0 } ^ { k _ { c } } | \widetilde { \nabla f } [ k ] | ^ { 2 } } \end{array}$ $\tau ( \tilde { \delta } \in S _ { l } )$ 0 f is and
$$\begin{array} { r l } & { \frac { ( 1 - 2 \bar { \eta } ^ { ( t ) } ) L ^ { ( t ) } + \tilde { \eta } ^ { ( t ) } \bigtriangleup \tau _ { l } ^ { ( t ) } } { \big ( 1 - 2 \bar { \eta } ^ { ( t ) } \big ) \big ( L ^ { ( t ) } + H ^ { ( t ) } \big ) + \tilde { \eta } ^ { ( t ) } \big ( \bigtriangleup \tau _ { l } ^ { ( t ) } + \bigtriangleup \tau _ { h } ^ { ( t ) } \big ) } - \frac { L ^ { ( t ) } } { L ^ { ( t ) } + H ^ { ( t ) } } } \\ & { { = } \tilde { \eta } ^ { ( t ) } \frac { \bigtriangleup \tau _ { l } ^ { ( t ) } \tau \left( \tilde { \delta } ^ { ( t ) } \in S _ { h } \right) - \bigtriangleup \tau _ { h } ^ { ( t ) } \tau \left( \tilde { \delta } ^ { ( t ) } \in S _ { l } \right) } { \sum _ { k = 0 } ^ { ( d - 1 ) / 2 } | \widetilde { \nabla f } ^ { ( t + 1 ) } [ k ] | ^ { 2 } } . } \end{array}$$
If $t ~ > ~ t _ { 0 }$ and $\tau \left( { \tilde { \delta } } ^ { ( t ) } \in S _ { h } \right) \ > \ \tau \left( { \tilde { \delta } } ^ { ( t ) } \in S _ { l } \right)$ then the above changed amount will be positive and gradient descent will increase $\tau \left( \tilde { \delta } \in S _ { l } \right)$ at this step. If $\begin{array} { r l } { \triangle \tau _ { l } ^ { ( t ) } \tau \left( \tilde { \pmb { \delta } } ^ { ( t ) } \in S _ { h } \right) } & { { } < } \end{array}$ $\triangle \tau _ { h } ^ { ( t ) } \tau \left( \tilde { \delta } ^ { ( t ) } \in S _ { l } \right)$ , then gradient descent will increase $\tau \left( \tilde { \delta } ^ { ( t ) } \in S _ { h } \right)$ untill the step $t _ { 1 }$ at which $\triangle \tau _ { l } ^ { ( t _ { 1 } ) } \tau \left( \tilde { \pmb \delta } ^ { ( t _ { 1 } ) } \in S _ { h } \right) \geq \triangle \tau _ { h } ^ { ( t _ { 1 } ) } \tau \left( \tilde { \pmb \delta } ^ { ( t _ { 1 } ) } \in S _ { l } \right)$ , then for any $t > t _ { 1 }$ , we have $\tau \left( \tilde { \delta } ^ { ( t + 1 ) } \in S _ { l } \right) >$ $\tau \left( \tilde { \delta } ^ { ( t ) } \in S _ { l } \right)$ .
# A.2 PROOF OF THEOREM 2
We provide the proof for ReLU activation function for positive $e \tilde { t } a$ , the case for negative $\tilde { \eta }$ is similar. The update rules of $R _ { k }$ at the $( t + 1 )$ -th step are
$$\begin{array} { r l r } & { } & { R _ { k } ^ { ( t + 1 ) 2 } = R _ { k } ^ { ( t ) 2 } - 2 \tilde { \eta } ^ { ( t ) } R _ { k } ^ { ( t ) } \cos \left( \triangle \varphi _ { k } ^ { ( t ) } \right) } \\ & { } & { R _ { k } ^ { ( t ) } \cos \left( \triangle \varphi _ { k } ^ { ( t ) } \right) = R _ { k } ^ { ( t - 1 ) } \cos \left( \triangle \varphi _ { k } ^ { ( t - 1 ) } \right) - \tilde { \eta } ^ { ( t - 1 ) } . } \end{array}$$
$k > k ^ { \prime } > 0$ with $R _ { k } ^ { ( 0 ) } > R _ { k ^ { \prime } } ^ { ( 0 ) }$ , we have
$$\begin{array} { c } { { R _ { k } ^ { ( t + 1 ) 2 } - R _ { k ^ { \prime } } ^ { ( t + 1 ) 2 } = R _ { k } ^ { ( t ) 2 } - R _ { k ^ { \prime } } ^ { ( t ) 2 } - 2 \tilde { \eta } ^ { ( t ) } \left[ R _ { k } ^ { ( t ) } \cos \left( \bigtriangleup \varphi _ { k } ^ { ( t ) } \right) - R _ { k ^ { \prime } } ^ { ( t ) } \cos \left( \bigtriangleup \varphi _ { k ^ { \prime } } ^ { ( t ) } \right) \right] } } \\ { { = R _ { k } ^ { ( 0 ) 2 } - R _ { k ^ { \prime } } ^ { ( 0 ) 2 } - 2 \displaystyle \sum _ { t ^ { \prime } = 0 } ^ { t } \tilde { \eta } ^ { ( t ^ { \prime } ) } \left[ R _ { k } ^ { ( 0 ) } \cos \left( \bigtriangleup \varphi _ { k } ^ { ( 0 ) } \right) - R _ { k ^ { \prime } } ^ { ( 0 ) } \cos \left( \bigtriangleup \varphi _ { k ^ { \prime } } ^ { ( 0 ) } \right) \right] } } \end{array}$$
at the $( t + 1 )$ -th step. If $\begin{array} { r } { R _ { k } ^ { ( 0 ) } \cos \left( \triangle \varphi _ { k } ^ { ( 0 ) } \right) - R _ { k ^ { \prime } } ^ { ( 0 ) } \cos \left( \triangle \varphi _ { k ^ { \prime } } ^ { ( 0 ) } \right) > 0 } \end{array}$ , considering the case $\tilde { \eta } ^ { ( t ^ { \prime } ) } =$ $\tilde { \eta } _ { \mathrm { m a x } }$ for any $t ^ { \prime }$ and the condition that the left L.H.S of the above equation is larger than 0 gives us Eq.(11). On the other hand, if $\begin{array} { r } { R _ { k } ^ { ( 0 ) } \cos \left( \triangle \varphi _ { k } ^ { ( 0 ) } \right) - R _ { k ^ { \prime } } ^ { ( 0 ) } \cos \left( \triangle \varphi _ { k ^ { \prime } } ^ { ( 0 ) } \right) < 0 } \end{array}$ , then $R _ { k } ^ { ( t ) } > R _ { k ^ { \prime } } ^ { ( t ) }$ for all $t \geq 0$ .
# A.3 PROOF OF THEOREM 3
We consider the case for $l _ { 2 }$ FGM perturbations with $\tilde { \eta } > 0$ , the case for negative $\tilde { \eta }$ is similar. Let the initialization of the network always satisfy the condition
$$\frac { L ^ { ( 0 ) } } { L ^ { ( 0 ) } + H ^ { ( 0 ) } } = \tau ( \tilde { \delta } ^ { ( 0 ) } \in S _ { l } ) < \tau ( \tilde { { \pmb x } } \in S _ { l } ) = \frac { L _ { x } } { L _ { x } + H _ { x } }$$
such that $\tau ( \tilde { \pmb { x } } \in S _ { l } ) - \tau ( \tilde { \pmb { \delta } } ^ { ( 0 ) } \in S _ { l } ) = \zeta > 0$ . Then at the $( t )$ -th step, we can express $\tau ( \tilde { \delta } ^ { ( 0 ) } \in S _ { l } )$ as follows
$$\begin{array} { r l } & { \frac { L ^ { ( t ) } } { L ^ { ( t ) } + H ^ { ( t ) } } = \frac { L ^ { ( 0 ) } + \sum _ { t ^ { \prime } = 0 } ^ { t - 1 } \tilde { \eta } ^ { ( t ^ { \prime } ) } \bigtriangleup \tau _ { l } ^ { ( t ^ { \prime } ) } } { L ^ { ( 0 ) } + H ^ { ( 0 ) } + \sum _ { t ^ { \prime } = 0 } ^ { t - 1 } \tilde { \eta } ^ { ( t ^ { \prime } ) } \big ( \triangle \tau _ { h } ^ { ( t ^ { \prime } ) } + \triangle \tau _ { l } ^ { ( t ^ { \prime } ) } \big ) } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad L ^ { ( 0 ) } + \sum _ { t ^ { \prime } = 0 } ^ { t - 1 } \tilde { \eta } ^ { ( t ^ { \prime } ) } \big ( \sum _ { t ^ { \prime \prime } = 0 } ^ { t ^ { \prime } } \tilde { \eta } ^ { ( t ^ { \prime \prime } ) } L _ { x } + \triangle \tau _ { l } ^ { ( 0 ) } \big ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad L ^ { ( 0 ) } + H ^ { ( 0 ) } + \sum _ { t ^ { \prime } = 0 } ^ { t - 1 } \tilde { \eta } ^ { ( t ^ { \prime } ) } \big ( \sum _ { t ^ { \prime \prime } = 0 } ^ { t ^ { \prime } } \tilde { \eta } ^ { ( t ^ { \prime \prime } ) } \big ( L _ { x } + H _ { x } \big ) + \big \triangleup \tau _ { l } ^ { ( 0 ) } + \triangle \tau _ { h } ^ { ( 0 ) } \big ) . } \end{array}$$
Let
$$a = \sum _ { t ^ { \prime } = 0 } ^ { t - 1 } \tilde { \eta } ^ { ( t ^ { \prime } ) } \sum _ { t ^ { \prime \prime } = 0 } ^ { t ^ { \prime } } \tilde { \eta } ^ { ( t ^ { \prime \prime } ) } L _ { x } , b = \sum _ { t ^ { \prime } = 0 } ^ { t - 1 } \tilde { \eta } ^ { ( t ^ { \prime } ) } \sum _ { t ^ { \prime \prime } = 0 } ^ { t ^ { \prime } } \tilde { \eta } ^ { ( t ^ { \prime \prime } ) } H _ { x } , c = \sum _ { t ^ { \prime } = 0 } ^ { t - 1 } \tilde { \eta } ^ { ( t ^ { \prime } ) } \triangle \tau _ { l } ^ { ( 0 ) } , d = \sum _ { t ^ { \prime } = 0 } ^ { t - 1 } \tilde { \eta } ^ { ( t ^ { \prime } ) } \triangle \tau _ { h } ^ { ( 0 ) } ,$$
then
$$\frac { a } { a + b } = \tau ( \tilde { \pmb { x } } \in S _ { l } ) , \frac { c } { c + d } = \frac { \triangle \tau _ { l } ^ { ( 0 ) } } { \triangle \tau _ { l } ^ { ( 0 ) } + \triangle \tau _ { h } ^ { ( 0 ) } }$$
and
$$\begin{array} { r } { \frac { L ^ { ( t ) } } { L ^ { ( t ) } + H ^ { ( t ) } } = \frac { L ^ { ( 0 ) } + a + c } { L ^ { ( 0 ) } + H ^ { ( 0 ) } + a + b + c + d } } \\ { = \tau ( \tilde { \pmb { x } } \in S _ { l } ) \frac { 1 + \frac { c } { a } + \frac { L ^ { ( 0 ) } } { a } } { 1 + \frac { L ^ { ( 0 ) } + H ^ { ( 0 ) } } { a + b } + \frac { c + d } { a + b } } . } \end{array}$$
If
$$\begin{array} { c } { { \displaystyle \frac { c } { a } + \frac { L ^ { ( 0 ) } } { a } < \frac { L ^ { ( 0 ) } + H ^ { ( 0 ) } } { a + b } + \frac { c + d } { a + b } } } \\ { { \displaystyle \frac { c } { L ^ { ( 0 ) } + H ^ { ( 0 ) } } + \tau ( \tilde { \delta } ^ { ( 0 ) } \in S _ { l } ) < \tau ( \tilde { \pmb x } \in S _ { l } ) \left( 1 + \frac { c + d } { L ^ { ( 0 ) } + H ^ { ( 0 ) } } \right) } } \\ { { \triangle \tau _ { l } ^ { ( 0 ) } - \tau ( \tilde { \pmb x } \in S _ { l } ) ( \triangle \tau _ { l } ^ { ( 0 ) } + \triangle \tau _ { h } ^ { ( 0 ) } ) < \zeta \left( L ^ { ( 0 ) } + H ^ { ( 0 ) } \right) } } \end{array}$$
then we must have
$$\tau ( \tilde { \pmb \delta } ^ { ( t ) } \in S _ { l } ) < \tau ( \tilde { \pmb x } \in S _ { l } )$$
at the $t$ -th step. A stronger condition is that
$$\triangle \tau _ { l } ^ { ( 0 ) } < \tau ( \tilde { \pmb { x } } \in S _ { l } ) ( \triangle \tau _ { l } ^ { ( 0 ) } + \triangle \tau _ { h } ^ { ( 0 ) } )$$
then we will have $\tau ( \tilde { \pmb { \delta } } ^ { ( t ) } \in S _ { l } ) < \tau ( \tilde { \pmb { x } } \in S _ { l } )$ for all $t$ . This condition approximately states that the ”ratio” of low frequency component of $\triangle \tau _ { l } ^ { ( 0 ) } + \triangle \tau _ { h } ^ { ( 0 ) }$ is smaller than that of clean data.
# B $l _ { 2 }$ PGD PERTURBATIONS
The PGD update rule for finding perturbations of $_ { \textbf { \em x } }$ with learning rate $\xi$ at step $j + 1$ is:
$$\delta ^ { ( j + 1 ) } = { \mathcal { P } } _ { { \mathcal { B } } ( 0 , \epsilon ) } \left[ \delta ^ { ( j ) } + \xi \frac { \partial \ell } { \partial f } ^ { ( j ) } \nabla _ { x } f ^ { ( j ) } \right] ,$$
where $B ( 0 , \epsilon )$ is a ball centered at 0 with radius $\epsilon$ in Euclidean space and $\mathcal { P }$ is the projection operator defined as
$$\mathcal { P } _ { B ( 0 , \epsilon ) } \left[ \delta \right] = \underset { \delta ^ { \prime } \in B ( 0 , \epsilon ) } { \mathrm { a r g m i n } } \| \delta ^ { \prime } - \delta \| ^ { 2 } .$$
Note that in this part quantities removing the step script $j$ (e.g. $\frac { \partial \ell } { \partial f }$ and $\nabla _ { x } f$ ) refers to not involving perturbations. For convenience, we use the same learning rate $\xi$ for all steps $j$ and instead explore the update of
$$\kappa ^ { ( j ) } = \frac { \delta ^ { ( j ) } } { \xi }$$
to the order of $\delta$ to see trends of PGD perturbations in frequency domain alongside PGD iterations since $\tau ( \tilde { \delta } [ k ] ) = \tau ( \tilde { \kappa } [ k ] )$ . For ease of notation, we adopt the following representations: Let $\triangle \phi _ { k } ^ { ( j ) }$ denote the difference of phases between $\widetilde { \nabla f [ k ] }$ and $\tilde { \kappa } ^ { ( j ) } [ k ]$ ; l $\mathrm { ~ ~ \sf ~ { ~ \sf ~ * ~ } ~ } \bar { \beta } ^ { ( j ) } = \partial \ell / \partial f + \delta ^ { ( j ) } \cdot \nabla _ { \bf x } f$ where $\bar { \beta } ^ { ( 0 ) } > 0$ and one can drive similar results for $\bar { \beta } ^ { ( 0 ) } < 0$ ; we denote
$$\begin{array} { r } { \displaystyle \Lambda \bar { \tau } _ { l } ^ { ( j ) } \triangleq 2 \sum _ { k = 0 } ^ { k _ { c } } | \tilde { \kappa } ^ { ( j ) } [ k ] | | \widetilde { \nabla f } [ k ] | \cos \left( \bigtriangleup \phi _ { k } ^ { ( j ) } \right) \mathrm { ~ a n d ~ } \bigtriangleup \bar { \tau } _ { h } ^ { ( j ) } \triangleq 2 \sum _ { k = k _ { c } + 1 } ^ { ( d - 1 ) / 2 } | \tilde { \kappa } ^ { ( j ) } [ k ] | | \widetilde { \nabla f } [ k ] | \cos \left( \bigtriangleup \phi _ { k } ^ { ( j ) } \right) , } \end{array}$$
where $\bar { \beta } ^ { ( j ) } \triangle \bar { \tau } _ { l } ^ { ( j ) }$ and $\bar { \beta } ^ { ( j ) } \triangle \bar { \tau } _ { h } ^ { ( j ) }$ are changed amounts of LFC and HFC of $| \kappa | ^ { 2 }$ at the $( j + 1 )$ - th step of PGD iteration. We provide below our results on frequency spectrum of -norm PGD perturbations.
Theorem 4 (The spectral trajectory of $l _ { 2 }$ PGD perturbation) At the $( j + 1 )$ -th step of PGD, iteration of PGD will change the ratio of LFC of $l _ { 2 }$ norm PGD adversarial perturbation for a neural network $( l )$ which satisfies $| \partial \ell / \partial f | = \overset { \cdot } { \epsilon } ^ { 1 + \nu }$ with $0 < \nu < 1$ as follows,
$$\tau ( \tilde { \pmb { \delta } } \in S _ { l } ) \gets \tau ( \tilde { \pmb { \delta } } \in S _ { l } ) + \bar { \beta } ^ { ( j ) } \frac { \triangle \bar { \tau } _ { l } ^ { ( j ) } \tau \left( \tilde { \pmb { \delta } } ^ { ( j ) } \in S _ { h } \right) - \triangle \bar { \tau } _ { h } ^ { ( j ) } \tau \left( \tilde { \pmb { \delta } } ^ { ( j ) } \in S _ { l } \right) } { \sum _ { k = 0 } ^ { ( d - 1 ) / 2 } | \tilde { \star } ^ { ( j + 1 ) } [ k ] | ^ { 2 } } .$$
Remark If the two-layer neural network in (1) is trained with at least $t \geq t _ { 1 }$ steps $t _ { 1 }$ determined by theorem 1) such that $\tau ( \widetilde { \nabla f } \in S _ { l } ) > \tau ( \widetilde { \nabla f } \in S _ { h } )$ , then, according to theorem 4, there exists
$$j _ { 0 } = \operatorname* { m a x } \left\{ 0 , \frac { \triangle \bar { \tau } _ { h } ^ { ( 0 ) } - \triangle \bar { \tau } _ { l } ^ { ( 0 ) } } { \tilde { \beta } \left( \sum _ { k = 0 } ^ { k = k _ { c } } | \widetilde { \nabla f } [ k ] | ^ { 2 } - \sum _ { k = k _ { c } } ^ { k = ( d - 1 ) / 2 } | \widetilde { \nabla f } [ k ] | ^ { 2 } \right) } \right\} ,$$
where $\tilde { \beta } = \mathrm { m a x } _ { i \in [ 0 , j _ { 0 } ] } \bar { \beta } ^ { ( i ) }$ , such that $\tau ( \tilde { \delta } ^ { ( j + 1 ) } \in S _ { l } ) > \tau ( \tilde { \delta } ^ { ( j ) } \in S _ { l } )$ for all $j > j _ { 0 }$ if $\tau ( \tilde { \delta } ^ { ( j ) } \in$ $S _ { l } ) < \tau ( \tilde { \delta } ^ { ( j ) } \in S _ { h } \bar { ) }$ .
# B.1 PROOF OF THEOREM 4
At the $( \mathrm { j } + 1 )$ -th step of PGD update for $\kappa ^ { ( j + 1 ) }$ , if
1. P (j) $\mathcal { P } _ { B ( 0 , \epsilon ) } ^ { ( j ) } = I$
$$\kappa ^ { ( j + 1 ) } = \kappa ^ { ( j ) } + \frac { \partial \ell } { \partial f } \nabla _ { x } f + \frac { \partial \ell } { \partial f } \sum _ { r } a _ { r } \sigma ^ { \prime \prime } \delta ^ { ( j ) } \cdot W _ { : , r } W _ { : , r } + \delta ^ { ( j ) } \cdot \nabla _ { x } f \nabla _ { x } f + \mathcal { O } ( \delta ^ { 2 } ) ;$$
2. P (j) B(0,) 6= I :
$$\pmb { \kappa } ^ { ( j + 1 ) } = \frac { \epsilon } { \| \pmb { \kappa } ^ { ( j ) } + \nabla _ { \pmb { x } } \ell ^ { ( j ) } \| } \left( \pmb { \kappa } ^ { ( j ) } + \frac { \partial \ell } { \partial f } ^ { ( j ) } \nabla _ { \pmb { x } } f ^ { ( j ) } \right) .$$
In either case, the quantity $\tau ( \tilde { \kappa } [ k ] )$ is proportional to
$$\left| \mathcal { F } \left( \kappa ^ { ( j ) } + \frac { \partial \ell } { \partial f } ^ { ( j ) } \nabla _ { \pmb { x } } f ^ { ( j ) } \right) \right| ^ { 2 } = \left| \mathcal { F } \left( \kappa ^ { ( j ) } + \frac { \partial \ell } { \partial f } \nabla _ { \pmb { x } } f + \delta ^ { ( j ) } \cdot \nabla _ { \pmb { x } } f \nabla _ { \pmb { x } } f \right) \right| ^ { 2 }$$
since the term $\delta \partial \ell / \partial f < \delta ^ { 2 }$ and can be dropped. Therefore, we now consider
$$\tilde { \kappa } ^ { ( j + 1 ) } [ k ] = \tilde { \kappa } ^ { ( j ) } [ k ] + \left( \frac { \partial \ell } { \partial f } + \delta ^ { ( j ) } \cdot \nabla _ { x } f \right) \widetilde { \nabla } f [ k ]$$
at the $( j + 1 )$ -th step of PGD in the frequency domain to explore ratio of frequency $k$ to the whole frequency spectrum of perturbations
$$\tau \left( \tilde { \delta } ^ { ( j + 1 ) } [ k ] \right) \propto | \tilde { \kappa } ^ { ( j ) } [ k ] | ^ { 2 } + 2 \left( \beta ^ { \prime } + \delta ^ { ( j ) } \cdot \nabla _ { x } f \right) | \tilde { \kappa } ^ { ( j ) } [ k ] | | \widetilde { \nabla f } [ k ] | \cos ( \bigtriangleup \phi _ { k } ^ { ( j ) } ) .$$
Lemma 1 (Dynamics of $l _ { 2 }$ Norm PGD in the Frequency Domain) If the initialization of $l _ { 2 }$ norm PGD adversarial perturbation satisfies $\begin{array} { r } { \frac { \partial \ell } { \partial f } + \pmb { \delta } ^ { ( 0 ) } \cdot \nabla _ { \pmb { x } } ^ { * } f > \mathbf { \overset { . } { 0 } } } \end{array}$ , then it will be positive at every iteration of $P G D ^ { 3 }$ .
Similar to Eq.(15), one can derive the changed amount of $\tau ( \tilde { \delta } \in S _ { l } )$ in theorem 4 at the $( j + 1 )$ -th step and find the necessary condition.
# C SUPPLEMENTARY EXPERIMENT
In this part, we present experiments on models with MSE loss and two-layer neural networks with fixed outer-layer parameters in Section 4.
# C.1 MSE LOSS
We show the supplementary experiment of Section 4.1 in Fig. 7 and Fig. 8. They have similar results to show that the spectrum of adversarial perturbations are more concentrated in the low-frequency domain after a sufficient training.
 Figure 7: The difference of the spectrum between original and adversarial examples. The model are trained with MSE loss.
Then we show the supplementary experiment of Section 4.2 in Fig. 9 and Fig. 10. They have similar results to show the log-spectrum difference of adversarial examples is generally concentrated around.
In general, there is little empirical gap between MSE loss and CrossEntropy loss.

 Figure 8: The expectation of the spectrum of adversarial perturbations. The model are trained with MSE loss.
 Figure 9: The difference of the log-spectrum between original and adversarial examples. The model are trained with MSE loss. Figure 10: The expectation of the log-spectrum of adversarial perturbations. The model are trained with MSE loss.
# C.2 TWO-LAYER NEURAL NETWORK
We use two-layer neural networks with fixed outer-layer parameters. The input layer is of size $3 * 3 2 * 3 2$ followed by a ReLU activation function, and the hidden layer is of size 500 followed by a sigmoid activation function. The dataset is still CIFAR10. We use random initialization and SGD optimizer without any training tricks. This setting can be used in practice and get higher than $40 \%$ test accuracy. The attack method is the same as the setup in Section 4.
We show the LFC ratio of the adversarial perturbations during the training process in Fig.11. After sufficient training, we show the expectation of the spectrum in Fig.12(a) and the expectation of the log-spectrum difference in Fig.12(b).
 Figure 11: The LFC ratio of the adversarial perturbations for two-layer neural networks in the training process. (a) The attack method is $l _ { 2 }$ FGM; (b) The attack method is $l _ { 2 }$ PGD.
 Figure 12: For two-layer neural network, the expectation of: (a) the spectrum of adversarial perturbations; (Due to the large value gap between LFC and HFC, it is hard to see the trend in original result, so we show the logarithm of the result which will not change the size relationship.) (b) the log-spectrum difference of adversarial examples.
# D PERTURBATIONS OF PGD-ATTACK ADVERSARIAL TRAINED MODEL ARE MORE CONCENTRATED IN LFC
We do use the same setup in Section 4, and the PGD-attack adversarial training is also PGD-attack with $\epsilon = 8 / 2 5 5$ , 40 iterations and step size $\xi = 4 / 2 5 5$ in each training step. Then we test the ratio of LFC of original images, perturbations in a normally trained model and perturbations in a PGDattack adversarially trained model. The results are shown in Fig. 13. It shows that the LFC ratio of perturbations in PGD-attack adversarially trained model is generally higher than that in normally trained model.
 Figure 13: the ratio of LFC of original images, perturbations in a normally trained model and perturbations in a PGD-attack adversarially trained model123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201# Learning to Predict Vehicle Trajectories with Model-based Planning
Haoran Song Di Luan Wenchao Ding Michael Yu Wang Qifeng Chen The Hong Kong University of Science and Technology {hsongad, wdingae, dluan, mywang, cqf}@ust.hk
Abstract: Predicting the future trajectories of on-road vehicles is critical for autonomous driving. In this paper, we introduce a novel prediction framework called PRIME, which stands for Prediction with Model-based Planning. Unlike recent prediction works that utilize neural networks to model scene context and produce unconstrained trajectories, PRIME is designed to generate accurate and feasibility-guaranteed future trajectory predictions. PRIME guarantees the trajectory feasibility by exploiting a model-based generator to produce future trajectories under explicit constraints and enables accurate multimodal prediction by utilizing a learning-based evaluator to select future trajectories. We conduct experiments on the large-scale Argoverse Motion Forecasting Benchmark, where PRIME outperforms the state-of-the-art methods in prediction accuracy, feasibility, and robustness under imperfect tracking.
Keywords: trajectory prediction, autonomous driving
# 1 Introduction
In the architecture of autonomous driving, prediction serves as the bridging module that reasons future states based on the perceived information from upstream detection and tracking and provides the predicted future states to facilitate the downstream planning. Therefore, making accurate and reasonable trajectory predictions for on-road vehicles is vital for planning safe, efficient, and comfortable motion for self-driving vehicles (SDVs).
The widely known challenge of trajectory prediction lies in modeling multi-agent interaction and inferring multimodal future states under driving scenarios. Traditional methods [1, 2, 3, 4, 5] produce motion forecasting by handcrafted rules or models with embedded physical and environmental features, which are insufficient for modeling interactive agents in complex scenes. Learning-based approaches [6, 7, 8], with deep neural networks to fuse scene context information and generate future trajectories, significantly promote the prediction accuracy and dominate the recent motion forecasting benchmarks for autonomous driving [9, 10].
Despite achieving steady improvement in accuracy, much less attention has been paid to the feasibility and robustness of learning-based trajectory prediction. Indeed, most traffic participants operate under their inherent kinematic constraints (e.g., non-holonomic motion constraints for vehicles) while in compliance with the road structure (e.g., lane connectivity, static obstacles) and semantic information (e.g., traffic lights, speed limits). All these kinematic and environmental constraints explicitly regularize the trajectory space. However, most existing approaches model traffic agents as points and generate future trajectories without imposing constraints. Such constraint-free predictions may be incompliant with kinematic or environmental characteristics and thus give rise to massive uncertainty in the predicted future states. As a result, the downstream planning module would inevitably undergo some extra burdens, and even the “freezing robot problem” [11]. Furthermore, the trajectory predictions typically generated by neural network regression have high dependences on long-term tracking. For some dense driving scenarios where the target would be momently occluded or suddenly appears within the sensing range, tracking results are discontinuous or not accumulated enough. The prediction accuracy would thereby degrade under such imperfect tracking cases.
 Figure 1: Illustration of the PRIME framework. The model-based generator (left) samples feasible future trajectories $\tau$ for the target agent by taking its real-time state $\mathbf { \bar { s } } _ { t a r } ^ { 0 }$ and HD map $\mathcal { M }$ , while imposing explicit constraints $\mathcal { C }$ to guarantee trajectory feasibility. The learning-based evaluator (right) receives the feasible trajectory set $\tau$ and all observed tracks $s$ to model the implicit interactions in scene context and then selects a final set of trajectories $\mathcal { T } _ { t a r } \subset \mathcal { T }$ as the prediction result.
Toward overcoming these challenges, we propose PRIME, a novel architecture for vehicle trajectory prediction, as illustrated in Fig. 1. The core idea is to exploit a model-based motion planner as the prediction generator to produce feasibility-guaranteed future trajectories under explicit physical constraints, together with a deep neural network as the prediction evaluator to enable accurate multimodal prediction by learning complex implicit interactions. To the best of our knowledge, PRIME is the first to incorporate an interpretable motion planner in prediction learning and also the only method that ensures kinematic and environmental feasibility in data-driven trajectory prediction. We conduct experiments on the large-scale Argoverse motion forecasting benchmark and achieves better prediction accuracy over the state-of-the-art. Furthermore, PRIME shows significant superiority in trajectory feasibility guarantee and prediction robustness under imperfect tracking. These attributes would facilitate more flexible and safe motion planning for SDVs.
# 2 Related Work
Prediction and Planning are closely intertwined in autonomous driving [12, 13, 14, 15]. Planning is to generate constraint-compliant trajectory candidates and, after considering safety, comfort, path progress, etc., select the best trajectory for execution by the SDV (ego agent). Prediction facilitates the trajectory selection in planning by inferring future trajectories of the surrounding vehicles (target agents). Their different focuses make the corresponding mainstream solutions diverge. Model-based approaches [16, 17, 18, 19] are preferred in planning due to their interpretability and reliability in computing safe trajectories under explicit constraints. Learning-based methods [6, 7, 20, 21], in contrast, prevail in prediction by utilizing its advantage in modeling implicit interactions.
Some learning-based prediction works incorporate the goal-directed idea from planning to infer the possible goals and then produce goal-conditioned trajectories [22, 23, 24, 25]. Moreover, the novel planning-prediction-coupled frameworks are introduced to make predictions conditioned on ego intentions [26] or motion plans [27, 28]. Although much emphasis on improving the point-level prediction accuracy, the data-driven frameworks cannot ensure the given constraints are indeed imposed on trajectory generation. Despite DKM [29] embeds the two-axle vehicle kinematics [30] in the output layer to ensure kinematic feasibility, yet still no guarantee on environmental compliance. Inspired by the popular sampling-based paradigm in vehicle motion planning [13, 17], we employ a model-based planner for providing feasibility-guaranteed trajectory sets, and thereby the learningbased part is reduced to evaluate future trajectories. With making the most of model-based planning and learning-based prediction, PRIME handles complex agent-map interactions while fulfilling environmental and kinematic constraints.
Modeling agent-map interactions is fundamental for capturing information from scene map and dynamic agents. The rasterized representation [20, 31, 32] is proposed for learning-based methods, which renders traffic entities into images by different colors or intensities and then encodes rasters with Convolutional Neural Networks. As an alternative, the vectorized representation [33, 34, 25] vectorizes scene context as nodes to construct a graph, which exploits High Definition (HD) maps more explicitly and improves prediction accuracy. By contrast, we address the agent-map modeling with a hierarchical structure that incorporates the lane-association ideas from [3] while extends to learn global scene context. To be specific, our prediction generator acts locally in a planning manner to generate path-conditioned trajectory sets, and the prediction evaluator learns a global understanding of the scene context by aggregating all trajectory and map features.
Generating multimodal trajectories is essential for handling the intrinsic multimodal prediction distributions. Stochastic models are mostly built upon conditional variational autoencoder [7, 35, 36, 37, 38] and generative adversarial network [39, 40, 41, 42], while sampling with uncontrollable latent variables at inference may impede their deployment on safety-critical driving systems. Deterministic models are mainly based on multi-mode trajectory regression [43, 44, 20, 34]. To alleviate mode collapse in prediction learning, recent works decompose the task into classification over anchor trajectories [45] or goal-conditioned trajectories [25], followed by trajectory offset regression. However, no feasibility could be ensured for the regressed results. CoverNet [32] formulates multimodal prediction by directly classifying on a pre-constructed trajectory set, but still, its predictions may violate the agent kinematics or scene constraints. For our framework, leveraging model-based planning as the prediction generator brings superiorities in 1) maintaining multimodal distributions by generating trajectories on diverse reachable paths, 2) ensuring trajectory feasibility by imposing real-time constraints, 3) mitigating the high reliance on long-term tracking, and 4) producing trajectories with continuous information rather than just discrete locations.
# 3 Overview
Problem formulation. Assume the self-driving vehicle is equipped with detection and tracking modules to provide observed states $s$ of on-road agents $\mathcal { A }$ and has access to HD map $\mathcal { M }$ . Let $\mathbf { s } _ { i } ^ { \bar { t } }$ denote the state of agent $a _ { i } \in { \mathcal { A } }$ at frame $t$ , including position, heading, velocity, turning rate and actor type, and $\mathbf { s } _ { i } = \left\{ \mathbf { s } _ { i } ^ { - T _ { P } + 1 } , \mathbf { s } _ { i } ^ { - T _ { P } + 2 } , . . . , \mathbf { s } _ { i } ^ { 0 } \right\}$ denotes the state sequence in the observed period $T _ { P }$ . Given any agent as the prediction target, we denote it by $a _ { t a r }$ and its surrounding agents by $\mathcal { A } _ { n b r s } = \{ a _ { 1 } , a _ { 2 } , . . . , a _ { m } \}$ for differentiation, with their state sequence correspondingly given as $\mathbf { s } _ { t a r }$ and $S _ { n b r s } = \{ \mathbf { s } _ { 1 } , \mathbf { s } _ { 2 } , . . . , \mathbf { s } _ { m } \}$ . Accordingly, $S = \{ \mathbf { s } _ { t a r } \} \cup S _ { n b r s }$ and $\mathcal { A } = \{ a _ { t a r } \} \cup \mathcal { A } _ { n b r s }$ . Our objective is to predict multimodal future trajectories $\mathcal { T } _ { t a r } = \{ \mathcal { T } _ { k } | k = 1 , 2 , . . . , K \}$ together with corresponding trajectory probability $\left\{ p _ { k } \right\}$ , where $\mathcal { T } _ { k }$ denotes a predicted trajectory for target agent $a _ { t a r }$ with continuous state information up to the prediction horizon $T _ { F }$ , $K$ is the number of predicted trajectories. Additionally, it is required to ensure each prediction $\mathcal { T } _ { k } \in \mathcal { T } _ { t a r }$ is feasible with existing constraints $\mathcal { C }$ , which includes environmental constraints $\mathcal { C } _ { \mathcal { M } }$ and the kinematic constraints $\mathcal { C } _ { t a r }$ .
Our framework. The two-stage architecture of PRIME consists of model-based generator $G$ and learning-based evaluator $E$ . Concretely, the generator $G : ( \mathbf { s } _ { t a r } ^ { 0 } , \mathcal { M } , \mathcal { C } ) \mapsto ( \mathcal { P } , \mathcal { T } )$ is tasked to produce the trajectory space for the target, which is approximated by a finite set of feasible trajectories $\tau$ . This part starts with searching a set of reachable paths $\mathcal { P } = \{ \mathcal { P } _ { j } | j = 1 , 2 , . . . , l \}$ from HD map $\mathcal { M }$ , which provides reference path for trajectory generation. Then a classical sampling-based planner is utilized to generate trajectory samples under constraints in $\mathcal { C }$ , and thus provide the feasible future trajectory set $\mathcal { T } = \cup _ { j = 1 } ^ { l } \{ \bar { \mathcal { T } _ { j , k } } | k = 1 , 2 , . . . , n _ { j } \}$ for the target. $\mathcal { T } _ { j , k }$ denotes the $k$ -th feasible trajectory generated from path $\mathcal { P } _ { j }$ , and the total number of trajectories is $\begin{array} { r } { n = \sum _ { j = 1 } ^ { l } n _ { j } } \end{array}$ . The model-based actions. The evaluator $E : ( \mathcal { P } , \mathcal { T } , \overset { \cdot } { S } ) \mapsto ( \mathcal { T } _ { t a r } , \{ p _ { k } \} )$ takes charge of learning implicit interactions, which features with a dual representation for spatial information and with the attention mechanism to process the varying sizes of $l$ reachable paths, $m$ surrounding agents, and $n$ feasible trajectories. Notably, the evaluator $E$ is reduced to score trajectories and select prediction results $\bar { \mathcal { T } _ { t a r } } \subset \mathcal { T }$ , rather than regressing position or displacement as most learning-based frameworks do.
# 4 Model-based Generator
# 4.1 Path Search
Unlike motion planning, where the reference path for the controllable ego agent is given, the future paths of uncontrollable targets in prediction are unknown. Therefore, we conduct the path search in advance of trajectory generation such that any prediction target could be associated with a set of potential paths ${ \mathcal { P } } ^ { + }$ . Our path search algorithm $\dot { G } _ { p a t h } : ( \mathcal { M } , \mathbf { s } _ { t a r } ^ { 0 } ) \mapsto \mathcal { P } ^ { + }$ is implemented by Depth
First-Search on HD map $\mathcal { M }$ , with more details described in the supplementary material. Yielding a potential path $\mathcal { P } _ { j } \in \mathcal { P } ^ { \bar { + } }$ with the centerline coordinates of each lane segment sequence, we expect all the paths of ${ \bar { \mathcal { P } } } ^ { + }$ to provide sufficient coverage for the future trajectory space of $a _ { t a r }$ . As no dynamic constraint is imposed in this phase, for target with current state $\bar { \bf s } _ { t a r } ^ { 0 }$ , some paths in ${ \mathcal { P } } ^ { + }$ may not be reachable at frame $t = T _ { F }$ . For instance, a high-speed vehicle cannot change to the opposite lane with a U-turn in few seconds. Such unreachable paths could be recognized in the following trajectory generation phase as no trajectories samples towards them are feasible. Finally, a set of reachable paths ${ \mathcal { P } } \subseteq { \mathcal { P } } ^ { + }$ would be reserved.
# 4.2 Trajectory Generation
Given the potential paths in ${ \mathcal { P } } ^ { + }$ as dynamic references, we choose to generate future trajectories in a planning manner. For SDV, motion planning typically aims at finding an optimal trajectory to connect the current state and a goal state, essentially different from prediction that infers probable trajectories for vehicles with unknown intentions. Despite this, the modelbased generator in planning, which computes a large number of trajectory samples for the follow-up selection, could also be exploited in prediction.
 Figure 2: Trajectory generation in a Frenet Frame ´
We adopt the trajectory generation phase of Frenet plan- ´ ner [17] in our trajectory generator $G _ { t r a j } ^ { \bf { \bar { \alpha } } } : ( \mathcal { P } ^ { + } , { \bf s } _ { t a r } ^ { 0 } , \mathcal { \bar { C } } ) \mapsto $ $\tau$ . Given a reference path in ${ \mathcal { P } } ^ { + }$ , a dynamic curvilinear frame is given by the tangential vector $\vec { t _ { r } }$ and normal vector $\vec { n } _ { r }$ at a certain point $r$ on the path centerline. The Cartesian coordinate $\vec { x } = ( x , y )$ could be converted to the Frenet coordinate ´ $( s , d )$ , with the relation
$$\vec { x } ( s ( t ) , d ( t ) ) = \vec { r } ( s ( t ) ) + d ( t ) \vec { n } _ { r } ( s ( t ) ) ,$$
in which $\vec { r }$ represents a vector pointing from the path root, $s$ and $d$ denote the covered arc length and the perpendicular offset, as illustrated in Fig. 2. The trajectory generation phase first projects the current state $\mathbf { s } _ { t a r } ^ { 0 }$ onto the Frenet frame and obtains the state tuple ´ $[ s _ { 0 } , \dot { s } _ { 0 } , \bar { \dot { s } } _ { 0 } , d _ { 0 } , \dot { d } _ { 0 } , \ddot { d } _ { 0 } ]$ . The longitudinal movement $s ( t )$ and lateral movement $d ( t )$ within the prediction horizon $T _ { F }$ are then generated independently by connecting the fixed start state with different end states using parametric curves to cover different driving maneuvers. Compared with planning, prediction receives less accurate state estimation for targets and does not need fine-grained trajectories. In our trajectory generator, therefore, some high-order state variables are simplified to zero. For longitudinal movement, we sample the target velocity $\dot { s } ( T _ { F } ) \dot { s } _ { i }$ in the range of $[ \mathrm { m a x } ( 0 , \dot { s } _ { 0 } - \delta ^ { - } T _ { F } ) , \mathrm { m i n } ( \hat { \dot { s } } , \dot { s } _ { 0 } + \delta ^ { + } T _ { F } ) ]$ while leaving $s ( T _ { F } )$ unconstrained. The constants $\delta ^ { - }$ , $\delta ^ { + }$ and $\hat { s }$ are given by considering the actor type of $a _ { t a r }$ and speed limit in $\mathcal { M }$ , to control the longitudinal velocity $\dot { s } _ { i }$ in a reasonable range. Each longitudinal trajectory $s _ { i } ( t )$ is calculated using a quartic polynomial
$$\mathrm { t . } \quad [ s ( 0 ) , \dot { s } ( 0 ) , \ddot { s } ( 0 ) , \dot { s } ( T _ { F } ) , \ddot { s } ( T _ { F } ) ] = [ s _ { 0 } , \dot { s } _ { 0 } , 0 , \dot { s } _ { i } , 0 ] .$$
For lateral movement, we sample the target offset $d ( T _ { F } ) d _ { j }$ in the range of $[ - d _ { l a n e } / 2 , d _ { l a n e } / 2 ]$ where $d _ { l a n e }$ denotes lane width. Each lateral trajectory $d _ { j } ( t )$ is calculated using a quintic polynomial
$$[ d ( 0 ) , \dot { d } ( 0 ) , \ddot { d } ( 0 ) , d ( T _ { F } ) , \dot { d } ( T _ { F } ) , \ddot { d } ( T _ { F } ) ] = [ d _ { 0 } , \dot { d } _ { 0 } , 0 , d _ { j } , 0 , 0 ] .$$
With the resulted longitudinal and lateral trajectory set $\mathcal { T } _ { l o n }$ and $\mathcal { T } _ { l a t }$ , a full trajectory $\vec { x } ( s ( t ) , d ( t ) )$ is formed by every combinations in $\mathcal { T } _ { l o n } \times \mathcal { T } _ { l a t }$ . Next, the trajectories incompliant with given constraints $\mathcal { C }$ would be filtered out. We first project the Frenet coordinates ´ $( s , d )$ back to global coordinates $( x , y )$ to check if the trajectory collides with static obstacles given in $\mathcal { C } _ { \mathcal { M } }$ . For collision-free trajectories, their high-order state variables are then converted by the Frenet-Cartesian-transfomation ´
$$\ [ s , \dot { s } , \ddot { s } , d , \dot { d } , \ddot { d } ] \longmapsto [ \vec { x } , v , \kappa , \alpha ]$$
to check if any velocity $v$ , acceleration $\alpha$ or curvature $\kappa$ exceeds the kinematic constraints given in $\mathcal { C } _ { t a r }$ . Finally, each reference path $\mathcal { P } _ { j } \in \mathcal { P }$ would generate a set of $n _ { j }$ feasibility-guaranteed future trajectories $\mathbf { \bar { \{ } } T _ { j , k } | k = 1 , 2 , . . . , n _ { j } \}$ , and all the trajectories together form an overall trajectory space $\tau$ . Although the constraints are set conservatively with leaving some margin for the learning-based evaluator, our model-based generator effectively narrows down the trajectory space $\tau$ by imposing constraints. This unique advantage would set our framework with higher accuracy and robustness.
 Figure 3: PRIME framework overview. The model-based generator searches reachable paths $\mathcal { P }$ through the map and produces feasible future trajectories $\tau$ . The learning-based evaluator encodes the traffic entities in $( \mathcal { P } , \mathcal { T } , \mathcal { S } )$ and learns implicit interactions in the subsequent attention modules. Afterwards, each future trajectory $\mathcal { T } _ { j , k }$ could query its track tensor $\mathbf { X } _ { j } ( \mathbf { s } _ { t a r } )$ from P2T, interaction tensor $\mathbf { Y } _ { j } ( \mathbf { s } _ { t a r } )$ from A2A and future tensor $\mathbf { Z } ( T _ { j , k } )$ from F2F, and it is scored by feeding the concatenation of these tensors to fully-connected layers. Finally, the evaluator ranks all feasible future trajectories in $\tau$ by scoring and outputs a final set of $K$ predicted trajectories.
# 5 Learning-based Evaluator
# 5.1 State Representation
The prediction evaluator aggregates scene context, including observed state sequences $s$ , path set $\mathcal { P }$ , and future trajectory set $\tau$ . To make it compatible with most existing trajectory prediction datasets, state sequence $\mathbf { s } _ { i }$ is reduced to history track in the learning part. Before feeding to the network, we discretize each history track $\mathbf { s } _ { i }$ and future trajectory $\mathcal { T } _ { j , k }$ as a location sequence with time interval $\Delta T$ , and each reference path $\mathcal { P } _ { j }$ as a waypoint sequence with distance interval $\Delta D$ . Since the longitudinal movement $s$ and lateral offset $d$ indicate how an agent moves relative to a reference path, they represent the local spatial relationship more straightforwardly. For this reason, we use the Frenet coordinates ´ $( s , d )$ in addition to the Cartesian coordinates $( x , y )$ to form a dual spatial representation. Here, the spatial information $( x , y , s , d )$ of future trajectories in $\tau$ is given by the generator, while the $( s , d )$ coordinates of history tracks in $s$ are obtained by projecting $( x , y )$ coordinates on the corresponding reference path. Additionally, we adopt the approach of [34] to add a binary mask $b$ to history track’s representation $( x , y , s , d , b )$ to indicate if the location is padded.
# 5.2 Encoding Scene Context
Prior to capture interrelationships between traffic entities, we first encode each kind of entity in the scene. All encoders are structured with a temporal convolutional layer followed by a long short-term memory (LSTM) layer. The track encoder and the future encoder employ a unidirectional LSTM and make the last hidden state $h ( \cdot )$ as the motion encoding for history track and future trajectory, while the path encoder uses a bidirectional LSTM and provides the sequence of hidden states $H ( \cdot )$ as the path spatial encoding. Given the scene context description $( \mathcal { S } , \mathcal { P } , \mathcal { T } )$ , each reachable path $\mathcal { P } _ { j } \in \mathcal { P }$ is encoded as a $H ( \mathcal { P } _ { j } )$ , where $j = 1 , 2 , . . . , l$ . Considering that the Frenet representation ´ is dependent with the path frame, we encode all history tracks with respect to each reference path $\mathcal { P } _ { j }$ , which results in $l$ groups of track encodings $\{ h ( \mathbf { s } _ { t a r } ) , h ( \mathbf { s } _ { 1 } ) , . . . , h ( \mathbf { s } _ { m } ) \} _ { j }$ . Each future trajectory $\mathcal { T } _ { j , k } \in \mathcal { T }$ is relative to its reference path $\mathcal { P } _ { j }$ , so all future trajectories are encoded correspondingly to form $l$ groups of future encodings $\{ h ( \mathcal { T } _ { j , k } ^ { \setminus } ) | k = 1 , 2 , . . . , n _ { j } \}$ .
# 5.3 Modeling Interactions
Next is to capture the implicit interactions resulted from the static environment and multiple dynamic agents. To fuse the spatial-temporal information from varying numbers of entities in the scene context, the attention mechanism [46] is adopted to construct four modules, namely, path to track (P2T), path to future (P2F), agent to agent (A2A), and future to future (F2F). They are implemented in the same way of scaled dot-product attention and use linear layers for mapping key, query and value. The overall workflow is shown in Fig. 3. In the upper branch, P2T brings the spatial information of each path encoding $\mathcal { P } _ { j }$ into the corresponding track encodings $\{ h ( \mathbf { s } _ { t a r } ) , h ( \mathbf { s } _ { 1 } ) , . . . , h ( \mathbf { s } _ { m } ) \} _ { j }$ . The track encodings are further processed by a self-attention structure in A2A, aiming to capture the interactions between agents in the past time domain. The lower branch lays emphasis on updating the features contained in future encodings. P2F brings the spatial information of path encoding $H ( \mathcal P _ { j } )$ into the corresponding future encodings $\{ h ( \mathcal { T } _ { j , k } ) | k = 1 , 2 , . . . , n _ { j } \}$ . It is followed by F2F that fuses all future encodings $\bigcup _ { j = 1 } ^ { l } \left\{ h ( \mathcal T _ { j , k } ) | k = 1 , 2 , . . . , n _ { j } \right\}$ from different paths $\mathcal { P } _ { j } ( j = 1 , 2 , . . . , l )$ using self-attention. In particular, F2F obtains a global understanding of the reachable space given by $\mathcal { P }$ and, by this way, attempts to further perceive the differences between different trajectories in $\tau$ . For any future trajectories $\mathcal { T } _ { j , k } \in \mathcal { T }$ , the corresponding track tensor $\mathbf { X } _ { j } ( \mathbf { s } _ { t a r } )$ , interaction tensor $\mathbf { Y } _ { j } ( \mathbf { s } _ { t a r } )$ and future tensor $\bar { \bf Z } ( \mathcal { T } _ { j , k } )$ could be obtained from P2T, A2A and F2F modules, which are then concatenated together to form a full description $\mathbf { U } _ { j , k } = \operatorname { C o n c a t } ( \mathbf { X } _ { j } ( \mathbf { s } _ { t a r } ) , \mathbf { Y } _ { j } ( \mathbf { s } _ { t a r } ) , \mathbf { Z } ( { \mathcal { T } } _ { j , k } ) )$ .
# 5.4 Trajectory Scoring, Learning, and Inference
With $\mathbf { U } _ { j , k }$ as a full description, we score all the $n$ trajectories $\mathcal { T } _ { j , k }$ using a maximum entropy model:
$$\gamma ( \mathcal { T } _ { j , k } ) = \frac { \exp ( f ( \mathbf { U } _ { j , k } ) ) } { \sum _ { j = 1 } ^ { l } \sum _ { k = 1 } ^ { n _ { j } } \exp ( f ( \mathbf { U } _ { j , k } ) ) } ,$$
in which $f ( \cdot )$ is implemented using a 3-layer MLP at the end of the evaluation network $E$ . The score label $\psi ( T _ { j , k } )$ is resulted from calculating the accumulated squared distance error $\mathrm { D i s t } ( \cdot )$ between the future trajectory $\mathcal { T } _ { j , k }$ and the ground truth trajectory $\mathcal { T } _ { G T }$ within the prediction horizon $T _ { F }$ :
$$\psi ( \mathcal { T } _ { j , k } ) = \frac { \exp ( - \mathrm { D i s t } ( \mathbf { T } _ { j , k } , \mathbf { T } _ { G T } ) / \tau ) } { \sum _ { j = 1 } ^ { l } \sum _ { k = 1 } ^ { n _ { j } } \exp ( - \mathrm { D i s t } ( \mathbf { T } _ { j , k } , \mathbf { T } _ { G T } ) / \tau ) } ,$$
where $\tau$ is set as a temperature factor. The overall network is trained by cross entropy between the evaluated scores and the labeled scores L = CrossEntropy $( \gamma ( \mathcal { T } _ { j , k } ) , \psi ( \mathcal { T } _ { j , k } ) )$ . For the inference stage that requires $K$ predicted trajectories, we adopt the non-maximum suppression (NMS) algorithm to remove near-duplicate trajectories, as did in [25]. According to the predicted scores, this method greedily picks trajectories from $\tau$ and excludes the lower scored trajectory between very close ones. Finally, $K$ trajectories with descending order of scores form the prediction result $\begin{array} { r l } { \mathcal { T } _ { t a r } } & { { } = } \end{array}$ $\{ \mathcal { T } _ { i } | k = 1 , 2 , . . . , K \}$ , and the prediction probability $p _ { k }$ is derived by $p _ { k } = \gamma ( \mathcal T _ { k } ) / { \sum _ { k = 1 } ^ { K } \gamma ( \mathcal T _ { k } ) }$ .
# 6 Experiments
Dataset. Argoverse [10] is one of the largest publicly available motion forecasting datasets, which contains over 324K data sequence collected from complex urban driving scenarios. The training, validation, and test sets are taken from disjoint parts of the cities. Each sequence lasts for 5 seconds, containing the centroid locations of each tracked agent sampled at $1 0 \ : \mathrm { H z }$ , in which one vehicle with relatively complex motion is marked as the prediction target. The objective is to predict its locations 3 seconds into the future, given an initial 2-second observation.
Metrics. We follow the Argoverse evaluation criteria under $K = 1$ and $K = 6$ . Minimum Average Displacement Error $( \mathrm { m i n A D E } _ { K }$ ) is the average L2 distance error of the best predicted trajectory. Minimum Final Displacement Error $( \mathrm { m i n F D E } _ { K } )$ ) is the L2 distance error of the best predicted trajectory at the final timestamp. Miss Rate $( \mathrm { M R } _ { K } )$ is the ratio of scenarios that none of $K$ predicted trajectories has less than 2 meters L2 final displacement error. For multimodal prediction, the probability-based metrics ${ \mathsf { p } } { \cdot } { \mathrm { m i n A D E } } _ { K }$ and ${ \mathsf { p } } { \cdot } { \mathrm { m i n F D E } } _ { K }$ are calculated by adding $- l o g ( p )$ to $\mathrm { m i n A D E } _ { K }$ and $\mathrm { m i n F D E } _ { K }$ , where $p$ corresponds to the probability of the best predicted trajectory. In the Argoverse benchmark, best refers to the predicted trajectory with the minimum endpoint error.
Implementation Details. Our implementation is detailed in the supplementary material. Among the state-of-the-art methods, only LaneGCN [34] is open-source. So we use its official implementation and Argoverse baselines [10] for additional tests about trajectory feasibility and imperfect tracking.
<table><tr><td rowspan="2">Method</td><td colspan="3">K=1</td><td colspan="5">K=6</td><td rowspan="2">Infeasibility (%)</td></tr><tr><td>minADE</td><td>minFDE</td><td>MR (%)</td><td>minADE</td><td>minFDE</td><td>p-minADE</td><td>p-minFDE</td><td>MR (%)</td></tr><tr><td>Argo-CV</td><td>3.53</td><td>7.89</td><td>83.48</td><td>3.39</td><td>7.57</td><td>5.18</td><td>9.36</td><td>81.68</td><td>0.00</td></tr><tr><td>Argo-LSTM+map</td><td>2.96</td><td>6.81</td><td>81.22</td><td>2.34</td><td>5.44</td><td>4.14</td><td>7.23</td><td>69.16</td><td>43.53</td></tr><tr><td>Argo-NN+map</td><td>3.65</td><td>8.12</td><td>83.55</td><td>2.08</td><td>4.03</td><td>3.87</td><td>5.82</td><td>58.21</td><td>86.39</td></tr><tr><td>LaneGCN [34]</td><td>1.71</td><td>3.78</td><td>59.05</td><td>0.87</td><td>1.36</td><td>2.66</td><td>3.16</td><td>16.34</td><td>16.52</td></tr><tr><td>Alibaba-ADLab</td><td>1.97</td><td>4.35</td><td>63.76</td><td>0.92</td><td>1.48</td><td>2.67</td><td>3.23</td><td>15.86</td><td>1</td></tr><tr><td>TNT [25]</td><td>1.78</td><td>3.91</td><td>59.72</td><td>0.94</td><td>1.54</td><td>2.73</td><td>3.33</td><td>13.28</td><td>1</td></tr><tr><td>Jean [21]</td><td>1.74</td><td>4.24</td><td>68.56</td><td>1.00</td><td>1.42</td><td>2.79</td><td>3.21</td><td>13.08</td><td>1</td></tr><tr><td>Poly</td><td>1.70</td><td>3.82</td><td>58.80</td><td>0.87</td><td>1.47</td><td>2.67</td><td>3.26</td><td>12.02</td><td>1</td></tr><tr><td>PRIME (Ours)</td><td>1.91</td><td>3.82</td><td>58.67</td><td>1.22</td><td>1.56</td><td>2.71</td><td>3.05</td><td>11.50</td><td>0.00</td></tr></table>
Table 1: Comparison with the Argoverse baselines and the state-of-the-art methods on the Argoverse test set. All metrics are lower the better and Miss Rate (MR, $\mathrm { K } { = } 6$ ) is the key metric.
# 6.1 Comparison with State-of-the-art
We compare our proposed PRIME against the Argoverse baselines [10] (CV, LSTM+map, $\mathrm { N N + m a p } ,$ ), the top-3 methods in the Argoverse Motion Forecasting Competition 2020 (Jean [21], Poly, Alibaba-ADLab), and the recently published state-of-the-art, LaneGCN [34] and TNT [25]. The performance comparison under Argoverse test set is shown in Table 1. It could be noted that PRIME outperforms all other methods on Miss Rate $K = 6$ ), which is the official ranking metric in Argoverse Competition 2020. It reflects that our method produces accurate multimodal predictions consistently in diverse scenarios. We also achieve the best on the probability-based metric p${ \mathrm { m i n F D E } } _ { 6 }$ , which would be highly beneficial to weigh between multiple predictions in making decisions and motion plans. From the methods with public details, including LaneGCN [34], TNT [25], and Jean [21], we can find they all perform the learning-based paradigm that utilizes neural networks to model traffic entities and generates future trajectories, while PRIME is the only one that integrates a model-based motion generator into prediction learning. Notably, due to the lack of more detailed on-road information in the Argoverse dataset, such as vehicle types, bounding box, static obstacles, etc., the quantitative result is achieved by imposing general constraints on the model-based generator. This indicates there exists more space to improve when deploying our framework in a real autonomous driving system. Furthermore, handling environmental and dynamic constraints in an interpretable model-based manner and generating trajectories with continuous state information is significant for real-world deployment, which could not be reflected from the evaluation metrics.
# 6.2 Ablation Studies
We ablate the F2F module and Frenet´ representation (denoted by SD) from the complete evaluation network to study their impacts. Table 2 reports the results on the Argoverse validation set. With P2T, P2A, and A2A attention modules capturing the basic interactions between map and agents, the base model performs at the same level with TNT $\mathbf { \bar { ( M R _ { 6 } } = 9 \% }$ reported in [25]), indicat
<table><tr><td>Modules</td><td colspan="3"> p-minADE6 p-minFDE6 MR6(%)</td><td># Params</td></tr><tr><td>Base</td><td>2.33</td><td>2.63</td><td>8.52</td><td>0.69 M</td></tr><tr><td>Base+F2F</td><td>2.31</td><td>2.61</td><td>8.23</td><td>0.72M</td></tr><tr><td>Base+SD</td><td>2.29</td><td>2.58</td><td>7.81</td><td>0.99M</td></tr><tr><td>Base+F2F+SD</td><td>2.29</td><td>2.57</td><td>7.51</td><td>1.02 M</td></tr></table>
Table 2: Ablation studies on the Argoverse validation set.
ing that these modules are effective in capturing agent-map interactions. As for the Frenet represen- ´ tation providing the local spatial relationship and the F2F module fusing all feasible trajectories to get a global understanding of the reachable space, they both promote the performance. By comparison, the inclusion of Frenet representation is more effective. Additionally, the complete network ´ makes the best performance with only 1.02M parameters, which indicates that separating the function of trajectory generation would reduce the learning burden while achieving high performance.
# 6.3 Trajectory Feasibility
As a typical non-holonomic motion system, vehicles are constrained by inherent kinematic characteristics. So we investigate the ratio of infeasible trajectories produced by prediction models. Since the high-order states (velocity, acceleration, or turning rate) cannot be estimated accurately from discrete locations predicted by common learning-based models, we evaluate the trajectory feasibility only using curvature. By interpolating the predicted positions with pairwise cubic splines, we get the curvature at each point. A trajectory is labeled as infeasible if the curvature $\kappa > 1 / 3$ (i.e., the minimum turning radius is 3 meters) at any of its points. The ratio of infeasible trajectories is shown in the last column of Table 1. Except for the physical baseline Argo-CV (Constant Velocity), the others, as representatives of the unconstrained learning-based models, have at least $1 6 . 5 \%$ infeasible predictions. Although we only use curvature for judgment and set a fairly conservative threshold (the minimal turning radius for a regular sedan is around $4 . 5 \sim 6 . 0$ meters), the infeasible predictions still take up a considerable proportion, which would cause redundant burdens for SDVs to make decisions and plans. By contrast, the model-based generator in our framework can handle any kinematic and environmental constraints, thereby ensuring trajectory feasibility.
# 6.4 Imperfect Tracking
While most motion forecasting datasets provide tracking results of a certain duration for prediction targets, a self-driving vehicle would inevitably encounter realworld situations where the target is lost in some timestamps or not tracked long enough yet. Then the prediction model is required to robustly handle imperfect tracks rather than being restricted to fixedduration tracking inputs. To let the models (ours, LaneGCN, and $\mathrm { N N } +$ map baseline) be aware of imperfect tracks, we retrained them by randomly dropping out tracked locations. For processing such inputs while keeping network structures, we pad the locations of dropped timestamps with the nearest tracked location and add a dimension of the binary mask to denote the padded location. The drop rate is randomly sampled from $0 \sim 0 . 6$ for each data
 Figure 4: Comparison of prediction robustness under imperfect tracking.
sequence in training but fixed in testing. The drop rate is pointwise applied, i.e., 0.6 drop rate may drop more or less than $6 0 \%$ of locations on a track. The last timestamp is always kept to ensure the prediction target could be detected at inference. Fig. 4 shows how the miss rate varies with track drop rate, we observe that our model performs stably, with only $3 . 6 \%$ relative increase on $\mathrm { M R _ { 6 } }$ , while the relative increase is around $3 0 \% \sim 4 0 \%$ for the others. The result indicates that the learning-based prediction models rely on long-term tracked results to regress trajectories, while our framework design relieves that to a certain extent, thereby improving the prediction robustness.
# 7 Conclusion
We present the prediction framework PRIME that learns to predict vehicle trajectories with modelbased planning. PRIME guarantees the trajectory feasibility by exploiting a model-based generator to produce future trajectories under explicit constraints. It makes accurate trajectory predictions by employing a learning-based evaluator to capture implicit interactions in scene context and select future trajectories by scoring. With the novel framework design, PRIME outperforms the state-ofthe-art in prediction accuracy, feasibility, and robustness. Moreover, the advantages of reasonably regularizing trajectory space, predicting trajectories with continuous state, and the compatibility with on-road information would set our framework highly useful in real system deployment.
# Acknowledgments
This research work was supported in part by The Hong Kong University of Science and Technology under the project “LDSERF-Autonomy Through Learning”.
# References
[1] D. Helbing and P. Molnar. Social force model for pedestrian dynamics. Physical review E, 51 (5):4282, 1995. [2] A. Houenou, P. Bonnifait, V. Cherfaoui, and W. Yao. Vehicle trajectory prediction based on motion model and maneuver recognition. In IROS, 2013. [3] J. Ziegler et al. Making bertha drive—an autonomous journey on a historic route. IEEE Intelligent transportation systems magazine, 6(2):8–20, 2014. [4] S. Lefevre, D. Vasquez, and C. Laugier. A survey on motion prediction and risk assessment \` for intelligent vehicles. ROBOMECH journal, 1(1):1–14, 2014. [5] W. Schwarting, A. Pierson, J. Alonso-Mora, S. Karaman, and D. Rus. Social behavior for autonomous vehicles. PNAS, 116(50):24972–24978, 2019. [6] A. Alahi, K. Goel, V. Ramanathan, A. Robicquet, L. Fei-Fei, and S. Savarese. Social lstm: Human trajectory prediction in crowded spaces. In CVPR, 2016. [7] N. Lee, W. Choi, P. Vernaza, C. B. Choy, P. H. Torr, and M. Chandraker. Desire: Distant future prediction in dynamic scenes with interacting agents. In CVPR, 2017. [8] M. Bansal, A. Krizhevsky, and A. Ogale. Chauffeurnet: Learning to drive by imitating the best and synthesizing the worst. In CVPR, 2018. [9] H. Caesar, V. Bankiti, A. H. Lang, S. Vora, V. E. Liong, Q. Xu, A. Krishnan, Y. Pan, G. Baldan, and O. Beijbom. nuscenes: A multimodal dataset for autonomous driving. In CVPR, 2020. [10] M.-F. Chang, J. Lambert, P. Sangkloy, J. Singh, S. Bak, A. Hartnett, D. Wang, P. Carr, S. Lucey, D. Ramanan, et al. Argoverse: 3d tracking and forecasting with rich maps. In CVPR, 2019. [11] P. Trautman and A. Krause. Unfreezing the robot: Navigation in dense, interacting crowds. In IROS, 2010. [12] D. Ferguson, T. M. Howard, and M. Likhachev. Motion planning in urban environments. Journal of Field Robotics, 25(11-12):939–960, 2008. [13] J. Wei, J. M. Dolan, and B. Litkouhi. A prediction-and cost function-based algorithm for robust autonomous freeway driving. In IEEE Intelligent Vehicles Symposium, 2010. [14] C. Katrakazas, M. Quddus, W.-H. Chen, and L. Deka. Real-time motion planning methods for autonomous on-road driving: State-of-the-art and future research directions. Transportation Research Part C: Emerging Technologies, 60:416–442, 2015. [15] W. Schwarting, J. Alonso-Mora, and D. Rus. Planning and decision-making for autonomous vehicles. Annual Review of Control, Robotics, and Autonomous Systems, 2018. [16] M. Pivtoraiko, R. A. Knepper, and A. Kelly. Differentially constrained mobile robot motion planning in state lattices. Journal of Field Robotics, 26(3):308–333, 2009. [17] M. Werling, J. Ziegler, S. Kammel, and S. Thrun. Optimal trajectory generation for dynamic street scenarios in a frenet frame. In ICRA, 2010. [18] M. McNaughton, C. Urmson, J. M. Dolan, and J.-W. Lee. Motion planning for autonomous driving with a conformal spatiotemporal lattice. In ICRA, 2011. [19] E. Galceran, A. G. Cunningham, R. M. Eustice, and E. Olson. Multipolicy decision-making for autonomous driving via changepoint-based behavior prediction. In RSS, 2015. [20] H. Cui, V. Radosavljevic, F.-C. Chou, T.-H. Lin, T. Nguyen, T.-K. Huang, J. Schneider, and N. Djuric. Multimodal trajectory predictions for autonomous driving using deep convolutional networks. In ICRA, 2019. [21] J. Mercat, T. Gilles, N. El Zoghby, G. Sandou, D. Beauvois, and G. P. Gil. Multi-head attention for multi-modal joint vehicle motion forecasting. In ICRA, 2020. [22] B. D. Ziebart, N. Ratliff, G. Gallagher, C. Mertz, K. Peterson, J. A. Bagnell, M. Hebert, A. K. Dey, and S. Srinivasa. Planning-based prediction for pedestrians. In IROS, 2009. [23] E. Rehder, F. Wirth, M. Lauer, and C. Stiller. Pedestrian prediction by planning using deep neural networks. In ICRA, 2018. [24] K. Mangalam, H. Girase, S. Agarwal, K.-H. Lee, E. Adeli, J. Malik, and A. Gaidon. It is not the journey but the destination: Endpoint conditioned trajectory prediction. In ECCV, 2020. [25] H. Zhao, J. Gao, T. Lan, C. Sun, B. Sapp, B. Varadarajan, Y. Shen, Y. Shen, Y. Chai, C. Schmid, et al. Tnt: Target-driven trajectory prediction. In CoRL, 2020. [26] N. Rhinehart, R. McAllister, K. Kitani, and S. Levine. Precog: Prediction conditioned on goals in visual multi-agent settings. In ICCV, 2019. [27] H. Song, W. Ding, Y. Chen, S. Shen, M. Y. Wang, and Q. Chen. Pip: Planning-informed trajectory prediction for autonomous driving. In ECCV, 2020. [28] T. Salzmann, B. Ivanovic, P. Chakravarty, and M. Pavone. Trajectron $^ { + + }$ : Dynamically-feasible trajectory forecasting with heterogeneous data. In ECCV, 2020. [29] H. Cui, T. Nguyen, F.-C. Chou, T.-H. Lin, J. Schneider, D. Bradley, and N. Djuric. Deep kinematic models for kinematically feasible vehicle trajectory predictions. In ICRA, 2020. [30] R. Rajamani. Vehicle dynamics and control. Springer Science & Business Media, 2011. [31] N. Djuric, V. Radosavljevic, H. Cui, T. Nguyen, F.-C. Chou, T.-H. Lin, N. Singh, and J. Schneider. Uncertainty-aware short-term motion prediction of traffic actors for autonomous driving. In WACV, 2020. [32] T. Phan-Minh, E. C. Grigore, F. A. Boulton, O. Beijbom, and E. M. Wolff. Covernet: Multimodal behavior prediction using trajectory sets. In CVPR, 2020. [33] J. Gao, C. Sun, H. Zhao, Y. Shen, D. Anguelov, C. Li, and C. Schmid. Vectornet: Encoding hd maps and agent dynamics from vectorized representation. In CVPR, 2020. [34] M. Liang, B. Yang, R. Hu, Y. Chen, R. Liao, S. Feng, and R. Urtasun. Learning lane graph representations for motion forecasting. In ECCV, 2020. [35] N. Rhinehart, K. M. Kitani, and P. Vernaza. R2p2: A reparameterized pushforward policy for diverse, precise generative path forecasting. In ECCV, 2018. [36] J. Hong, B. Sapp, and J. Philbin. Rules of the road: Predicting driving behavior with a convolutional model of semantic interactions. In CVPR, 2019. [37] Y. C. Tang and R. Salakhutdinov. Multiple futures prediction. In NeurIPS, 2019. [38] S. Casas, C. Gulino, S. Suo, K. Luo, R. Liao, and R. Urtasun. Implicit latent variable model for scene-consistent motion forecasting. In ECCV, 2020. [39] A. Gupta, J. Johnson, L. Fei-Fei, S. Savarese, and A. Alahi. Social gan: Socially acceptable trajectories with generative adversarial networks. In CVPR, 2018. [40] A. Sadeghian, V. Kosaraju, A. Sadeghian, N. Hirose, H. Rezatofighi, and S. Savarese. Sophie: An attentive gan for predicting paths compliant to social and physical constraints. In CVPR, 2019. [41] T. Zhao, Y. Xu, M. Monfort, W. Choi, C. Baker, Y. Zhao, Y. Wang, and Y. N. Wu. Multi-agent tensor fusion for contextual trajectory prediction. In CVPR, 2019. [42] X. Li, G. Rosman, I. Gilitschenski, C.-I. Vasile, J. A. DeCastro, S. Karaman, and D. Rus. Vehicle trajectory prediction using generative adversarial network with temporal logic syntax tree features. IEEE Robotics and Automation Letters, 2021. [43] N. Deo and M. M. Trivedi. Convolutional social pooling for vehicle trajectory prediction. In CVPR Workshops, 2018. [44] S. Casas, W. Luo, and R. Urtasun. Intentnet: Learning to predict intention from raw sensor data. In CoRL, 2018. [45] Y. Chai, B. Sapp, M. Bansal, and D. Anguelov. Multipath: Multiple probabilistic anchor trajectory hypotheses for behavior prediction. In CoRL, 2019. [46] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, 2017.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286# IMPROVING ONE-SHOT NAS BY SUPPRESSING THE POSTERIOR FADING
Anonymous authors Paper under double-blind review
# ABSTRACT
Neural architecture search (NAS) has demonstrated success in automatically designing effective neural network architectures. To improve the efficiency of NAS, previous approaches adopt weight sharing method to force all models share the same set of weights. However, it has been observed that a model performing better with shared weights does not necessarily perform better when trained alone. In this paper, we analyse existing weight sharing one-shot NAS approaches from a Bayesian point of view and identify the posterior fading problem, which compromises the effectiveness of shared weights. To alleviate this problem, we present a practical approach to guide the parameter posterior towards its true distribution. Moreover, a hard latency constraint is introduced during the search so that the desired latency can be achieved. The resulted method, namely Posterior Convergent NAS (PC-NAS), achieves state-of-the-art performance under standard GPU latency constraint on ImageNet. In our small search space, our model PC-NAS-S attains $7 6 . 8 \%$ top-1 accuracy, $2 . 1 \%$ higher than MobileNetV2 $\left( 1 . 4 \mathbf { x } \right)$ with the same latency. When adopted to the large search space, PC-NAS-L achieves $7 8 . 1 \%$ top1 accuracy within $1 1 \mathrm { m s }$ . The discovered architecture also transfers well to other computer vision applications such as object detection and person re-identification.
# 1 INTRODUCTION
Neural network design requires extensive experiments by human experts. In recent years, there has been a growing interest in developing algorithmic NAS solutions to automate the manual process of architecture design (Zoph & Le, 2016; Liu et al., 2018a; Zhong et al., 2018; Li et al., 2019; Lin et al., 2019). Despite remarkable results, early works on NAS (Real et al., 2018; Elsken et al., 2017) are limited to searching only using proxy or subsampled dataset due to the exorbitant computational cost. To overcome this difficulty, (Bender et al., 2018; Pham et al., 2018) attempted to improve search efficiency via sharing weights across models. These approaches utilize an overparameterized network (supergraph) containing every single model, which can be further divided into two categories.
The first category is continuous relaxation method (Liu et al., 2018c; Cai et al., 2018), which keeps a set of so called architecture parameters to represent the model, and updates these parameters alternatively with supergraph weights. The resulting model is obtained using the architecture parameters at convergence. The continuous relaxation method suffers from the rich-get-richer problem (Adam & Lorraine, 2019), which means that a better-performed model at the early stage would be trained more frequently (or have larger learning rates). This introduces bias and instability to the search process. The other category is referred to as one-shot method (Brock et al., 2017b; Guo et al., 2019; Bender et al., 2018; Chu et al., 2019), which divides the NAS procedure into a training stage and a searching stage. In the training stage, the supergraph is optimized along with either dropping out each operator with certain probability or sampling uniformly among candidate architectures. In the search stage, a search algorithm is applied to find the architecture with the highest validation accuracy with shared weights. The one-shot approach ensures the fairness among all models by sampling architecture or dropping out operator uniformly. However, as identified in (Adam & Lorraine, 2019; Chu et al., 2019; Bender et al., 2018), the problem of one-shot method is that the validation accuracy of the model with shared weights is not predictive to its true performance.
In this paper, we formulate NAS as a Bayesian model selection problem (Chipman et al., 2001). This formulation is especially helpful in understanding the one-shot approaches in a theoretical way, which in turn provides us a guidance to fundamentally addressing one of the major issues of one-shot approaches. Specially, we show that shared weights are actually a maximum likelihood estimation of a proxy distribution to the true parameter distribution. Most importantly, we identify the common issue of weight sharing, which we call Posterior Fading, i.e., as the number of models in the supergraph increases, the KL-divergence between true parameter posterior and proxy posterior also increases.
To alleviate the Posterior Fading problem, we proposed a practical approach to guide the convergence of the proxy distribution towards the true parameter posterior. Specifically, we divide the training of supergraph into several intervals and maintain a pool of high potential partial models and progressively update this pool after each interval . At each training step, a partial model is sampled from the pool and complemented to a full model. To update the partial model pool, we first generate candidates by extending each partial model and evaluate their potentials, keeping the best performancing ones. The search space is effectively shrunk in the upcoming training interval. Consequently, the parameter posterior get close to the desired true posterior during this procedure. Main contributions of our work is concluded as follows:
• We for the first time analyse one-shot approaches from a Bayesian point of view and identify the associated disadvantage which we call Posterior Fading. • Guided by the theoretical result, we introduce a novel NAS algorithm fundamentally different from existing one-shot methods, which guides the proxy distribution to converge towards the true parameter posterior.
To examine the effectiveness of our newly proposed method, we benchmark its performance on ImageNet (Russakovsky et al., 2015) against the existing methods. In one typical search space (Cai et al., 2018), our PC-NAS-S attains $7 6 . 8 \%$ top-1 accuracy, $0 . 5 \%$ higher and $2 0 \%$ faster than EfficientNet-B0 (Tan & Le, 2019a), which is the previous state-of-the-art model in mobile setting. To further demonstrate the advantage of our method, we test it on a larger space and our PC-NAS-L boosts the accuracy to $7 8 . 1 \%$ .
# 2 RELATED WORK
Early neural architecture search (NAS) (Miller et al., 1989; Liu et al., 2018b; Real et al., 2017; Zoph & Le, 2016; Baker et al., 2017a; Wang et al., 2019) methods normally involves with reinforcement learning or neuro-evolution. This type of NAS is typically considered as an agent-based explore and exploit process, where an agent (e.g. an evolution mechanism or a recurrent neural network(RNN)) is introduced to explore a given architecture space with training a network in the inner loop to get an evaluation for guiding exploration. Such methods are computationally expensive and hard to be used on large-scale datasets, e.g. ImageNet.
Recent works (Pham et al., 2018; Brock et al., 2017a; Liu et al., 2018c; Cai et al., 2018) try to alleviate this computation cost via modeling NAS as a single training process of an over-parameterized network that comprises all candidate models, in which weights of the same operators in different models are shared. ENAS (Pham et al., 2018) reduces the computation cost by orders of magnitude, while requires an RNN agent and focuses on small-scale datasets (e.g. CIFAR10). One-shot NAS (Brock et al., 2017b) trains the over-parameterized network along with droping out each operator with increasing probability. Then it use the pre-trained over-parameterized network to evaluate randomly sampled architectures. DARTS (Liu et al., 2018c) additionally introduces a real-valued architecture parameter for each operator and alternately train operator weights and architecture parameters by back-propagation. ProxylessNAS (Cai et al., 2018) binarize the real-value parameters in DARTS to save the GPU cumputation and memory for training the over-parameterized network.
The paradigm of ProxylessNAS (Cai et al., 2018) and DARTS (Liu et al., 2018c) introduce unavoidable bias since operators of models performing well in the beginning will easily get trained more and normally keep being better than other. But they are not necessarily superior than others when trained from scratch.
 Figure 1: One example of search space(a) and PC-NAS process(b)(c)(d). Each mixed opperator consists of $N ( = 3$ in this figure) operators. However, only one operator in each mixop is invoked at a time for each batch. In (b), partial models 1 and 2 in the pool consist of choices in mixop 1 and 2. We extend these 2 partial models to one mixop 3. 6 extended candidate models are evaluated and ranked in(c). In (d), the new pool consists of the top-2 candidate models ranked in (c).
Other relevant works are ASAP (Noy et al., 2019) and XNAS (Nayman et al., 2019), which introduce pruning during the training of over-parameterized networks to improve the efficiency of NAS. Similar to these approaches, we start with an over-parameterized network and then reduce the search space to derive the optimized architecture. Instead of focusing on the speed-up of training and only pruning by evaluating the architecture parameters, we further improve the rankings of models and evaluate operators directly on validation set.
# 3 METHODS
In this section, we first formulate neural architecture search in a Bayesian manner. Utilizing this setup, we introduce the PC-NAS algorithm and analyse its advantage comparing to previous approaches. Finally, we discuss the search algorithm combined with latency constraint.
# 3.1 A PROBABILISTIC SETUP FOR MODEL UNCERTAINTY
Suppose we have $K$ different models $\mathcal { M } = \{ \mathbf { m } _ { 1 } , . . . , \mathbf { m } _ { K } \}$ under consideration for data $\mathcal { D }$ , and $p ( \mathcal { D } | \theta _ { k } , \mathbf { m } _ { k } )$ describes the probability density of data $\mathcal { D }$ given model $\mathbf { m } _ { k }$ and its associated parameters $\theta _ { k }$ . The Bayesian approach proceeds by assigning a prior probability distribution $p ( \boldsymbol { \theta } _ { k } | \mathbf { \bar { m } } _ { k } )$ to the parameters of each model, and a prior probability $p ( \mathbf { m } _ { k } )$ to each model.
In order to ensure fairness among all models, we set the model prior $p ( \mathbf { m } _ { k } )$ a uniform distribution. Under previous setting, we can drive
$$p ( \mathbf { m } _ { k } | \mathcal { D } ) = \ \frac { p ( \mathcal { D } | \mathbf { m } _ { k } ) p ( \mathbf { m } _ { k } ) } { \sum _ { k } p ( \mathcal { D } | \mathbf { m } _ { k } ) p ( \mathbf { m } _ { k } ) } ,$$
where
$$p ( \mathcal { D } | { \bf m } _ { k } ) = \int p ( \mathcal { D } | \theta _ { k } , { \bf m } _ { k } ) p ( \theta _ { k } | { \bf m } _ { k } ) \mathrm { d } \theta _ { k } .$$
Since $p ( \mathbf { m } _ { k } )$ is uniform, the Maximum Likelihood Estimation (MLE) of $\mathbf { m } _ { k }$ is just the maximum of (2). It can be inferred that, $p ( \boldsymbol { \theta } _ { k } | \mathbf { m } _ { k } )$ is crucial to the solution of the model selection. We are interested in attaining the model with highest test accuracy in a trained alone manner, thus the parameter prior $p ( \boldsymbol { \theta } _ { k } | \mathbf { m } _ { k } )$ is just the posterior $p _ { \mathrm { a l o n e } } ( \theta _ { k } | \mathbf { m } _ { k } , \mathcal { D } )$ which means the distribution of $\theta _ { k }$ when $\mathbf { m } _ { k }$ is trained alone on dataset $\mathcal { D }$ . Thus we would use the term true parameter posterior to refer $p _ { \mathrm { a l o n e } } ( \theta _ { k } | \mathbf { m } _ { k } , \mathcal { D } )$ .
# 3.2 NETWORK ARCHITECTURE SELECTION IN A BAYESIAN POINT OF VIEW
We constrain our discussion in the setting which is frequently used in NAS literature for simplicity. As a building block of our search space, a mixed operator (mixop), denoted by $\mathbb { O } = \{ O _ { 1 } \ldots \bar { } , O _ { N } \}$ , contains $N$ different choices of candidate operators $O _ { i }$ for $i = 1 , \dots N$ in parallel. The search space is defined by $L$ mixed operators (layers) connected sequentially interleaved by downsampling as in Fig. 1(a). The network architecture (model) m is defined by a vector $\left[ o _ { 1 } , o _ { 2 } , . . . , o _ { L } \right]$ , $o _ { l } \in \mathbb { O }$ representing the choice of operator for layer $l$ . The parameter for the operator $o$ at the $l$ -th layer is denoted as $\theta _ { l o }$ . The parameters of the supergraph are denoted by $\theta$ which includes $\{ \theta _ { l o } | l \ \in \ \{ 1 , 2 , . . . , L \} , o \ \in \ \mathbb { O } \}$ . In this setting, the parameters of each candidate operator are shared among multiple architectures. The parameters related with a specific model $\mathbf { m } _ { k }$ is denoted as $\theta _ { k } = \theta _ { 1 , o _ { 1 } } , \theta _ { 2 , o _ { 2 } } , . . . , \theta _ { L , o _ { L } }$ , which is a subset of the parameters of the supergraph $\theta$ . Obtaining the $p _ { \mathrm { a l o n e } } ( \theta _ { k } | \mathbf { m } _ { k } , \mathcal { D } )$ or a MLE of it for every model is computationally intractable. Therefore, the one-shot method trains the supergraph by dropping out each operator (Brock et al., 2017b) or sampling different architectures (Bender et al., 2018; Chu et al., 2019) and utilize the shared weights to evaluate single model. In this work, we adopt the latter training paradigm while the former one could be easily generalized. Suppose we sample a model $\mathbf { m } _ { k }$ and optimize the supergraph with a mini-batch of data based on the objective function $L _ { \mathrm { a l o n e } }$ :
$$- \log p _ { \mathrm { a l o n e } } ( \theta | { \bf m } _ { k } , \mathcal { D } ) \propto L _ { \mathrm { a l o n e } } ( \theta , { \bf m } _ { k } , \mathcal { D } ) = - \log p _ { \mathrm { a l o n e } } ( \mathcal { D } | \theta , { \bf m } _ { k } ) - \log p ( \theta | { \bf m } _ { k } ) ,$$
where $- \log p ( \theta | { \bf m } _ { k } )$ is a regularization term. Thus minimizing this objective equals to making MLE to $p _ { \mathrm { a l o n e } } ( \theta | { \bf m } _ { k } , { \mathcal D } )$ . When training the supergraph, we sample many models $\mathbf { m } _ { k }$ , and then train the parameters for these models, which corresponds to a stochastic approximation of the following objective function:
$$L _ { \mathrm { s h a r e } } ( \theta , D ) = \frac { 1 } { K } \sum _ { k } L _ { \mathrm { a l o n e } } ( \theta , { \bf m } _ { k } , { \mathcal D } ) .$$
This is equivalent to adopting a proxy parameter posterior as follows:
$$p _ { \mathrm { s h a r e } } ( \theta | \mathcal D ) = \ \frac { 1 } { Z } \prod _ { k } p _ { \mathrm { a l o n e } } ( \theta | { \bf m } _ { k } , \mathcal D ) ,$$
$$- \log p _ { \mathrm { s h a r e } } ( \theta | \mathcal { D } ) = - \sum _ { k } \log p _ { \mathrm { a l o n e } } ( \theta | \mathbf { m } _ { k } , \mathcal { D } ) + \log Z .$$
Maximizing $p _ { \mathrm { s h a r e } } ( \theta | D )$ is equivalent to minimizing $L _ { \mathrm { s h a r e } }$ .
We take one step further to assume that the parameters at each layer are independent, i.e.
$$p _ { \mathrm { a l o n e } } ( \theta | { \bf m } _ { k } , \mathcal { D } ) = \prod _ { l , o } p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | { \bf m } _ { k } , \mathcal { D } ) .$$
Due to the independence, we have
$$p _ { \mathrm { s h a r e } } ( \theta | \mathcal { D } ) = \prod _ { k } \prod _ { l , o } p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | \mathbf { m } _ { k } , \mathcal { D } ) = \prod _ { l , o } p _ { \mathrm { s h a r e } } ( \theta _ { l , o } | \mathcal { D } ) ,$$
where
$$p _ { \mathrm { s h a r e } } ( \theta _ { l , o } | \mathcal { D } ) = \prod _ { k } p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | \mathbf { m } _ { k } , \mathcal { D } ) .$$
The KL-divergence between $p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | \mathbf { m } _ { k } , \mathcal { D } )$ and $p _ { \mathrm { s h a r e } } ( \theta _ { l , o } | \mathcal { D } )$ is as follows:
$$\begin{array} { r l } { D _ { K \mathcal { L } } \Big ( p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | { \bf m } _ { k } , \mathcal { D } ) \Big | \Big | p _ { \mathrm { s h a r e } } ( \theta _ { l , o } | \mathcal { D } ) \Big ) = \displaystyle \int p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | { \bf m } _ { k } , \mathcal { D } ) \log \frac { p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | { \bf m } _ { k } , \mathcal { D } ) } { p _ { \mathrm { s h a r e } } ( \theta _ { l , o } | \mathcal { D } ) } \mathrm { d } \theta } & { } \\ { = \displaystyle \int p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | { \bf m } _ { k } , \mathcal { D } ) \log \frac { p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | { \bf m } _ { k } , \mathcal { D } ) } { \prod _ { i } p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | { \bf m } _ { i } , \mathcal { D } ) } \mathrm { d } \theta } & { } \\ { = \displaystyle \sum _ { i \neq k } - \int p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | { \bf m } _ { k } , \mathcal { D } ) \log p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | { \bf m } _ { i } , \mathcal { D } ) \mathrm { d } \theta . } & { } \end{array}$$
The KL-divergence is just the summation of the cross-entropy of $p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | \mathbf { m } _ { k } , \mathcal { D } )$ and $p _ { \mathrm { a l o n e } } ( \theta _ { l , o } | \mathbf { m } _ { i } , \mathcal { D } )$ where $i \neq k$ . The cross-entropy term is always positive. Increasing the number of architectures would push $p _ { \mathrm { s h a r e } }$ away from $p _ { \mathrm { a l o n e } }$ , namely the Posterior Fading. We conclude that non-predictive problem originates naturally from one-shot supergraph training, as a typical search space contains a huge $1 0 ^ { 2 1 }$ architectures. Thus if we effectively reduce the number of architectures in (10) during training, the KL divergence would decrease. This is the intuition of our PC-NAS algorithm.
Inputs: $G$ (supergraph), $L$ (num of mixops in $G$ ), $\mathbf { m } ^ { \prime }$ (partial candidate), Lat(latency constraint), $S$ (evaluation number), $D _ { v a l }$ (validataion set) Scores $= \emptyset$ for $i = 1 : S$ do $\mathbf { m } ^ { * } = \mathbf { \mathrm { e x p a n d } } ( \mathbf { m } ^ { \prime } )$ randomly expand $\mathbf { m } ^ { \prime }$ to full depth L if Latency $( \mathbf { m } ^ { * } ) >$ Lat then continue dump samples that don’t satisfy the latency constraint end if $\mathrm { a c c } = \mathrm { A c c } ( \mathbf { m } ^ { * } , D _ { v a l } )$ inference $\mathbf { m } ^ { * }$ for one batch and return its accuracy Scores.append(acc) save accuracy end for Outputs: Average(Scores)
# 3.3 POSTERIOR CONVERGENT NAS
The naive approach to mitigate the posterior fading problem is to limit the number of candidate models inside the supergraph. However, large number of candidates is demanded for NAS to discover promising models. Due to this conflict, we present PC-NAS which adopt progressive search space shrinking. The resulted algorithm divides the training of shared weights into $L$ intervals, where $L$ is the number of mixed operators in the search space. The number of training epochs of a single interval is denoted as $T _ { i }$ .
Partial model pool is a collection of partial models. At the $l$ -th interval, a single partial model should contain $l - 1$ selected operators $\left[ o _ { 1 } , o _ { 2 } , . . . , o _ { l - 1 } \right]$ . The size of partial model pool is denoted as $P$ . After the $l$ -th interval, each partial model in the pool will be extended by the $N$ operators in $l$ -th mixop. Thus there are $P \times N$ candidate extended partial models with length $l$ . These candidate partial models are evaluated and the top- $P$ among which are used as the partial model pool for the interval $l + 1$ . An illustrative exmaple of partial model pool update is in Fig. 1(b)(c)(d).
Candidate evaluation with latency constraint We define the potential of a partial model to be the expected validation accuracy of the models which contain the partial model.
$$\mathrm { P o t e n t i a l } ( o _ { 1 } , o _ { 2 } , . . . , o _ { l } ) = E _ { { \bf m } \in \{ { \bf m } | { m } _ { i } = { o _ { i } } , \forall i \le l \} } ( A c c ( { \bf m } ) ) .$$
where the validation accuracy of model $\mathbf { m }$ is denoted by $A c c ( \mathbf { m } )$ . We estimate this value by uniformly sampling valid models and computing the average of their validation accuracy using one mini-batch. We use $S$ to denote the evaluation number, which is the total number of sampled models. We observe that when $S$ is large enough, the potential of a partial model is fairly stable and discriminative among candidates. See Algorithm 1 for pseudocode. The latency constraint is imposed by discarding invalid full models when calculating potentials of partial models in the pool.
Training based on partial model pool The training iteration of the supergraph along with the partial model pool has two steps. First, for a partial model from the pool, we randomly sample the missing operator $\{ o _ { l + 1 } , o _ { l + 2 } , . . . , o _ { L } \}$ to complement the partial model to a full model. Then we optimize $\theta$ using the sampled full model and mini-batch data. Initially, the partial model pool is empty. Thus the supergraph is trained by uniformly sampled models, which is identical to previous one-shot training stage. After the initial training, all operators in the first mixop are evaluated. The top $P$ operators form the partial model pool in the second training stage. Then, the supergraph resumes training and the training procedure is identical to the one discussed in last paragraph. Inspired by warm-up, the first stage is set much more epochs than following stages denoted as $T _ { w }$ . The whole PC-NAS process is elaborated in algorithm 2. The number of models in shrunk search space at the interval $l$ is strictly less than interval $l - 1$ . At the final interval, the number of cross-entropy terms in (10) are P-1 for each architectures in final pool. Thus the parameter posterior of PC-NAS would move towards the true posterior during these intervals.
Algorithm 2 PC-NAS: Posterior Convergent Architecture Search
<table><tr><td>Inputs:P(size of partial model pool), G(supergraph),Oi (the ith operator in mixed operator) L(num of mixed operators in G),Tw(warm-up epochs),Ti(interval between updation of partia model pool),Dtrain(train set),Dval (validataion set), Lat(latency constraint) PartialModels = @</td></tr><tr><td>Warm-up(G,Dtrain,Tw) uniformly sample models from G and train</td></tr><tr><td>forI= O:(L ·Ti-1) do if I mod T== O then</td></tr><tr><td>ExtendedPartialModels=</td></tr><tr><td>if PartialModels== O then</td></tr><tr><td>ExtendedPartialModels.append([Oil)add all operator in the first mixop end if</td></tr><tr><td>form in PartialModels do ExtendedPartialModels.append(Extend(m,O1),.,Extend(m,ON))</td></tr><tr><td>end for form' inExtendedPartialModelsdo</td></tr><tr><td>m'.potential=Potential(m',Dval,Lat, S)evaluate the extended partial model end for</td></tr><tr><td>PartialModels = Top(ExtendedPartialModels,P)keep P best partial models end if</td></tr><tr><td>Train(PartialModels,Dtrain)train one epoch using partial models</td></tr><tr><td>end for Outputs:PartialModels</td></tr></table>
# 4 EXPERIMENTS RESULTS
We demonstrate the effectiveness of our methods on ImageNet, a large scale benchmark dataset, which contains 1,000,000 training samples with 1000 classes. For this task, we focus on models that have high accuracy under certain GPU latency constraint. We search models using PC-NAS, which progressively updates a partial model pool and trains shared weights. Then, we select the model with the highest potential in the pool and report its performance on the test set after training from scratch. Finally, we investigate the transferability of the model learned on ImageNet by evaluating it on two tasks, object detection and person re-identification.
# 4.1 TRAINING DETAILS
Dataset and latency measurement: As a common practice, we randomly sample 50,000 images from the train set to form a validation set during the model search. We conduct our PC-NAS on the remaining images in train set. The original validation set is used as test set to report the performance of the model generated by our method. The latency is evaluated on Nvidia GTX 1080Ti and the batch size is set 16 to fully utilize GPU resources.
Search spaces: We use two search spaces. We benchmark our small space similar to ProxylessNAS (Cai et al., 2018) and FBNet (Wu et al., 2018) for fair comparison. To test our PC-NAS method in a more complicated search space, we add 3 more kinds of operators to the small space’s mixoperators to construct our large space. Details of the two spaces are in A.1.
PC-NAS hyperparameters: We use PC-NAS to search in both small and large space. To balance training time and performance, we set evaluation number $S \ : = \ : 9 0 0$ and partial model pool size $P = 5$ in both experiments. Ablation study of the two values is in 4.4. When updating weights of the supergraph, we adopt mini-batch nesterov SGD optimizer with momentum 0.9, cosine learning rate decay from 0.1 to 5e-4, batch size 512, and L2 regularization with weight 1e-4. The warmup epochs $T _ { w }$ and shrinking interval $T _ { i }$ are set 100 and 5, thus the total training of supergraph lasts
$1 0 0 + 2 0 \times 5 = 2 0 0$ epochs. After searching, we select the best one from the top 5 final partial models and train it from scratch. Similar to EfficientNet and MixNet, We add squeeze-and-excitation (SE) layers (Hu et al., 2018) to our model at the end of each operator. Results with and without SE layers are listed separately in the Table 1. Since the authors didn’t list no SE versions of EfficientNet or MixNet in their original papers, we train them as well as PC-NAS (w/o SE) with exactly the same script and the results are in Table 4.
# 4.2 IMAGENET RESULTS
Table 1: PC-NAS’ Imagenet results compared with state-of-the-art methods in the mobile setting.
<table><tr><td>model</td><td>space</td><td>params</td><td>latency</td><td>top-1</td><td>top-1(+SE)</td></tr><tr><td>MobileNetV2 1.4x (Sandler et al.,2018)</td><td>=</td><td>6.9M 5.1M</td><td>10ms</td><td>74.7%</td><td>=</td></tr><tr><td>AmoebaNet-A (Real et al., 2018)</td><td>5.6x1014</td><td></td><td>23ms</td><td>74.5%</td><td></td></tr><tr><td>PNASNet (Liu et al., 2018a)</td><td>1021</td><td>5.1M</td><td>25ms</td><td>74.2%</td><td></td></tr><tr><td>FBNet-C (Wu et al., 2018)</td><td></td><td>5.5M</td><td>1</td><td>74.9%</td><td>=</td></tr><tr><td>MnasNet (Tan et al., 2018)</td><td>-</td><td>4.4M</td><td>11ms</td><td>74.8%</td><td>76.1%</td></tr><tr><td>ProxylessNAS-gpu (Cai et al., 2018)</td><td>721</td><td>7.1M</td><td>8ms</td><td>75.1%</td><td>-</td></tr><tr><td>MixNet-S (Tan & Le,2019b)</td><td>1</td><td>4.1M</td><td>13 ms</td><td>1</td><td>75.8%</td></tr><tr><td>EfficientNet-B0 (Tan &Le,2019a)</td><td></td><td>5.3M</td><td>13 ms</td><td>=</td><td>76.3%</td></tr><tr><td>PC-NAS-S</td><td>1021</td><td>5.1M</td><td>10 ms</td><td>76.1%</td><td>76.8%</td></tr><tr><td>PC-NAS-L</td><td>2021</td><td>15.3M</td><td>11 ms</td><td>77.5%</td><td>78.1%</td></tr></table>
Table 1 shows the performance of our model on ImageNet. We set our target latency at $1 0 m s$ according to our measurement of mobile setting models on GPU. Our search result in the small space, namely PC-NAS-S, achieves $7 6 . 8 \%$ top-1 accuracy under our latency constraint, which is $0 . 5 \%$ higher than EffcientNet-B0 (in terms of absolute accuracy improvement), $1 \%$ higher than MixNet-S. If we slightly relax the time constraint, our search result from the large space, namly PC-NAS-L, achieves $7 \dot { 8 } . 1 \%$ top-1 accuracy, which improves top-1 accuracy by $\bar { 1 . 8 \% }$ compared to EfficientNet-B0, $2 . 3 \%$ compared to MixNet-S. Both PC-NAS-S and PC-NAS-L are faster than EffcientNet-b0 and MixNet-S.
Table 2: Performance Comparison on COCO and Market-1501
<table><tr><td>backbone</td><td>params</td><td>latency</td><td>COCO mAP</td><td>Market-1501mAP</td></tr><tr><td>MobileNetV2</td><td>3.5M</td><td>7ms</td><td>31.7</td><td>76.8</td></tr><tr><td>ResNet50</td><td>25.5M</td><td>15ms</td><td>36.8</td><td>80.9</td></tr><tr><td>ResNet101</td><td>44.4M</td><td>26ms</td><td>39.4</td><td>82.1</td></tr><tr><td>PC-NAS-L</td><td>15.3M</td><td>11ms</td><td>38.5</td><td>81.0</td></tr></table>
# 4.3 TRANSFERABILITY OF PC-NAS
We validate our PC-NAS’s transferability on two tasks, object detection and person re-identification. We use COCO (Lin et al., 2014) dataset as benchmark for object detection and Market-1501 (Zheng et al., 2015) for person re-identification. For the two dataset, PC-NAS-L pretrained on ImageNet is utilized as feature extractor, and is compared with other models under the same training script. For object detection, the experiment is conducted with the two-stage framework FPN (Lin et al., 2017). Table 2 shows the performance of our PC-NAS model on COCO and Market-1501. For COCO, our approach significantly surpasses the mAP of MobileNetV2 as well as ResNet50. Compare to the standard ResNet101 backbone, our model achieves comparable mAP quality with almost $1 / 3$ parameters and $2 . 3 \times$ faster speed. Similar phenomena are found on Market-1501.
 Figure 2: (a): Influence of warm-up epochs $T _ { w }$ , partial model pool size $P$ , and evaluation number $S$ to the resulted model. (b): Comparison of model rankings for One-Shot (left) and PC-NAS (right).
# 4.4 ABLATION STUDY
Impact of hyperparameters: In this section, we further study the impact of hyperparameters on our method within our small space on ImageNet. The hyperparameters include warm-up, training epochs Tw, partial model pool size $P$ , and evaluation number $S$ . We tried setting Tw as 100 and 150 with fixed $P = 5$ and $S = 9 0 0$ . The resulted models of these two settings show no significant difference in top-1 accuracy (less than $0 . 1 \%$ ), shown as in Fig. 2a. Thus we choose warm-up training epochs as 100 in our experiment to save computation resources. For the influence of $P$ and $S$ , we show the results in Fig. 2a. It can be seen that the top-1 accuracy of the models found by PC-NAS increases with both $\mathrm { \bf P }$ and S. Thus we choose $P = 5$ , $S = 9 0 0$ in the experiments for better performance. we did not observe significant improvement when further increasing these two hyperparameters.
Effectiveness of shrinking search space: To assess the role of space shrinking, we train the supergraph of our large space using One-Shot (Brock et al., 2017b) method without any shrinking of the search space. Then we conduct model search on this supergraph by progressively updating a partial model pool in our method. The resulted model using this setting attains $7 7 . 1 \%$ top-1 accuracy on ImageNet, which is $1 \%$ lower than our PC-NAS-L. We further double the value of $P$ or $S$ , and the results are listed in Table 3. From these results, we could conclude that our search method alone already lead to impressive performance. And our space shrinking training strategy improves model ranking and brings extra $0 . { \bar { 7 } } \% - 1 \%$ accuracy boost.
We add another comparison as follows. First, we select a batch of models from the candidates of our final pool under small space and evaluate their stand alone top-1 accuracy. Then we use One-Shot to train the supergraph also under small space without shrinking. Finally, we shows the model rankings of PC-NAS and One-Shot using the accuracy obtained from inferring the models in the supergraphs trained with the two methods. The difference is shown in Fig. 2b, the pearson correlation coefficients between stand-alone accuracy and accuracy in supergraph of One-Shot and PC-NAS are 0.11 and 0.92, thus models under PC-NAS’s space shrinking can be ranked by their accuracy evaluated on sharing weights much more precisely than One-Shot.
Effectiveness of our search method: To investigate the importance of our search method, we utilize Evolution Algorithm (EA) to search for models with the above supergraph of our large space trained with One-Shot. The top-1 accuracy of discovered model drops furthur to $7 5 . 9 \%$ accuracy, which is $2 . 2 \%$ lower than PC-NAS-L . We implement EA with population size 5, aligned to the value of pool size $P$ in our method, and set the mutation operation as randomly replace the operator in one mixop operator to another. We constrain the total number of validation images in EA the same as ours. The results are also shown in Table 3.
# 5 CONCLUSION
In this paper, a new architecture search approach called PC-NAS is proposed. We study the conventional weight sharing approach from Bayesian point of view and identify a key issue that compromises the effectiveness of shared weights. With the theoretical motivation, a practical method
Table 3: Comparison of different one-shot search methods
<table><tr><td rowspan=1 colspan=1>training method</td><td rowspan=1 colspan=1>search method</td><td rowspan=1 colspan=1>top-1 acc</td></tr><tr><td rowspan=1 colspan=1>PC-NAS</td><td rowspan=1 colspan=1>PC-NAS</td><td rowspan=1 colspan=1>78.1%</td></tr><tr><td rowspan=1 colspan=1>One-Shot</td><td rowspan=1 colspan=1>PC-NAS</td><td rowspan=1 colspan=1>77.1%</td></tr><tr><td rowspan=1 colspan=1>One-Shot</td><td rowspan=1 colspan=1>PC-NAS(P= 10)</td><td rowspan=1 colspan=1>77.4%</td></tr><tr><td rowspan=1 colspan=1>One-Shot</td><td rowspan=1 colspan=1>PC-NAS (S二1800)</td><td rowspan=1 colspan=1>77.2%</td></tr><tr><td rowspan=1 colspan=1>One-Shot</td><td rowspan=1 colspan=1>EA</td><td rowspan=1 colspan=1>75.9%</td></tr></table>
Table 4: Accuracy comparison trained with exactly the same script
<table><tr><td rowspan=1 colspan=1>models</td><td rowspan=1 colspan=1>top-1 acc</td></tr><tr><td rowspan=1 colspan=1>EfficientNet-B0 (w/o SE)</td><td rowspan=1 colspan=1>74.1%</td></tr><tr><td rowspan=1 colspan=1>MixNet-S (w/o SE)</td><td rowspan=1 colspan=1>74.6%</td></tr><tr><td rowspan=1 colspan=1>PC-NAS-S (w/o SE)</td><td rowspan=1 colspan=1>76.1%</td></tr><tr><td rowspan=1 colspan=1>PC-NAS-L (w/o SE)</td><td rowspan=1 colspan=1>77.5%</td></tr></table>
is devised to mitigate the issue. Experimental results demonstrate the effectiveness of our method, which achieves state-of-the-art performance on ImageNet, and transfers well to COCO detection and person re-identification too.
# REFERENCES
Georege Adam and Jonathan Lorraine. Understanding neural architecture search techniques. arXiv preprint arXiv:1904.00438, 2019.
Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. International Conference on Learning Representations, 2017a.
Gabriel Bender, Pieter-Jan Kindermans, Barret Zoph, Vijay Vasudevan, and Quoc V. Le. Understanding and simplifying one-shot architecture search. ICML, 2018.
Andrew Brock, Ritchie James M. Lim, Theodore, and Nick Weston. Smash: one-shot model architecture search through hypernetworks. NIPS Workshop on Meta-Learning, 2017a.
Andrew Brock, J.M. Ritchie, Theodore Lim, and Nick Weston. Smash: One-shot model architecture search through hypernetworks. arXiv preprint arXiv:1708.05344, 2017b.
Han Cai, Ligeng Zhu, and Song Han. Proxylessnas: Direct neural architecture search on target task and hardware. arXiv preprint arXiv:1812.00332, 2018.
Hugh Chipman, Edward I. George, and Robert E. McCulloch. The practical implementation of bayesian model selectio. In Institute of Mathematical Statistics Lecture Notes - Monograph Series, 38, pp. 65–116, 2001.
XiangXiang Chu, Bo Zhang, Ruijun Xu, and Jixiang Li. Fairnas:rethinking evaluation of weight sharing neural architecture search. arXiv preprint arXiv:1907.01845v2, 2019.
Thomas Elsken, Jan-Hendrik Metzen, and Frank Hutter. Simple and efficient architecture search for convolutional neural networks. ICLR workshop, 2017.
Zichao Guo, Xiangyu Zhang, Haoyuan Mu, Wen Heng, Zechun Liu, Yichen Wei, and Jian Sun. Single path one-shot neural architecture search with uniform sampling. arXiv preprint arXiv:1904.00420, 2019.
Jie Hu, Li Shen, Samuel Albanie, Gang Sun, and Enhua Wu. Squeeze-and-excitation networks. CVPR, 2018.
Chuming Li, Xin Yuan, Chen Lin, Minghao Guo, Wei Wu, Wanli Ouyang, and Junjie Yan. Am-lfs: Automl for loss function search. arXiv preprint arXiv:1905.07375, 2019.
Chen Lin, Minghao Guo, Chuming Li, Xin Yuan, Wei Wu, Dahua Lin, Wanli Ouyang, and Junjie Yan. Online hyper-parameter learning for auto-augmentation strategy. arXiv preprint arXiv:1905.07373, 2019.
Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European conference on computer vision, pp. 740–755. Springer, 2014.
Tsung-Yi Lin, Piotr Dollar, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. ´ Feature pyramid networks for object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2117–2125, 2017.
Chenxi Liu, Barret Zoph, Maxim Neumann, Jonathon Shlens, Wei Hua, Li-Jia Li, Fei-Fei Li, Alan Yuille, Jonathan Huang, and Kevin Murphy. Progressive neural architecture search. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 19–34, 2018a.
Hanxiao Liu, Karen Simonyan, Oriol Vinyals, Chrisantha Fernando, and Koray Kavukcuoglu. Hierarchical representations for efficient architecture search. ICLR, 2018b.
Hanxiao Liu, Karen Simonyan, and Yiming Yang. Darts: Differentiable architecture search. arXiv preprint arXiv:1806.09055, 2018c.
Geoffrey F. Miller, Peter M. Todd, and Shailesh U. Hegde. Designing neural networks using genetic algorithms. ICGA, pp. volume 89, pages 379–384, 1989.
Niv Nayman, Asaf Noy, Tal Ridnik, Itamar Friedman, Rong Jin, and Lihi Zelnik-Manor. Xnas: Neural architecture search with expert advice. arXiv preprint arXiv:1906.08031, 2019.
Asaf Noy, Niv Nayman, Tal Ridnik, Nadav Zamir, Sivan Doveh, Itamar Friedman, Raja Giryes, and Lihi Zelnik-Manor. Asap: Architecture search, anneal and prune. arXiv preprint arXiv:1904.04123, 2019.
Hieu Pham, Melody Y. Guan, Barret Zoph, Quoc V. Le, and Jeff Dean. Efficient neural architecture search via parameter sharing. arXiv preprint arXiv:1802.03268, 2018.
Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon Suematsu, Jie Tan, Quoc V. Le, and Alexey Kurakin. Large-scale evolution of image classifiers. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2902–2911. JMLR. org, 2017.
Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V. Le. Regularized evolution for image classifier architecture search. arXiv preprint arXiv:1802.01548, 2018.
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Fei-Fei Li. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, pp. 115(3):211–252, 2015.
Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4510–4520, 2018.
Mingxing Tan and Quoc V. Le. Efficientnet: Rethinking model scaling for convolutional neural networks. arXiv preprint arXiv:1905.11946, 2019a.
Mingxing Tan and Quoc V. Le. Mixnet: Mixed depthwise convolutional kernels. BMVC, 2019b.
Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, and Quoc V. Le. Mnasnet: Platformaware neural architecture search for mobile. arXiv preprint arXiv:1807.11626, 2018.
Linnan Wang, Yiyang Zhao, Yuu Jinnai, Yuandong Tian, and Rodrigo Fonseca. Alphax: exploring neural architectures with deep neural networks and monte carlo tree search. arXiv preprint arXiv:1903.11059, 2019.
Bichen Wu, Xiaoliang Dai, Peizhao Zhang, Yanghan Wang, Fei Sun, Yiming Wu, Yuandong Tian, Peter Vajda, Yangqing Jia, and Kurt Keutzer. Fbnet: Hardware-aware efficient convnet design via differentiable neural architecture search. arXiv preprint arXiv:1812.03443, 2018.
Liang Zheng, Liyue Shen, Lu Tian, Shengjin Wang, Jingdong Wang, and Qi Tian. Scalable person re-identification: A benchmark. In Proceedings of the IEEE international conference on computer vision, pp. 1116–1124, 2015.
Zhao Zhong, Junjie Yan, Wei Wu, Jing Shao, and Cheng-Lin Liu. Practical block-wise neural network architecture generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2423–2432, 2018.
Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
# A APPENDIX
# A.1 CONSTRUCTION OF THE SEARCH SPACE:
The operators in our spaces have structures described by either Conv1x1-ConvNxM-Conv1x1 or Conv1x1-ConvNxM-ConvMxN-Conv1x1. We define expand ratio as the ratio between the channel numbers of the ConvNxM in the middle and the input of the first Conv1x1.
Small search space Our small search space contains a set of MBConv operators (mobile inverted bottleneck convolution (Sandler et al., 2018)) with different kernel sizes and expand ratios, plus Identity, adding up to 10 operators to form a mixoperator. The 10 operators in our small search space are listed in the left column of Table 5, where notation OP X Y represents the specific operator OP with expand ratio X and kernel size Y.
Large search space We add 3 more kinds of operators to the mixoperators of our large search space, namely NConv, DConv, and RConv. We use these 3 operators with different kernel sizes and expand ratios to form 10 operators exclusively for large space, thus the large space contains 20 operators. For large search space, the structure of NConv, DConv are Conv1x1-ConvKxK-Conv1x1 and Conv1x1-ConvKxK-ConvKxK-Conv1x1, and that of RConv is Conv1x1-Conv1xK-ConvKx1- Conv1x1. The kernel sizes and expand ratios of operators exclusively for large space are lised in the right column of Table 5, where notation OP X Y represents the specific operator OP with expand ratio X and $\mathrm { K } { = } \mathrm { Y }$ .
There are altogether 21 mixoperators in both small and large search spaces. Thus our small search space contains $\mathrm { 1 0 ^ { 2 1 } }$ models, while the large one contains $2 \bar { 0 } ^ { 2 1 }$ .
Table 5: operator table
<table><tr><td colspan="2">Operatorsin both large and small space</td><td colspan="2">Operators exclusively in large space</td></tr><tr><td>MBConv_1_3</td><td>MBConv_3_3</td><td>NConv_1_3</td><td>NConv_2_3</td></tr><tr><td>MBConv_6_3</td><td>MBConv_1_5</td><td>DConv_1_3</td><td>DConv_2_3</td></tr><tr><td>MBConv_3_5</td><td>MBConv_6_5</td><td>RConv_1_5</td><td>RConv_2_5</td></tr><tr><td>MBConv_1_7</td><td>MBConv_3_7</td><td>RConv_4_5</td><td>RConv_1_7</td></tr><tr><td>MBConv_6_7</td><td>Identity</td><td>RConv_2_7</td><td>RConv_4_7</td></tr></table>
# A.2 SPECIFICATIONS OF RESULTED MODELS:
The specifications of PC-NAS-S and PC-NAS-L are shown in Fig. 3. We observe that PC-NAS-S adopts either high expansion rate or large kernel size at the tail end, which enables a full use of high level features. However, it tends to select small kernels and low expansion rates to ensure the model remains lightweight. PC-NAS-L chooses lots of powerful bottlenecks exclusively contained in the large space to achieve the accuracy boost. The high expansion rate is not quite frequently seen which is to compensate the computation utilized by large kernel size. Both PC-NAS-S and PC-NAS-L tend to use heavy operator when the resolution reduces, circumventing too much information loss in these positions.
 Figure 3: The architectures of PC-NAS-S and PC-NAS-L.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284# JOINT MULTIMODAL LEARNING WITH DEEP GENERATIVE MODELS
Masahiro Suzuki, Kotaro Nakayama, Yutaka Matsuo The University of Tokyo Bunkyo-ku, Tokyo, Japan {masa,k-nakayama,matsuo}@weblab.t.u-tokyo.ac.jp
# ABSTRACT
We investigate deep generative models that can exchange multiple modalities bidirectionally, e.g., generating images from corresponding texts and vice versa. Recently, some studies handle multiple modalities on deep generative models, such as variational autoencoders (VAEs). However, these models typically assume that modalities are forced to have a conditioned relation, i.e., we can only generate modalities in one direction. To achieve our objective, we should extract a joint representation that captures high-level concepts among all modalities and through which we can exchange them bi-directionally. As described herein, we propose a joint multimodal variational autoencoder (JMVAE), in which all modalities are independently conditioned on joint representation. In other words, it models a joint distribution of modalities. Furthermore, to be able to generate missing modalities from the remaining modalities properly, we develop an additional method, JMVAE-kl, that is trained by reducing the divergence between JMVAE’s encoder and prepared networks of respective modalities. Our experiments show that our proposed method can obtain appropriate joint representation from multiple modalities and that it can generate and reconstruct them more properly than conventional VAEs. We further demonstrate that JMVAE can generate multiple modalities bidirectionally.
# 1 INTRODUCTION
In our world, information is represented through various modalities. While images are represented by pixel information, these can also be described with text or tag information. People often exchange such information bi-directionally. For instance, we can not only imagine what “a young female with a smile who does not wear glasses” looks like, but also add this caption to a corresponding photograph. To do so, it is important to extract a joint representation that captures high-level concepts among all modalities. Then we can bi-directionally generate modalities through the joint representations. However, each modality typically has a different kind of dimension and structure, e.g., images (real-valued and dense) and texts (discrete and sparse). Therefore, the relations between each modality and the joint representations might become high nonlinearity. To discover such relations, deep neural network architectures have been used widely for multimodal learning (Ngiam et al., 2011; Srivastava & Salakhutdinov, 2012). The common approach with these models to learn joint representations is to share the top of hidden layers in modality specific networks. Among them, generative approaches using deep Boltzmann machines (DBMs) (Srivastava & Salakhutdinov, 2012; Sohn et al., 2014) offer the important advantage that these can generate modalities bi-directionally.
Recently, variational autoencoders (VAEs) (Kingma & Welling, 2013; Rezende et al., 2014) have been proposed to estimate flexible deep generative models by variational inference methods. These models use back-propagation during training, so that it can be trained on large-scale and highdimensional dataset compared with DBMs with MCMC training. Some studies have addressed to handle such large-scale and high-dimensional modalities on VAEs, but they are forced to model conditional distribution (Kingma et al., 2014; Sohn et al., 2015; Pandey & Dukkipati, 2016). Therefore, it can only generate modalities in one direction. For example, we cannot obtain generated images from texts if we train the likelihood of texts given images. To generate modalities bi-directionally, all modalities should be treated equally under the learned joint representations, which is the same as previous multimodal learning models before VAEs.
 Figure 1: Various images and attributes generated from an input image. We used the CelebA dataset (Liu et al., 2015) to train and test models in this example. Each yellow box corresponds to different processes. All processes are estimated from a single generative model: the joint multimodal variational autoencoder (JMVAE), which is our proposed model.
As described in this paper, we develop a novel multimodal learning model with VAEs, which we call a joint multimodal variational autoencoder (JMVAE). The most significant feature of our model is that all modalities, $\mathbf { x }$ and w (e.g., images and texts), are conditioned independently on a latent variable $\mathbf { z }$ corresponding to joint representation, i.e., the JMVAE models a joint distribution of all modalities, $p ( \mathbf { x } , \mathbf { w } )$ . Therefore, we can extract a high-level representation that contains all information of modalities. Moreover, since it models a joint distribution, we can draw samples from both $p ( \mathbf { x } | \mathbf { w } )$ and $p ( \mathbf { w } | \mathbf { x } )$ . Because, at this time, modalities that we want to generate are usually missing, the inferred latent variable becomes incomplete and generated samples might be collapsed in the testing time when missing modalities are high-dimensional and complicated. To prevent this issue, we propose a method of preparing the new encoders for each modality, $p ( \mathbf { z } | \mathbf { x } )$ and $p ( \mathbf { z } | \mathbf { w } )$ , and reducing the divergence between the multimodal encoder $p ( \mathbf { z } | \mathbf { x } , \mathbf { w } )$ , which we call JMVAE-kl. This contributes to more effective bi-directional generation of modalities, e.g., from face images to texts (attributes) and vice versa (see Figure 1).
The main contributions of this paper are as follows:
• We introduce a joint multimodal variational autoencoder (JMVAE), which is the first study to train joint distribution of modalities with VAEs. • We propose an additional method (JMVAE-kl), which prevents generated samples from being collapsed when some modalities are missing. We experimentally confirm that this method solves this issue. We show qualitatively and quantitatively that JMVAE can extract appropriate joint distribution and that it can generate and reconstruct modalities similarly or more properly than conventional VAEs. We demonstrate that the JMVAE can generate multiple modalities bi-directionally even if these modalities have completely different kinds of dimensions and structures, e.g., highdimentional color face images and low-dimentional binary attributes.
# 2 RELATED WORK
The common approach of multimodal learning with deep neural networks is to share the top of hidden layers in modality specific networks. Ngiam et al. (2011) proposed this approach with deep autoencoders (AEs) and found that it can extract better representations than single modality settings. Srivastava & Salakhutdinov (2012) also took this idea but used deep Boltzmann machines (DBMs) (Salakhutdinov & Hinton, 2009). DBMs are generative models with undirected connections based on maximum joint likelihood learning of all modalities. Therefore, this model can generate modalities bi-directionally. Sohn et al. (2014) improved this model to exchange multiple modalities effectively, which are based on minimizing the variation of information and JMVAE-kl in ours can be regarded as minimizing it with variational learning on parameterized distributions (see Section 3.3 and Appendix A). However, it is computationally difficult for DBMs to train high-dimensional data such as natural images because of MCMC training.
Recently, VAEs (Kingma & Welling, 2013; Rezende et al., 2014) are used to train such highdimensional modalities. Kingma et al. (2014); Sohn et al. (2015) propose conditional VAEs (CVAEs), which maximize a conditional log-likelihood by variational methods. Many studies are based on CVAEs to train various multiple modalities such as handwriting digits and labels (Kingma et al., 2014; Sohn et al., 2015), object images and degrees of rotation (Kulkarni et al., 2015), face images and attributes (Larsen et al., 2015; Yan et al., 2015), and natural images and captions (Mansimov et al., 2015). The main features of CVAEs are that the relation between modalities is one-way and a latent variable does not contain the information of a conditioned modality1, which are unsuitable for our objective.
Pandey & Dukkipati (2016) proposed a conditional multimodal autoencoder (CMMA), which also maximizes the conditional log-likelihood. The difference between CVAEs is that a latent variable is connected directly from a conditional variable, i.e., these variables are not independent. Moreover, this model forces the latent representation from an input to be close to the joint representation from multiple inputs, which is similar to JMVAE-kl. However, the CMMA still considers that modalities are generated in fixed direction. This is the most different part from ours.
# 3 METHODS
This section first introduces the algorithm of VAEs briefly and then proposes a novel multimodal learning model with VAEs, which we call the joint multimodal variational autoencoder (JMVAE).
# 3.1 VARIATIONAL AUTOENCODERS
Given observation variables $\mathbf { x }$ and corresponding latent variables $\mathbf { z }$ , their generating processes are definable as $\mathbf { z } \sim p ( \mathbf { z } ) = \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ and $\mathbf { x } \sim p _ { \theta } ( \mathbf { x } | \mathbf { z } )$ , where $\theta$ is the model parameter of $p$ . The objective of VAEs is maximization of the marginal distribution $\begin{array} { r } { p ( \mathbf { x } ) = \int p _ { \theta } ( \dot { \mathbf { x } } | \mathbf { z } ) p ( \mathbf { z } ) d \mathbf { x } } \end{array}$ . Because this distribution is intractable, we instead train the model to maximize the following lower bound of the marginal distribution $\mathcal { L } _ { V A E } ( \mathbf { x } )$ a s
$$\begin{array} { r } { \log p ( \mathbf { x } ) \geq - D _ { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } ) | | p ( \mathbf { z } ) ) + E _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } ) } [ \log p _ { \theta } ( \mathbf { x } | \mathbf { z } ) ] = \mathcal { L } _ { V A E } ( \mathbf { x } ) , } \end{array}$$
where $q _ { \phi } ( { \bf z } | { \bf x } )$ is an approximate distribution of posterior $p ( \mathbf { z } | \mathbf { x } )$ and $\phi$ is the model parameter of $q$ . We designate $q _ { \phi } ( { \bf z } | { \bf x } )$ as encoder and $p _ { \boldsymbol { \theta } } ( \mathbf { x } | \mathbf { z } )$ as decoder. Moreover, in Equation 1, the first term represents a regularization. The second one represents a negative reconstruction error.
To optimize the lower bound $\mathcal { L } ( \mathbf { x } )$ with respect to parameters $\theta , \phi$ , we estimate gradients of Equation 1 using stochastic gradient variational Bayes (SGVB). If we consider $q _ { \phi } ( { \bf z } | { \bf x } )$ as Gaussian distribution $\mathcal { N } ( \mathbf { z } ; \pmb { \mu } , \mathrm { d i a g } ( \pmb { \sigma } ^ { 2 } ) )$ , where $\phi \ = \ \{ \mu , \sigma ^ { 2 } \}$ , then we can reparameterize ${ \mathbf z } \sim q _ { \phi } ( { \mathbf z } | { \mathbf x } )$ to $\mathbf { z } = \pmb { \mu } + \pmb { \sigma } \odot \pmb { \epsilon } ,$ , where $\dot { \mathbf { \epsilon } } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ . Therefore, we can estimate the gradients of the negative reconstruction term in Equation 1 with respect to $\theta$ and $\phi$ as $\nabla _ { \theta , \phi } E _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } ) } [ \log p _ { \theta } ( \mathbf { x } | \mathbf { z } ) ] =$ $E _ { \mathcal { N } ( \epsilon ; \mathbf { 0 } , \mathbf { I } ) } \big [ \nabla _ { \theta , \phi } \log p _ { \theta } ( \mathbf { z } | \mu + \pmb { \sigma } \odot \epsilon ) \big ]$ . Because the gradients of the regularization term are solvable analytically, we can optimize Equation 1 with standard stochastic optimization methods.
# 3.2 JOINT MULTIMODAL VARIATIONAL AUTOENCODERS
Next, we consider i.i.d. dataset $( \mathbf { X } , \mathbf { W } ) = \{ ( \mathbf { x } _ { 1 } , \mathbf { w } _ { 1 } ) , . . . , ( \mathbf { x } _ { N } , \mathbf { w } _ { N } ) \}$ , where two modalities $\mathbf { x }$ and w have different kinds of dimensions and structures2. Our objective is to generate two modalities bi-directionally. For that reason, we assume that these are conditioned independently on the same latent concept $\mathbf { z }$ : joint representation. Therefore, we assume their generating processes as $\mathbf { z } \sim p ( \mathbf { z } )$ and $\mathbf { x } , \mathbf { w } \sim p ( \mathbf { x } , \mathbf { \bar { w } } | \mathbf { z } ) \stackrel { - } { = } p _ { \theta _ { \mathbf { x } } } ( \mathbf { x } | \mathbf { z } ) p _ { \theta _ { \mathbf { w } } } ( \mathbf { w } | \mathbf { z } )$ , where $\theta _ { \mathbf { x } }$ and $\theta _ { \mathbf { w } }$ represent the model parameters of each independent $p$ . Figure 2(a) shows a graphical model that represents generative processes. One can see that this models joint distribution of all modalities, $p ( \mathbf { x } , \mathbf { w } )$ . Therefore, we designate this model as a joint multimodal variational autoencoder (JMVAE).
 Figure 2: (a) Graphical model of the JMVAE. Gray circles represent observed variables. The white one denotes a latent variable. (b) Two approaches to estimate encoders with a single input, $q ( \mathbf { z } | \mathbf { x } )$ and $q ( \mathbf { z } | \mathbf { w } )$ , on the JMVAE: left, make modalities except an input modality missing (JMVAE-zero); right, prepare encoders that have a single input and make them close to the JMVAE encoder (JMVAE-kl).
Considering an approximate posterior distribution as $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } )$ , we can estimate a lower bound of the log-likelihood $\log p ( \mathbf { x } , \mathbf { w } )$ as follows:
$$\begin{array} { r c l } { \mathcal { L } _ { J M } ( \mathbf { x } , \mathbf { w } ) } & { = } & { E _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } [ \log \frac { p _ { \theta } ( \mathbf { x } , \mathbf { w } , \mathbf { z } ) } { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } ] } \\ & { = } & { \displaystyle - D _ { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) | | p ( \mathbf { z } ) ) } \\ & & { \displaystyle + E _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } [ \log p _ { \theta _ { \mathbf { x } } } ( \mathbf { x } | \mathbf { z } ) ] + E _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } [ \log p _ { \theta _ { \mathbf { w } } } ( \mathbf { w } | \mathbf { z } ) ] . } \end{array}$$
Equation 3 has two negative reconstruction terms which are correspondent to each modality. As with VAEs, we designate $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } )$ as the encoder and both $p _ { \theta _ { \mathbf { x } } } ( \mathbf { x } | \mathbf { z } )$ and $p _ { \theta _ { \mathbf { w } } } ( \mathbf { w } | \mathbf { z } )$ as decoders.
We can apply the SGVB to Equation 3 just as Equation 1, so that we can parameterize the encoder and decoder as deterministic deep neural networks and optimize them with respect to their parameters, $\theta _ { \mathbf { x } } , \theta _ { \mathbf { w } }$ , and $\phi$ . Because each modality has different feature representation, we should set different networks for each decoder, $p _ { \theta _ { \mathbf { x } } } ( \mathbf { x } | \mathbf { z } )$ and $p _ { \theta _ { \mathbf { w } } } ( \mathbf { w } | \mathbf { z } )$ . The type of distribution and corresponding network architecture depends on the representation of each modality, e.g., Gaussian when the representation of modality is continuous, and a Bernoulli when it is a binary value.
Unlike original VAEs and CVAEs, the JMVAE models joint distribution of all modalities. In this model, modalities are conditioned independently on a joint latent variable. Therefore, we can extract better representation that includes all information of modalities. Moreover, we can estimate both marginal distribution and conditional distribution in bi-directional, so that we can not only obtain images reconstructed themselves but also draw texts from corresponding images and vice versa. Additionally, we can extend JMVAEs to handle more than two modalities such as $p ( \mathbf { x } , \mathbf { w } _ { 1 } , \mathbf { w } _ { 2 } , . . . )$ in the same learning framework.
# 3.3 INFERENCE MISSING MODALITIES
In the JMVAE, we can extract joint latent features by sampling from the encoder $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } )$ at testing time. Our objective is to exchange modalities bi-directionally, e.g., images to texts and vice versa. In this setting, modalities that we want to sample are missing, so that inputs of such modalities are set to zero (the left panel of Figure 2(b)). The same is true of reconstructing a modality only from itself. This is a natural way in discriminative multimodal settings to estimate samples from unimodal information (Ngiam et al., 2011). However, if missing modalities are high-dimensional and complicated such as natural images, then the inferred latent variable becomes incomplete and generated samples might collapse.
We propose a method to solve this issue, which we designate as JMVAE-kl. Moreover, we describe the former way as JMVAE-zero to distinguish it. Suppose that we have encoders with a single input, $q _ { \phi _ { \mathbf { x } } } ( \mathbf { z } | \mathbf { x } )$ and $q _ { \phi _ { \mathbf { w } } } ( \mathbf { z } | \mathbf { w } )$ , where $\phi _ { \mathbf { x } }$ and $\phi _ { \mathbf { w } }$ are parameters. We would like to train them by bringing their encoders close to an encoder $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } )$ (the right panel of Figure 2(b)). Therefore, the object function of JMVAE-kl becomes
$$\ ? _ { \boldsymbol { J } M _ { k } \left( \alpha \right) } ( \mathbf { x } , \mathbf { w } ) = \mathcal { L } _ { \boldsymbol { J } M } ( \mathbf { x } , \mathbf { w } ) - \alpha \cdot \left[ D _ { K L } \big ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) \big | \big | q _ { \phi _ { \mathbf { x } } } ( \mathbf { z } | \mathbf { x } ) \big ) + D _ { K L } \big ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) \big | \big | q _ { \phi _ { \mathbf { w } } } ( \mathbf { z } | \mathbf { w } ) \big ) \right] ,$$
where $\alpha$ is a factor that regulates the KL divergence terms.
From another viewpoint, maximizing Equation 4 can be regarded as minimizing the variation of information with variational learning on parameterized distributions (proven and derived in Appendix A). The variation of information, a measure of the distance between two variables, is written as $- E _ { p _ { D } ( \mathbf { x } , \mathbf { w } ) } [ \log p ( \mathbf { x } | \mathbf { w } ) + \log p ( \mathbf { w } | \mathbf { x } ) ]$ , where $p _ { D }$ is the data distribution. It is apparent that the variation of information is the sum of two negative conditional log-likelihoods. Therefore, minimizing the variation of information contributes to appropriate bi-directional exchange of modalities. Sohn et al. (2014) also train their model to minimize the VI for the same objective as ours. However, they use DBMs with MCMC training.
# 4 EXPERIMENTS
This section presents evaluation of the qualitative and quantitative performance and confirms the JMVAE functionality in practice.
# 4.1 DATASETS
As described herein, we used two datasets: MNIST and CelebA (Liu et al., 2015).
MNIST is not a dataset for multimodal setting. In this work, we used this dataset for toy problem of multimodal learning. We consider handwriting images and corresponding digit labels as two different modalities. We used 50,000 as training set and the remaining 10,000 as a test set.
CelebA consists of 202,599 color face images and corresponding 40 binary attributes such as male, eyeglasses, and mustache. In this work, we regard them as two modalities. This dataset is challenging because these have completely different kinds of dimensions and structures. Beforehand, we cropped the images to squares and resized to $6 4 \times 6 4$ and normalized. From the dataset, we chose 191,899 images that are identifiable face by OpenCV and used them for our experiment. We used $90 \%$ out of all the dataset contains as training set and the remaining $10 \%$ of them as test set.
# 4.2 MODEL ARCHITECTURES
For MNIST, we considered images as $\mathbf { x } \in \mathbb { R } ^ { 2 8 \times 2 8 }$ and corresponding labels as $\mathbf { w } \in \{ 0 , 1 \} ^ { 1 0 }$ . We prepared two networks each with two dense layers of 512 hidden units and using leaky rectifiers and shared the top of each layers and mapped them into 64 hidden units. Moreover, we prepared two networks each with three dense layers of 512 units and set $p ( \mathbf { x } | \mathbf { z } )$ as Bernoulli and $p ( \mathbf { w } | \mathbf { z } )$ as categorical distribution whose output layer is softmax. We used warm-up (Bowman et al., 2015; Sønderby et al., 2016), which first forces training only of the term of the negative reconstruction error and then gradually increases the effect of the regularization term to prevent local minima during early training. We increased this term linearly during the first $N _ { t }$ epochs as with Sønderby et al. (2016). We set $N _ { t } = 2 0 0$ and trained for 500 epochs on MNIST. Moreover, same as Burda et al. (2015); Sønderby et al. (2016), we resampled the binarized training values randomly from MNIST for each epoch to prevent over-fitting.
For CelebA, we considered face images as $\mathbf { x } \in \mathbb { R } ^ { 3 2 \times 3 2 \times 3 }$ and corresponding attributes as ${ \textbf { w } } \in$ $\{ - 1 , 1 \} ^ { 4 0 }$ . We prepared two networks with layers (four convolutional and a flattened layers for $\mathbf { x }$ and two dense layers for w) with ReLU and shared the top of each layers and mapped them into 128 units. For the decoder, we prepared two networks, with a dense and four deconvolutional layers for x and three dense layers for w, and set Gaussian distribution for decoder of both modalities, where the variance of Gaussian was fixed to 1 for the decoder of w. In CelebA settings, we combined JMVAE with generative adversarial networks (GANs) (Goodfellow et al., 2014) to generate clearer images. We considered the network of $p ( \mathbf { x } | \mathbf { z } )$ as generator in GAN, then we optimized the GAN loss with the lower bound of the JMVAE, which is the same way as a VAE-GAN model (Larsen et al., 2015). As presented herein, we describe this model as JMVAE-GAN. We set $N _ { t } = 2 0$ and trained for 100 epochs on CelebA.
We used the Adam optimization algorithm (Kingma & Ba, 2014) with a learning rate of $1 0 ^ { - 3 }$ on MNIST and $1 0 ^ { - 4 }$ on CelebA. The models were implemented using Theano (Team et al., 2016) and Lasagne (Dieleman et al., 2015).
Table 1: Evaluation of test log-likelihood. All models are trained and tested on MNIST. $\alpha$ is a coefficient of regularization term in JMVAE-kl (Equation 4): left, marginal log-likelihood; right, conditional log-likelihood.
<table><tr><td rowspan="2"></td><td colspan="2">≤logp(x)</td><td rowspan="2"></td><td colspan="2">≤logp(x|w)</td></tr><tr><td>multiple</td><td>single</td><td>multiple</td><td>single</td></tr><tr><td>VAE</td><td></td><td>-86.91</td><td>CVAE CMMA</td><td>-83.80</td><td></td></tr><tr><td>JMVAE-zero</td><td>-86.89</td><td>-86.89</td><td></td><td>-86.12</td><td></td></tr><tr><td>JMVAE-kl,α = 0.01</td><td>-86.89</td><td>-86.55</td><td>JMVAE-zero</td><td>-84.64</td><td>-4838</td></tr><tr><td>JMVAE-kl,α = 0.1</td><td>-86.86</td><td>-86.73</td><td>JMVAE-kl,α = 0.01</td><td>-84.61</td><td>-129.6</td></tr><tr><td>JMVAE-kl,α =1</td><td>-89.20</td><td>-89.20</td><td>JMVAE-kl,α =0.1 JMVAE-kl,α =1</td><td>-84.72 -86.97</td><td>-126.0 -112.7</td></tr></table>
Table 2: Evaluation of log-likelihood. Models are trained and tested on CelebA. We trained JMVAE-kl and set $\alpha = 0 . 1$ : left, marginal log-likelihood; right, conditional log-likelihood (with the multiple lower bound).
<table><tr><td rowspan="2"></td><td colspan="2">≤logp(x)</td><td colspan="2"><logp(xw)</td></tr><tr><td>multiple</td><td>single</td><td>CVAE-GAN</td><td>-4152</td></tr><tr><td>VAE-GAN</td><td></td><td>-4439</td><td>CMMA-GAN</td><td>-4147</td></tr><tr><td>JMVAE-GAN</td><td>-4141</td><td>-4144</td><td>JMVAE-GAN</td><td>-4130</td></tr></table>
# 4.3 QUANTITATIVE EVALUATION
# 4.3.1 EVALUATION METHOD
For this experiment, we estimated test log-likelihood to evaluate the performance of model. This estimate roughly corresponds to negative reconstruction error. Therefore, higher is better. From this performance, we can find that not only whether the JMVAE can generate samples properly but also whether it can obtain joint representation properly. If the log-likelihood of a modality is low, representation for this modality might be hurt by other modalities. By contrast, if it is the same or higher than model trained on a single modality, then other modalities contribute to obtaining appropriate representation.
We estimate the test marginal log-likelihood and test conditional log-likelihood on JMVAE. We compare the test marginal log-likelihood against VAEs (Kingma & Welling, 2013; Rezende et al., 2014) and the test conditional log-likelihood against CVAEs (Kingma et al., 2014; Sohn et al., 2015) and CMMAs (Pandey & Dukkipati, 2016). On CelebA, we combine all competitive models with GAN and describe them as VAE-GAN, CVAE-GAN, and CMMA-GAN. For fairness, architectures and parameters of these competitive models were set to be as close as possible to those of JMVAE.
We calculate the importance weighted estimator (Burda et al., 2015) from lower bounds at testing time because we would like to estimate the true test log-likelihood from lower bounds. To estimate the test marginal log-likelihood $p ( \mathbf { w } )$ of the JMVAE, we use two possible lower bounds: sampling from $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } )$ or $q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } )$ . We describe the former lower bound as the multiple lower bound and the latter one as the single lower bound. When we estimate the test conditional loglikelihood $\log p ( \mathbf { x } | \mathbf { w } )$ , we also use two lower bounds, each of which is estimated by sampling from $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } )$ (multiple) or $q _ { \phi _ { w } } ( \mathbf { z } | \mathbf { w } )$ (single) (see Appendix B for more details). To estimate the single lower bound, we should approximate the single encoder $( q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } )$ or $q _ { \phi _ { w } } ( \mathbf { z } | \mathbf { w } ) )$ by JMVAE-zero or JMVAE-kl. When the value of log-likelihood with the single lower bound is the same or larger than that with the multiple lower bound, the approximation of the single encoder is good. Note that original VAEs use a single lower bound and that CVAEs and CMMAs use a multiple lower bound.
# 4.3.2 MNIST
Our first experiment evaluated the test marginal log-likelihood and compared it with that of the VAE on MNIST dataset. We trained the model with both JMVAE-zero and JMVAE-kl and confirmed these differences. As described in Section 4.3.1, we have two possible ways of estimating the marginal log-likelihood of the JMVAE, i.e., multiple and single lower bounds. The left of Table 1 shows the test marginal log-likelihoods of the VAE and JMVAE. It is apparent that log-likelihood of the JMVAE-zero is the same or slightly better than that of the VAE. In the case of the loglikelihood of JMVAE-kl, the log-likelihood becomes better as $\alpha$ is small. Especially, JMVAE-kl with $\alpha ~ = ~ 0 . 0 1$ and single lower bound archives the highest log-likelihood in Table 1. If $\alpha$ is 1, however, then the test log-likelihood on JMVAE-kl becomes much lower. This is because the influence of the regularization term becomes strong as $\alpha$ is large.
 Figure 3: Visualizations of 2-D latent representation. The network architectures are the same as those in Section 4.3, except that the dimension of the top hidden layer is forced into 2. Points with different colors correspond to the digit labels. These were sampled from $q ( \mathbf { z } | \mathbf { x } )$ in the VAE and $q ( \mathbf { z } | \mathbf { x } , \mathbf { w } )$ in both the CVAE and JMVAE. We used JMVAE-zero as the JMVAE.
Next, we evaluated the test conditional log-likelihood and compared it with that of the CVAE and CMMA conditioned on w. As in the case of the marginal log-likelihood, we can estimate the JMVAE’s conditional log-likelihood by both the single and multiple lower bound. The single bound can be estimated using JMVAE-zero or JMVAE-kl. The right of Table 1 shows the test conditional log-likelihoods of the JMVAE, CVAE, and CMMA. It is apparent that the CVAE achieves the highest log-likelihood. Even so, in the case of multiple bound, log-likelihoods with both JMVAE-zero and JMVAE-kl (except $\alpha = 1$ ) outperform that of the CMMA.
It should be noted that the log-likelihood with JMVAE-zero and single bound is significantly low. As described in Section 3.3, this is because a modality w is missing as input. By contrast, it is apparent that the log-likelihood with JMVAE-kl is improved significantly from that with JMVAEzero. It shows that JMVAE-kl solves the issue of missing modalities (we can also find this result in generated images, see Appendix E). Moreover, we find that this log-likelihood becomes better as $\alpha$ is large, which is opposite to the other results. Therefore, there is a trade-off between whether each modality can be reconstructed properly and whether multiple modalities can be exchanged properly and it can be regulated by $\alpha$ .
# 4.3.3 CELEBA
In this section, we used CelebA dataset to evaluate the JMVAE. Table 2 presents the evaluations of marginal and conditional log-likelihood. From this table, it is apparent that values of both marginal and conditional log-likelihood with JMVAEs are larger than those with other competitive methods. Moreover, comparison with Table 1 shows that the improvement on CelebA is greater than that on MNIST, which suggests that joint representation with multiple modalities contributes to improvement of the quality of the reconstruction and generation in the case in which an input modality is large-dimensioned and complicated.
# 4.4 QUALITATIVE EVALUATION
# 4.4.1 JOINT REPRESENTATION ON MNIST
In this section, we first evaluated that the JMVAE can obtain joint representation that includes the information of modalities. Figure 3 shows the visualization of latent representation with the VAE, CVAE, and JMVAE on MNIST. It is apparent that the JMVAE obtains more discriminable latent representation by adding digit label information. Figure 3(b) shows that, in spite of using multimodal information as with the JMVAE, points in CVAE are distributed irrespective of labels because CVAEs force latent representation to be independent of label information, i.e., it is not objective for CVAEs to obtain joint representation.
# 4.4.2 GENERATING FACES FROM ATTRIBUTES AND JOINT REPRESENTATION ON CELEBA
Next, we confirm that JMVAE-GAN on CelebA can generate images from attributes. Figure 4(a) portrays generated faces conditioned on various attributes. We find that we can generate an average face of each attribute and various random faces conditioned on a certain attributes. Figure 4(b) shows that samples are gathered for each attribute and that locations of each variation are the same irrespective of attributes. From these results, we find that manifold learning of joint representation with images and attributes works well.
 Figure 4: (a) Generation of average faces and corresponding random faces. We first set all values of attributes $\{ - 1 , 1 \}$ randomly and designate them as Base. Then, we choose an attribute that we want to set (e.g., Male, Bald, Smiling) and change this value in Base to 2 (or $- 2$ if we want to set ”Not”). Each column corresponds to same attribute according to legend. Average faces are generated from $p ( \mathbf { x } | \mathbf { z } _ { m e a n } )$ , where ${ \bf z } _ { m e a n }$ is a mean of $q ( \mathbf { z } | \mathbf { w } )$ . Moreover, we can obtain various images conditioned on the same values of attributes such as $\mathbf { x } \sim p ( \mathbf { x } | \mathbf { z } )$ , where $\mathbf { z } = \mathbf { z } _ { m e a n } + \pmb { \sigma } \odot \pmb { \epsilon }$ , $\epsilon \sim \mathcal { N } ( \mathbf { 0 } , \zeta )$ , and $\zeta$ is the parameter which determines the range of variance. In this figure, we set $\zeta = 0 . 6$ . Each row in random faces has the same $\epsilon$ . (b) PCA visualizations of latent representation. Colors indicate which attribute each sample is conditioned on.
 Figure 5: Portraits of the Mona Lisa3(upper) and Mozart4(lower), generated their attributes, and reconstructed images conditioned on varied attributes, according to the legend. We cropped and resized it in the same way as CelebA. The procedure is as follows: generate the corresponding attributes w from an unlabeled image x; generate an average face ${ \bf x } _ { m e a n }$ from the attributes w; select attributes which we want to vary and change the values of these attributes; generate the changed average face $\mathbf { x } _ { m e a n } ^ { \prime }$ from the changed attributes; and obtain a changed reconstruction image $\mathbf { x } ^ { \prime }$ by $\mathbf { x } + \mathbf { x } _ { m e a n } ^ { \prime } - \mathbf { x } _ { m e a n }$ .
# 4.4.3 BI-DIRECTIONAL GENERATION BETWEEN FACES AND ATTRIBUTES ON CELEBA
Finally, we demonstrate that JMVAE-GAN can generate bi-directionally between faces and attributes. Figure 5 shows that MVAE-GAN can generate both attributes and changed images conditioned on various attributes from images which had no attribute information. This way of generating an image by varying attributes is similar to the way of the CMMA (Pandey & Dukkipati, 2016). However, the CMMA cannot generate attributes from an image because it only generates images from attributes in one direction.
# 5 CONCLUSION AND FUTURE WORK
In this paper, we introduced a novel multimodal learning model with VAEs, the joint multimodal variational autoencoders (JMVAE). In this model, modalities are conditioned independently on joint representation, i.e., it models a joint distribution of all modalities. We further proposed the method (JMVAE-kl) of reducing the divergence between JMVAE’s encoder and a prepared encoder of each modality to prevent generated samples from collapsing when modalities are missing. We confirmed that the JMVAE can obtain appropriate joint representations and high log-likelihoods on MNIST and CelebA datasets. Moreover, we demonstrated that the JMVAE can generate multiple modalities bi-directionally on the CelebA dataset.
In future work, we would like to evaluate the multimodal learning performance of JMVAEs using various multimodal datasets such as containing three or more modalities.
# REFERENCES
Samuel R Bowman, Luke Vilnis, Oriol Vinyals, Andrew M Dai, Rafal Jozefowicz, and Samy Bengio. Generating sentences from a continuous space. arXiv preprint arXiv:1511.06349, 2015.
Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015.
Sander Dieleman, Jan Schlter, Colin Raffel, Eben Olson, Sren Kaae Snderby, Daniel Nouri, Daniel Maturana, Martin Thoma, Eric Battenberg, Jack Kelly, Jeffrey De Fauw, Michael Heilman, Diogo Moitinho de Almeida, Brian McFee, Hendrik Weideman, Gbor Takcs, Peter de Rivaz, Jon Crall, Gregory Sanders, Kashif Rasul, Cong Liu, Geoffrey French, and Jonas Degrave. Lasagne: First release., August 2015. URL http://dx.doi.org/10.5281/zenodo.27878.
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.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
Diederik $\mathrm { \bf P }$ Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems, pp. 3581–3589, 2014.
Tejas D Kulkarni, William F Whitney, Pushmeet Kohli, and Josh Tenenbaum. Deep convolutional inverse graphics network. In Advances in Neural Information Processing Systems, pp. 2539–2547, 2015.
Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. arXiv preprint arXiv:1512.09300, 2015.
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3730–3738, 2015.
Christos Louizos, Kevin Swersky, Yujia Li, Max Welling, and Richard Zemel. The variational fair auto encoder. arXiv preprint arXiv:1511.00830, 2015.
Elman Mansimov, Emilio Parisotto, Jimmy Lei Ba, and Ruslan Salakhutdinov. Generating images from captions with attention. arXiv preprint arXiv:1511.02793, 2015.
Jiquan Ngiam, Aditya Khosla, Mingyu Kim, Juhan Nam, Honglak Lee, and Andrew Y Ng. Multimodal deep learning. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 689–696, 2011.
Gaurav Pandey and Ambedkar Dukkipati. Variational methods for conditional multimodal learning: Generating human faces from attributes. arXiv preprint arXiv:1603.01801, 2016.
Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
Ruslan Salakhutdinov and Geoffrey E Hinton. Deep boltzmann machines. In AISTATS, volume 1, pp. 3, 2009.
Kihyuk Sohn, Wenling Shang, and Honglak Lee. Improved multimodal deep learning with variation of information. In Advances in Neural Information Processing Systems, pp. 2141–2149, 2014.
Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. In Advances in Neural Information Processing Systems, pp. 3483–3491, 2015.
Casper Kaae Sønderby, Tapani Raiko, Lars Maaløe, Søren Kaae Sønderby, and Ole Winther. Ladder variational autoencoders. arXiv preprint arXiv:1602.02282, 2016.
Nitish Srivastava and Ruslan R Salakhutdinov. Multimodal learning with deep boltzmann machines. In Advances in neural information processing systems, pp. 2222–2230, 2012.
The Theano Development Team, Rami Al-Rfou, Guillaume Alain, Amjad Almahairi, Christof Angermueller, Dzmitry Bahdanau, Nicolas Ballas, Fr´ed´eric Bastien, Justin Bayer, Anatoly Belikov, et al. Theano: A python framework for fast computation of mathematical expressions. arXiv preprint arXiv:1605.02688, 2016.
Xinchen Yan, Jimei Yang, Kihyuk Sohn, and Honglak Lee. Attribute2image: Conditional image generation from visual attributes. arXiv preprint arXiv:1512.00570, 2015.
# A RELATION BETWEEN THE OBJECTIVE OF JMVAE-KL AND THE VARIATION OF INFORMATION
The variation of information can be expressed as $- E _ { p _ { \mathcal { D } } ( \mathbf { x } , \mathbf { w } ) } [ \log p ( \mathbf { x } | \mathbf { w } ) + \log p ( \mathbf { w } | \mathbf { x } ) ]$ , where $p _ { \mathcal { D } }$ is the data distribution. In this equation, we specifically examine the sum of two negative loglikelihoods and do not consider the expectation in this derivation. We can calculate the lower bounds of these log-likelihoods as follows:
$$\begin{array} { r c l } { \log p ( \mathbf { x } | \mathbf { w } ) + \log p ( \mathbf { w } | \mathbf { x } ) } & { \geq } & { \displaystyle { E _ { q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } [ \log \frac { p ( \mathbf { x } | \mathbf { z } ) p ( \mathbf { z } | \mathbf { w } ) } { q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } ] + E _ { q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } [ \log \frac { p ( \mathbf { w } | \mathbf { z } ) p ( \mathbf { z } | \mathbf { x } ) } { q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } ] } } \\ & { = } & { \displaystyle { E _ { q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } [ \log p ( \mathbf { x } | \mathbf { z } ) ] + E _ { q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } [ \log p ( \mathbf { w } | \mathbf { z } ) ] } } \\ & & { - D _ { K L } ( q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) | | p ( \mathbf { z } | \mathbf { x } ) ) - D _ { K L } ( q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) | | p ( \mathbf { z } | \mathbf { w } ) ) } \\ & { = } & { \displaystyle { \mathcal { L } _ { J M } ( \mathbf { x } , \mathbf { w } ) - [ D _ { K L } ( q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) | | p ( \mathbf { z } | \mathbf { x } ) ) + D _ { K L } ( q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) | | p ( \mathbf { z } | \mathbf { w } ) ) } } \\ & & { + D _ { K L } ( q ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) | | p ( \mathbf { z } ) ) . } \end{array}$$
If all the probability distributions are parameterized in neural networks, we can consider each $p ( \mathbf { z } | \mathbf { x } )$ and $p ( \mathbf { z } | \mathbf { w } )$ as $q ( \mathbf { z } | \mathbf { x } )$ and $q ( \mathbf { z } | \mathbf { w } )$ , respectively. This is because both $p ( \mathbf { z } | \mathbf { x } )$ and $q ( \mathbf { z } | \mathbf { x } )$ (or both $p ( \mathbf { z } | \mathbf { w } )$ and $q ( \mathbf { z } | \mathbf { w } ) )$ can be expressed as same network architectures. Therefore, the replaced Equation 5 can be calculated as follows:
$$\begin{array} { r l r } & { } & { { \mathcal L } _ { J M } ( { \bf x } , { \bf w } ) - [ D _ { K L } ( q ( { \bf z } | { \bf x } , { \bf w } ) | | q ( { \bf z } | { \bf x } ) ) + D _ { K L } ( q ( { \bf z } | { \bf x } , { \bf w } ) | | q ( { \bf z } | { \bf w } ) ) ] + D _ { K L } ( q ( { \bf z } | { \bf x } , { \bf w } ) | | p ( { \bf z } ) ) } \\ & { } & { = { \mathcal L } _ { J M _ { k l } ( 1 ) } ( { \bf x } , { \bf w } ) + D _ { K L } ( q ( { \bf z } | { \bf x } , { \bf w } ) | | p ( { \bf z } ) ) \geq { \mathcal L } _ { J M _ { k l } ( 1 ) } ( { \bf x } , { \bf w } ) , } \end{array}$$
where $\mathcal { L } _ { J M _ { k l } ( 1 ) }$ is Equation 4 with $\alpha = 1$ . Therefore, maximizing Equation 4 is regarded as minimizing the variation of information with variational learning on parameterized distributions, i.e., maximizing the lower bounds of the negative variation of information.
# B TEST LOWER BOUNDS
Two lower bounds used to estimate test marginal log-likelihood $p ( \mathbf { x } )$ of the JMVAE are as follows:
$$\begin{array} { r } { \mathcal { L } _ { s i n g l e } ( \mathbf { x } ) = E _ { q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) } [ \log \frac { p _ { \theta _ { x } } ( \mathbf { x } | \mathbf { z } ) p ( \mathbf { z } ) } { q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) } ] , } \end{array}$$
$$\mathcal { L } _ { m u l t i p l e } ( \mathbf { x } ) = E _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } [ \log \frac { p _ { \theta _ { x } } ( \mathbf { x } | \mathbf { z } ) p ( \mathbf { z } ) } { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } ] .$$
 Figure 6: Comparison of the original images and reconstructed images by the JMVAE $\alpha = 0 . 1$ ). We used (a) MNIST and (b) CelebA datasets.
We can also estimate test conditional log-likelihood $p ( \mathbf { x } | \mathbf { w } )$ from these two lower bounds as
$$\mathcal { L } _ { s i n g l e } ( \mathbf { x } | \mathbf { w } ) = E _ { q _ { \phi _ { w } } ( \mathbf { z } | \mathbf { w } ) } [ \log \frac { p ( \mathbf { x } , \mathbf { z } | \mathbf { w } ) } { q _ { \phi _ { w } } ( \mathbf { z } | \mathbf { w } ) } ] = E _ { q _ { \phi _ { w } } ( \mathbf { z } | \mathbf { w } ) } [ \log \frac { p \varrho _ { \mathbf { x } } ( \mathbf { x } | \mathbf { z } ) p \varrho _ { w } ( \mathbf { w } | \mathbf { z } ) p ( \mathbf { z } ) } { q _ { \phi _ { w } } ( \mathbf { z } | \mathbf { w } ) } ] - \log p ( \mathbf { w } ) ,$$
$$\begin{array} { r } { \mathcal { L } _ { m u l t i p l e } ( \mathbf { x } | \mathbf { w } ) = E _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } [ \log \frac { p \theta _ { x } ( \mathbf { x } | \mathbf { z } ) p \theta _ { w } ( \mathbf { w } | \mathbf { z } ) p ( \mathbf { z } ) } { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { w } ) } ] - \log p ( \mathbf { w } ) , } \end{array}$$
where $\begin{array} { r } { \log p ( \mathbf { w } ) = \log E _ { p ( \mathbf { z } ) } [ p _ { \theta _ { w } } ( \mathbf { w } | \mathbf { z } ) ] = \log \frac { 1 } { N _ { w } } \sum _ { i } ^ { N _ { w } } p _ { \theta _ { w } } ( \mathbf { w } | \mathbf { z } ^ { ( i ) } ) } \end{array}$ and $\mathbf { z } ^ { ( i ) } \sim p ( \mathbf { z } )$ . In this paper, we set $N _ { w } = 5 , 0 0 0$ on MNIST and $N _ { w } = 1 0$ on CelebA.
We can obtain a tighter bound on the log-likelihood by $k$ -fold importance weighted sampling. For example, we obtain an importance weighted bound on $\log p ( \mathbf { x } )$ from Equation 11 as follows:
$$\log p ( \mathbf { x } ) \geq E _ { \mathbf { z } _ { 1 } , \ldots , \mathbf { z } _ { k } \sim q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) } [ \log { \frac { 1 } { k } } \sum _ { i = 1 } ^ { k } { \frac { p _ { \theta _ { x } } ( \mathbf { x } | \mathbf { z } ) p ( \mathbf { z } ) } { q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) } } ] = { \mathcal { L } } _ { s i n g l e } ^ { k } ( \mathbf { x } ) .$$
Strictly speaking, these two lower bounds are not equal. However, if the number of importance samples is extremely large, the difference of these two lower bounds converges to $0$ .
Proof. Let the multiple and single From the theorem of the import $k$ -hold importance weighted nce weighted bound, both $\mathcal { L } _ { s i n g l e } ^ { k }$ and Lkmultiple Lksingle and Lksin gle converge to $\log p ( \mathbf { x } )$ as $k \to \infty$ .
Therefore,
$$\begin{array} { r } { \operatorname* { l i m } _ { k \infty } | \mathcal { L } _ { m u l t i p l e } ^ { k } - \mathcal { L } _ { s i n g l e } ^ { k } | \leq | \operatorname* { l i m } _ { k \infty } \mathcal { L } _ { m u l t i p l e } ^ { k } - \operatorname* { l i m } _ { k \infty } \mathcal { L } _ { s i n g l e } ^ { k } | = 0 \quad \mathbb { I } } \end{array}$$
# C RECONSTRUCTED IMAGES
Figure 6 presents a comparison of the original image and reconstructed image by the JMVAE on both MNIST and CelebA datasets. It is apparent that the JMVAE can reconstruct the original image properly with either a multiple or single encoder.
Table 3: Evaluation of test log-likelihood. All models are trained on the MNIST dataset: left, marginal loglikelihood; right, conditional log-likelihood.
 Figure 7: Image generation from conditional distribution $p ( \mathbf { x } | \mathbf { w } )$ . We used a single encoder $p ( \mathbf { z } | \mathbf { w } )$ for both generations.
# D TEST JOINT LOG-LIKELIHOOD ON MNIST
Table 3 shows the joint log-likelihood of the JMVAE on MNIST dataset by both JMVAE-zero and JMVAE-kl. It is apparent that the log-likelihood test on both approaches is almost identical (strictly, JMVAE-zero is slightly lower). The test log-likelihood on JMVAE-kl becomes much lower if $\alpha$ is large.
# E IMAGE GENERATION FROM CONDITIONAL DISTRIBUTION ON MNIST
Figure 7 presents generation samples of $\mathbf { x }$ conditioned on single input w. It is apparent that the JMVAE with JMVAE-kl generates conditioned digit images properly, although that with JMVAEzero cannot generate them. As results showed, we also confirmed qualitatively that JMVAE-kl can model $q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } )$ properly compared to JMVAE-zero.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297# RECURRENT INFERENCE MACHINES FOR SOLVING INVERSE PROBLEMS
Patrick Putzky & Max Welling
Informatics Institute University of Amsterdam {pputzky,m.welling}@uva.nl
# ABSTRACT
Inverse problems are typically solved by first defining a model and then choosing an inference procedure. With this separation of modeling from inference, inverse problems can be framed in a modular way. For example, variational inference can be applied to a broad class of models. The modularity, however, typically goes away after model parameters have been trained under a chosen inference procedure. During training, model and inference often interact in a way that the model parameters will ultimately be adapted to the chosen inference procedure, posing the two components inseparable after training. But if model and inference become inseperable after training, why separate them in the first place?
We propose a novel learning framework which abandons the dichotomy between model and inference. Instead, we introduce Recurrent Inference Machines (RIM), a class of recurrent neural networks (RNN), that directly learn to solve inverse problems.
We demonstrate the effectiveness of RIMs in experiments on various image reconstruction tasks. We show empirically that RIMs exhibit the desirable convergence behavior of classical inference procedures, and that they can outperform state-ofthe-art methods when trained on specialized inference tasks.
Our approach bridges the gap between inverse problems and deep learning, providing a framework for fast progression in the field of inverse problems.
# 1 INTRODUCTION
Inverse Problems are a broad class of problems which can be encountered in all scientific disciplines, from the natural sciences to engineering. The task in inverse problems is to reconstruct a signal from observations that are subject to a known (or inferred) corruption process known as the forward model. A typical example of an inverse problem is the linear measurement problem
$$\mathbf { y } = \mathbf { A } \mathbf { x } + \mathbf { n } ,$$
where $\mathbf { x }$ is the signal of interest, $\mathbf { A }$ is an $m \times d$ corruption matrix, $\mathbf { n }$ is an additive noise vector, and $\mathbf { y }$ is the actual measurement. If $\mathbf { A }$ is a wide matrix such that $m \ll d$ , this problem is typically ill-posed. Many signal reconstruction problems can be phrased in terms of the linear measurement problem such as image denoising, super-resolution, deconvolution and so on. The general form of A typically defines the problem class. If A is an identity matrix the problem is a denoising problem, while in tomography A represents a Fourier transform and a consecutive sub-sampling of the Fourier coefficients.
Inverse problems are often formulated as an optimization problem of the form
$$\operatorname* { m i n } _ { \mathbf { x } } d ( \mathbf { y } , \mathbf { A x } ) + \lambda R ( \mathbf { x } ) ,$$
where $d ( \mathbf { y } , \mathbf { A x } )$ is the data fidelity term that enforces $\mathbf { x }$ to satisfy the observations $\mathbf { y }$ , and $R ( \mathbf { x } )$ is a regularization term which restricts the solution to comply with a predefined model over $\mathbf { x }$ .
The difficulties that arise in this framework are two-fold: (1) it is difficult to choose $R ( \mathbf { x } )$ such that it is an appropriate model for complex signals such as natural images, and (2) even under a well chosen $R ( \mathbf { x } )$ the optimization procedure might become difficult.
Compressed sensing approaches give up on a versatile $R ( \mathbf { x } )$ in order to define a convex optimization procedure. The idea is that the signal $\mathbf { x }$ has a sparse representation in some basis $\Psi$ such that $\mathbf { x } = \Psi \mathbf { u }$ and that the optimization problem can be rephrased as
$$\operatorname* { m i n } _ { \mathbf { u } } d ( \mathbf { y } , \mathbf { A } \Psi \mathbf { u } ) + \lambda \left\| \mathbf { u } \right\| _ { 1 } ,$$
where $\left\| \cdot \right\| _ { 1 }$ is the sparsity inducing L1-norm (Donoho, 2006a). Under certain classes of $d ( \mathbf { y } , \mathbf { A } \Psi \mathbf { u } )$ such as quadratic errors the optimization problem becomes convex. Results from the compressed sensing literature offer provable bounds on the reconstruction performance for sparse signals of this form (Candes et al., 2006; Donoho, 2006b). The basis \` $\Psi$ can also be learned from data (Aharon et al., 2006; Elad & Aharon, 2006).
Other approaches interpret equation (2) in terms of probabilities such that finding the solution is a matter of performing maximum a posteriori (MAP) estimation (Figueiredo et al., 2007). In those cases $d ( \mathbf { y } , \mathbf { A } \Psi \mathbf { u } )$ takes the form of a log-likelihood and $R ( \mathbf { x } )$ takes the form of a parametric logprior $\log p _ { \theta } ( \mathbf { x } )$ over variable $\mathbf { x }$ such that the minimization becomes:
$$\underset { \mathbf { x } } { \operatorname* { m a x } } \log p ( \mathbf { y } \vert \mathbf { A } , \mathbf { x } ) + \log p _ { \theta } ( \mathbf { x } ) .$$
This allows for more expressiveness of $R ( \mathbf { x } )$ and for the possibility of learning the prior $p _ { \theta } ( \mathbf { x } )$ from data. However, with more expressive priors optimization will become more difficult as well. In fact, only for a few trivial prior-likelihood pairs will inference remain convex. In practice one often has to resort to approximations of the objective and to approximate double-loop algorithms in order to allow for scalable inference (Nickisch & Seeger, 2009; Zoran & Weiss, 2011).
In this work we take a radically different approach to solving inverse problems. We move away from the idea that it is beneficial to separate learning a prior (regularizer) from the optimization to do the reconstruction. The usual thinking is that this separation allows for greater modularity and the possibility to interchange one of these two complementary components in order to build new algorithms. In practice however, we observe that the optimization procedure almost always has to be adapted to the model choice to achieve good performance (Aharon et al., 2006; Elad & Aharon, 2006; Nickisch & Seeger, 2009; Zoran & Weiss, 2011). In fact, it is well known that the optimization procedure used for training should match the one used during testing because the model has adapted itself to perform well under that optimization procedure (Kumar et al., 2005; Wainwright, 2006).
What we need is a single framework which allows us to backpropagate through the optimization procedure when we learn the free parameters. Hence, We propose to look at inverse problems as a direct mapping from observations to estimated signal,
$$\hat { \mathbf { x } } = f _ { \phi } ( \mathbf { A } , \mathbf { y } )$$
where $\hat { \bf x }$ is an estimate of signal $\mathbf { x }$ from observations $( \mathbf { A } , \mathbf { y } )$ . Here we define $\phi$ as a set of learnable parameters which define the inference algorithm as well as constraints on $\mathbf { x }$ . The goal is thus to define map whose parameters are directly optimized for solving the inverse problem itself. It has the benefits of both having high expressive power (if the map $f _ { \phi }$ is complex enough) as well as being fast at inference time.
This paradigm shift allows us to learn and combine the effect of a prior, the reconstruction fidelity and an inference method without the need to explicitly define the functional form of all components. The whole procedure is simply interpreted as a single RNN. As a result, there is no need for sparsity assumptions, the introduction of model constraints to allow for convexity, or even for double-loop algorithms (Gregor & LeCun, 2010). In fact the proposed framework allows for use of current deep learning approaches which have high expressive power without trading off scalability. It further allows us to move all the manual parameter tuning - which is still common in traditional approaches (Zoran & Weiss, 2011) - away from the inference phase and into the learning phase. We believe this framework can be an important asset to introduce deep learning into the domain of inverse problems.
 Figure 1: (A) Graphical illustration of the recurrent structure of MAP estimation (compare equation (6)). The three boxes represent likelihood model $p ( \mathbf { y } \vert \mathbf { x } )$ (A omitted), prior $p _ { \theta } ( \mathbf { x } )$ , and update function $\Gamma$ , respectively. In each iteration, likelihood and prior collect the current estimate of $\mathbf { x }$ , to send a gradient to update function $\Gamma$ (see text). $\Gamma$ then produces a new estimate of $\mathbf { x }$ . Typically, prior $p _ { \theta } ( \mathbf { x } )$ and update function $\Gamma$ are modeled as two distinct model components. Here they are both depicted in gray boxes because they each represent model internal information which we wish to be transferable between different observations, i.e. they are observation independent. Likelihood term $p ( \mathbf { y } \vert \mathbf { x } )$ is depicted in blue to emphasize it as a model extrinsic term, some aspects of the likelihood term can change from one observation to the other (such as matrix A). The likelihood term is observation-dependent. $\mathbf { ( B ) }$ Model simplification. The central insight of this work is to merge prior $p _ { \theta } ( \mathbf { x } )$ and update function $\Gamma$ into one model with trainable parameters $\phi$ . The model then iteratively produces new estimates through feedback from likelihood model $p ( \mathbf { y } \vert \mathbf { x } )$ and previous updates. (C) A Recurrent Inference Machine unrolled in time. Here we have added an additional state variable which represents information that is carried over time, but is not directly subjected to constraints through the likelihood term $p ( \mathbf { y } \vert \mathbf { x } )$ . During training, estimates at each time step are subject to an error signal from the ground truth signal $\mathbf { x }$ (dashed two-sided arrows) in order to perform backpropagation. The intermittent error signal will force the model to perform well as soon as possible during iterations. At test time, there is no error signal from $\mathbf { x }$ .
# 2 RECURRENT INFERENCE MACHINES
The goal of this work is to find an inverse model as described in equation (5). Often, however, it will be intractable to find (5) directly, even with modern non-linear function approximators. For high-dimensional $\mathbf { y }$ and $\mathbf { x }$ , which are typically considered in inverse problems, it will simply not be possible to fit matrix A into memory explicitly, but instead matrix A will be replaced by an operator that acts on $\mathbf { x }$ . An example is the Discrete Fourier Transform (DFT). Instead of using a Fourier matrix which is quadratic in the size of $\mathbf { x }$ , DFTs are typically performed using the Fast Fourier Transform (FFT) algorithm which reduces computational cost and memory consumption significantly. The use of operators, however, does not allow us to feed A into (5) anymore, but instead we will have to resort to an iterative approach that alternates between updates of $\mathbf { x }$ and evaluation of Ax. This is precisely what is typically done in gradient-based inference methods, and we will motivate our framework from there.
# 2.1 GRADIENT-BASED INFERENCE
Recall from equation (4) that inverse problems can be interpreted in terms of probability such that optimization is an iterative approach to MAP inference. In its most simple form each consecutive estimate of $\mathbf { x }$ is then computed through a recursive function of the form
$$\mathbf { x } _ { t + 1 } = \mathbf { x } _ { t } + \gamma _ { t } \nabla \left( \log p \left( \mathbf { y } \vert \mathbf { A } , \mathbf { x } \right) + \log p _ { \theta } \left( \mathbf { x } \right) \right) \left( \mathbf { x } _ { t } \right)$$
where we make use of the fact that $p ( \mathbf { x } | \mathbf { A } , \mathbf { y } ) \propto p ( \mathbf { y } | \mathbf { A } , \mathbf { x } ) p _ { \boldsymbol { \theta } } ( \mathbf { x } )$ and $\gamma _ { t }$ is the step size or learning rate at iteration $t$ . Further, $\mathbf { A }$ is a (partially-)observable covariate, $p ( \mathbf { y } | \mathbf { A } , \mathbf { x } )$ is the likelihood function for a given inference problem, and $p _ { \theta } \left( \mathbf { x } \right)$ is a prior over signal $\mathbf { x }$ . In many cases where either the likelihood term or the prior term deviate from standard models, optimization will not be convex. In constrast, the approach presented in this work is completely freed from ideas about convexity, as will be shown in the next section.
# 2.2 RECURRENT FUNCTION DEFINITION
The central insight of this work is that update equation (6) can be generalized such that
$$\mathbf { x } _ { t + 1 } = \mathbf { x } _ { t } + g _ { \phi } ( \nabla _ { \mathbf { y } | \mathbf { x } } , \mathbf { x } _ { t } )$$
where we denote $\nabla \log p ( \mathbf { y } \vert \mathbf { A } , \mathbf { x } ) ( \mathbf { x } _ { t } )$ by $\nabla _ { \mathbf { y } | \mathbf { x } }$ for readability and $\phi$ is a set of learnable parameters that govern the updates of $\mathbf { x }$ . In this representation, prior parameters $\theta$ and learning rate parameters $\gamma$ have been merged into one set of trainable parameters $\phi$ .
To recover the original update equation (6), $g _ { \phi } ( \nabla _ { \mathbf y | \mathbf x } , \mathbf x _ { t } )$ is written as
$$g _ { \phi } ( \nabla _ { \mathbf { y } | \mathbf { x } } , \mathbf { x } _ { t } ) = \gamma _ { t } \left( \nabla _ { \mathbf { y } | \mathbf { x } } + \nabla _ { \mathbf { x } } \right)$$
where we make use of $\nabla _ { \mathbf x }$ to denote $\nabla \log p _ { \theta } ( \mathbf { x } ) ( \mathbf { x } _ { t } )$ . It will be useful to dissect the terms on the right-hand side of (8) to make sense of the usefulness of the modification.
First notice, that in equation (6) we never explicitly evaluate the prior, but only evaluate its gradient in order to perform updates. If never used, learning a prior appears to be unnecessary, and instead it appears more reasonable to directly learn a gradient function $\nabla _ { \mathbf x } = f _ { \theta } ( \mathbf x _ { t } ) \in \mathbb R ^ { d }$ . The advantage of working solely with gradients is that they do no require the evaluation of an (often) intractable normalization constant of $p _ { \theta } ( \mathbf { x } )$ .
A second observation is that the step sizes $\gamma _ { t }$ are usually subject to either a chosen schedule or chosen through a deterministic algorithm such as a line search. That means the step sizes are always chosen according to a predefined model $\Gamma$ . Interestingly, this model is usually not learned. In order to make inference faster and improve performance we suggest to learn the model $\Gamma$ as well.
In (7) we have made the prior $p _ { \theta } ( \mathbf { x } )$ and the the step size model $\Gamma$ implicit in function $g _ { \phi } ( \nabla _ { \mathbf y | \mathbf x } , \pmb \eta _ { t } )$ . We explicitly keep $\nabla _ { \mathbf { y } | \mathbf { x } }$ as an input to (7) because - as opposed to $\Lambda$ and $p _ { \theta } ( \mathbf { x } )$ - it represents extrinsic information that is injected into the model. It allows for changes in the likelihood model $p ( \mathbf { y } \vert \mathbf { x } )$ without the need to retrain parameters $\phi$ of the inference model $g _ { \phi }$ . Figure 1 gives a visual summary of the insights from this section.
# 2.3 OUTPUT CONSTRAINTS
In many problem domains the range of values for variable $\mathbf { x }$ is naturally constraint. For example, images typically have pixels with strictly positive values. In order to model this constraint we make use of nonlinear link functions as they are typically used in neural networks, such that
$$\mathbf { x } = \Psi ( \pmb { \eta } )$$
where $\Psi ( \cdot )$ is any differentiable link function and $\eta$ is the space in which RIMs iterate such that update equation (7) is replaced by
$$\pmb { \eta } _ { t + 1 } = \pmb { \eta } _ { t } + g _ { \phi } ( \nabla _ { \mathbf { y } | \pmb { \eta } } , \pmb { \eta } _ { t } )$$
As a result $\mathbf { x }$ can be constraint to a certain range of values through $\Psi ( \cdot )$ , whereas iterations are performed in the unconstrained space of $\eta$
# 2.4 RECURRENT NETWORKS
A useful extension of (7) is to introduce a latent state variable $\mathbf { s } _ { t }$ into the procedure. This latent variable is typically used as a utility in recurrent neural networks to learn temporal dependencies in data processing. With an additional latent variable the update equations become
$$\begin{array} { r l } & { \pmb { \eta } _ { t + 1 } = \pmb { \eta } _ { t } + h _ { \phi } \left( \nabla _ { \mathbf { y } | \eta } , \pmb { \eta } _ { t } , \mathbf { s } _ { t + 1 } \right) } \\ & { \mathbf { s } _ { t + 1 } = h _ { \phi } ^ { \ast } \left( \nabla _ { \mathbf { y } | \eta } , \pmb { \eta } _ { t } , \mathbf { s } _ { t } \right) } \end{array}$$
where $h _ { \phi } ^ { * } ( \cdot )$ is the update model for state variable s. The variable s will allow the procedure to have memory in order to track progression, curvature, approximate a preconditioning matrix $\mathbf { T } _ { t }$ (such as in BFGS) and determine a stopping criterion among other things. The concept of a temporal memory is quite limited in classical inference methods, which will allow RIMs to have a potential advantage over these methods.
# 2.5 TRAINING
In order to learn a step-wise inference procedure it will be necessary to simulate the inference steps during training. I.e. during training, an RIM will perform a number of inference steps $T$ . At each step the model will produce a prediction as depicted in figure Figure 1. Each of those predictions is then subject to a loss, which encourages the model to produce predictions that improve over time. In it’s simplest form we can define a loss which is simply a weighted sum of the individual prediction losses at each time step such that
$$\mathcal { L } ^ { t o t a l } ( \phi ) = \sum _ { t = 1 } ^ { T } w _ { t } \mathcal { L } ( \mathbf { x } _ { t } ( \phi ) , \mathbf { x } )$$
is the total loss. Here, $\mathcal { L } ( \cdot )$ is a base loss function such as the mean square error, $w _ { t }$ is a positive scalar and $\mathbf { x } _ { t } ( \phi )$ is a prediction at time $t$ . In this work we follow Andrychowicz et al. (2016) in setting $w _ { t } = 1$ for all time steps.
# 3 RELATED WORK
The RIM framework can be seen as an auto-encoder framework in which only the decoder is trained, whereas the encoder is given by a known corruption process. In terms of the training procedure this makes RIMs very similar to denoising auto-encoders (Vincent et al., 2008). Though initially with the objective of regularization in mind, denoising auto-encoders have been shown to be effectively used as generative models (Vincent et al., 2010). The difference of RIMs to denoising auto-encoders and also more recently developed auto-encoders such as Kingma & Welling (2014); Rezende et al. (2014) is that RIMs enforce coupling between encoder and decoder both, during training and test time. In it’s typical form, decoder and encoder of an auto-encoder are only coupled during training time, while there is no information flow during test time (Kingma & Welling, 2014; Rezende et al., 2014; Vincent et al., 2008; 2010). An exception is the work from Gregor et al. (2016) which is conceptually strongly related to RIMs. There, an RNN model is used to generate static data by drawing on a fixed canvas. An error signal is propagated throughout the generation process.
There have been approaches in the past which aim to formulate a framework in which an inference procedure is learned. One of the best known frameworks is LISTA (Gregor & LeCun, 2010) which aims to learn a model that reconstructs sparse codes from data. LISTA models try to fit into the classical framework of doing inference as described in 1, whereas RIMs are completely removed from assumptions about sparsity. A recent paper by Andrychowicz et al. (2016) aims to train RNNs as optimizers for non-convex optimization problems. Though introduced with a different intention, RIMs can be seen as a generalization of this approach, in which the model - in addition to the gradient information - is aware about the absolute position of a prediction in variable space(see equation (7)).
# 4 EXPERIMENTAL RESULTS
We evaluate our method on various kinds of image restoration tasks which can each be formulated in terms of linear measurement problems as described in equation (1). We first analyze the properties
of our proposed method on a set of restoration tasks from random projections. Later we compare our model on two well known image restoration tasks: image denoising and image super-resolution.
# 4.1 MODELS
If not specified otherwise we use the same RNN architecture for all experiments presented in this work. The chosen RNN consists of three convolutional hidden layers and a final convolutional output layer. All convolutional filters were chosen to be of size $3 \times 3$ pixels. The first hidden layer consists of convolutions with stride 2 (64 features), subsequent batch normalization and a tanh nonlinearity. The second hidden layer represents the RNN part of the model. We chose a gated recurrent unit (GRU) (Chung et al., 2014) with 256 features. The third hidden layer is a transpose convolution layer with 64 features which aims to recover the original image dimensions of the signal, followed again by a batch normalization layer and a tanh nonlinearity. All models have been trained on a fixed number of iterations of 20 steps. All methods were implemented in Tensorflow1.
# 4.2 DATA
All experiments were run on the BSD-300 data set (Martin et al., $2 0 0 1 ) ^ { 2 }$ . For training we extracted patches of size $3 2 \texttt { X } 3 2$ pixels with stride 4 from the 200 training images available in the data set. In total this amounts to a data set of about 400 thousand image patches with highly redundant information. All models were trained over only two epochs, i.e. each unique image patch was seen by a model only twice during training. Validation was performed on a held-out data set of 1000 image patches.
For testing we either used the whole test set of 100 images from BSDS-300 or we used only a subset of 68 images which was introduced by Roth & Black (2005) and which is commonly used in the image restoration community 3.
# 4.3 IMAGE RESTORATION
All tasks addressed in this work assume a linear measurement problem of the form as described in equation (1) with additive (isotropic) Gaussian noise. In this case the gradient of the likelihood takes the form
$$\nabla _ { \mathbf { y } | \mathbf { x } } = { \frac { 1 } { \sigma ^ { 2 } } } \mathbf { A } ^ { T } ( \mathbf { y } - \mathbf { A x } )$$
where $\sigma ^ { 2 }$ is the noise variance. For very small $\sigma$ this gradient diverges. In order to make the gradient more stable also for small $\sigma$ we chose to rewrite it as
$$\nabla _ { \mathbf { y } | \mathbf { x } } = \frac { 1 } { \sigma ^ { 2 } + \epsilon } \mathbf { A } ^ { T } ( \mathbf { y } - \mathbf { A x } )$$
where $\epsilon = \mathrm { s o f t p l u s } ( \phi _ { \epsilon } )$ and $\phi _ { \epsilon }$ is a trainable parameter. As a link function $\Psi$ (see (9)) we chose the logistic sigmoid nonlinearity4 and we used the mean square error as training loss.
# 4.4 MULTI-TASK LEARNING WITH RANDOM PROJECTIONS
To analyze the properties of our proposed framework in terms of convergence and to test whether all components of the model are useful, we first trained the model to reconstruct image patches from noisy random projections of grayscale image patches. We consider three types of random projection matrices: (1) Gaussian ensembles with elements drawn from a standard normal distribution, (2) binary ensembles with entries of values $\{ - 1 , 1 \}$ drawn from a Bernulli distribution with $p = 0 . 5$ , and (3) Fourier ensembles with randomly sampled rows from a Fourier matrix (see Donoho (2006b)).
We trained three models on these tasks: (1) a Recurrent Inference Machine (RIM) as described in 2, (2) a gradient-descent network (GDN) which does not use the current estimate as an input (compare
 Figure 2: Reconstruction performance over time on random projections. Shown are results of the three reconstruction tasks from random projections (see text) on 5000 random patches from the BSD-300 test set. Value of p represent the the reduction in dimensionality through the random projection. Noise standard deviation was chosen to be $\sigma = 1$ . Solid lines correspond to the mean peak signal-to-noise-ration (PSNR) over time, and shaded areas correspond to one standard deviation around the mean. Vertical dashed lines mark the last time step that was used during training.
Andrychowicz et al. (2016)), and (3) a feed-forward network (FFN) which uses the same inputs as the RIM but where we replaced the GRU unit with a ReLu layer in order to remove state-dependence. Model (2) and (3) are simplifications of RIM in order to test the influence of each of the removed model components on prediction performance.
Figure 2 shows the reconstruction performance of all three models on random projections. In all tasks the RIM clearly outperforms both other models, showing overall consistent convergence behavior. The FFN performs well on easier tasks but starts to show degrading performance over time on more difficult tasks. This suggests that the state information of RIM plays an important role on the convergence behavior as well as overall performance. The GDN shows worst performance among all three models. For all tasks, the performance of GDN starts to degrade clearly after the 20 time steps that were used during training. We hypothesize that the model is able to compensate some of the missing information about the current estimate of $\mathbf { x }$ through state variable s during training, but the model is not able to transfer this ability to episodes with more iterations.
These results suggests that both the current estimate as well as the recurrent state carry useful information for performing inference. We will therefor only consider fully fledged RIMs from here on.
# 4.5 IMAGE DENOISING
After evaluating our model on $3 2 \texttt { X } 3 2$ pixel image patches we wanted to see how reconstruction performance generalizes to full sized images and to an out of domain problem. We chose to reuse the RIM that was trained on the random projections task to perform image denoising. In this section we will call this model RIM-3task. To test the hypothesis that inference should be trained task specific, we further trained a model RIM-denoise solely on the denoising task. Table 2 shows the denoising performance through the mean PSNR on the BSD-300 test set for both models as compared to state-of-the-art methods in image denoising. The RIM-3task model shows very competitive results with other methods on all noise levels. This exemplifies that the model indeed has learned something reminiscent of a prior, as it was never directly trained on this task. The RIM-denoise model further improves upon the performance of RIM-3task and it outperforms most other methods on all noise levels. This is to say that the same RIM was used to perform denoising on different noise levels, and this model does not require any hand tuning after training.
 Figure 3: Denoising performance on example image use in Zoran & Weiss (2011). $\sigma = 5 0$ . Noisy image was 8-bit quantized before reconstruction.
Table 2 shows denoising perfomance on image that have been 8-bit quantized after adding noise(see Schmidt et al. (2016)). In this case performance slightly deteriorates for both models, though still making competitive with stateof-the-art methods. This effect could possibly be accommodated through further training, or by adjusting the forward model. Figure 3 gives some qualitative results on the denoising performance for one of the test images from BSD-300 as compared to the method from Zoran & Weiss (2011). RIM is able to produce more naturalistic images with less visible artifacts. The state variable in our RIM model allows for a growing receptive field size over time, which could explain the good long range interactions that the model shows.
Table 1: Color denoising. Denoising performance on the 68 images for $\sigma =$ 25 after 8-bit quantization. Results for RTF-5 (Schmidt et al., 2016) and CBM3D (Dabov et al., 2007b) adopted from Schmidt et al. (2016). In parenthesis are results for the full 100 test images.
<table><tr><td>Method</td><td>PSNR</td></tr><tr><td>CBM3D</td><td>30.18</td></tr><tr><td>RTF-5</td><td>30.57</td></tr><tr><td>RIM (ours)</td><td>30.84(30.67)</td></tr></table>
Many denoising algorithms are solely tested on gray-scale images. Sometimes this is due to additional difficulties that multi-channel problems bring for some inference approaches. To show that it is straightforward to apply RIMs to multi-channel problems we trained a model to denoise RGB images. The denoising performance can be seen in table 1. The model is able to exploit correlations across color channels which allows for an additional boost in reconstruction performance.
# 4.6 IMAGE SUPER-RESOLUTION
We further tested our approach on the well known image super-resolution task. We trained a single RIM 5 on $3 6 \texttt { X } 3 6$ pixel image patches from the BSD-300 training set to perform image super
<table><tr><td rowspan="2">0</td><td colspan="3">Not Quantized</td><td colspan="3">8-bit Quantized</td></tr><tr><td>15</td><td>25</td><td>50</td><td>15</td><td>25</td><td>50</td></tr><tr><td>KSVD</td><td>30.87</td><td>28.28</td><td>25.17</td><td></td><td></td><td></td></tr><tr><td>5x5FoE</td><td>30.99</td><td>28.40</td><td>25.35</td><td></td><td>28.22</td><td></td></tr><tr><td>BM3D</td><td>31.08</td><td>28.56(28.35)</td><td>25.62(25.45)</td><td></td><td>28.31</td><td></td></tr><tr><td>LSSC</td><td>31.27</td><td>28.70</td><td>25.72</td><td></td><td>28.23</td><td></td></tr><tr><td>EPLL</td><td>31.19</td><td>28.68(28.47)</td><td>25.67(25.50)</td><td></td><td></td><td></td></tr><tr><td>opt-MRF</td><td>31.18</td><td>28.66</td><td>25.70</td><td></td><td></td><td></td></tr><tr><td>MLP</td><td></td><td>28.85(28.75)</td><td>(25.83)</td><td></td><td></td><td></td></tr><tr><td>RTF-5</td><td></td><td>28.75</td><td></td><td></td><td>28.74</td><td></td></tr><tr><td>RIM-3task</td><td>31.19(30.98)</td><td>28.67(28.45)</td><td>25.78(25.59)</td><td>31.06(30.88)</td><td>28.41(28.24)</td><td>24.86(24.73)</td></tr><tr><td>RIM-denoise</td><td>31.31(31.10)</td><td>28.91(28.72)</td><td>26.06(25.88)</td><td>31.25(31.05)</td><td>28.76(28.58)</td><td>25.27(25.14)</td></tr></table>
Table 2: Denoising performance on gray-scale images from BSD-300 test set. Shown are mean PSNR values for different noise values. Number outside of parenthesis correspond to test performance on the 68 test images from Roth & Black (2005), and numbers in parenthesis correspond to performance on all 100 test images from BSD-300. 68 image performance for KSVD (Elad & Aharon, 2006), FoE (Roth & Black, 2005), BM3D (Dabov et al., 2007a), LSSC (Mairal et al., 2009), EPLL (Zoran & Weiss, 2011), and opt-MRF (Chen et al., 2013) adopted from Chen et al. (2013). Performances on 100 images adopted from Burger et al. (2013). 68 image performance on MLP (Burger et al., 2012), RTF-5 (Schmidt et al., 2016) and all quantized results adopted from Schmidt et al. (2016).
 Figure 4: Super-resolution example with factor 3. Comparison with the same methods as in table 3. Reported numbers are PSNR/SSIM. Best results in bold.
resolution for factors 2, 3, and $4 ^ { 6 }$ . We followed the same testing protocol as in Huang et al. (2015), and we used the test images that were retrieved from their website 7. Table 3 shows a comparison with some state-of-the-art methods on super-resolution for the BSD-300 test set. Figure 4 shows a qualitative example of super-resolution performance. The other deep learning method in this comparison, SRCNN Dong et al. (2014), is outperformed by RIM on all scales. Interestingly SRCNN was trained for each scale independently whereas we only trained one RIM for all scales. The chosen RIM has only about 500.000 parameters which amounts to about 2MB of disk space, which makes this architecture very attractive also for mobile computing.
Table 3: Image super-resolution performance on RGB images from BSD-300 test set. Mean and standard deviation (of the mean) of Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index (SSIM) Wan (2004). Standard deviation of the mean was estimated from 10.000 boostrap samples. Test protocol and images taken from Huang et al. (2015). Only the three best performing methods from Huang et al. (2015) were chosen for comparison: SRCNN Dong et al. (2014), $\mathbf { A } +$ Timofte et al. (2015), SelfExSR Huang et al. (2015). Best mean values in bold.
<table><tr><td>Metric</td><td>Scale</td><td>Bicubic</td><td>SRCNN</td><td>A+</td><td>SelfExSR</td><td>RIM (Ours)</td></tr><tr><td rowspan="3">PSNR</td><td>2x</td><td>29.55 ± 0.35</td><td>31.11 ± 0.39</td><td>31.22 ± 0.40</td><td>31.18 ± 0.39</td><td>31.39 ± 0.39</td></tr><tr><td>3x</td><td>27.20 ± 0.33</td><td>28.20 ±0.36</td><td>28.30 ± 0.37</td><td>28.30 ± 0.37</td><td>28.51 ± 0.37</td></tr><tr><td>4x</td><td>25.96 ± 0.33</td><td>26.70 ± 0.34</td><td>26.82 ± 0.35</td><td>26.85 ± 0.36</td><td>27.01 ± 0.35</td></tr><tr><td rowspan="3">SSIM</td><td>2x</td><td>0.8425 ± 0.0078</td><td>0.8835 ± 0.0062</td><td>0.8862 ± 0.0063</td><td>0.8855 ± 0.0064</td><td>0.8885 ± 0.0062</td></tr><tr><td>3x</td><td>0.7382 ± 0.0114</td><td>0.7794 ± 0.0102</td><td>0.7836 ± 0.0104</td><td>0.7843 ± 0.0104</td><td>0.7888 ± 0.0101</td></tr><tr><td>4x</td><td>0.6672 ± 0.0131</td><td>0.7018 ± 0.0125</td><td>0.7089 ± 0.0125</td><td>0.7108 ± 0.0124</td><td>0.7156 ± 0.0125</td></tr></table>
# 5 DISCUSSION
In this work, we introduce a general learning framework for solving inverse problems with deep learning approaches. We establish this framework by abandoning the traditional separation between model and inference. Instead, we propose to learn both components jointly without the need to define their explicit functional form. This paradigm shift enables us to bridge the gap between the fields of deep learning and inverse problems. We believe that this framework can have a major impact on many inverse problems, for example in medical imaging and radio astronomy. Although we have focused on linear image reconstruction tasks in this work, the framework can be applied to inverse problems of all kinds, such as non-linear inverse problems.
# ACKNOWLEDGMENTS
The research was funded by the DOME project (Astron & IBM) and the Netherlands Organization for Scientific Research (NWO). The authors are greatful for helpful comments from Thomas Kipf, Mijung Park, Rajat Thomas, and Karen Ullrich.
# REFERENCES
Image quality assessment: form error visibility to structural similarity. IEEE Transactions on Image Processing, 13(4):600–612, 2004.
Michal Aharon, Michael Elad, and Alfred Bruckstein. K-SVD: An algorithm for designing overcomplete dictionaries for sparse representation. IEEE Transactions on Signal Processing, 54(11): 4311–4322, nov 2006.
Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W. Hoffman, David Pfau, Tom Schaul, and Nando de Freitas. Learning to learn by gradient descent by gradient descent. jun 2016.
Harold Christopher Burger, Christian Schuler, and Stefan Harmeling. Image denoising: Can plain neural networks compete with BM3D? In IEEE Conference on Computer Vision and Pattern Recognition, pp. 2392–2399. IEEE, jun 2012.
Harold Christopher Burger, Christian J. Schuler, and Stefan Harmeling. Learning how to combine internal and external denoising methods. In Joachim Weickert, Matthias Hein, and Bernt Schiele (eds.), GCPR, volume 8142 of Lecture Notes in Computer Science, pp. 121–130. Springer, 2013.
Emmanuel J. Candes, Justin K. Romberg, and Terence Tao. Stable signal recovery from incomplete \` and inaccurate measurements. Communications on Pure and Applied Mathematics, 59(8):1207– 1223, aug 2006.
Yunjin Chen, Thomas Pock, Rene Ranftl, and Horst Bischof. Revisiting Loss-Specific Training of ´ Filter-Based MRFs for Image Restoration. In 35th German Conference on Pattern Recognition (GCPR), pp. 271–281, 2013.
Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling. dec 2014.
K. Dabov, A. Foi, V. Katkovnik, and K. Egiazarian. Image Denoising by Sparse 3-D TransformDomain Collaborative Filtering. IEEE Transactions on Image Processing, 16(8):2080–2095, aug 2007a.
Kostadin Dabov, Alessandro Foi, Vladimir Katkovnik, and Karen Egiazarian. Color Image Denoising via Sparse 3D Collaborative Filtering with Grouping Constraint in Luminance-Chrominance Space. In 2007 IEEE International Conference on Image Processing, pp. I – 313–I – 316. IEEE, sep 2007b.
Chao Dong, Chen Change Loy, Kaiming He, and Xiaoou Tang. Learning a deep convolutional network for image super-resolution. ECCV, pp. 184–199, 2014.
David L. Donoho. For most large underdetermined systems of linear equations the minimal L1-norm solution is also the sparsest solution. Communications on Pure and Applied Mathematics, 59(6): 797–829, jun 2006a.
D.L. Donoho. Compressed sensing. IEEE Transactions on Information Theory, 52(4):1289–1306, apr 2006b.
Michael Elad and Michal Aharon. Image Denoising Via Sparse and Redundant Representations Over Learned Dictionaries. IEEE Transactions on Image Processing, 15(12):3736–3745, dec 2006.
Mario A. T. Figueiredo, Robert D. Nowak, and Stephen J. Wright. Gradient Projection for Sparse ´ Reconstruction: Application to Compressed Sensing and Other Inverse Problems. IEEE Journal of Selected Topics in Signal Processing, 1(4):586–597, dec 2007.
Karol Gregor and Yann LeCun. Learning Fast Approximations of Sparse Coding. In Proceedings of the 27th International Conference on Machine Learning (ICML-10), pp. 399–406, 2010.
Karol Gregor, Frederic Besse, Danilo Jimenez Rezende, Ivo Danihelka, and Daan Wierstra. Towards Conceptual Compression. apr 2016.
Jia-Bin Huang, Abhishek Singh, and Narendra Ahuja. Single image super-resolution from transformed self-exemplars. In 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5197–5206. IEEE, jun 2015.
Diederik P. Kingma and Max Welling. Auto-Encoding Variational Bayes. In The 2nd International Conference on Learning Representations (ICLR), 2014.
Sanjiv Kumar, Jonas August, and Martial Hebert. Exploiting Inference for Approximate Parameter Learning in Discriminative Fields: An Empirical Study. In Proceedings of the 5th international conference on Energy Minimization Methods in Computer Vision and Pattern Recognition, pp. 153–168. Springer-Verlag, 2005.
Julien Mairal, Francis Bach, Jean Ponce, Guillermo Sapiro, and Andrew Zisserman. Non-local sparse models for image restoration. In 2009 IEEE 12th International Conference on Computer Vision, pp. 2272–2279. IEEE, sep 2009.
David Martin, Charless Fowlkes, Doron Tal, and Jitendra Malik. A database of human segmented natural images and its application to evaluating segmentation algorithms and measuring ecological statistics. In Proc. 8th Int’l Conf. Computer Vision, volume 2, pp. 416–423, July 2001.
Hannes Nickisch and Matthias W. Seeger. Convex variational Bayesian inference for large scale generalized linear models. In Proceedings of the 26th International Conference on Machine Learning, pp. 761–768, New York, New York, USA, jun 2009. ACM Press.
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, 2014.
Stefan Roth and Michael J. Black. Fields of experts: A framework for learning image priors. In Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, volume 2, pp. 860–867. IEEE, 2005.
Uwe Schmidt, Jeremy Jancsary, Sebastian Nowozin, Stefan Roth, and Carsten Rother. Cascades of regression tree fields for image restoration. IEEE Transactions on Pattern Analysis and Machine Intelligence, 38(4):677–689, 2016.
Radu Timofte, Vincent de Smet, and Luc van Gool. $\mathbf { A } +$ : Adjusted anchored neighborhood regression for fast super-resolution. In ACCV, volume 9006, pp. 111–126. 2015.
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, New York, New York, USA, 2008. ACM Press.
Pascal Vincent, Hugo Larochelle, Isabelle Lajoie, Yoshua Bengio, and Pierre-Antoine Manzagol. Stacked Denoising Autoencoders: Learning Useful Representations in a Deep Network with a Local Denoising Criterion. The Journal of Machine Learning Research, 11:3371–3408, 2010.
MJ Wainwright. Estimating the wrong graphical model: Benefits in the computation-limited setting. The Journal of Machine Learning Research, 2006.
Daniel Zoran and Yair Weiss. From learning models of natural image patches to whole image restoration. In 2011 International Conference on Computer Vision, pp. 479–486. IEEE, nov 2011.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302# SEQUENTIAL LATENT KNOWLEDGE SELECTION FOR KNOWLEDGE-GROUNDED DIALOGUE
Byeongchang Kim Jaewoo Ahn Gunhee Kim Department of Computer Science and Engineering Seoul National University, Seoul, Korea {byeongchang.kim,jaewoo.ahn}@vision.snu.ac.kr gunhee@snu.ac.kr http://vision.snu.ac.kr/projects/skt
# ABSTRACT
Knowledge-grounded dialogue is a task of generating an informative response based on both discourse context and external knowledge. As we focus on better modeling the knowledge selection in the multi-turn knowledge-grounded dialogue, we propose a sequential latent variable model as the first approach to this matter. The model named sequential knowledge transformer (SKT) can keep track of the prior and posterior distribution over knowledge; as a result, it can not only reduce the ambiguity caused from the diversity in knowledge selection of conversation but also better leverage the response information for proper choice of knowledge. Our experimental results show that the proposed model improves the knowledge selection accuracy and subsequently the performance of utterance generation. We achieve the new state-of-the-art performance on Wizard of Wikipedia (Dinan et al., 2019) as one of the most large-scale and challenging benchmarks. We further validate the effectiveness of our model over existing conversation methods in another knowledge-based dialogue Holl-E dataset (Moghe et al., 2018).
# 1 INTRODUCTION
Knowledge-grounded dialogue is a task of generating an informative response based on both discourse context and selected external knowledge (Ghazvininejad et al., 2018). For example, it is more descriptive and engaging to respond “I’ve always been more of a fan of the American football team from Pittsburgh, the Steelers!” than “Nice, I like football too.” (Dinan & Weston, 2019). As it has been one of the key milestone tasks in conversational research (Zhang et al., 2018), a majority of previous works have studied how to effectively combine given knowledge and dialogue context to generate an utterance (Zhang et al., 2018; Li et al., 2019b; Parthasarathi & Pineau, 2018; Madotto et al., 2018; Gopalakrishnan et al., 2019). Recently, Dinan et al. (2019) proposed to tackle the knowledge-grounded dialogue by decomposing it into two sub-problems: first selecting knowledge from a large pool of candidates and generating a response based on the selected knowledge and context.
In this work, we investigate the issue of knowledge selection in the multi-turn knowledge-grounded dialogue, since practically the selection of pertinent topics is critical to better engage humans in conversation, and technically the utterance generation becomes easier with a more powerful and consistent knowledge selector in the system. Especially, we focus on developing a sequential latent variable model for knowledge selection, which has not been discussed in previous research. We believe it brings several advantages for more engaging and accurate knowledge-based chit-chat. First, it can correctly deal with the diversity in knowledge selection of conversation. Since one can choose any knowledge to carry on the conversation, there can be one-to-many relations between dialogue context and knowledge selection. Such multimodality by nature makes the training of a dialogue system much more difficult in a data-driven way. However, if we can sequentially model the history of knowledge selection in previous turns, we can reduce the scope of probable knowledge candidates at current turn. Second, the sequential latent model can better leverage the response information, which makes knowledge selection even more accurate. It is naturally easy to select the knowledge in the pool once the response is known, because the response is generated based on the selected knowledge. Our sequential model can keep track of prior and posterior distribution over knowledge, which are sequentially updated considering the responses in previous turns, and thus we can better predict the knowledge by sampling from the posterior. Third, the latent model works even when the knowledge selection labels for previous dialogue are not available, which is common in practice. For example, if multiple people have discussion about given documents, knowledge selection of previous turns is done by others. The latent model can infer which knowledge others are likely to select and use.
 Figure 1: An example of wizard’s tasks in knowledge-grounded conversation of Wizard of Wikipedia (Dinan et al., 2019).
Table 1: Accuracy of knowledge selection with and without knowing the response. We test with GRU (Cho et al., 2014), Transformer (Vaswani et al., 2017) and BERT (Devlin et al., 2019) as the sentence encoder. For human evaluation, we randomly sample 20 dialogues and ask human annotators to select the most likely knowledge sentence from the pool.
<table><tr><td>Methods</td><td>w/o response</td><td>w/ response</td></tr><tr><td>GRU</td><td>20.0</td><td>66.0</td></tr><tr><td>Transformer BERT</td><td>22.5</td><td>70.4</td></tr><tr><td></td><td>23.4</td><td>78.2</td></tr><tr><td>Transformer+ GT history BERT+GT history</td><td>25.4</td><td>70.4</td></tr><tr><td>Random</td><td>27.3</td><td>79.2</td></tr><tr><td></td><td>2.7</td><td>2.7</td></tr><tr><td>Human</td><td>17.1</td><td>83.7</td></tr></table>
Finally, the contributions of this work are as follows.
1. We propose a novel model named sequential knowledge transformer (SKT). To the best of our knowledge, our model is the first attempt to leverage a sequential latent variable model for knowledge selection, which subsequently improves knowledge-grounded chit-chat. 2. Our experimental results show that the proposed model improves not only the knowledge selection accuracy but also the performance of utterance generation. As a result, we achieve the new state-of-the-art performance on Wizard of Wikipedia (Dinan et al., 2019) and a knowledge-annotated version of Holl-E (Moghe et al., 2018) dataset.
# 2 PROBLEM STATEMENT AND MOTIVATION
As a main testbed of our research, we choose the Wizard of Wikipedia (WoW) benchmark (Dinan et al., 2019), since it is one of the most large-scale and challenging datasets for open-domain multi-turn knowledge-based dialogue. Moreover, the dataset can evaluate the algorithm’s ability for solving the two subproblems of knowledge selection and response generation. That is, it provides ground-truth labels of knowledge selection and clear grounding between the pairs of selected knowledge and response. In our experiments, we also evaluate on Holl-E (Moghe et al., 2018) as another dataset for knowledge-grounded dialogue, after collecting clearer labels of knowledge sentences.
The Flow of Conversation. The WoW (Dinan et al., 2019) deals with a chit-chat dialogue task where two speakers discuss in depth about a given topic. One speaker (coined as Wizard) is to be both engaging and knowledgeable on the topic with access to an information retrieval (IR) system over Wikipedia to supplement its knowledge. The other speaker (Apprentice) is curious and eager to learn about the topic. With an example in Figure 1, the conversation flow takes place as follows.
1. One topic is chosen among 1,431 topics and shared between the two speakers. 2. Given an apprentice’s utterance and a wizard’s previous utterance, the IR system retrieves relevant knowledge, which includes the first paragraph of top 7 articles each for wizard and apprentice and the first 10 sentences of the original Wikipedia page of the topic (e.g. the lifeguard wikipage). The knowledge pool contains 67.57 sentences on average. Then.
the wizard must choose a single relevant sentence from them (knowledge selection) and construct an utterance (response generation).
3. The conversation repeats until a minimum number of turns (5 each) reaches.
The Motivation of Sequential Latent Models. The goal of the task is to model the wizard that solves the two subproblems of knowledge selection and response generation (Dinan et al., 2019). In the knowledge selection step, a single relevant knowledge sentence is chosen from a pool of candidates, and in the response generation step, a final utterance is generated with the chosen knowledge and dialogue context. This pipeline is originally proposed to tackle open-domain TextQA (Chen et al., 2017); for example, Min et al. (2018) show its effectiveness for single-document TextQA, to which the key is to locate the sentences that contain the information about the answer to a question.
For knowledge-grounded dialogue, however, there can be one-to-many relations between the dialogue context and the knowledge to be selected unlike TextQA. Except a direct question about context, one can choose any diverse knowledge to carry on the conversation. Therefore, the knowledge selection in dialogue is diverse (i.e. multimodal) by nature, which should be correctly considered in the model. It is our main motivation to propose a sequential latent variable model for knowledge selection, which has not been studied yet. The latent variable not only models such diversity of knowledge but also sequentially track the topic flow of knowledge in the multi-turn dialogue.
Another practical advantage of the sequential latent model lies in that it is easy to find which knowledge is chosen once the response is known, since the response is written based on the selected knowledge. Table 1 clearly validates this relation between knowledge and response. In the WoW dataset, knowing a response boosts the accuracy of knowledge sentence selection for both human and different models. These results hint that knowledge selection may need to be jointly modeled with response generation in a sequence of multi-turn chit-chats, which can be done by the sequential latent models.
# 3 APPROACH
We propose a novel model for knowledge-grounded conversation named sequential knowledge transformer (SKT), whose graphical model is illustrated in Figure 2. It is a sequential latent model that sequentially conditions on previously selected knowledge to generate a response.
We will use $1 \leq t \leq T$ to iterate over dialogue turns, $1 \leq m \leq M$ and $1 \leq n \leq N$ to respectively iterate over words in the utterance of apprentice and wizard, and $1 \le l \le L$ to denote knowledge sentences in the pool. Thus, $T$ is the dialogue length, $M$ and $N$ are the length of each utterance of apprentice and wizard, and $L$ is the size of the knowledge pool.
The input to our model at turn $t$ is previous turns of conversation, which consists of utterances from apprentice $\mathbf { x } ^ { 1 } , . . . , \mathbf { x } ^ { t }$ , utterances from wizard $\mathbf { y } ^ { 1 } , . . . , \mathbf { y } ^ { t - 1 }$ and the knowledge pool $\mathbf { k } ^ { 1 } , . . . , \mathbf { k } ^ { t }$ , where $\mathbf { \hat { k } } ^ { t } = \{ \mathbf { k } ^ { t , l } \} = \mathbf { k } ^ { t , 1 } , . . . , \mathbf { k } ^ { t , L }$ . The output of the model is selected knowledge $\mathbf { k } _ { s } ^ { t }$ and the wizard’s response $\mathbf { y } ^ { t }$ . Below, we discuss sentence embedding, knowledge selection and utterance decoding in our approach. Note that our technical novelty lies in the knowledge selection model, while exploiting existing techniques for text encoding and utterance decoding.
Sentence Encoding. We represent an apprentice utterance $\mathbf { x } ^ { t }$ to an embedding $\mathbf { h } _ { x } ^ { t }$ using BERT (Devlin et al., 2019) and average pooling over time steps (Cer et al., 2018):
$$\mathbf { H } _ { x } ^ { t } = \mathrm { B E R T } _ { b a s e } ( [ x _ { 1 } ^ { t } ; \ldots ; x _ { M } ^ { t } ] ) \in \mathbb { R } ^ { M \times 7 6 8 } , \mathbf { h } _ { x } ^ { t } = \mathrm { a v g p o o l } ( \mathbf { H } _ { x } ^ { t } ) \in \mathbb { R } ^ { 7 6 8 } .$$
e of Wizard . Each appre $\mathbf { y } ^ { t - 1 }$ is embedded as -wizard utterance $\mathbf { h } _ { y } ^ { t - 1 }$ e sentences ar at dialog turn asis $\{ \mathbf { h } _ { k } ^ { t , l } \} = \mathbf { h } _ { k } ^ { t , 1 } , . . . , \mathbf { h } _ { k } ^ { t , L }$ $\mathbf { h } _ { x y } ^ { t } = [ \mathbf { h } _ { x } ^ { t } ; \mathbf { h } _ { y } ^ { t } ]$ $t$ jointly represented through a GRU (Cho et al., 2014) layer: $\mathbf { d } _ { x y } ^ { t } = \mathrm { \bar { G } R U } _ { d i a l o g } ( \mathbf { \bar { d } } _ { x y } ^ { t - 1 } , \mathbf { h } _ { x y } ^ { t } ) \in \mathbb { R } ^ { 7 6 8 }$ .
Sequential Knowledge Selection. Compared to previous works, we make two significant modifications. First, we regard the knowledge selection as a sequential decision process instead of a single-step decision process. Second, due to the diversity of knowledge selection in dialogue, we model it as latent variables. As a result, we can carry out the joint inference of multi-turns of knowledge selection and response generation rather than separate inference turn by turn.
 Figure 2: A graphical representation of the proposed sequential knowledge transformer (SKT) model. At the third turn, the goal is to generate wizard’s response $( \mathbf { y } ^ { 3 } )$ given dialogue context $( \mathbf { x } ^ { \leq 3 } , \mathbf { y } ^ { < 3 } )$ . Our model sequentially infer which knowledge is likely to be used $( \mathbf { k } ^ { \leq 3 } )$ , from which the utterance $\mathbf { y } ^ { 3 }$ is generated.
There have been much research on sequential latent variable models (Chung et al., 2015; Fraccaro et al., 2016; Goyal et al., 2017; Aneja et al., 2019; Shankar & Sarawagi, 2019). For example, Shankar & Sarawagi (2019) propose a posterior attention model that represents the attention of seq2seq models as sequential latent variables. Inspired by them, we factorize the response generation with latent knowledge selection and derive the variational lower bound as follows:
$$\begin{array} { r l } & { \log p ( \mathbf { y } | \mathbf { x } ) = \log \prod _ { t } \sum _ { \mathbf { k } ^ { t } } p _ { \theta } ( \mathbf { y } ^ { t } | \mathbf { x } ^ { \le t } , \mathbf { y } ^ { < t } , \mathbf { k } ^ { \le t } ) \pi _ { \theta } ( \mathbf { k } ^ { t } | \mathbf { x } ^ { \le t } , \mathbf { y } ^ { < t } , \mathbf { k } ^ { < t } ) } \\ & { \ge \sum _ { t } \mathbb { E } _ { q _ { \phi } ( \mathbf { k } ^ { t - 1 } ) } \Big [ \mathbb { E } _ { q _ { \phi } ( \mathbf { k } ^ { t } ) } \big [ \log p _ { \theta } ( \mathbf { y } ^ { t } | \mathbf { x } ^ { \le t } , \mathbf { y } ^ { < t } , \mathbf { k } ^ { t } ) \big ] - D _ { K L } ( q _ { \phi } ( \mathbf { k } ^ { t } ) \mid \| \pi _ { \theta } ( \mathbf { k } ^ { t } ) ) \Big ] , } \end{array}$$
where $q _ { \phi } ( \mathbf { k } ^ { t } )$ is shorthand for $q _ { \phi } ( \mathbf { k } ^ { t } | \mathbf { x } ^ { \leq t } , \mathbf { y } ^ { \leq t } , \mathbf { k } ^ { < t } )$ and $\pi _ { \theta } ( \mathbf { k } ^ { t } )$ for $\pi _ { \theta } ( \mathbf { k } ^ { t } | \mathbf { x } ^ { \leq t } , \mathbf { y } ^ { < t } , \mathbf { k } ^ { < t } )$ for brevity. Note that $p _ { \theta } ( \mathbf { y } ^ { t } | \cdot \bigr )$ is a decoder network, $\pi _ { \theta } ( \mathbf { k } ^ { t } )$ is a categorical conditional distribution of knowledge given dialogue context and previously selected knowledge, and $q _ { \phi } ( \mathbf { k } ^ { t } )$ is an inference network to approximate posterior distribution $p _ { \theta } ( \mathbf { k } ^ { t } | \mathbf { x } ^ { \leq t } , \mathbf { y } ^ { \leq t } , \mathbf { k } ^ { < t } )$ .
The conditional probability of generating wizard’s response $\mathbf { y } ^ { t }$ given dialogue context $\mathbf { x } ^ { \leq t }$ and $\mathbf { y } ^ { < t }$ can be re-written from Eq. (2) as follows:
$$p ( { \mathbf { y } ^ { t } } | { \mathbf { x } ^ { \le t } } , { \mathbf { y } ^ { < t } } ) \approx \prod _ { i = 1 } ^ { t - 1 } \sum _ { \mathbf { k } ^ { i } } q _ { \phi } ( \mathbf { k } ^ { i } ) \Big ( \sum _ { \mathbf { k } ^ { t } } p _ { \theta } ( { \mathbf { y } ^ { t } } | { \mathbf { x } ^ { \le t } } , { \mathbf { y } ^ { < t } } , \mathbf { k } ^ { t } ) \pi _ { \theta } ( \mathbf { k } ^ { t } ) \Big ) .$$
The detailed derivation can be found in Appendix. Eq.(4) means that we first infer from the knowledge posterior which knowledge would be used up to previous turn $t - 1$ , estimate the knowledge for current turn $t$ from prior knowledge distribution and generate an utterance from the inferred knowledge. Figure 2 shows an example of this generation process at $t = 3$ . We parameterize the decoder network $p _ { \theta }$ , the prior distribution of knowledge $\pi _ { \theta }$ , and the approximate posterior $q _ { \phi }$ with deep neural networks as will be discussed.
From the posterior distribution $q _ { \phi } ( { \bf k } ^ { t - 1 } )$ we draw a sample $\mathbf { k } _ { s } ^ { t - 1 }$ , and then update $\pi _ { \theta }$ and $q _ { \phi }$ with the sentence embedding of sampled knowledge (ht−1,sk ) and the embeddings of previous and current utterances $( \mathbf { d } _ { x y } ^ { t - 1 } , \mathbf { d } _ { x y } ^ { t } , \mathbf { h } _ { x } ^ { t } )$ . We use an attention mechanism over current knowledge pool $\{ \mathbf h _ { k } ^ { t , l } \}$ to compute knowledge distribution given the dialogue context. This process is modeled as
$$\begin{array} { r l } & { \pi _ { \boldsymbol { \theta } } ( { \bf k } ^ { t } | { \bf x } ^ { \leq t } , { \bf y } ^ { < t } , { \bf k } _ { s } ^ { \leq t - 1 } ) = \mathrm { s o f t m a x } ( \mathbf { q } _ { p r i o r } ^ { t } [ { \bf h } _ { k } ^ { t , 1 } , . . . , { \bf h } _ { k } ^ { t , L } ] ^ { \top } ) \in \mathbb { R } ^ { L } } \\ & { q _ { \boldsymbol { \phi } } ( { \bf k } ^ { t } | { \bf x } ^ { \leq t } , { \bf y } ^ { \leq t } , { \bf k } _ { s } ^ { \leq t - 1 } ) = \mathrm { s o f t m a x } ( \mathbf { q } _ { p o s t } ^ { t } [ { \bf h } _ { k } ^ { t , 1 } , . . . , { \bf h } _ { k } ^ { t , L } ] ^ { \top } ) \in \mathbb { R } ^ { L } , } \end{array}$$
where
$$\begin{array} { r l } & { \mathbf { q } _ { p r i o r } ^ { t } = \mathbf { W } _ { p r i o r } \big ( [ \mathbf { d } _ { x y } ^ { t - 1 } ; \mathbf { h } _ { x } ^ { t } ; \mathrm { G R U } _ { h i s t } ( \mathbf { d } _ { k } ^ { t - 2 } , \mathbf { h } _ { k } ^ { t - 1 , s } ) ] \big ) , } \\ & { \mathbf { q } _ { p o s t } ^ { t } = \mathbf { W } _ { p o s t } \big ( [ \mathbf { d } _ { x y } ^ { t } ; \mathrm { G R U } _ { h i s t } ( \mathbf { d } _ { k } ^ { t - 2 } , \mathbf { h } _ { k } ^ { t - 1 , s } ) ] \big ) , } \end{array}$$
$\mathbf { d } _ { k } ^ { t }$ is the hidden state of $\mathrm { G R U } _ { h i s t }$ and we initialize $\mathbf { d } _ { x y } ^ { 0 } = \mathbf { d } _ { k } ^ { 0 } = \mathbf { 0 } \in \mathbb { R } ^ { 7 6 8 }$ , and $\mathbf { W } _ { p r i o r } , \mathbf { W } _ { p o s t } \in$ $\mathbb { R } ^ { 7 6 8 \times ( 7 6 8 \ast 2 ) }$ are the parameters. We here use the GRU (Li et al., 2017; Aneja et al., 2019) to sequentially condition previously selected knowledge to $\pi _ { \theta }$ and $q _ { \phi }$ .
Finally, we sample knowledge $\mathbf { k } _ { s } ^ { t }$ over attention distribution in Eq. (6) and pass it to the decoder. At test time, we select the knowledge with the highest probability over distribution in Eq. (5).
Decoding with Copy Mechanism. We generate the wizard’s response at turn $t$ , given current context $\mathbf { x } ^ { t }$ and selected knowledge sentence $\mathbf { k } _ { s } ^ { t }$ . We feed their concatenated embedding $\mathbf { H } _ { x k _ { s } } ^ { t } = [ \mathbf { H } _ { x } ^ { t } ; \mathbf { H } _ { k _ { s } } ^ { t } ]$ to the decoder $p _ { \theta }$ . To maximize the effect of selected knowledge for response generation, we choose the Copy mechanism (Xia et al., 2017; Li et al., 2019b) with Transformer decoder (Vaswani et al., 2017). We obtain the output word probability (Zhao et al., 2019a):
$$\begin{array} { r l } & { \mathbf { h } _ { n } ^ { t } = \mathrm { D e c o d e r } ( \mathbf { H } _ { x k _ { s } } ^ { t } , \mathbf { y } _ { < n } ^ { t } ) , \quad \mathbf { q } _ { n } ^ { t } , \mathbf { K } ^ { t } , \mathbf { V } ^ { t } = \mathbf { h } _ { n } ^ { t } \mathbf { W } _ { q } ^ { \top } , \mathbf { H } _ { x k _ { s } } ^ { t } \mathbf { W } _ { k } ^ { \top } , \mathbf { H } _ { x k _ { s } } ^ { t } \mathbf { W } _ { v } ^ { \top } , } \\ & { p _ { t , n } ^ { g e n } ( w ) = \mathrm { s o f t m a x } ( \mathbf { W } _ { o u t } \mathbf { h } _ { n } ^ { t } ) , \quad p _ { t , n } ^ { c o p y } ( w ) = \mathrm { s o f t m a x } ( \mathbf { q } _ { n } ^ { t } \mathbf { K } ^ { t } ) , } \\ & { p _ { t , n } ( w ) = ( 1 - \alpha _ { t , n } ^ { c o p y } ) * p _ { t , n } ^ { g e n } ( w ) + \alpha _ { t , n } ^ { c o p y } * p _ { t , n } ^ { c o p y } ( w ) , } \end{array}$$
where αcopyt,n $\alpha _ { t , n } ^ { c o p y } = \sigma ( \mathbf { W } _ { c o p y } ^ { \top } \sum p _ { t , n } ^ { c o p y } ( w ) \cdot \mathbf { V } ^ { t } )$ and $\sigma$ is a sigmoid. Finally, we select the word with the highest probability $y _ { n + 1 } ^ { t } = \arg \operatorname* { m a x } _ { w \in \mathcal { V } } p _ { t , n } ( w )$ where $\nu$ is the dictionary. Unless the word $y _ { n + 1 } ^ { t }$ is an EOS token, we repeat generating the next word by feeding $y _ { n + 1 } ^ { t }$ to the decoder.
# 3.1 TRAINING
Obviously, there is a large gap in knowledge selection accuracy between training with or without true labels (e.g. 23.2 of E2E Transformer MemNet with labels vs 4.8 of PostKS without labels in Table 2). As one way to take advantage of true labels for training of latent models, prior research has employed auxiliary losses over latent variables (Wen et al., 2017; Zhao et al., 2017). Similarly, we use the knowledge loss from Dinan et al. (2019) (i.e. the cross-entropy loss between predicted and true knowledge sentences) as an auxiliary loss for the latent variable. Thus, the training objective is a combination of the variational lower-bound from Eq. (3) and the auxiliary knowledge loss as
$$\begin{array} { r l r } { { \mathcal { L } = - \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } _ { q _ { \phi } ( \mathbf { k } ^ { t - 1 } ) } \Big [ \mathbb { E } _ { q _ { \phi } ( \mathbf { k } ^ { t } ) } \big [ \log p _ { \theta } ( \mathbf { y } ^ { t } \vert \mathbf { x } ^ { \leq t } , \mathbf { y } ^ { < t } , \mathbf { k } _ { s } ^ { t } ) \big ] } \ } \\ & { } & { \qquad - D _ { K L } \big ( q _ { \phi } ( \mathbf { k } ^ { t } ) \ \parallel \ \pi _ { \theta } ( \mathbf { k } ^ { t } ) \big ) + \lambda \underbrace { \log q _ { \phi } ( \mathbf { k } _ { a } ^ { t } ) } _ { \mathrm { K n o w l e d g e l o s s } } \Big ] , } \end{array}$$
where $\mathbf { k } _ { s } ^ { t }$ is a sampled knowledge from $q _ { \phi } ( \mathbf { k } ^ { t } | \mathbf { x } ^ { \leq t } , \mathbf { y } ^ { \leq t } , \mathbf { k } ^ { < t } )$ , $\mathbf { k } _ { a } ^ { t }$ is a true knowledge, and $\lambda$ is a hyperparameter. Note that knowledge is sequentially sampled from attention distribution as in Eq. (6). We train our model by mini-batch gradient descent. We approximate the expectation by drawing one sample from the posterior with Gumbel-Softmax function (Jang et al., 2017; Maddison et al., 2017b). Further details of optimization can be found in Appendix.
# 4 EXPERIMENTS
We evaluate our model mainly on the Wizard of Wikipedia (Dinan et al., 2019) and additionally Holl-E (Moghe et al., 2018) as another knowledge-grounded chit-chat dataset. We quantitatively and qualitatively compare our approach with other state-of-the-art models.
# 4.1 DATASETS
Wizard of Wikipedia. It contains 18,430 dialogues for training, 1,948 dialogues for validation and 1,933 dialogues for test. The test set is split into two subsets, Test Seen and Test Unseen. Test Seen contains 965 dialogues on the topics overlapped with the training set, while Test Unseen contains 968 dialogues on the topics never seen before in training and validation set.
Holl-E. It contains 7,228 dialogues for training, 930 dialogues for validation and 913 dialogues for test. A single document is given per dialogue; the documents include about 58 and 63 sentences on average for training/validation and test set, respectively. The dataset provides spans in the document as additional information to provide which parts of the document is used to generate a response. However, the span labels are rather inconsistent; for example, they are often shorter than a single sentence or contain multiple consecutive sentences. Thus, we collect a new set of ground-truth (GT)
Table 2: Quantitative results on the Wizard of Wikipedia dataset (Dinan et al., 2019). The method with $[ { ^ * } ]$ does not use the knowledge loss. The scores of E2E Transformer MemNet† and Transformer (no knowledge)† are from the original paper. The variant (BERT vocab)‡ is re-runned using the authors’ code, since the vocabulary is different from original paper due to the use of BERT.
<table><tr><td rowspan="2">Method</td><td colspan="4">Test Seen</td><td colspan="4">Test Unseen</td></tr><tr><td>PPL</td><td>R-1</td><td>R-2</td><td>Acc</td><td>PPL</td><td>R-1</td><td>R-2</td><td>Acc</td></tr><tr><td>Random knowledge selection</td><td>1</td><td>8.4</td><td>1.4</td><td>2.7</td><td>-</td><td>8.0</td><td>1.2</td><td>2.3</td></tr><tr><td>Repeat last utterance</td><td>1</td><td>14.5</td><td>3.1</td><td>1</td><td>1</td><td>14.1</td><td>2.9</td><td>-</td></tr><tr><td>Transformer (no knowledge)† (Dinan et al., 2019)</td><td>41.8</td><td>17.8</td><td>-</td><td>-</td><td>87.0</td><td>14.0</td><td>1</td><td>1</td></tr><tr><td>E2E Transformer MemNet† (Dinan et al., 2019)</td><td>63.5</td><td>16.9</td><td>1</td><td>22.5</td><td>97.3</td><td>14.4</td><td>-</td><td>12.2</td></tr><tr><td>E2E Transformer MemNet (BERT vocab)‡</td><td>53.2</td><td>17.7</td><td>4.8</td><td>23.2</td><td>137.8</td><td>13.6</td><td>1.9</td><td>10.5</td></tr><tr><td>PostKS* (Lian et al., 2019)</td><td>79.1</td><td>13.0</td><td>1.0</td><td>4.8</td><td>193.8</td><td>13.1</td><td>1.0</td><td>4.2</td></tr><tr><td>E2E BERT</td><td>53.5</td><td>16.8</td><td>4.5</td><td>23.7</td><td>105.7</td><td>13.5</td><td>2.2</td><td>13.6</td></tr><tr><td>PostKS + Knowledge Loss</td><td>54.5</td><td>18.1</td><td>5.3</td><td>23.4</td><td>144.8</td><td>13.5</td><td>2.0</td><td>9.4</td></tr><tr><td>E2E BERT +PostKS</td><td>54.6</td><td>17.8</td><td>5.3</td><td>25.5</td><td>113.2</td><td>13.4</td><td>2.3</td><td>14.1</td></tr><tr><td>E2E BERT + PostKS +Copy</td><td>52.2</td><td>19.0</td><td>6.5</td><td>25.5</td><td>83.4</td><td>15.6</td><td>3.9</td><td>14.4</td></tr><tr><td>Ours</td><td>52.0</td><td>19.3</td><td>6.8</td><td>26.8</td><td>81.4</td><td>16.1</td><td>4.2</td><td>18.3</td></tr></table>
Table 3: Quantitative results on the Holl-E dataset (Moghe et al., 2018) with single reference and multiple references test set.
<table><tr><td rowspan="2">Method</td><td colspan="4">Single Reference</td><td colspan="4">Multiple References</td></tr><tr><td>PPL</td><td>R-1</td><td>R-2</td><td>Acc</td><td>PPL</td><td>R-1</td><td>R-2</td><td>Acc</td></tr><tr><td>Random knowledge selection</td><td>-</td><td>7.4</td><td>1.8</td><td>1.9</td><td>1</td><td>10.3</td><td>3.6</td><td>3.5</td></tr><tr><td>Repeat last utterance</td><td>-</td><td>11.4</td><td>1.5</td><td>-</td><td>-</td><td>13.6</td><td>2.0</td><td>-</td></tr><tr><td>E2E Transformer MemNet (Dinan et al.,2019)</td><td>140.6</td><td>20.1</td><td>10.3</td><td>22.7</td><td>83.6</td><td>24.3</td><td>12.8</td><td>32.3</td></tr><tr><td>PostKS* (Lian et al., 2019)</td><td>196.6</td><td>15.2</td><td>6.0</td><td>1.5</td><td>114.1</td><td>19.2</td><td>7.9</td><td>3.2</td></tr><tr><td>E2E BERT</td><td>112.6</td><td>25.9</td><td>18.3</td><td>28.2</td><td>66.9</td><td>31.1</td><td>22.7</td><td>37.5</td></tr><tr><td>PostKS + Knowledge Loss</td><td>135.1</td><td>19.9</td><td>10.7</td><td>22.5</td><td>81.9</td><td>23.8</td><td>12.9</td><td>32.2</td></tr><tr><td>E2E BERT +PostKS</td><td>119.9</td><td>27.8</td><td>20.1</td><td>27.6</td><td>66.7</td><td>33.7</td><td>25.8</td><td>37.3</td></tr><tr><td>E2E BERT+ PostKS +Copy</td><td>47.4</td><td>29.2</td><td>22.3</td><td>27.8</td><td>27.9</td><td>35.9</td><td>29.0</td><td>37.8</td></tr><tr><td>Ours</td><td>48.9</td><td>29.8</td><td>23.1</td><td>29.2</td><td>28.5</td><td>36.5</td><td>29.7</td><td>39.2</td></tr></table>
knowledge per document so that it is similar to that of WoW where all of the GT knowledge are in the form of sentences. Basically, we select the sentence that includes the span as the GT knowledge sentence. If the span is given over multiple sentences, we select the minimum number of consecutive sentences containing the span as GT. If no span is given, we use the no passages used tag as GT, which amounts to $5 \%$ of all GT labels. It indicates that the gold utterance is generated with no knowledge grounding and the model should predict the label of no passages used for this sample to be correct. We make our new set of GT annotations available in the project page.
# 4.2 EXPERIMENTAL SETTING
Evaluation Metrics. We follow the evaluation protocol of WoW (Dinan et al., 2019). We measure unigram F1 (R-1), bigram F1 (R-2) and perplexity (PPL) for response generation, and the accuracy for knowledge selection. For $n$ -gram metrics, we remove all the punctuations and (a, an, the) before computing the score. We remind that lower perplexity and higher $n$ -gram (R-1, R-2) scores indicate better performance.
The test set for Holl-E is split into two subsets, single reference and multiple references. The dataset basically provides a single response per context (denoted as single reference). However, for some conversations, more responses (e.g. 2–13) are collected from multiple annotators per context (multiple references). For evaluation of multiple references, we take the best score over multiple GTs by following Moghe et al. (2018). For knowledge accuracy, we regard the model’s prediction is correct if it matches at least one of the correct answers.
Baselines. We closely compare with two state-of-the-art knowledge-grounded dialogue models. The first one is E2E Transformer MemNet (Dinan et al., 2019), which uses a Transformer memory network for knowledge selection and a Transformer decoder for utterance prediction. The second one is PostKS (Lian et al., 2019), which uses the posterior knowledge distribution as a pseudo-label for knowledge selection. For fair comparison, we replace all GRU layers in PostKS with Transformers. We also compare with four variants of these models as an ablation study: (i) E2E BERT, where we replace the Transformer memory network with pre-trained BERT, (ii) PostKS $^ +$ Knowledge loss, where we additionally use the knowledge loss, (iii) E2E BERT $^ +$ PostKS, which combines all the components of baselines, and (iv) E2E BERT $+ \mathrm { P o s t K S + C o p y }$ , where we additionally use the copy mechanism with the Transformer decoder.
We use official BERT tokenizer to tokenize the words and use pre-defined BERT vocabulary $( \nu =$ 30522) to convert token to index1. All the baselines use the exactly same inputs with our model except PostKS, which does not make use of knowledge labels as proposed in the original paper.
# 4.3 QUANTITATIVE RESULTS
Table 2 compares the performance of different methods on the Wizard of Wikipedia dataset. Our model outperforms the state-of-the-art knowledge-grounded dialogue models in all metrics for knowledge selection (accuracy) and utterance generation (unigram F1, bigram F1). The PostKS that is trained with no knowledge label shows low accuracy on knowledge selection, which is slightly better than random guess. However, it attains better performance than E2E Transformer MemNet with the knowledge loss in the WoW Test Seen, which shows that leveraging prior and posterior knowledge distribution is effective for knowledge-grounded dialogue, although using sequential latent variable improves further. BERT improves knowledge selection accuracy, but not much as in TextQA because of diversity in knowledge selection of conversation. The E2E BERT $^ +$ PostKS + Copy performs the best among baselines, but not as good as ours, which validates that sequential latent modeling is critical for improving the accuracy of knowledge selection and subsequently utterance generation. Additionally, the performance gaps between ours and baselines are larger in Test Unseen. It can be understood that the sequential latent variable can generalize better. Adding the copy mechanism to the baseline substantially improves the accuracy of utterance generation, but barely improves the knowledge selection, which also justifies the effectiveness of the sequential latent variable. Transformer (no knowledge) shows the lowest perplexity in the WoW Test Seen, and it is mainly due to that it may generate only general and simple utterances since no knowledge is grounded. This behavior can be advantageous for the perplexity, while the other knowledge-based models take a risk of predicting wrong knowledge, which is unfavorable for perplexity.
Table 3 compares the performance of our model on Holl-E dataset. Similarly, our model outperforms all the baselines in all metrics. One notable trend is that BERT considerably reduces the perplexity in all models, which may be due to that the dataset size of Holl-E is much smaller than WoW and BERT prevents overfitting (Hao et al., 2019).
# 4.4 QUALITATIVE RESULTS
Single-Turn Human Evaluation. We perform a user study to complement the limitation of automatic language metrics. We evaluate several aspects of utterance generation using the similar setting in Guu et al. (2018). We randomly sample 100 test examples, and each sample is evaluated by three unique human annotators on Amazon Mechanical Turk (AMT). At test, we show dialogue context and generated utterance by our method or baselines. We ask turkers to rate the quality of each utterance in two aspects, which are referred to Li et al. (2019a): (i) Engagingness: how much do you like the response? and (ii) Knowledgeability: how much is the response informative? Each item is scored from 1 to 4 to avoid catch-all category in the answer (Dalal et al., 2014), where 1 means not at all, 2 is a little, 3 is somewhat, and 4 is a lot. To mitigate annotator bias and inter-annotator variability, we adjust human scoring with Bayesian calibration (Kulikov et al., 2019). Note that human evaluation on knowledge selection is not possible, since any knowledge could be fine for a given context, which is key motivation for our sequential latent model – diversity of knowledge selection.
Table 4 summarizes the results of the single-turn human evaluation, which validates that annotators prefer our results to those of baselines. Again, the performance gaps between ours and baselines are larger in Test Unseen, thank to better generality of our sequential latent model.
Table 4: Single-turn human evaluation results on the Wizard of Wikipedia. We report the mean ratings and their standard errors of different methods for engagingness and knowledgeability scores. TMN stands for E2E Transformer MemNet (Dinan et al., 2019).
<table><tr><td rowspan="3">Method</td><td colspan="4">Test Seen</td><td colspan="4">Test Unseen</td></tr><tr><td colspan="2">Raw</td><td colspan="2">Calibrated</td><td colspan="2">Raw</td><td colspan="2">Calibrated</td></tr><tr><td>Engage</td><td>Knowledge</td><td>Engage</td><td>Knowledge</td><td>Engage</td><td>Knowledge</td><td>Engage</td><td>Knowledge</td></tr><tr><td>PostKS</td><td>1.65 (0.05)</td><td>1.72 (0.06)</td><td>1.51 (0.02)</td><td>1.72 (0.01)</td><td>1.66 (0.06)</td><td>1.74 (0.06)</td><td>1.38 (0.02)</td><td>1.60 (0.02)</td></tr><tr><td>TMN</td><td>2.57 (0.05)</td><td>2.47 (0.06)</td><td>2.41 (0.02)</td><td>2.49 (0.01)</td><td>2.39 (0.06)</td><td>2.21 (0.06)</td><td>2.12 (0.02)</td><td>2.05 (0.02)</td></tr><tr><td>Ours</td><td>2.59 (0.05)</td><td>2.53 (0.06)</td><td>2.45 (0.02)</td><td>2.55 (0.01)</td><td>2.52 (0.06)</td><td>2.35 (0.06)</td><td>2.26 (0.02)</td><td>2.21 (0.02)</td></tr><tr><td>Human</td><td>3.14 (0.05)</td><td>3.09 (0.05)</td><td>3.00 (0.02)</td><td>3.12 (0.01)</td><td>3.11 (0.05)</td><td>2.99 (0.05)</td><td>2.83 (0.01)</td><td>2.85 (0.02)</td></tr></table>
Table 5: Multi-turn human evaluation results on the Wizard of Wikipedia. We report the averages and standard deviations (in parentheses).
<table><tr><td>Method</td><td>Test Seen</td><td>Test Unseen</td></tr><tr><td>E2E Transformer MemNet (Dinan et al., 2019)</td><td>2.36 (1.38)</td><td>2.10 (0.96)</td></tr><tr><td>Ours</td><td>2.39 (0.99)</td><td>2.38 (1.01)</td></tr><tr><td>Human (Dinan et al., 2019)</td><td>4.13 (1.08)</td><td>4.34 (0.98)</td></tr></table>
Multi-turn Human Evaluation. We add another human evaluation results in a multi-turn setting using the evaluation toolkit from Wizard of Wikipedia (Dinan et al., 2019). Humans are paired with one of the models and chat about a specific topic (given a choice of 2–3 topics) for 3–5 dialogue turns. After conversation, they score their dialogue partners on a scale of $_ { 1 - 5 }$ , with the rating indicating how much they liked the conversation. We collect the votes for 110 randomly sampled conversations from 11 different turkers.
Table 5 compares the results of different methods for the multi-turn evaluation. Human annotators prefer our results to those of baselines with a larger gap in Test Unseen.
Dialogue Examples. Figure 3 shows selected examples of utterance prediction. In each set, we show dialogue context, human response, and utterances generated by our method and baselines. Thanks to the use of latent variables, our model can better capture the changes in dialogue topics and thus generate more appropriate responses.
# 5 RELATED WORK
Knowledge-based conversations have been studied much including collecting new datasets (Qin et al., 2019; Zhang et al., 2018; Ghazvininejad et al., 2018; Zhou et al., 2018; Dinan et al., 2019; Moghe et al., 2018) or developing new models (Lian et al., 2019; Li et al., 2019b; Yavuz et al., 2019; Zhao et al., 2019b; Dinan et al., 2019; Liu et al., 2019). Most works on the models have less investigated the knowledge selection issue but instead focused on how to effectively combine given knowledge and dialogue context to improve response informativeness. For example, Ghazvininejad et al. (2018) aid a Seq2Seq model with an external knowledge memory network, and Li et al. (2019b) propose an Incremental Transformer to encode multi-turn utterances along with knowledge in related documents. Recently, Dinan et al. (2019) propose both a dataset of Wizard of Wikipedia and a model to leverage the two-step procedure of selecting knowledge from the pool and generating a response based on chosen knowledge and given context.
One of the most related models to ours may be Lian et al. (2019), who also focus on the knowledge selection issue in the two-stage knowledge-grounded dialogue. However, our work is novel in that we model it as a sequential decision process with latent variables and introduce the knowledge loss. Thanks to these updates, our model achieves significantly better performance as shown in the experiments.
Sequential Latent Variable Models. There have been many studies about sequential latent variable models. Chung et al. (2015) propose one of the earliest latent models for sequential data, named VRNN. Later, this architecture is extended to SRNN (Fraccaro et al., 2016) and Z-Forcing (Goyal et al., 2017). There have been some notable applications of sequential latent models, including document summarization (Li et al., 2017), image captioning (Aneja et al., 2019) and text generation (Shao et al., 2019). Another related class of sequential latent models may be latent attention models (Deng et al., 2018; Wang et al., 2018; Yang et al., 2017), which exploit the latent variables to model the attention mapping between input and output sequences. Although our method is partly influenced by such recent models, it is novel to propose a sequential latent model for the knowledgegrounded chit-chat problem.
Figure 3: Examples of generated responses by our model and baselines on Wizard of Wikipedia. TMN stands for E2E Transformer MemNet, and A and W for apprentice and wizard. Examples with selected knowledge sentences can be found at Appendix E.
<table><tr><td>Seen Test (Topic: Italian Cuisine)</td><td>Unseen Test (Topic:Hunting)</td></tr><tr><td>: A:I love chicken parmigiana as well, but I think my ultimate</td><td>: W:That is true but we always have to watch out for excessive</td></tr><tr><td>favorite is beef lasagna...Extra cheese please! W: Chicken with sauce and mozzarella.. Be still my heart! A:Truthfully,anythingwith cheese is the best (Ours)ilove pizza too !it'sa traditional italian dish</td><td>hunting. It has caused some species to be endangered. A:Yes Iagree.Idon't believe in the useless hunting that poachers do. Its so cruel. (Ours) iagree,poaching has been defined as the illegal hunting or</td></tr><tr><td>consisting of yeasted flatbread typically topped with tomato sauce and cheese (TMN) ilove cheese ! (E2E BERT+KL)i like mine topped with vegetables, meats, and condiments . (Human) especially cheddar cheese !it’s the second most</td><td>capturing of wild animals . (TMN)i thinks so,i’m not sure if you 're talking about poaching,but i know that poodles are the second most intelligent breed behind the poodle . (E2EBERT+KL)iagree.i think it’sa great way to catch fish . (Human) agreed,i remember reading one time that unless you</td></tr></table>
# 6 CONCLUSION
This work investigated the issue of knowledge selection in multi-turn knowledge-grounded dialogue, and proposed a sequential latent variable model, for the first time, named sequential knowledge transformer (SKT). Our method achieved the new state-of-the-art performance on the Wizard of Wikipedia benchmark (Dinan et al., 2019) and a knowledge-annotated version of Holl-E dataset (Moghe et al., 2018). There are several promising future directions beyond this work. First, we can explore other inference models such as sequential Monte Carlo methods using filtering variational objectives (Maddison et al., 2017a). Second, we can study the interpretability of knowledge selection such as measuring the uncertainty of attention (Heo et al., 2018).
# ACKNOWLEDGMENTS
We thank Hyunwoo Kim, Chris Dongjoo Kim, Soochan Lee, Junsoo Ha and the anonymous reviewers for their helpful comments. This work was supported by SK T-Brain corporation and Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No.2019-0-01082, SW StarLab). Gunhee Kim is the corresponding author.
# REFERENCES
Jyoti Aneja, Harsh Agrawai, Dhruv Batra, and Alexander Schwing. Sequential Latent Spaces for Modeling the Intention During Diverse Image Captioning. In ICCV, 2019.
Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. Enriching Word Vectors with Subword Information. In TACL, 2016.
Daniel Cer, Yinfei Yang, Sheng-yi Kong, Nan Hua, Nicole Limtiaco, Rhomni St John, Noah Constant, Mario Guajardo-Cespedes, Steve Yuan, Chris Tar, et al. Universal Sentence Encoder. arXiv:1803.11175, 2018.
Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading Wikipedia to Answer OpenDomain Questions. In ACL, 2017.
Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, ¨ Holger Schwenk, and Yoshua Bengio. Learning Phrase Representations Using RNN EncoderDecoder for Statistical Machine Translation. In EMNLP, 2014. Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A Recurrent Latent Variable Model for Sequential Data. In NIPS, 2015. Dev K Dalal, Nathan T Carter, and Christopher J Lake. Middle Response Scale Options are Inappropriate for Ideal Point Scales. J. Bus. Psychol., 29(3):463–478, 2014. Yuntian Deng, Yoon Kim, Justin Chiu, Demi Guo, and Alexander Rush. Latent Alignment and Variational Attention. In NIPS, 2018. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-Training of Deep Bidirectional Transformers for Language Understanding. In NAACL-HLT, 2019. Emily Dinan and Jason Weston. Advances in Conversational AI. https://ai.facebook. com/blog/advances-in-conversational-ai/, 2019. Emily Dinan, Stephen Roller, Kurt Shuster, Angela Fan, Michael Auli, and Jason Weston. Wizard of Wikipedia: Knowledge-Powered Conversational Agents. In ICLR, 2019. Sergey Edunov, Myle Ott, Michael Auli, David Grangier, and Marc’Aurelio Ranzato. Classical Structured Prediction Losses for Sequence to Sequence Learning. In NAACL-HLT, 2017. Marco Fraccaro, Søren Kaae Sønderby, Ulrich Paquet, and Ole Winther. Sequential Neural Models with Stochastic Layers. In NIPS, 2016. Marjan Ghazvininejad, Chris Brockett, Ming-Wei Chang, Bill Dolan, Jianfeng Gao, Wen-tau Yih, and Michel Galley. A Knowledge-Grounded Neural Conversation Model. In AAAI, 2018. Xavier Glorot and Yoshua Bengio. Understanding the Difficulty of Training Deep Feedforward Neural Networks. In AISTATS, 2010. Karthik Gopalakrishnan, Behnam Hedayatnia, Qinlang Chen, Anna Gottardi, Sanjeev Kwatra, Anu Venkatesh, Raefer Gabriel, Dilek Hakkani-Tur, and Amazon Alexa AI. Topical-Chat: Towards ¨ Knowledge-Grounded Open-Domain Conversations. In Interspeech, 2019. Anirudh Goyal Alias Parth Goyal, Alessandro Sordoni, Marc-Alexandre Cotˆ e, Nan Rosemary Ke, ´ and Yoshua Bengio. Z-Forcing: Training Stochastic Recurrent Networks. In NIPS, 2017. Kelvin Guu, Tatsunori B Hashimoto, Yonatan Oren, and Percy Liang. Generating Sentences by Editing Prototypes. TACL, 6:437–450, 2018. Yaru Hao, Li Dong, Furu Wei, and Ke Xu. Visualizing and Understanding the Effectiveness of BERT. In EMNLP, 2019. Jay Heo, Hae Beom Lee, Saehoon Kim, Juho Lee, Kwang Joon Kim, Eunho Yang, and Sung Ju Hwang. Uncertainty-Aware Attention for Reliable Interpretation and Prediction. In NIPS, 2018. Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with Gumbel-Softmax. In ICLR, 2017. Diederik Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. In ICLR, 2015. Ilya Kulikov, Alexander H Miller, Kyunghyun Cho, and Jason Weston. Importance of a Search Strategy in Neural Dialogue Modelling. In INLG, 2019. Margaret Li, Jason Weston, and Stephen Roller. ACUTE-EVAL: Improved Dialogue Evaluation with Optimized Questions and Multi-turn Comparisons. arXiv:1909.03087, 2019a. Piji Li, Wai Lam, Lidong Bing, and Zihao Wang. Deep Recurrent Generative Decoder for Abstractive Text Summarization. In EMNLP, 2017. Zekang Li, Cheng Niu, Fandong Meng, Yang Feng, Qian Li, and Jie Zhou. Incremental Transformer with Deliberation Decoder for Document Grounded Conversations. In ACL, 2019b. Rongzhong Lian, Min Xie, Fan Wang, Jinhua Peng, and Hua Wu. Learning to Select Knowledge for Response Generation in Dialog Systems. In IJCAI, 2019. Zhibin Liu, Zheng-Yu Niu, Hua Wu, and Haifeng Wang. Knowledge aware conversation generation with reasoning on augmented graph. In EMNLP, 2019. Chris J Maddison, John Lawson, George Tucker, Nicolas Heess, Mohammad Norouzi, Andriy Mnih, Arnaud Doucet, and Yee Teh. Filtering Variational Objectives. In NIPS, 2017a. Chris J Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables. 2017b. Andrea Madotto, Chien-Sheng Wu, and Pascale Fung. Mem2Seq: Effectively Incorporating Knowledge Bases into End-to-End Task-Oriented Dialog Systems. In EMNLP, 2018. Sewon Min, Victor Zhong, Richard Socher, and Caiming Xiong. Efficient and Robust Question Answering from Minimal Context over Documents. In ACL, 2018. Nikita Moghe, Siddhartha Arora, Suman Banerjee, and Mitesh M Khapra. Towards Exploiting Background Knowledge for Building Conversation Systems. In EMNLP, 2018. Prasanna Parthasarathi and Joelle Pineau. Extending Neural Generative Conversational Model using External Knowledge Sources. In EMNLP, 2018. Gabriel Pereyra, George Tucker, Jan Chorowski, Łukasz Kaiser, and Geoffrey Hinton. Regularizing Neural Networks by Penalizing Confident Output Distributions. In ICLR, 2017. Lianhui Qin, Michel Galley, Chris Brockett, Xiaodong Liu, Xiang Gao, Bill Dolan, Yejin Choi, and Jianfeng Gao. Conversing by Reading: Contentful Neural Conversation with On-Demand Machine Reading. In ACL, 2019. Shiv Shankar and Sunita Sarawagi. Posterior Attention Models for Sequence to Sequence Learning. In ICLR, 2019. Zhihong Shao, Minlie Huang, Jiangtao Wen, Wenfei Xu, and Xiaoyan Zhu. Long and Diverse Text Generation with Planning-based Hierarchical Variational Model. In EMNLP, 2019. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is All You Need. In NIPS, 2017. Weiyue Wang, Derui Zhu, Tamer Alkhouli, Zixuan Gan, and Hermann Ney. Neural Hidden Markov Model for Machine Translation. In ACL, 2018. Tsung-Hsien Wen, Yishu Miao, Phil Blunsom, and Steve Young. Latent intention dialogue models. In ICML, 2017. Yingce Xia, Fei Tian, Lijun Wu, Jianxin Lin, Tao Qin, Nenghai Yu, and Tie-Yan Liu. Deliberation Networks: Sequence Generation Beyond One-Pass Decoding. In NIPS, 2017. Zichao Yang, Zhiting Hu, Yuntian Deng, Chris Dyer, and Alex Smola. Neural Machine Translation with Recurrent Attention Modeling. In EACL, 2017. Semih Yavuz, Abhinav Rastogi, Guan-Lin Chao, and Hakkani-Tur Dilek. DeepCopy: Grounded Response Generation with Hierarchical Pointer Networks. In SIGDIAL, 2019. Saizheng Zhang, Emily Dinan, Jack Urbanek, Arthur Szlam, Douwe Kiela, and Jason Weston. Personalizing Dialogue Agents: I Have a Dog, Do You Have Pets Too? In ACL, 2018. Tiancheng Zhao, Ran Zhao, and Maxine Eskenazi. Learning Discourse-level Diversity for Neural Dialog Models using Conditional Variational Autoencoders. In ACL, 2017.
Wei Zhao, Liang Wang, Kewei Shen, Ruoyu Jia, and Jingming Liu. Improving Grammatical Error Correction via Pre-Training a Copy-Augmented Architecture with Unlabeled Data. In NAACLHLT, 2019a.
Xueliang Zhao, Chongyang Tao, Wei Wu, Can Xu, Dongyan Zhao, and Rui Yan. A DocumentGrounded Matching Network for Response Selection in Retrieval-based Chatbots. In IJCAI, 2019b.
Kangyan Zhou, Shrimai Prabhumoye, and Alan W Black. A Dataset for Document Grounded Conversations. In EMNLP, 2018.
# A DERIVATION OF CONDITIONAL PROBABILITY
In Section 3, we re-write the conditional probability of wizard’s response $\mathbf { y } ^ { t }$ given dialogue context $\mathbf { x } ^ { \leq t }$ and $\mathbf { y } ^ { < t }$ from Eq. (2) to Eq. (4). We can simply derive it as follows:
p(y|x) (13)
$$\begin{array} { l } { { = } \displaystyle \prod _ { t } \displaystyle \sum _ { \mathbf { k } ^ { \prime } } p _ { \theta } ( \mathbf { y } ^ { t } | \mathbf { x } ^ { \leq t } , \mathbf { y } ^ { < t } , \mathbf { k } ^ { \leq t } ) \pi _ { \theta } ( \mathbf { k } ^ { t } ) \quad \mathrm { ( b y ~ E q . ~ ( 2 ) ) } } \\ { { = \displaystyle \prod _ { i = 1 } ^ { t - 1 } \sum _ { \mathbf { k } ^ { \prime } } p _ { \theta } ( \mathbf { y } ^ { i } | \mathbf { x } ^ { \leq i } , \mathbf { y } ^ { < i } ) { \displaystyle p _ { \theta } ( \mathbf { k } ^ { i } ) } \Big ( \displaystyle \sum _ { \mathbf { k } ^ { t } } p _ { \theta } ( \mathbf { y } ^ { t } | \mathbf { x } ^ { \leq t } , \mathbf { y } ^ { < t } , \mathbf { k } ^ { \leq t } ) \pi _ { \theta } ( \mathbf { k } ^ { t } ) \Big ) \quad \mathrm { ( b y ~ B a y e s ' ~ n l e ) } } } \\ { { \approx \displaystyle \prod _ { i = 1 } ^ { t - 1 } \displaystyle \sum _ { \mathbf { k } ^ { i } } p _ { \theta } ( \mathbf { y } ^ { i } | \mathbf { x } ^ { \leq i } , \mathbf { y } ^ { < i } ) { q _ { \theta } ( \mathbf { k } ^ { i } ) } \Big ( \displaystyle \sum _ { \mathbf { k } ^ { t } } p _ { \theta } ( \mathbf { y } ^ { t } | \mathbf { x } ^ { \leq t } , \mathbf { y } ^ { < t } , \mathbf { k } ^ { \leq t } ) \pi _ { \theta } ( \mathbf { k } ^ { t } ) \Big ) } } \\ { { = \displaystyle \prod _ { i = 1 } ^ { t - 1 } \displaystyle \sum _ { \mathbf { k } ^ { t } } q _ { \phi } ( \mathbf { k } ^ { i } ) \Big ( \displaystyle \sum _ { \mathbf { k } ^ { t } } p _ { \theta } ( \mathbf { y } ^ { t } | \mathbf { x } ^ { \leq t } , \mathbf { y } ^ { < t } , \mathbf { k } ^ { t } ) \pi _ { \theta } ( \mathbf { k } ^ { t } ) \Big ) \quad \mathrm { ( x \leq t ~ a n d ~ \mathbf { y } ^ { < t } ~ a r e ~ g i v e n ) } } } \\ { { \approx p ( \mathbf { y } ^ { t } | \mathbf { x } ^ { \leq t } , \mathbf { y } ^ { < t } ) , } } \end{array}$$
where $q _ { \phi } ( \mathbf { k } ^ { i } )$ is an approximated posterior distribution and $p _ { \theta } ( \mathbf { k } ^ { i } )$ is a true posterior distribution.
# B TRAINING DETAILS
All the parameters except pretrained parts are initialized with Xavier method (Glorot & Bengio, 2010). We use Adam optimizer (Kingma & Ba, 2015) with $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 9 9 , \epsilon = 1 e - 0 7$ . For the models without BERT, we set the learning rate to 0.001 and initialize the embedding matrix with fastText (Bojanowski et al., 2016) trained on the Common Crawl corpus. For the models with BERT, we set the learning rate to 0.00002 and initialize encoder weights with BERT-Base, Uncased pretrained weights. We apply label smoothing (Pereyra et al., 2017; Edunov et al., 2017; Vaswani et al., 2017) for both knowledge selection and response generation, and set 0.1 and 0.05 for each. We set the temperature of Gumbel-Softmax to $\tau = 0 . 1$ and the hyperparameter for the knowledge loss to $\lambda = 1 . 0$ . For efficiency, we batch the dialogues rather than individual turns. We train our model up to 5 epochs on two NVIDIA TITAN Xp GPU.
# C KNOWLEDGE SELECTION ACCURACY OVER TURNS
Table 6 compares the knowledge selection accuracy of different methods for each turn on the Wizard of Wikipedia. Thanks to the sequential latent variable, our model consistently outperforms other methods for all turns in knowledge selection accuracy. Notably, in all models, the accuracy significantly drops after the first turn, which is often easily predictable as a topic definition sentence. It shows the diversity nature in knowledge selection, as discussed in Section 2.
# D QUANTITATIVE RESULTS ON SEMI-SUPERVISED SETTING
Table 7 shows the results of our model with partial knowledge labels on the Wizard of Wikipedia. We attain better performance with more labeled knowledge data for training as expected. Furthermore, our model achieves competitive performance with less label. For instance, our model using only 1/4 labeled training data is comparable to E2E Transformer MemNet and even better in Test Unseen. As a result, our sequential latent knowledge selection model can be utilized in a semi-supervised method without severe drop in the performance.
Table 6: Knowledge selection accuracy for each turn on the Wizard of Wikipedia (Dinan et al., 2019). The method with $[ { ^ * } ]$ uses no knowledge loss. TMN stands for E2E Transformer MemNet.
<table><tr><td rowspan="2">Method</td><td colspan="5">Test Seen</td><td colspan="5">Test Unseen</td></tr><tr><td>1st</td><td>2nd</td><td>3rd</td><td>4th</td><td>5th</td><td>1st</td><td>2nd</td><td>3rd</td><td>4th</td><td>5th</td></tr><tr><td>PostKS* (Lian et al., 2019)</td><td>3.6</td><td>3.6</td><td>4.1</td><td>7.0</td><td>9.5</td><td>3.4</td><td>3.0</td><td>4.7</td><td>4.1</td><td>9.9</td></tr><tr><td>PostKS +Knowledge Loss</td><td>55.4</td><td>19.3</td><td>10.7</td><td>8.7</td><td>7.0</td><td>26.0</td><td>3.8</td><td>4.0</td><td>3.9</td><td>3.8</td></tr><tr><td>TMN (Dinan et al., 2019)</td><td>55.8</td><td>19.5</td><td>10.4</td><td>7.6</td><td>6.2</td><td>25.9</td><td>7.0</td><td>4.1</td><td>4.2</td><td>6.1</td></tr><tr><td>E2E BERT+PostKS</td><td>56.5</td><td>20.6</td><td>13.7</td><td>10.4</td><td>9.2</td><td>36.0</td><td>8.1</td><td>6.1</td><td>6.8</td><td>5.7</td></tr><tr><td>Ours</td><td>59.1</td><td>20.6</td><td>15.8</td><td>12.8</td><td>9.1</td><td>52.9</td><td>8.8</td><td>8.4</td><td>6.4</td><td>10.7</td></tr></table>
Table 7: Performance of our model with partial knowledge labels on Wizard of Wikipedia (Dinan et al., 2019).
<table><tr><td rowspan="2">Method</td><td colspan="4">Test Seen</td><td colspan="4">Test Unseen</td></tr><tr><td>PPL</td><td>R-1</td><td>R-2</td><td>Acc</td><td>PPL</td><td>R-1</td><td>R-2</td><td>Acc</td></tr><tr><td>E2E Transformer MemNet (Dinan et al.,2019)</td><td>63.5</td><td>16.9</td><td>:</td><td>22.5</td><td>97.3</td><td>14.4</td><td>:</td><td>12.2</td></tr><tr><td>E2E Transformer MemNet (BERT vocab)‡</td><td>53.2</td><td>17.7</td><td>4.8</td><td>23.2</td><td>137.8</td><td>13.6</td><td>1.9</td><td>10.5</td></tr><tr><td>Ours</td><td>52.0</td><td>19.3</td><td>6.8</td><td>26.8</td><td>81.4</td><td>16.1</td><td>4.2</td><td>18.3</td></tr><tr><td>1/2 knowledge labeled</td><td>49.0</td><td>19.2</td><td>6.6</td><td>25.1</td><td>77.8</td><td>16.1</td><td>4.1</td><td>16.7</td></tr><tr><td>1/4 knowledge labeled</td><td>45.7</td><td>18.7</td><td>6.1</td><td>22.4</td><td>78.0</td><td>15.8</td><td>3.6</td><td>13.8</td></tr><tr><td>1/8 knowledge labeled</td><td>45.3</td><td>18.6</td><td>6.0</td><td>21.0</td><td>79.9</td><td>15.7</td><td>3.6</td><td>12.3</td></tr><tr><td>no knowledge loss</td><td>54.7</td><td>17.1</td><td>4.6</td><td>0.3</td><td>88.2</td><td>15.5</td><td>3.4</td><td>0.1</td></tr></table>
# E EXAMPLES WITH SELECTED KNOWLEDGE
Figure 4 and 5 show selected examples of knowledge selection and response generation. In each set, given dialogue context, we compare selected knowledge and generated utterances by our method and baselines with human ground truths.
Seen Test (Topic: Italian Cuisine) Figure 4: Examples of selected knowledge and generated responses by our model and baselines on the WoW Seen Test set. Unseen Test (Topic: Hunting)
<table><tr><td colspan="3">SeenTest(Topic:TtalanCuisine) :</td></tr><tr><td colspan="3">A: Ilove chicken parmigiana as well,but I think my ultimate favorite is beef lasagna... Extra cheese please!</td></tr><tr><td colspan="3">W: Chicken with sauce and mozzarella.... Be still my heart! A:Truthfully,anything with cheese is the best</td></tr><tr><td colspan="2">Task 1: Knowledge Selection</td><td>Task 2: Response Generation ilove pizza too !it’s a traditional italian dish</td></tr><tr><td>Ours</td><td>Pizza is a traditional Italian dish consisting of a yeasted flatbread typically topped with tomato sauce and cheese and baked in an oven. (from“Pizza”Wikipedia page)</td><td>nconsisting of yeasted flatbread typically topped with tomato sauce and cheese</td></tr><tr><td>TMN</td><td>no_passages_used</td><td>i love cheese </td></tr><tr><td>E2E BERT +KL</td><td>It can also be topped with additional vegetables,meats,and condiments,and can condiments . be made without cheese. (from“Pizza”Wikipedia page)</td><td>i like mine topped with vegetables,meats,and</td></tr><tr><td>Human</td><td>It is the second-most popular cheese in the US (behind mozzarella), with an average annual consumption of 10 lb (4.5 kg) per capita. (from “Cheddar cheese”Wikipedia page)</td><td>especially cheddar cheese !it ’s the second most popular cheese in the use !</td></tr></table>
W: That is true but we always have to watch out for excessive hunting. It has cause some species to be endangered.
Figure 5: Examples of selected knowledge and generated responses by our model and baselines on the WoW Unseen Test set.
<table><tr><td colspan="2">Task1: Knowledge Selection</td><td>Task 2:Response Generation</td></tr><tr><td>Ours</td><td>Poaching has traditionally been defined as the illegal hunting or capturing of wild animals,usually associated with land use rights. (from“Poaching”Wikipedia page)</td><td>i agree,poaching has been defined as the illegal hunting or capturing of wild animals .</td></tr><tr><td>TMN</td><td>no_passages_used</td><td>i thinks so,i'm not sure if you ’re talking about poaching , but i know that poodles are the second most intelligent breed behind the poodle .</td></tr><tr><td>E2E BERT +KL</td><td>Hunting can also be a means of pest control. iagree .i think it ’s a great way to catch fish . (from“Poaching”Wikipedia page)</td><td></td></tr><tr><td>Human</td><td>It is also not considered hunting to pursue animals without intent to kill them,as in wildlife photography, birdwatching,or scientific research (from“Hunting”Wikipedia page)</td><td>agreed,i remember reading one time that unless you plan to kill the animals its not considered hunting.</td></tr></table>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257# THE EARLY PHASE OF NEURAL NETWORK TRAINING
Jonathan Frankle† MIT CSAIL
David J. Schwab CUNY ITS Facebook AI Research
Ari S. Morcos Facebook AI Research
# ABSTRACT
Recent studies have shown that many important aspects of neural network learning take place within the very earliest iterations or epochs of training. For example, sparse, trainable sub-networks emerge (Frankle et al., 2019), gradient descent moves into a small subspace (Gur-Ari et al., 2018), and the network undergoes a critical period (Achille et al., 2019). Here we examine the changes that deep neural networks undergo during this early phase of training. We perform extensive measurements of the network state during these early iterations of training and leverage the framework of Frankle et al. (2019) to quantitatively probe the weight distribution and its reliance on various aspects of the dataset. We find that, within this framework, deep networks are not robust to reinitializing with random weights while maintaining signs, and that weight distributions are highly non-independent even after only a few hundred iterations. Despite this behavior, pre-training with blurred inputs or an auxiliary self-supervised task can approximate the changes in supervised networks, suggesting that these changes are not inherently label-dependent, though labels significantly accelerate this process. Together, these results help to elucidate the network changes occurring during this pivotal initial period of learning.
# 1 INTRODUCTION
Over the past decade, methods for successfully training big, deep neural networks have revolutionized machine learning. Yet surprisingly, the underlying reasons for the success of these approaches remain poorly understood, despite remarkable empirical performance (Santurkar et al., 2018; Zhang et al., 2017). A large body of work has focused on understanding what happens during the later stages of training (Neyshabur et al., 2019; Yaida, 2019; Chaudhuri & Soatto, 2017; Wei & Schwab, 2019), while the initial phase has been less explored. However, a number of distinct observations indicate that significant and consequential changes are occurring during the most early stage of training. These include the presence of critical periods during training (Achille et al., 2019), the dramatic reshaping of the local loss landscape (Sagun et al., 2017; Gur-Ari et al., 2018), and the necessity of rewinding in the context of the lottery ticket hypothesis (Frankle et al., 2019). Here we perform a thorough investigation of the state of the network in this early stage.
To provide a unified framework for understanding the changes the network undergoes during the early phase, we employ the methodology of iterative magnitude pruning with rewinding (IMP), as detailed below, throughout the bulk of this work (Frankle & Carbin, 2019; Frankle et al., 2019). The initial lottery ticket hypothesis, which was validated on comparatively small networks, proposed that small, sparse sub-networks found via pruning of converged larger models could be trained to high performance provided they were initialized with the same values used in the training of the unpruned model (Frankle & Carbin, 2019). However, follow-up work found that rewinding the weights to their values at some iteration early in the training of the unpruned model, rather than to their initial values, was necessary to achieve good performance on deeper networks such as ResNets (Frankle et al., 2019). This observation suggests that the changes in the network during this initial phase are vital for the success of the training of small, sparse sub-networks. As a result, this paradigm provides a simple and quantitative scheme for measuring the importance of the weights at various points early in training within an actionable and causal framework.
We make the following contributions, all evaluated across three different network architectures:
1. We provide an in-depth overview of various statistics summarizing learning over the early part of training. 2. We evaluate the impact of perturbing the state of the network in various ways during the early phase of training, finding that: (i) counter to observations in smaller networks (Zhou et al., 2019), deeper networks are not robust to reinitializion with random weights, but maintained signs (ii) the distribution of weights after the early phase of training is already highly non-i.i.d., as permuting them dramatically harms performance, even when signs are maintained (iii) both of the above perturbations can roughly be approximated by simply adding noise to the network weights, though this effect is stronger for (ii) than (i)
3. We measure the data-dependence of the early phase of training, finding that pre-training using only $p ( x )$ can approximate the changes that occur in the early phase of training, though pre-training must last for far longer ${ \sim } 3 2 \times$ longer) and not be fed misleading labels.
# 2 KNOWN PHENOMENA IN THE EARLY PHASE OF TRAINING
Lottery ticket rewinding: The original lottery ticket paper (Frankle & Carbin, 2019) rewound weights to initialization, i.e., $k ~ = ~ 0$ , during IMP. Follow up work on larger models demonstrated that it is necessary to rewind to a later point during training for IMP to succeed, i.e., $k \ < < \ T$ , where $T$ is total training iterations (Frankle et al., 2019). Notably, the benefit of rewinding to a later point in training saturates quickly, roughly between 500 and 2000 iterations for ResNet-20 on CIFAR-10 (Figure 1). This timescale is strikingly similar to the changes in the Hessian described below.
Hessian eigenspectrum: The shape of the loss landscape around the network state also appears
 Figure 1: Accuracy of IMP when rewinding to various iterations of the early phase for ResNet20 sub-networks as a function of sparsity level.
to change rapidly during the early phase of training (Sagun et al., 2017; Gur-Ari et al., 2018). At initialization, the Hessian of the loss contains a number of large positive and negative eigenvalues. However, very rapidly the curvature is reshaped in a few marked ways: a few large eigenvalues emerge, the bulk eigenvalues are close to zero, and the negative eigenvalues become very small. Moreover, once the Hessian spectrum has reshaped, gradient descent appears to occur largely within the top subspace of the Hessian (Gur-Ari et al., 2018). These results have been largely confirmed in large scale studies (Ghorbani et al., 2019), but note they depend to some extent on architecture and (absence of) batch normalization (Ioffe & Szegedy, 2015). A notable exception to this consistency is the presence of substantial $L _ { 1 }$ energy of negative eigenvalues for models trained on ImageNet.
Critical periods in deep learning: Achille et al. (2019) found that perturbing the training process by providing corrupted data early on in training can result in irrevocable damage to the final performance of the network. Note that the timescales over which the authors find a critical period extend well beyond those we study here. However, architecture, learning rate schedule, and regularization all modify the timing of the critical period, and follow-up work found that critical periods were also present for regularization, in particular weight decay and data augmentation (Golatkar et al., 2019).
# 3 PRELIMINARIES AND METHODOLOGY
Networks: Throughout this paper, we study five standard convolutional neural networks for CIFAR-10. These include the ResNet-20 and ResNet-56 architectures designed for CIFAR-10 (He et al., 2015), the ResNet-18 architecture designed for ImageNet but commonly used on CIFAR-10 (He et al., 2015), the WRN-16-8 wide residual network (Zagoruyko & Komodakis, 2016), and the
 Figure 2: Rough timeline of the early phase of training for ResNet-20 on CIFAR-10.
VGG-13 network (Simonyan & Zisserman (2015) as adapted by Liu et al. (2019)). Throughout the main body of the paper, we show ResNet-20; in Appendix B, we present the same experiments for the other networks. Unless otherwise stated, results were qualitatively similar across all three networks. All experiments in this paper display the mean and standard deviation across five replicates with different random seeds. See Appendix A for further model details.
Iterative magnitude pruning with rewinding: In order to test the effect of various hypotheses about the state of sparse networks early in training, we use the Iterative Magnitude Pruning with rewinding (IMP) procedure of Frankle et al. (2019) to extract sub-networks from various points in training that could have learned on their own. The procedure involves training a network to completion, pruning the $20 \%$ of weights with the lowest magnitudes globally throughout the network, and rewinding the remaining weights to their values from an earlier iteration $k$ during the initial, pre-pruning training run. This process is iterated to produce networks with high sparsity levels. As demonstrated in Frankle et al. (2019), IMP with rewinding leads to sparse sub-networks which can train to high performance even at high sparsity levels $> 9 0 \%$ .
Figure 1 shows the results of the IMP with rewinding procedure, showing the accuracy of ResNet20 at increasing sparsity when performing this procedure for several rewinding values of $k$ . For $k \geq 5 0 0$ , sub-networks can match the performance of the original network with $1 6 . 8 \%$ of weights remaining. For $k > 2 0 0 0$ , essentially no further improvement is observed (not shown).
# 4 THE STATE OF THE NETWORK EARLY IN TRAINING
Many of the aforementioned papers refer to various points in the “early” part of training. In this section, we descriptively chart the state of ResNet-20 during the earliest phase of training to provide context for this related work and our subsequent experiments. We specifically focus on the first 4,000 iterations (10 epochs). See Figure A3 for the characterization of additional networks. We include a summary of these results for ResNet-20 as a timeline in Figure 2, and include a broader timeline including results from several previous papers for ResNet-18 in Figure A1.
As shown in Figure 3, during the earliest ten iterations, the network undergoes substantial change. It experiences large gradients that correspond to a rapid increase in distance from the initialization and a large number of sign changes of the weights. After these initial iterations, gradient magnitudes drop and the rate of change in each of the aforementioned quantities gradually slows through the remainder of the period we observe. Interestingly, gradient magnitudes reach a minimum after the first 200 iterations and subsequently increase to a stable level by iteration 500. Evaluation accuracy, improves rapidly, reaching $55 \%$ by the end of the first epoch (400 iterations), more than halfway to the final $9 1 . 5 \%$ . By 2000 iterations, accuracy approaches $80 \%$ .
During the first 4000 iterations of training, we observe three sub-phases. In the first phase, lasting only the initial few iterations, gradient magnitudes are very large and, consequently, the network changes rapidly. In the second phase, lasting about 500 iterations, performance quickly improves, weight magnitudes quickly increase, sign differences from initialization quickly increase, and gradient magnitudes reach a minimum before settling at a stable level. Finally, in the third phase, all of these quantities continue to change in the same direction, but begin to decelerate.
 Figure 3: Basic telemetry about the state of ResNet-20 during the first 4000 iterations (10 epochs). Top row: evaluation accuracy/loss; average weight magnitude; percentage of weights that change sign from initialization; the values of ten randomly-selected weights. Bottom row: gradient magnitude; L2 distance of weights from their initial values and final values at the end of training; cosine similarity of weights from their initial values and final values at the end of training.
 Figure 4: Performance of an IMP-derived sub-network of ResNet-20 on CIFAR-10 initialized to the signs at iteration 0 or $k$ and the magnitudes at iteration 0 or $k$ . Left: $k = 5 0 0$ . Right: $k = 2 0 0 0$ .
# 5 PERTURBING NEURAL NETWORKS EARLY IN TRAINING
Figure 1 shows that the changes in the network weights over the first 500 iterations of training are essential to enable high performance at high sparsity levels. What features of this weight transformation are necessary to recover increased performance? Can they be summarized by maintaining the weight signs, but discarding their magnitudes as implied by Zhou et al. (2019)? Can they be represented distributionally? In this section, we evaluate these questions by perturbing the early state of the network in various ways. Concretely, we either add noise or shuffle the weights of IMP sub-networks of ResNet-20 across different network sub-compenents and examine the effect on the network’s ability to learn thereafter. The sub-networks derived by IMP with rewinding make it possible to understand the causal impact of perturbations on sub-networks that are as capable as the full networks but more visibly decline in performance when improperly configured. To enable comparisons between the experiments in Section 5 and provide a common frame of reference, we measure the effective standard deviation of each perturbation, i.e. stddev $( w _ { p e r t u r b } - w _ { o r i g } )$ .
# 5.1 ARE SIGNS ALL YOU NEED?
Zhou et al. (2019) show that, for a set of small convolutional networks, signs alone are sufficient to capture the state of lottery ticket sub-networks. However, it is unclear whether signs are still sufficient for larger networks early in training. In Figure 4, we investigate the impact of combining the magnitudes of the weights from one time-point with the signs from another. We found that the signs at iteration 500 paired with the magnitudes from initialization (red line) or from a separate random initialization (green line) were insufficient to maintain the performance reached by using both signs and magnitudes from iteration 500 (orange line), and performance drops to that of using both magnitudes and signs from initialization (blue line). However, while using the magnitudes from iteration 500 and the signs from initialization, performance is still substantially better than initialization signs and magnitudes. In addition, the overall perturbation to the network by using the magnitudes at iteration 500 and signs from initialization (mean: 0.0, stddev: 0.033) is smaller than by using the signs at iteration 500 and the magnitudes from initialization $( 0 . 0 \pm 0 . 0 4 2$ , mean $\pm$ std). These results suggest that the change in weight magnitudes over the first 500 iterations of training are substantially more important than the change in the signs for enabling subsequent training.
 Figure 5: Performance of an IMP-derived ResNet-20 sub-network on CIFAR-10 initialized with the weights at iteration $k$ permuted within various structural elements. Left: $k = 5 0 0$ . Right: $k = 2 0 0 0$ .
 Figure 6: The effect of training an IMP-derived sub-network of ResNet-20 on CIFAR-10 initialized with the weights at iteration $k$ as shuffled within various structural elements where shuffling only occurs between weights with the same sign. Left: $k = 5 0 0$ . Right: $k = 2 0 0 0$ .
By iteration 2000, however, pairing the iteration 2000 signs with magnitudes from initialization (red line) reaches similar performance to using the signs from initialization and the magnitudes from iteration 2000 (purple line) though not as high performance as using both from iteration 2000. This result suggests that network signs undergo important changes between iterations 500 and 2000, as only $9 \%$ of signs change during this period. Our results also suggest that counter to the observations of Zhou et al. (2019) in shallow networks, signs are not sufficient in deeper networks.
# 5.2 ARE WEIGHT DISTRIBUTIONS I.I.D.?
Can the changes in weights over the first $k$ iterations be approximated distributionally? To measure this, we permuted the weights at iteration $k$ within various structural sub-components of the network (globally, within layers, and within convolutional filters). If networks are robust to these permutations, it would suggest that the weights in such sub-compenents might be approximated and sampled from. As Figure 5 shows, however, we found that performance was not robust to shuffling weights globally (green line) or within layers (red line), and drops substantially to no better than that of the original initialization (blue line) at both 500 and 2000 iterations.1 Shuffling within filters (purple line) performs slightly better, but results in a smaller overall perturbation $( 0 . 0 \pm 0 . 0 9 2$ for $k = 5 0 0$ ) than shuffling layerwise $( 0 . 0 { \pm } 0 . 1 4 3 )$ or globally $( 0 . 0 { \pm } 0 . 1 4 4 )$ , suggesting that this change in perturbation strength may simply account for the difference.
 Figure 7: The effect of training an IMP-derived sub-network of ResNet-20 on CIFAR-10 initialized with the weights at iteration $k$ and Gaussian noise of $n \sigma$ , where $\sigma$ is the standard deviation of the initialization distribution for each layer. Left: $k = 5 0 0$ . Right: $k = 2 0 0 0$ .
Are the signs from the rewinding iteration, $k$ , sufficient to recover the damage caused by permutation? In Figure 6, we also consider shuffling only amongst weights that have the same sign. Doing so substantially improves the performance of the filter-wise shuffle; however, it also reduces the extent of the overall perturbation $( 0 . 0 \pm 0 . 0 4 9$ for $k = 5 0 0$ ). It also improves the performance of shuffling within layers slightly for $k = 5 0 0$ and substantially for $k = 2 0 0 0$ . We attribute the behavior for $k = 2 0 0 0$ to the signs just as in Figure 4: when the magnitudes are similar in value (Figure 4 red line) or distribution (Figure 6 red and green lines), using the signs improves performance. Reverting back to the initial signs while shuffling magnitudes within layers (brown line), however, damages the network too severely $( 0 . 0 \pm 0 . 0 8 7$ for $k = 5 0 0 \mathrm { \AA }$ ) to yield any performance improvement over random noise. These results suggest that, while the signs from initialization are not sufficient for high performance at high sparsity as shown in Section 5.1, the signs from the rewinding iteration are sufficient to recover the damage caused by permutation, at least to some extent.
# 5.3 IS IT ALL JUST NOISE?
Some of our previous results suggested that the impact of signs and permutations may simply reduce to adding noise to the weights. To evaluate this hypothesis, we next study the effect of simply adding Gaussian noise to the network weights at iteration $k$ . To add noise appropriately for layers with different scales, the standard deviation of the noise added for each layer was normalized to a multiple of the standard deviation $\sigma$ of the initialization distribution for that layer. In Figure 7, we see that for iteration $k = 5 0 0$ , sub-networks can tolerate $0 . 5 \sigma$ to $1 \sigma$ of noise before performance degrades back to that of the original initialization at higher levels of noise. For iteration $k = 2 0 0 0$ , networks are surprisingly robust to noise up to $1 \sigma$ , and even $2 \sigma$ exhibits nontrivial performance.
In Figure 8, we plot the performance of each network at a fixed sparsity level as a function of the effective standard deviation of the noise imposed by each of the aforementioned perturbations. We find that the standard deviation of the effective noise explained fairly well the resultant performance $k = 5 0 0$ : $r = - 0 . 6 7 2$ , $p = 0 . 0 0 8$ ; $k = 2 0 0 0$ : $r = - 0 . 7 2 6$ , $p = 0 . 0 0 3 )$ . As expected, perturbations that preserved the performance of the network generally resulted in smaller changes to the state of the network at iteration $k$ . Interestingly, experiments that mixed signs and magnitudes from different points in training (green points) aligned least well with this pattern: the standard deviation of the perturbation is roughly similar among all of these experiments, but the accuracy of the resulting networks changes substantially. This result suggests that although the standard deviation of the noise is certainly indicative of lower accuracy, there are still specific perturbations that, while small in overall magnitude, can have a large effect on the network’s ability to learn, suggesting that the observed perturbation effects are not, in fact, just a consequence of noise.
# 6 THE DATA-DEPENDENCE OF NEURAL NETWORKS EARLY IN TRAINING
Section 5 suggests that the change in network behavior by iteration $k$ is not due to easilyascertainable, distributional properties of the network weights and signs. Rather, it appears that training is required to reach these network states. It is unclear, however, the extent to which various aspects of the data distribution are necessary. Mainly, is the change in weights during the early phase of training dependent on $p ( x )$ or $p ( y | \dot { x } ) \dot { }$ ? Here, we attempt to answer this question by measuring the extent to which we can re-create a favorable network state for sub-network training using restricted information from the training data and labels. In particular, we consider pre-training the network with techniques that ignore labels entirely (self-supervised rotation prediction, Section 6.2), provide misleading labels (training with random labels, Section 6.1), or eliminate information from examples (blurring training examples Section 6.3).
 Figure 8: The effective standard deviation of various perturbations as a function of mean evaluation accuracy (across 5 seeds) at sparsity $2 6 . 2 \%$ . The mean of each perturbation was approximately 0. Left: $k = 5 0 0$ , $r = - 0 . 6 7 2$ , $p = 0 . 0 0 8$ ; Right: $k = 2 0 0 0$ , $r = - 0 . 7 2 6$ , $p = 0 . 0 0 3$ .
 Figure 9: The effect of pre-training ResNet-20 on CIFAR-10 with random labels, self-supervised rotation, $4 \mathbf { x }$ blurring, and $4 \mathbf { x }$ blurring and self-supervised rotation.
We first train a randomly-initialized, unpruned network on CIFAR-10 on the pre-training task for a set number of epochs. After pre-training, we train the network normally as if the pre-trained state were the original initialization. We then use the state of the network at the end of the pre-training phase as the “initialization” to find masks for IMP. Finally, we examine the performance of the IMPpruned sub-networks as initialized using the state after pre-training. This experiment determines the extent to which pre-training places the network in a state suitable for sub-network training as compared to using the state of the network at iteration $k$ of training on the original task.
# 6.1 RANDOM LABELS
To evaluate whether this phase of training is dependent on underlying structure in the data, we drew inspiration from Zhang et al. (2017) and pre-trained networks on data with randomized labels. This experiment tests whether the input distribution of the training data is sufficient to put the network in a position from which IMP with rewinding can find a sparse, trainable sub-network despite the presence of incorrect (not just missing) labels. Figure 9 (upper left) shows that pre-training on random labels for up to 10 epochs provides no improvement above rewinding to iteration 0 and that pre-training for longer begins to hurt accuracy. This result suggests that, though it is still possible that labels may not be required for learning, the presence incorrect labels is sufficient to prevent learning which approximates the early phase of training.
# 6.2 SELF-SUPERVISED ROTATION PREDICTION
What if we remove labels entirely? Is $p ( x )$ sufficient to approximate the early phase of training? Historically, neural network training often involved two steps: a self-supervised pre-training phase followed by a supervised phase on the target task (Erhan et al., 2010). Here, we consider one such self-supervised technique: rotation prediction (Gidaris et al., 2018). During the pre-training phase, the network is presented with a training image that has randomly been rotated $9 0 n$ degrees (where $n \in \{ 0 , 1 , 2 , 3 \bar \} )$ . The network must classify examples by the value of $n$ . If self-supervised pretraining can approximate the early phase of training, it would suggest that $p ( x )$ is sufficient on its own. Indeed, as shown in Figure 9 (upper right), this pre-training regime leads to well-trainable subnetworks, though networks must be trained for many more epochs compared to supervised training (40 compared to 1.25, or a factor of $3 2 \times 1$ ). This result suggests that the labels for the ultimate task themselves are not necessary to put the network in such a state (although explicitly misleading labels are detrimental). We emphasize that the duration of the pre-training phase required is an order of magnitude larger than the original rewinding iteration, however, suggesting that labels add important information which accelerates the learning process.
# 6.3 BLURRING TRAINING EXAMPLES
To probe the importance of $p ( x )$ for the early phase of training, we study the extent to which the training input distribution is necessary. Namely, we pretrain using blurred training inputs with the correct labels. Following Achille et al. (2019), we blur training inputs by downsampling by $4 \mathbf { x }$ and then upsampling back to the full size. Figure 9 (bottom left) shows that this pre-training method succeeds: after 40 epochs of pre-training, IMP with rewinding can find sub-networks that are similar in performance to those found after training on the original task for 500 iterations (1.25 epochs).
Due to the success of the the rotation and blurring pre-training tasks, we explored the effect of combining these pre-training techniques. Doing so tests the extent to which we can discard both the training labels and some information from the training inputs. Figure 9 (bottom right) shows that doing so provides the network too little information: no amount of pre-training we considered makes it possible for IMP with rewinding to find sub-networks that perform tangibly better than rewinding to iteration 0. Interestingly however, as shown in Appendix B, trainable sub-networks are found for VGG-13 with this pre-training regime, suggesting that different network architectures have different sensitivities to the deprivation of labels and input content.
# 6.4 SPARSE PRETRAINING
Since sparse sub-networks are often challenging to train from scratch without the proper initialization (Han et al., 2015; Liu et al., 2019; Frankle & Carbin, 2019), does pre-training make it easier for sparse neural networks to learn? Doing so would serve as a rough form of curriculum learning (Bengio et al., 2009) for sparse neural networks. We experimented with training sparse sub-networks of ResNet-20 (IMP sub-networks, randomly reinitialized sub-networks, and randomly pruned subnetworks) first on self-supervised rotation and then on the main task, but found no benefit beyond rewinding to iteration 0 (Figure 10). Moreover, doing so when starting from a sub-network rewound to iteration 500 actually hurts final accuracy. This result suggests that while pre-training is sufficient to approximate the early phase of supervised training with an appropriately structured mask, it is not sufficient to do so with an inappropriate mask.
 Figure 10: The effect of pretraining sparse sub-networks of Resnet-20 (rewound to iteration 500) with 40 epochs of self-supervised rotation before training on CIFAR-10.
# 7 DISCUSSION
In this paper, we first performed extensive measurements of various statistics summarizing learning over the early part of training. Notably, we uncovered 3 sub-phases: in the very first iterations, gradient magnitudes are anomalously large and motion is rapid. Subsequently, gradients overshoot to smaller magnitudes before leveling off while performance increases rapidly. Then, learning slowly begins to decelerate. We then studied a suite of perturbations to the network state in the early phase finding that, counter to observations in smaller networks (Zhou et al., 2019), deeper networks are not robust to reinitializing with random weights with maintained signs. We also found that the weight distribution after the early phase of training is highly non-independent. Finally, we measured the data-dependence of the early phase with the surprising result that pre-training on a self-supervised task yields equivalent performance to late rewinding with IMP.
These results have significant implications for the lottery ticket hypothesis. The seeming necessity of late rewinding calls into question certain interpretations of lottery tickets as well as the ability to identify sub-networks at initialization. Our observation that weights are highly non-independent at the rewinding point suggests that the weights at this point cannot be easily approximated, making approaches which attempt to “jump” directly to the rewinding point unlikely to succeed. However, our result that labels are not necessary to approximate the rewinding point suggests that the learning during this phase does not require task-specific information, suggesting that rewinding may not be necessary if networks are pre-trained appropriately.
# REFERENCES
Alessandro Achille, Matteo Rovere, and Stefano Soatto. Critical learning periods in deep neural networks. 2019.
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.
Pratik Chaudhuri and Stefano Soatto. Stochastic gradient descent performs variational inference, converges to limit cycles for deep networks. 2017. URL https://arxiv.org/abs/1710. 11029.
Dumitru Erhan, Yoshua Bengio, Aaron Courville, Pierre-Antoine Manzagol, Pascal Vincent, and Samy Bengio. Why does unsupervised pre-training help deep learning? Journal of Machine Learning Research, 11(Feb):625–660, 2010.
Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In International Conference on Learning Representations, 2019. URL https:// openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rJl-b3RcF7.
Jonathan Frankle, Gintare Karolina Dziugaite, Daniel M Roy, and Michael Carbin. Stabilizing the lottery ticket hypothesis. arXiv preprint arXiv:1903.01611, 2019.
Behrooz Ghorbani, Shankar Krishnan, and Ying Xiao. An investigation into neural net optimization via hessian eigenvalue density. In Proceedings of the 36th International Conference on Machine Learning, volume 97, pp. 2232–2241, 2019. URL http://proceedings.mlr.press/ v97/ghorbani19b.html.
Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ S1v4N2l0-.
Aditya Golatkar, Alessandro Achille, and Stefano Soatto. Time matters in regularizing deep networks: Weight decay and data augmentation affect early learning dynamics, matter little near convergence. 2019.
Guy Gur-Ari, Daniel A Roberts, and Ethan Dyer. Gradient descent happens in a tiny subspace. arXiv preprint arXiv:1812.04754, 2018.
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, pp. 1135–1143, 2015.
K He, X Zhang, S Ren, and J Sun. Deep residual learning for image recognition. In Computer Vision and Pattern Recogntion (CVPR), volume 5, pp. 6, 2015.
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 448–456. JMLR.org, 2015. URL http://dl.acm.org/citation.cfm?id=3045118.3045167.
Zhuang Liu, Mingjie Sun, Tinghui Zhou, Gao Huang, and Trevor Darrell. Rethinking the value of network pruning. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $=$ rJlnB3C5Ym.
Behnam Neyshabur, Zhiyuan Li, Srinadh Bhojanapalli, Yann LeCun, and Nathan Srebro. Towards understanding the role of over-parametrization in generalization of neural networks. 2019.
Levent Sagun, Utku Evci, Ugur Guney, Yann Dauphin, and Leon Bottou. Empirical analysis of the hessian of over-parametrized neural networks. 2017. URL https://arxiv.org/abs/ 1706.04454.
Shibani Santurkar, Dimitris Tsipras, Andrew Ilyas, and Aleksander Madry. How does batch normalization help optimization? In Advances in neural information processing systems, 2018.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. 2015.
Mingwei Wei and David Schwab. How noise during training affects the hessian spectrum in overparameterized neural networks. 2019.
Sho Yaida. Fluctuation-dissipation relations for stochastic gradient descent. 2019.
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. 2017.
Hattie Zhou, Janice Lan, Rosanne Liu, and Jason Yosinski. Deconstructing lottery tickets: Zeros, signs, and the supermask. 2019.
A MODEL DETAILS
<table><tr><td>Network</td><td>Epochs</td><td>Batch Size</td><td>Learning Rate</td><td>Parameters</td><td>Eval Accuracy</td></tr><tr><td>ResNet-20</td><td>160</td><td>128</td><td>0.1 (Mom 0.9)</td><td>272K</td><td>91.5 ± 0.2%</td></tr><tr><td>ResNet-56</td><td>160</td><td>128</td><td>0.1 (Mom 0.9)</td><td>856K</td><td>93.0 ± 0.1%</td></tr><tr><td>ResNet-18</td><td>160</td><td>128</td><td>0.1 (Mom 0.9)</td><td>11.2M</td><td>86.8 ± 0.3%</td></tr><tr><td>VGG-13</td><td>160</td><td>64</td><td>0.1 (Mom 0.9)</td><td>9.42M</td><td>93.5 ± 0.1%</td></tr><tr><td>WRN-16-8</td><td>160</td><td>128</td><td>0.1 (Mom 0.9)</td><td>11.1M</td><td>94.8 ± 0.1%</td></tr></table>
Table A1: Summary of the networks we study in this paper. We present ResNet-20 in the main body of the paper and the remaining networks in Appendix B.
Table A1 summarizes the networks. All networks follow the same training regime: we train with SGD for 160 epochs starting at learning rate 0.1 (momentum 0.9) and drop the learning rate by a factor of ten at epoch 80 and again at epoch 120. Training includes weight decay with weight 1e4. Data is augmented with normalization, random flips, and random crops up to four pixels in any direction.
# B EXPERIMENTS FOR OTHER NETWORKS
 Figure A1: Rough timeline of the early phase of training for ResNet-18 on CIFAR-10, including results from previous papers.
 Figure A2: The effect of IMP rewinding iteration on the accuracy of sub-networks at various levels of sparsity. Accompanies Figure 1.
 Figure A3: Basic telemetry about the state of all networks in Table A1 during the first 4000 iterations of training. Accompanies Figure 3.
 Figure A4: The effect of training an IMP-derived sub-network initialized to the signs at iteration 0 or $k$ and the magnitudes at iteration 0 or $k$ . Accompanies Figure A4.

 Resnet-56 (CIFAR-10) - Rewinding Iteration 500

 Resnet-56 (CIFAR-10) - Rewinding Iteration 2000
 Resnet-18 (CIFAR-10) - Rewinding Iteration 500
 Resnet-18 (CIFAR-10) - Rewinding Iteration 2000
 WRN-16-8 (CIFAR-10) - Rewinding Iteration 50
 WRN-16-8 (CIFAR-10) - Rewinding Iteration 250 Figure A5: The effect of training an IMP-derived sub-network initialized with the weights at iteration $k$ as shuffled within various structural elements. Accompanies Figure 5.
 Figure A6: The effect of training an IMP-derived sub-network initialized with the weights at iteration $k$ as shuffled within various structural elements where shuffling only occurs between weights with the same sign. Accompanies Figure 6.
 Figure A7: The effect of training an IMP-derived sub-network initialized with the weights at iteration $k$ and Gaussian noise of $n \sigma$ , where $\sigma$ is the standard deviation of the initialization distribution for each layer. Accompanies Figure 7.
 Figure A8: The effective standard deviation of each of the perturbations studied in Section 5 as a function of mean evaluation accuracy (across five seeds). Accompanies Figure 8.
 Figure A9: The effect of pre-training CIFAR-10 with random labels. Accompanies Figure 9.
 Figure A10: The effect of pre-training CIFAR-10 with self-supervised rotation. Accompanies Figure 9.
 Figure A11: The effect of pre-training CIFAR-10 with $4 \mathbf { x }$ blurring. Accompanies Figure 9.
 VGG-13 (CIFAR-10) - 4x Blurring $^ +$ Self-Superivsed Rotation

 Resnet-18 (CIFAR-10) - 4x Blurring $^ +$ Self-Superivsed Rotation
 WRN-16-8 (CIFAR-10) - 4x Blurring $^ +$ Self-Superivsed Rotation Figure A12: The effect of pre-training CIFAR-10 with $4 \mathbf { x }$ blurring and self-supervised rotation. Accompanies Figure 9.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441# MARGINALIZED AVERAGE ATTENTIONAL NETWORK FOR WEAKLY-SUPERVISED LEARNING
Yuan Yuan12, Yueming Lyu3, Xi Shen4, Ivor W. Tsang3 & Dit-Yan Yeung1 1Hong Kong University of Science and Technology, 2Alibaba Group 3University of Technology Sydney, 4Ecole des Ponts ParisTech
# ABSTRACT
In weakly-supervised temporal action localization, previous works have failed to locate dense and integral regions for each entire action due to the overestimation of the most salient regions. To alleviate this issue, we propose a marginalized average attentional network (MAAN) to suppress the dominant response of the most salient regions in a principled manner. The MAAN employs a novel marginalized average aggregation (MAA) module and learns a set of latent discriminative probabilities in an end-to-end fashion. MAA samples multiple subsets from the video snippet features according to a set of latent discriminative probabilities and takes the expectation over all the averaged subset features. Theoretically, we prove that the MAA module with learned latent discriminative probabilities successfully reduces the difference in responses between the most salient regions and the others. Therefore, MAAN is able to generate better class activation sequences and identify dense and integral action regions in the videos. Moreover, we propose a fast algorithm to reduce the complexity of constructing MAA from ${ \dot { O ( 2 ^ { T } ) } }$ to $O ( T ^ { 2 } )$ Extensive experiments on two large-scale video datasets show that our MAAN achieves a superior performance on weakly-supervised temporal action localization.
# 1 INTRODUCTION
Weakly-supervised temporal action localization has been of interest to the community recently. The setting is to train a model with solely video-level class labels, and to predict both the class and the temporal boundary of each action instance at the test time. The major challenge in the weakly-supervised localization problem is to find the right way to express and infer the underlying location information with only the video-level class labels. Traditionally, this is achieved by explicitly sampling several possible instances with different locations and durations (Bilen & Vedaldi, 2016; Kantorov et al., 2016; Zhang et al., 2017). The instance-level classifiers would then be trained through multiple instances learning (Cinbis et al., 2017; Yuan et al., 2017a) or curriculum learning (Bengio et al., 2009). However, the length of actions and videos varies too much such that the number of instance proposals for each video varies a lot and it can also be huge. As a result, traditional methods based on instance proposals become infeasible in many cases.
Recent research, however, has pivoted to acquire the location information by generating the class activation sequence (CAS) directly (Nguyen et al., 2018), which produces the classification score sequence of being each action for each snippet over time. The CAS along the 1D temporal dimension for a video is inspired by the class activation map (CAM) (Zhou et al., 2016a; 2014; Pinheiro & Collobert, 2015; Oquab et al., 2015) in weakly-supervised object detection. The CAM-based models have shown that despite being trained on image-level labels, convolutional neural networks (CNNs) have the remarkable ability to localize objects. Similar to object detection, the basic idea behind CAS-based methods for action localization in the training is to sample the non-overlapping snippets from a video, then to aggregate the snippet-level features into a video-level feature, and finally to yield a video-level class prediction. During testing, the model generates a CAS for each class that identifies the discriminative action regions, and then applies a threshold on the CAS to localize each action instance in terms of the start time and the end time.
In CAS-based methods, the feature aggregator that aggregates multiple snippet-level features into a video-level feature is the critical building block of weakly-supervised neural networks. A model’s ability to capture the location information of an action is primarily determined by the design of the aggregators. While using the global average pooling over a full image or across the video snippets has shown great promise in identifying the discriminative regions (Zhou et al., 2016a; 2014; Pinheiro & Collobert, 2015; Oquab et al., 2015), treating each pixel or snippet equally loses the opportunity to benefit from several more essential parts. Some recent works (Nguyen et al., 2018; Zhu et al., 2017) have tried to learn attentional weights for different snippets to compute a weighted sum as the aggregated feature. However, they suffer from the weights being easily dominated by only a few most salient snippets.
In general, models trained with only video-level class labels tend to be easily responsive to small and sparse discriminative regions from the snippets of interest. This deviates from the objective of the localization task that is to locate dense and integral regions for each entire action. To mitigate this gap and reduce the effect of the domination by the most salient regions, several heuristic tricks have been proposed to apply to existing models. For example, (Wei et al., 2017; Zhang et al., 2018b) attempt to heuristically erase the most salient regions predicted by the model which are currently being mined, and force the network to attend other salient regions in the remaining regions by forwarding the model several times. However, the heuristic multiple-run model is not end-to-end trainable. It is the ensemble of multiple-run mined regions but not the single model’s own ability that learns the entire action regions. “Hide-and-seek”(Singh & Lee, 2017) randomly masks out some regions of the input during training, enforcing the model to localize other salient regions when the most salient regions happen to be masked out. However, all the input regions are masked out with the same probability due to the uniform prior, and it is very likely that most of the time it is the background that is being masked out. A detailed discussion about related works can be found in Appendix D.
To this end, we propose the marginalized average attentional network (MAAN) to alleviate the issue raised by the domination of the most salient region in an end-to-end fashion for weakly-supervised action localization. Specifically, MAAN suppresses the action prediction response of the most salient regions by employing marginalized average aggregation (MAA) and learning the latent discriminative probability in a principled manner. Unlike the previous attentional pooling aggregator which calculates the weighted sum with attention weights, MAA first samples a subset of features according to their latent discriminative probabilities, and then calculates the average of these sampled features. Finally, MAA takes the expectation (marginalization) of the average aggregated subset features over all the possible subsets to achieve the final aggregation. As a result, MAA not only alleviates the domination by the most salient regions, but also maintains the scale of the aggregated feature within a reasonable range. We theoretically prove that, with the MAA, the learned latent discriminative probability indeed reduces the difference of response between the most salient regions and the others. Therefore, MAAN can identify more dense and integral regions for each action. Moreover, since enumerating all the possible subsets is exponentially expensive, we further propose a fast iterative algorithm to reduce the complexity of the expectation calculation procedure and provide a theoretical analysis. Furthermore, MAAN is easy to train in an end-to-end fashion since all the components of the network are differentiable. Extensive experiments on two large-scale video datasets show that MAAN consistently outperforms the baseline models and achieves superior performance on weakly-supervised temporal action localization.
In summary, our main contributions include: (1) a novel end-to-end trainable marginalized average attentional network (MAAN) with a marginalized average aggregation (MAA) module in the weaklysupervised setting; (2) theoretical analysis of the properties of MAA and an explanation of the reasons MAAN alleviates the issue raised by the domination of the most salient regions; (3) a fast iterative algorithm that can effectively reduce the computational complexity of MAA; and (4) a superior performance on two benchmark video datasets, THUMOS14 and ActivityNet1.3, on the weakly-supervised temporal action localization.
# 2 MARGINALIZED AVERAGE ATTENTIONAL NETWORK
In this section, we describe our proposed MAAN for weakly-supervised temporal action localization. We first derive the formulation of the feature aggregation module in MAAN as a MAA procedure in Sec. 2.1. Then, we study the properties of MAA in Sec. 2.2, and present our fast iterative computation algorithm for MAA construction in Sec. 2.3. Finally, we describe our network architecture that incorporates MAA, and introduce the corresponding inference process on weakly-supervised temporal action localization in Sec. 2.4.
 Figure 1: An illustration of the weighted sum aggregation and the marginalized average aggregation.
# 2.1 MARGINALIZED AVERAGE AGGREGATION
Let $\{ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \cdot \cdot \cdot \mathbf { x } _ { T } \}$ denote the set of snippet-level features to be aggregated, where $\mathbf { x } _ { t } \in \mathbb { R } ^ { m }$ is the $m$ dimensional feature representation extracted from a video snippet centered at time $t$ , and $T$ is the total number of sampled video snippets. The conventional attentional weighted sum pooling aggregates the input snippet-level features into a video-level representation $\overline { { \mathbf { x } } }$ . Denote the set of attentional weights corresponding to the snippet-level features as $\{ \lambda _ { 1 } , \lambda _ { 2 } , \dotsb \lambda _ { T } \}$ , where $\lambda _ { t }$ is a scalar attentional weight for $\mathbf { x } _ { t }$ . Then the aggregated video-level representation is given by
$$\overline { { \mathbf { x } } } = \sum _ { t = 1 } ^ { T } \lambda _ { t } \mathbf { x } _ { t } ,$$
as illustrated in Figure 1 (a). Different from the conventional aggregation mechanism, the proposed MAA module aggregates the features by firstly generating a set of binary indicators to determine whether a snippet should be sampled or not. The model then computes the average aggregation of these sampled snippet-level representations. Lastly, the model computes the expectation (marginalization) of the aggregated average feature for all the possible subsets, and obtains the proposed marginalized average aggregated feature. Formally, in the proposed MAA module, we first define a set of probabilities $\{ p _ { 1 } , p _ { 2 } , \cdot \cdot \cdot p _ { T } \}$ , where each $p _ { t } \in [ 0 , 1 ]$ is a scalar corresponding to $\mathbf { x _ { t } }$ , similar to the notation $\lambda _ { t }$ mentioned previously. We then sample a set of random variables $\{ z _ { 1 } , z _ { 2 } , \cdot \cdot \cdot z _ { T } \}$ , where $z _ { t } \sim B e r n o u l l i ( p _ { t } )$ , i.e., $z _ { t } \in \{ 0 , 1 \}$ with probability $P ( z _ { t } = 1 ) = p _ { t }$ . The sampled set is used to represent the subset selection of snippet-level features, in which $z _ { t } = 1$ indicates $\mathbf { x } _ { t }$ is selected, otherwise not. Therefore, the average aggregation of the sampled subset of snipped-level representations is given by $\begin{array} { r } { \overline { { \bf s } } = \sum _ { i = 1 } ^ { T } z _ { i } { \bf x } _ { i } / \sum _ { i = 1 } ^ { T } z _ { i } } \end{array}$ , and our proposed aggregated feature, defined as the expectation of all the possible subset-level average aggregated representations, is given by
$$\overline { { \mathbf { x } } } = \mathbb { E } [ \overline { { \mathbf { s } } } ] = \mathbb { E } \left[ \frac { \sum _ { i = 1 } ^ { T } z _ { i } \mathbf { x } _ { i } } { \sum _ { i = 1 } ^ { T } z _ { i } } \right] ,$$
which is illustrated in Figure 1 (b).
# 2.2 PARTIAL ORDER PRESERVATION AND DOMINANT RESPONSE SUPPRESSION
Direct learning and prediction with the attention weights $\lambda$ in Eq. (1) in weakly-supervised action localization leads to an over-response in the most salient regions. The MAA in Eq. (2) has two properties that alleviate the domination effect of the most salient regions. First, the partial order preservation property, i.e., the latent discriminative probabilities preserve the partial order with respect to their attention weights. Second, the dominant response suppression property, i.e., the differences in the latent discriminative probabilities between the most salient items and others are smaller than the differences between their attention weights. The partial order preservation property guarantees that it does not mix up the action and non-action snippets by assigning a high latent discriminative probability to a snippet with low response. The dominant response suppression property reduces the dominant effect of the most salient regions and encourages the identification of dense and more integral action regions. Formally, we present the two properties in Proposition 1 and Proposition 2, respectively. Detailed proofs can be found in Appendix A and Appendix B respectively.
Proposition 1. Let $z _ { i } \sim B e r n o u l l i ( p _ { i } )$ for $i \in \{ 1 , . . . , T \}$ . Then for $T \geq 2$ , Eq. (3) holds true, and $p _ { i } \geq p _ { j } \Leftrightarrow c _ { i } \geq c _ { j } \Leftrightarrow \lambda _ { i } \geq \lambda _ { j }$ .
$$\mathbb { E } \left[ \frac { \sum _ { i = 1 } ^ { T } z _ { i } \mathbf { x } _ { i } } { \sum _ { i = 1 } ^ { T } z _ { i } } \right] = \sum _ { i = 1 } ^ { T } c _ { i } p _ { i } \mathbf { x } _ { i } = \sum _ { i = 1 } ^ { T } \lambda _ { i } \mathbf { x } _ { i } ,$$
where $\begin{array} { r } { c _ { i } = \mathbb { E } \left[ 1 / ( 1 + \sum _ { k = 1 , k \neq i } ^ { T } z _ { k } ) \right] } \end{array}$ and $\lambda _ { i } = c _ { i } p _ { i }$ for $i \in \{ 1 , . . . , T \}$
Proposition 1 shows that the latent discriminative probabilities $\{ p _ { i } \}$ preserve the partial order of the attention weights $\{ \lambda _ { i } \}$ . This means that a large attention weight corresponds to a large discriminative probability, which guarantees that the latent discriminative probabilities preserve the ranking of the action prediction response. Eq. (3) can be seen as a factorization of the attention weight $\lambda _ { i }$ into the multiplication of two components, $p _ { i }$ and $c _ { i }$ , for $i \in \{ 1 , . . . , T \}$ . $p _ { i }$ is the latent discriminative probability related to the feature of snippet $i$ itself. The factor $c _ { i }$ captures the contextual information of snippet $i$ from the other snippets. This factorization can be considered to be introducing structural information into the aggregation. Factor $c _ { i }$ can be considered as performing a structural regularization for learning the latent discriminative probabilities $p _ { i }$ for $i \in \{ 1 , . . . , T \}$ , as well as for learning a more informative aggregation.
Proposition 2. Let $z _ { i } \sim B e r n o u l l i ( p _ { i } )$ for $i \in \{ 1 , . . . , T \}$ . Denote $\begin{array} { r } { c _ { i } = \mathbb { E } \left[ 1 / ( 1 + \sum _ { k = 1 , k \neq i } ^ { T } z _ { k } ) \right] } \end{array}$ and $\lambda _ { i } = c _ { i } p _ { i }$ for $i \in \{ 1 , . . . , T \}$ . Denote $\begin{array} { r } { \mathcal { T } = \Big \{ i \Big | c _ { i } \geq 1 / ( \sum _ { t = 1 } ^ { T } p _ { t } ) \Big \} } \end{array}$ as an index set. Then $\mathcal T \neq \emptyset$ and for $\forall i \in \mathcal { Z }$ , $\forall j \in \{ 1 , . . . , T \}$ inequality (4) holds true.
$$\left| \frac { p _ { i } } { \sum _ { t = 1 } ^ { T } p _ { t } } - \frac { p _ { j } } { \sum _ { t = 1 } ^ { T } p _ { t } } \right| \leq \left| \frac { \lambda _ { i } } { \sum _ { t = 1 } ^ { T } \lambda _ { t } } - \frac { \lambda _ { j } } { \sum _ { t = 1 } ^ { T } \lambda _ { t } } \right|$$
The index set $\mathcal { T }$ can be viewed as the most salient features set. Proposition 2 shows that the difference between the normalized latent discriminative probabilities of the most salient regions and others is smaller than the difference between their attention weights. It means that the prediction for each snippet using the latent discriminative probability can reduce the gap between the most salient featuress and the others compared to conventional methods that are based on attention weights. Thus, MAAN suppresses the dominant responses of the most salient featuress and encourages it to identify dense and more integral action regions.
Directly learning the attention weights $\lambda$ leans to an over response to the most salient region in weakly-supervised temporal localization. Namely, the attention weights for only a few snippets are too large and dominate the others, while attention weights for most of the other snippets that also belong to the true action are underestimated. Proposition 2 shows that latent discriminative probabilities are able to reduce the gap between the most salient features and the others compared to the attention weights. Thus, by employing the latent discriminative probabilities for prediction instead of the attention weights, our method can alleviate the dominant effect of the most salient region in weakly-supervised temporal localization.
# 2.3 RECURRENT FAST COMPUTATION
Given a video containing $T$ snippet-level representations, there are $2 ^ { T }$ possible configurations for the subset selection. Directly summing up all the $2 ^ { T }$ configurations to calculate $\overline { { \mathbf { x } } }$ has a complexity of $O ( 2 ^ { T } )$ . In order to reduce the exponential complexity, we propose an iterative method to calculate $\overline { { \mathbf { x } } }$ with ${ \dot { O } } ( T ^ { 2 } )$ complexity. Let us denote the aggregated feature of $\{ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \cdots \mathbf { x } _ { t } \}$ with length $t$ as $\mathbf { h } _ { t }$ , and denote $\mathbf { Y _ { t } } = \sum _ { i = 1 } ^ { t } z _ { i } \mathbf { x } _ { i }$ and $Z _ { t } = \sum _ { i = 1 } ^ { t } z _ { i }$ for simplicity, then we have a set of
$$\mathbf { h } _ { t } = \mathbb { E } \left[ \frac { \sum _ { i = 1 } ^ { t } z _ { i } \mathbf { x } _ { i } } { \sum _ { i = 1 } ^ { t } z _ { i } } \right] = \mathbb { E } \left[ \frac { \mathbf { Y _ { t } } } { Z _ { t } } \right] , t \in \{ 1 , 2 , \cdots , T \} ,$$
 Figure 2: The purple box demonstrates the marginalized average aggregation module, where the inputs are $\{ p _ { i } \} _ { i = 1 } ^ { 4 }$ and $\bf { \dot { \{ x _ { i } \} } _ { i = 1 } ^ { 4 } }$ and the output is $\mathbf { h } _ { 4 }$ . The two black boxes demonstrate the computation graphs of $q _ { i } ^ { t }$ and $\bf { m _ { i } ^ { t } }$ , respectively. The black hollow point indicates its value is 0, while the value of the black solid point is non-zero. $q _ { 0 } ^ { 0 }$ is initialized as 1.
and the aggregated feature of $\{ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \cdot \cdot \cdot \mathbf { x } _ { T } \}$ can be obtained as $\overline { { \mathbf { x } } } = \mathbf { h } _ { T }$ . In Eq. (5), $Z _ { t }$ is the summation of all the $z _ { i }$ , which indicates the number of elements selected in the subset. Although there are $2 ^ { t }$ distinct configurations for $\{ z _ { 1 } , z _ { 2 } , \cdot \cdot \cdot z _ { t } \}$ , it has only $t + 1$ distinct values for $Z _ { t }$ , i.e. $0 , 1 , \cdots , t$ . Therefore, we can divide all the $2 ^ { t }$ distinct configurations into $t + 1$ groups, where the configurations sharing with the same $Z _ { t }$ fall into the same group. Then the expectation $\mathbf { h } _ { t }$ can be calculated as the summation of the $t + 1$ parts. That is, $\begin{array} { r } { \mathbf { \dot { h } } _ { t } = \mathbb { E } \left[ \mathbb { E } \left[ \left. \frac { \mathbf { Y _ { t } } } { Z _ { t } } \right| Z _ { t } = i \right] \right] = \sum _ { i = 0 } ^ { t } \mathbf { m } _ { i } ^ { t } } \end{array}$ , where the $\mathbf { m } _ { i } ^ { t }$ , indicating the $i ^ { t h }$ part of $\mathbf { h } _ { t }$ for group $Z _ { t } = i$ , is shown in Eq. (6).
$$\mathbf { m } _ { i } ^ { t } = P \left( Z _ { t } = i \right) \mathbb { E } \left[ \frac { \mathbf { Y _ { t } } } { Z _ { t } } \bigg | Z _ { t } = i \right] .$$
In order to calculate $\begin{array} { r } { \mathbf { h } _ { t + 1 } = \sum _ { i = 0 } ^ { t + 1 } \mathbf { m } _ { i } ^ { t + 1 } } \end{array}$ , given $\mathbf { m } _ { i } ^ { t }$ , $i \in \{ 0 , \cdots , t \}$ , we can calculate t+1i , i ∈ $\{ 0 , 1 , \cdots , t + 1 \}$ recurrently. The key idea here is that $\mathbf { m } _ { i } ^ { t + 1 }$ comes from two cases: if $z _ { t + 1 } = 0$ , then $\mathbf { m } _ { i } ^ { t + 1 }$ is the same as $\mathbf { m } _ { i } ^ { t }$ ; if $z _ { t + 1 } = 1$ , then $\mathbf { m } _ { i } ^ { t + 1 }$ is the weighted average of $\mathbf { m } _ { i - 1 } ^ { t }$ and $\mathbf { x } _ { t + 1 }$ . The latter case is also related to the probability $P \left( Z _ { t } = i - 1 \right)$ . By denoting $q _ { i - 1 } ^ { t } = P \left( Z _ { t } = i - 1 \right)$ for simplicity, we can obtain $\mathbf { m } _ { i } ^ { t + 1 }$ as a function of several elements:
$$\mathbf { m } _ { i } ^ { t + 1 } = f ( \mathbf { m } _ { i - 1 } ^ { t } , \mathbf { m } _ { i } ^ { t } , \mathbf { x } _ { t + 1 } , p _ { t + 1 } , q _ { i - 1 } ^ { t } ) .$$
Similarly, the computation of $q _ { i } ^ { t + 1 } = P \left( Z _ { t + 1 } = i \right)$ comes from two cases: the probability of selecting $i - 1$ items from the first $t$ items and selecting the $\left( t + 1 \right) ^ { t h }$ item, i.e., $q _ { i - 1 } ^ { t } p _ { t + 1 }$ ; and the probability of selecting $i$ items all from the first $t$ items and not selecting the $\left( t + 1 \right) ^ { t h }$ item, i.e., $q _ { i } ^ { t } \left( 1 - p _ { t + 1 } \right)$ . We derive the function of $\mathbf { m } _ { i } ^ { t + 1 }$ and $\boldsymbol q _ { i } ^ { t + 1 }$ in Proposition 3. Detailed proofs can be found in Appendix C.
Proposition 3. Let zt ∼ Bernoulli(pt) , $Z _ { t } = \sum _ { i = 1 } ^ { t } z _ { i }$ and $\mathbf { Y _ { t } } = \sum _ { i = 1 } ^ { t } z _ { i } \mathbf { x } _ { i }$ for $t \in \{ 1 , . . . , T \}$ . Define $\mathbf { m } _ { i } ^ { t }$ $\mathbf { n } _ { i } ^ { t } \ , i \in \{ 0 , \cdot \cdot \cdot \ , t \}$ as Eq. (6) and $q _ { i } ^ { t } = P \left( Z _ { t } = i \right)$ , then $\mathbf { m } _ { i } ^ { t + 1 } \ i \in \{ 0 , 1 , \cdots , t + 1 \}$ can be obtained recurrently by Eq. (8) and Eq. (9).
$$\begin{array} { r l } & { \mathbf { m } _ { i } ^ { t + 1 } = p _ { t + 1 } \left( b _ { i - 1 } \mathbf { m } _ { i - 1 } ^ { t } + ( 1 - b _ { i - 1 } ) q _ { i - 1 } ^ { t } \mathbf { x } _ { t + 1 } \right) + ( 1 - p _ { t + 1 } ) \mathbf { m } _ { i } ^ { t } , } \\ & { ~ q _ { i } ^ { t + 1 } = p _ { t + 1 } q _ { i - 1 } ^ { t } + \left( 1 - p _ { t + 1 } \right) q _ { i } ^ { t } , } \end{array}$$
where $\begin{array} { r } { b _ { i } = \frac { i } { i + 1 } } \end{array}$ , ${ q _ { - 1 } ^ { t } = 0 }$ , $q _ { t + 1 } ^ { t } = 0$ , $q _ { 0 } ^ { 0 } = 1$ , $\mathbf { m } _ { 0 } ^ { t } = \mathbf { 0 }$ , and $\mathbf { m } _ { t + 1 } ^ { t } = \mathbf { 0 }$ .
Proposition 3 provides a recurrent formula to calculate $\mathbf { m } _ { i } ^ { t }$ . With this recurrent formula, we calculate the aggregation obtain the aggre $\mathbf { h } _ { T }$ by iteratived feature of $\mathbf { m } _ { i } ^ { t }$ fras $i = 1$ $t$ $t = 1$ to The $T$ . Therefore, we canerative computation $\{ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \cdot \cdot \cdot \mathbf { x } _ { T } \}$ $\begin{array} { r } { \overline { { \mathbf { x } } } = \mathbf { h } _ { T } = \sum _ { i = 0 } ^ { T } \mathbf { m } _ { i } ^ { T } } \end{array}$ procedure is summarized in Algorithm 1 in Appendix E. The time complexity is .
With the fast iterative algorithm in Algorithm 1, the MAA becomes practical for end-to-end training. A demonstration of the computation graph for $\boldsymbol q _ { i } ^ { t + 1 }$ in Eq. (9) and $\mathbf { \dot { m } } _ { i } ^ { t + 1 }$ in Eq. (8) is presented in the left and right-hand sides of Figure 2, respectively. From Figure 2, we can see clearly that, to compute $\mathbf { m } _ { 2 } ^ { 3 }$ (the big black node on the right), it needs $\mathbf { m } _ { 1 } ^ { 2 }$ , $\mathbf { m } _ { 2 } ^ { 2 }$ , x3, $p _ { 3 }$ , and $q _ { 1 } ^ { 2 }$ . The MAA can be easily implemented as a subnetwork for end-to-end training and can be used to replace the operation of other feature aggregators.
 Figure 3: Network architecture for the weakly-supervised action localization.
 Figure 4: The feature aggregators used in STPN and MAAN.
2.4 NETWORK ARCHITECTURE AND TEMPORAL ACTION LOCALIZATION
Network Architecture: We now describe the network architecture that employs the MAA module described above for weakly-supervised temporal action localization. We start from a previous stateof-the-art base architecture, the sparse temporal pooling network (STPN) (Nguyen et al., 2018). As shown in Figure 3, it first divides the input video into several non-overlapped snippets and extracts the I3D (Carreira & Zisserman, 2017) feature for each snippet. Each snippet-level feature is then fed to an attention module to generate an attention weight between 0 and 1. STPN then uses a feature aggregator to calculate a weighted sum of the snippet-level features with these class-agnostic attention weights to create a video-level representation, as shown on the left in Figure 4. The video-level representation is then passed through an FC layer followed by a sigmoid layer to obtain class scores. Our MAAN uses the attention module to generate the latent discriminative probability $p _ { t }$ and replaces the feature aggregator from the weighted sum aggregation by the proposed marginalized average aggregation, which is demonstrated on the right in Figure 4.
Training with video-level class labels: Formally, the model first performs aggregation of the i.e. . Th $\mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \cdots \mathbf { x } _ { T }$ ) to obtain the video-level reprogistic regression layer (FC layer entation sigmoid) $\bar { \textbf { x } } ( \bar { \textbf { x } } =$ $\mathbb { E } [ \bar { \sum _ { i = 1 } ^ { T } } z _ { i } \mathbf { x } _ { i } / \sum _ { i = 1 } ^ { T } z _ { i } ] )$ $^ +$ video-level classification prediction probability. Specifically, the prediction probability for class $c \in \{ 1 , 2 , \cdot \cdot \cdot C \}$ is parameterized as $\bar { \sigma } _ { j } ^ { c } = \sigma ( \bar { \mathbf { w } _ { c } ^ { \top } } \bar { \mathbf { x } } _ { j } )$ , where $\overline { { \mathbf { x } } } _ { j }$ is the aggregated feature for video $j \in \{ 1 , . . . , N \}$ . Suppose each video $\overline { { \mathbf { x } } } _ { j }$ is i.i.d and each action class is independent from the other, the negative log-likelihood function (cross-entropy loss) is given as follows:
$$\mathcal { L } ( \mathbf { W } ) = - \sum _ { j = 1 } ^ { N } \sum _ { c = 1 } ^ { C } \left( y _ { j } ^ { c } \log \sigma _ { j } ^ { c } + ( 1 - y _ { j } ^ { c } ) \log ( 1 - \sigma _ { j } ^ { c } ) \right) ,$$
where $y _ { j } ^ { c } \in \{ 0 , 1 \}$ is the ground-truth video-level label for class $c$ happening in video $j$ and $\mathbf { W } =$ $\left[ \mathbf { w } _ { 1 } , . . . , \mathbf { w } _ { C } \right]$ .
Temporal Action Localization: Let $\boldsymbol { s } ^ { c } = \mathbf { w } _ { c } ^ { \top } \overline { { \mathbf { x } } }$ be the video-level action prediction score, and $\sigma ( s ^ { c } ) = \sigma ( \mathbf { w } _ { c } ^ { \top } \overline { { \mathbf { x } } } )$ be the video-level action prediction probability. In STPN, as $\begin{array} { r } { \bar { \mathbf { x } } = \sum _ { t = 1 } ^ { T } \lambda _ { t } \mathbf { x } _ { t } } \end{array}$ , the $s ^ { c }$ can be rewritten as:
$$s ^ { c } = \mathbf w _ { c } ^ { \top } \overline { { \mathbf x } } = \sum _ { t = 1 } ^ { T } \lambda _ { t } \mathbf w _ { c } ^ { \top } \mathbf x _ { t } ,$$
In STPN, the prediction score of snippet $t$ for action class $\mathrm { c }$ in a video is defined as:
$$\begin{array} { r } { s _ { t } ^ { c } = \lambda _ { t } \sigma \big ( \mathbf { w } _ { c } ^ { \top } \mathbf { x } _ { t } \big ) , } \end{array}$$
where $\sigma ( \cdot )$ denotes the sigmoid function. In MAAN, as $\bar { \mathbf { x } } = \mathbb { E } [ \sum _ { i = 1 } ^ { T } z _ { i } \mathbf { x } _ { i } / \sum _ { i = 1 } ^ { T } z _ { i } ]$ , according to Proposition 1, the can be rewritten as:
$$s ^ { c } = \mathbf { w } _ { c } ^ { \top } \overline { { \mathbf { x } } } = \mathbf { w } _ { c } ^ { \top } \mathbb { E } [ \sum _ { i = 1 } ^ { T } z _ { i } \mathbf { x } _ { i } / \sum _ { i = 1 } ^ { T } z _ { i } ] = \sum _ { t = 1 } ^ { T } c _ { t } p _ { t } \mathbf { w } _ { c } ^ { \top } \mathbf { x } _ { t } .$$
The latent discriminative probability $p _ { t }$ corresponds to the class-agnostic attention weight for snippet $t$ . According to Proposition 1 and Proposition 2, $c _ { t }$ does not relate to snippet $t$ , but captures the context of other snippets. ${ \bf w } _ { c }$ corresponds to the class-specific weights for action class $c$ for all the snippets, and $\mathbf { w } _ { c } ^ { \top } \mathbf { x } _ { t }$ indicates the relevance of snippet $t$ to class $c$ . To generate temporal proposals, we compute the prediction score of snippet $t$ belonging to action class $c$ in a video as:
$$s _ { t } ^ { c } = p _ { t } \sigma ( \mathbf { w } _ { c } ^ { \top } \mathbf { x } _ { t } ) .$$
We denote the $\mathbf { s } ^ { c } = ( s _ { 1 } ^ { c } , s _ { 2 } ^ { c } , . . . , s _ { T } ^ { c } ) \top$ as the class activation sequence (CAS) for class $c$ . Similar to STPN, the threshold is applied to the CAS for each class to extract the one-dimensional connected components to generate its temporal proposals. We then perform non-maximum suppression among temporal proposals of each class independently to remove highly overlapped detections.
Compared to STPN (Eq. (12)), MAAN (Eq. (14)) employs the latent discriminative probability $p _ { t }$ instead of directly using the attention weight $\lambda _ { t }$ (equivalent to $c _ { t } p _ { t } \mathrm { . }$ ) for prediction. Proposition 2 suggests that MAAN can suppress the dominant response $s _ { t } ^ { c }$ compared to STPN. Thus, MAAN is more likely to achieve a better performance in weakly-supervised temporal action localization.
# 3 EXPERIMENTS
This section discusses the experiments on the weakly-supervised temporal action localization problem, which is our main focus. We have also extended our algorithm on addressing the weakly-supervised image object detection problem and the relevant experiments are presented in Appendix F.
# 3.1 EXPERIMENTAL SETTINGS
Datasets. We evaluate MAAN on two popular action localization benchmark datasets, THUMOS14 (Jiang et al., 2014) and ActivityNet1.3 (Heilbron et al., 2015). THUMOS14 contains 20 action classes for the temporal action localization task, which consists of 200 untrimmed videos (3,027 action instances) in the validation set and 212 untrimmed videos (3,358 action instances) in the test set. Following standard practice, we train the models on the validation set without using the temporal annotations and evaluate them on the test set. ActivityNet1.3 is a large-scale video benchmark for action detection which covers a wide range of complex human activities. It provides samples from 200 activity classes with an average of 137 untrimmed videos per class and 1.41 activity instances per video, for a total of 849 video hours. This dataset contains 10,024 training videos, 4,926 validation videos and 5,044 test videos. In the experiments, we train the models on the training videos and test on the validation videos.
Evaluation Metrics. We follow the standard evaluation metric by reporting mean average precision (mAP) values at several different levels of intersection over union (IoU) thresholds. We use the benchmarking code provided by ActivityNet1 to evaluate the models.
Implementation Details. We use two-stream I3D networks (Carreira & Zisserman, 2017) pre-trained on the Kinetics dataset (Kay et al., 2017) to extract the snippet-level feature vectors for each video. All the videos are divided into sets of non-overlapping video snippets. Each snippet contains 16 consecutive frames or optical flow maps. We input each 16 stacked RGB frames or flow maps into the I3D RGB or flow models to extract the corresponding 1024 dimensional feature vectors. Due to the various lengths of the videos, in the training, we uniformly divide each video into $T$ non-overlapped segments, and randomly sample one snippet from each segment. Therefore, we sample $T$ snippets for each video as the input of the model for training. We set $T$ to 20 in our MAAN model. The attention module in Figure 3 consists of an FC layer of $1 0 2 4 \times 2 5 6$ , a LeakyReLU layer, an FC layer of $2 5 6 \times 1$ , and a sigmoid non-linear activation, to generate the latent discriminative probability $p _ { t }$ We pass the aggregated video-level representation through an FC layer of $1 0 2 4 \times C$ followed by a sigmoid activation to obtain class scores. We use the ADAM optimizer (Kingma & Ba, 2014) with an initial learning rate of $5 \times 1 0 ^ { - 4 }$ to optimize network parameters. At the test time, we first reject classes whose video-level probabilities are below 0.1. We then forward all the snippets of the video to generate the CAS for the remaining classes. We generate the temporal proposals by cutting the CAS with a threshold th. The combination ratio of two-stream modalities is set to 0.5 and 0.5. Our algorithm is implemented in PyTorch 2. We run all the experiments on a single NVIDIA Tesla M40 GPU with a $2 4 \mathrm { G B }$ memory.
Table 1: Comparison of the proposed MAAN with four baseline feature aggregators on the THUMOS14 test set. All values are reported in percentage. The last column is the classification mAP.
<table><tr><td rowspan="2">Methods</td><td colspan="9">AP@IoU</td><td rowspan="2">Cls mAP</td></tr><tr><td>0.1</td><td>0.2</td><td>0.3</td><td>0.4</td><td>0.5</td><td>0.6</td><td>0.7</td><td>0.8</td><td>0.9</td></tr><tr><td>STPN</td><td>57.4</td><td>48.7</td><td>40.3</td><td>29.5</td><td>19.8</td><td>11.4</td><td>5.8</td><td>1.7</td><td>0.2</td><td>94.2</td></tr><tr><td>Dropout</td><td>53.4</td><td>44.9</td><td>35.4</td><td>25.0</td><td>16.2</td><td>8.7</td><td>4.3</td><td>1.3</td><td>0.1</td><td>92.4</td></tr><tr><td>Norm</td><td>48.0</td><td>39.9</td><td>30.5</td><td>20.9</td><td>12.3</td><td>5.7</td><td>2.4</td><td>0.6</td><td>0.1</td><td>95.2</td></tr><tr><td>SoftMaxNorm</td><td>22.2</td><td>17.2</td><td>12.8</td><td>9.6</td><td>6.3</td><td>4.3</td><td>2.8</td><td>1.0</td><td>0.1</td><td>94.8</td></tr><tr><td>MAAN</td><td>59.8</td><td>50.8</td><td>41.1</td><td>30.6</td><td>20.3</td><td>12.0</td><td>6.9</td><td>2.6</td><td>0.2</td><td>94.1</td></tr></table>
# 3.2 THUMOS14 DATASET
We first compare our MAAN model on the THUMOS14 dataset with several baseline models that use different feature aggregators in Figure 3 to gain some basic understanding of the behavior of our proposed MAA. The descriptions of the four baseline models are listed below.
(1) STPN. It employs the weighed sum aggregation $\begin{array} { r } { \bar { \mathbf { x } } = \sum _ { t = 1 } ^ { T } \lambda _ { t } \mathbf { x } _ { t } } \end{array}$ to generate the video-level representation. (2) Dropout. It explicitly performs dropout sampling with dropout probability $p = 0 . 5$ in STPN to obtain the video-level representation, $\begin{array} { r } { \bar { \mathbf { x } } = \sum _ { t = 1 } ^ { T } r _ { t } \bar { \lambda } _ { t } \mathbf { x } _ { t } } \end{array}$ , $r _ { t } \sim B e r n o u l l i ( 0 . 5 )$ . (3) Normalization. Denoted as “Norm” in the experiments, it utilizes the weighted average aggregation $\begin{array} { r } { \bar { \mathbf { x } } = \sum _ { t = 1 } ^ { T } \lambda _ { t } \mathbf { x } _ { t } / \sum _ { t = 1 } ^ { T } \lambda _ { t } } \end{array}$ for the video-level representation. (4) SoftMax Normalization. Denoted as “SoftMaxNorm” in the experiments, it applies the softmax function as the normalized weights to get the weighted average aggregated video-level feature, $\begin{array} { r } { \bar { \bf x } = \sum _ { t = 1 } ^ { T } e ^ { \lambda _ { t } } { \bf x } _ { t } / \sum _ { t = 1 } ^ { T } e ^ { \lambda _ { t } } } \end{array}$ .
We test all the models with the cutting threshold $^ { t h }$ as 0.2 of the max value of the CAS. We compare the detection average precision $( \% )$ at $\mathrm { I o U } = [ 0 . 1 : 0 . 1 : 0 . 9 ]$ and the video-level classification mean average precision $( \% )$ (denoted as Cls mAP) on the test set in Table 1. From Table 1, we can observe that although all the methods achieve a similar video-level classification mAP, their localization performances vary a lot. It shows that achieving a good video-level classification performance cannot guarantee obtaining a good snippet-level localization performance because the former only requires the correct prediction of the existence of an action, while the latter requires the correct prediction of both its existence and its duration and location. Moreover, Table 1 demonstrates that MAAN consistently outperforms all the baseline models at different levels of IoUs in the weakly-supervised temporal localization task. Both the “Norm” and “SoftmaxNorm” are the normalized weighted average aggregation. However, the “SoftmaxNorm” performs the worst, because the softmax function over-amplifies the weight of the most salient snippet. As a result, it tends to identify very few discriminative snippets and obtains sparse and non-integral localization. The “Norm” also performs worse than our MAAN. It is the normalized weighted average over the snippet-level representation, while MAAN can be considered as the normalized weighted average (expectation) over the subsetlevel representation. Therefore, MAAN encourages the identification of dense and integral action segments as compared to “Norm” which encourages the identification of only several discriminative snippets. MAAN works better than “Dropout” because “Dropout” randomly drops out the snippets with different attention weights by uniform probabilities. At each iteration, the scale of the aggregated feature varies a lot, however, MAAN samples with the learnable latent discriminative probability and conducts the expectation of keeping the scale of the aggregated feature stable. Compared to STPN, MAAN also achieves superior results. MAAN implicitly factorizes the attention weight into $c _ { t } p _ { t }$ , where $p _ { t }$ learns the latent discriminative probability of the current snippet, and $c _ { t }$ captures the contextual information and regularizes the network to learn a more informative aggregation. The properties of MAA disallow the predicted class activation sequences to concentrate on the most salient regions. The quantitative results show the effectiveness of the MAA feature aggregator.
 Figure 5: Visualization of the one-dimensional activation sequences on an example of the HammerThrow action in the test set of THUMOS14. The horizontal axis denotes the temporal dimension, which is normalized to [0, 1]. The first row of each model shows the ground-truth action segments. The second row demonstrates the predicted activation sequence for class HammerThrow.
Figure 5 visualizes the one-dimensional CASs of the proposed MAAN and all the baseline models. The temporal CAS generated by MAAN can cover large and dense regions to obtain more accurate action segments. In the example in Figure 5, MAAN can discover almost all the actions that are annotated in the ground-truth; however, the STPN have missed several action segments, and also tends to only output the more salient regions in each action segment. Other methods are much sparser compared to MAAN. The first row of Figure 5 shows several action segments in red and in green, corresponding to action segments that are relatively difficult and easy to be localized, respectively. We can see that all the easily-localized segments contain the whole person who is performing the “HammerThrow” action, while the difficultly-localized segments contain only a part of the person or the action. Our MAAN can successfully localize the easy segments as well as the difficult segments; however, all the other methods fail on the difficult ones. It shows that MAAN can identify several dense and integral action regions other than only the most discriminative region which is identified by the other methods.
We also compare our model with the state-of-the-art action localization approaches on the THUMOS14 dataset. The numerical results are summarized in Table 2. We include both fully and weakly-supervised learning, as in (Nguyen et al., 2018). As shown in Table 2, our implemented STPN performs slightly better than the results reported in the original paper (Nguyen et al., 2018). From Table 2, our proposed MAAN outperforms the STPN and most of the existing weakly-supervised action localization approaches. Furthermore, our model still presents competitive results compared with several recent fully-supervised approaches even when trained with only video-level labels.
# 3.3 ACTIVITYNET1.3 DATASET
We train the MAAN model on the ActivityNet1.3 training set and compare our performance with the recent state-of-the-art approaches on the validation set in Table 3. The action segment in ActivityNet is usually much longer than that of THUMOS14 and occupies a larger percentage of a video. We use a set of thresholds, which are [0.2, 0.15, 0.1, 0.05] of the max value of the CAS, to generate the proposals from the one-dimensional CAS. As shown in Table 3, with the set of thresholds, our implemented STPN performs slightly better than the results reported in the original paper (Nguyen et al., 2018). With the same threshold and experimental setting, our proposed MAAN model outperforms the STPN approach on the large-scale ActivityNet1.3. Similar to THUMOS14, our model also achieves good results that are close to some of the fully-supervised approaches.
Table 2: Comparison of our algorithm to the previous approaches on THUMOS14 test set. AP $( \% )$ is reported for different IoU thresholds. Both the fully-supervised and the weakly-supervised results are listed. (“UN”: using UntrimmedNet features, “I3D”: using I3D features, “ours”: our implementation.)
<table><tr><td rowspan="2">Supervision</td><td rowspan="2">Methods</td><td colspan="8">AP@IoU</td></tr><tr><td>0.1</td><td>0.2</td><td>0.3</td><td>0.4</td><td>0.5</td><td>0.6</td><td>0.7</td><td>0.8 0.9</td></tr><tr><td rowspan="8">Fully Supervised</td><td>Richard et al. (Richard & Gall, 2016)</td><td>39.7</td><td>35.7</td><td>30.0</td><td>23.2</td><td>15.2</td><td>-</td><td>-</td><td></td><td>■</td></tr><tr><td>Shou et al. (Shou et al.,2016)</td><td>47.7</td><td>43.5</td><td>36.3</td><td>28.7</td><td>19.0</td><td>10.3</td><td>5.3</td><td>=</td><td>=</td></tr><tr><td>Yeung et al. (Yeung et al.,2016)</td><td>48.9</td><td>44.0</td><td>36.0</td><td>26.4</td><td>17.1</td><td>-</td><td>-</td><td>-</td><td>=</td></tr><tr><td>Yuan et al.(Yuan et al.,2016)</td><td>51.4</td><td>42.6</td><td>33.6</td><td>26.1</td><td>18.8</td><td>=</td><td>-</td><td>=</td><td></td></tr><tr><td>Shou et al. (Shou et al., 2017)</td><td>-</td><td>-</td><td>40.1</td><td>29.4</td><td>23.3</td><td>13.1</td><td>7.9</td><td></td><td></td></tr><tr><td>Yuan et al. (Yuan et al.,2017b)</td><td>51.0</td><td>45.2</td><td>36.5</td><td>27.8</td><td>17.8</td><td>=</td><td>-</td><td>=</td><td></td></tr><tr><td>Xu et al. (Xu et al.,2017)</td><td>54.5</td><td>51.5</td><td>44.8</td><td>35.6</td><td>28.9</td><td></td><td></td><td></td><td></td></tr><tr><td>Zhao et al. (Zhao et al.,2017)</td><td>66.0</td><td>59.4</td><td>51.9</td><td>41.0</td><td>29.8</td><td>■</td><td>=</td><td>=</td><td></td></tr><tr><td rowspan="7">Weakly Supervised</td><td>Wang et al. (Wang et al., 2017)</td><td>44.4</td><td>37.7</td><td>28.2</td><td>21.1</td><td>13.7</td><td>=</td><td></td><td></td><td></td></tr><tr><td>Singh & Lee (Singh& Lee,2017)</td><td>36.4</td><td>27.8</td><td>19.5</td><td>12.7</td><td>6.8</td><td>=</td><td></td><td></td><td>=</td></tr><tr><td>STPN (Nguyen et al.,2018) (UN)</td><td>45.3</td><td>38.8</td><td>31.1</td><td>23.5</td><td>16.2</td><td>9.8</td><td>5.1</td><td>2.0</td><td>0.3</td></tr><tr><td>STPN (Nguyen et al., 2018) (I3D)</td><td>52.0</td><td>44.7</td><td>35.5</td><td>25.8</td><td>16.9</td><td>9.9</td><td>4.3</td><td>1.2</td><td>0.1</td></tr><tr><td>STPN (Nguyen et al.,2018) (ours)</td><td>57.4</td><td>48.7</td><td>40.3</td><td>29.5</td><td>19.8</td><td>11.4</td><td>5.8</td><td>1.7</td><td>0.2</td></tr><tr><td>AutoLoc (Shou et al.,2018)</td><td>■</td><td>■</td><td>35.8</td><td>29.0</td><td>21.2</td><td>13.4</td><td>5.8</td><td>-</td><td>-</td></tr><tr><td>MAAN (ours)</td><td>59.8</td><td>50.8</td><td>41.1</td><td>30.6</td><td>20.3</td><td>12.0</td><td>6.9</td><td>2.6</td><td>0.2</td></tr></table>
Table 3: Comparison of our algorithm to the state-of-the-art approaches on ActivityNet1.3 validation set. AP $( \% )$ is reported for different IoU threshold $\alpha$ . (“ours” means our implementation.)
<table><tr><td rowspan="2">Supervision</td><td rowspan="2">Methods</td><td colspan="3">AP @ IoU</td></tr><tr><td>0.5</td><td>0.75</td><td>0.95</td></tr><tr><td rowspan="4">Fully-supervised</td><td>Singh & Cuzzolin (Singh& Cuzzolin,2016)</td><td>34.5</td><td>-</td><td>1</td></tr><tr><td>Wang & Tao (Wang& Tao,2016)</td><td>45.1</td><td>4.1</td><td>0.0</td></tr><tr><td>Shou et al. (Shou et al.,2017)</td><td>45.3</td><td>26.0</td><td>0.2</td></tr><tr><td>Xiong et al. (Xiong et al.,2017)</td><td>39.1</td><td>23.5</td><td>5.5</td></tr><tr><td rowspan="3">Weakly-supervised</td><td>STPN (Nguyen et al., 2018)</td><td>29.3</td><td>16.9</td><td>2.6</td></tr><tr><td>STPN (Nguyen et al.,2018) (ours)</td><td>29.8</td><td>17.7</td><td>4.1</td></tr><tr><td>MAAN (ours)</td><td>33.7</td><td>21.9</td><td>5.5</td></tr></table>
# 4 CONCLUSION
We have proposed the marginalized average attentional network (MAAN) for weakly-supervised temporal action localization. MAAN employs a novel marginalized average aggregation (MAA) operation to encourage the network to identify the dense and integral action segments and is trained in an end-to-end fashion. Theoretically, we have proved that MAA reduces the gap between the most discriminant regions in the video to the others, and thus MAAN generates better class activation sequences to infer the action locations. We have also proposed a fast algorithm to reduce the computation complexity of MAA. Our proposed MAAN achieves superior performance on both the THUMOS14 and the ActivityNet1.3 datasets on weakly-supervised temporal action localization tasks compared to current state-of-the-art methods.
# 5 ACKNOWLEDGEMENT
We thank our anonymous reviewers for their helpful feedback and suggestions. Prof. Ivor W. Tsang was supported by ARC FT130100746, ARC LP150100671, and DP180100106.
# REFERENCES
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. ICLR, 2015.
Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In Proceedings of the 26th annual international conference on machine learning, pp. 41–48. ACM, 2009.
Hakan Bilen and Andrea Vedaldi. Weakly supervised deep detection networks. In CVPR, 2016.
J. Carreira and A Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In CVPR, 2017.
Ramazan Gokberk Cinbis, Jakob Verbeek, and Cordelia Schmid. Weakly supervised object localization with multi-fold multiple instance learning. IEEE transactions on pattern analysis and machine intelligence, 39(1):189–203, 2017.
Rohit Girdhar and Deva Ramanan. Attentional pooling for action recognition. In Advances in Neural Information Processing Systems, pp. 33–44, 2017.
Georgia Gkioxari, Ross Girshick, and Jitendra Malik. Contextual action recognition with $\mathbf { r } ^ { * }$ cnn. In Proceedings of the IEEE international conference on computer vision, pp. 1080–1088, 2015.
Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, pp. 1025–1035, 2017.
F. C. Heilbron, V. Escorcia, B. Ghanem, and J. C. Niebles. Activitynet: A large-scale video benchmark for human activity understanding. In CVPR, 2015.
Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In Advances in Neural Information Processing Systems, pp. 1693–1701, 2015.
Y.-G. Jiang, J. Liu, A. Roshan Zamir, G. Toderici, I. Laptev, M. Shah, and R. Sukthankar. THUMOS challenge: Action recognition with a large number of classes. http://crcv.ucf.edu/ THUMOS14/, 2014.
Vadim Kantorov, Maxime Oquab, Minsu Cho, and Ivan Laptev. ContextLocNet: Context-aware deep network models for weakly supervised localization. In ECCV, 2016.
W. Kay, J. Carreira, K. Simonyan, B. Zhang, C. Hillier, S. Vijayanarasimhan, F. Viola, T. Greem, T. Back, P. Natsev, M. Suleyman, and A. Zisserman. The kinetics human action video dataset. In arXiv:1705.06950v1, 2017.
Yoon Kim, Carl Denton, Luong Hoang, and Alexander M Rush. Structured attention networks. arXiv preprint arXiv:1702.00887, 2017.
D. Kingma and J. Ba. Adam: A method for stochastic optimization. In arXiv preprint arXiv:1412.6980, 2014.
Shu Kong and Charless Fowlkes. Low-rank bilinear pooling for fine-grained classification. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7025–7034. IEEE, 2017.
Arthur Mensch and Mathieu Blondel. Differentiable dynamic programming for structured prediction and attention. arXiv preprint arXiv:1802.03676, 2018.
Phuc Nguyen, Ting Liu, Gautam Prasad, and Bohyung Han. Weakly supervised action localization by sparse temporal pooling network. CVPR, 2018.
Maxime Oquab, Léon Bottou, Ivan Laptev, and Josef Sivic. Is object localization for free?-weaklysupervised learning with convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 685–694, 2015.
Pedro O Pinheiro and Ronan Collobert. From image-level to pixel-level labeling with convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1713–1721, 2015.
Alexander Richard and Juergen Gall. Temporal action detection using a statistical language model. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3131–3140, 2016.
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.
Shikhar Sharma, Ryan Kiros, and Ruslan Salakhutdinov. Action recognition using visual attention. arXiv preprint arXiv:1511.04119, 2015.
Zheng Shou, Dongang Wang, and Shih-Fu Chang. Temporal action localization in untrimmed videos via multi-stage cnns. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1049–1058, 2016.
Zheng Shou, Jonathan Chan, Alireza Zareian, Kazuyuki Miyazawa, and Shih-Fu Chang. CDC: convolutional-de-convolutional networks for precise temporal action localization in untrimmed videos. In CVPR, 2017.
Zheng Shou, Hang Gao, Lei Zhang, Kazuyuki Miyazawa, and Shih-Fu Chang. Autoloc: Weaklysupervised temporal action localization in untrimmed videos. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 154–171, 2018.
Karen Simonyan and Andrew Zisserman. Two-stream convolutional networks for action recognition in videos. In Advances in neural information processing systems, pp. 568–576, 2014.
Gurkirt Singh and Fabio Cuzzolin. Untrimmed video classification for activity detection: submission to activitynet challenge. arXiv preprint arXiv:1607.01979, 2016.
Krishna Kumar Singh and Yong Jae Lee. Hide-and-seek: Forcing a network to be meticulous for weakly-supervised object and action localization. In The IEEE International Conference on Computer Vision (ICCV), 2017.
Du Tran, Lubomir Bourdev, Rob Fergus, Lorenzo Torresani, and Manohar Paluri. Learning spatiotemporal features with 3d convolutional networks. In Proceedings of the IEEE international conference on computer vision, pp. 4489–4497, 2015.
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. 6000–6010, 2017.
C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie. The Caltech-UCSD Birds-200-2011 Dataset. Technical Report CNS-TR-2011-001, 2011.
Limin Wang, Yuanjun Xiong, Zhe Wang, Yu Qiao, Dahua Lin, Xiaoou Tang, and Luc Van Gool. Temporal segment networks: Towards good practices for deep action recognition. In European Conference on Computer Vision, pp. 20–36. Springer, 2016.
Limin Wang, Yuanjun Xiong, Dahua Lin, and Luc Van Gool. Untrimmednets for weakly supervised action recognition and detection. CVPR, 2017.
R. Wang and D. Tao. Acitivitynet large scale activity recognition challenge. UTS at Activitynet, 2016.
Yunchao Wei, Jiashi Feng, Xiaodan Liang, Ming-Ming Cheng, Yao Zhao, and Shuicheng Yan. Object region mining with adversarial erasing: A simple classification to semantic segmentation approach. In IEEE CVPR, 2017.
Yuanjun Xiong, Yue Zhao, Limin Wang, Dahua Lin, and Xiaoou Tang. A pursuit of temporal accuracy in general activity detection. arXiv preprint arXiv:1703.02716, 2017.
H. A. Xu, A. Das, and K. Saenko. R-c3d: Region convolutional 3d network for temporal activity detection. In ICCV, 2017. Serena Yeung, Olga Russakovsky, Greg Mori, and Li Fei-Fei. End-to-end learning of action detection from frame glimpses in videos. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2678–2687, 2016. J. Yuan, B. Ni, X. Yang, and A. A. Kassim. Temporal action localization with pyramid of score distribution features. In CVPR, 2016. Yuan Yuan, Xiaodan Liang, Xiaolong Wang, Dit-Yan Yeung, and Abhinav Gupta. Temporal dynamic graph LSTM for action-driven video object detection. In ICCV, pp. 1819–1828, 2017a. Z. Yuan, J. Stroud, T. Lu, and J. Deng. Temporal action localization by structured maximal sums. In CVPR, 2017b. Dingwen Zhang, Deyu Meng, and Junwei Han. Co-saliency detection via a self-paced multipleinstance learning framework. IEEE transactions on pattern analysis and machine intelligence, 39 (5):865–878, 2017. Jiani Zhang, Xingjian Shi, Junyuan Xie, Hao Ma, Irwin King, and Dit-Yan Yeung. Gaan: Gated attention networks for learning on large and spatiotemporal graphs. arXiv preprint arXiv:1803.07294, 2018a. Xiaolin Zhang, Yunchao Wei, Jiashi Feng, Yi Yang, and Thomas Huang. Adversarial complementary learning for weakly supervised object localization. arXiv preprint arXiv:1804.06962, 2018b. Y. Zhao, Y. Xiong, L. Wang, Z. Wu, X. Tang, and D. Lin. Temporal action detection with structured segment networks. In ICCV, 2017. B. Zhou, A. Khosla, Lapedriza. A., A. Oliva, and A. Torralba. Learning Deep Features for Discriminative Localization. CVPR, 2016a. Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Object detectors emerge in deep scene cnns. arXiv preprint arXiv:1412.6856, 2014. Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In Computer Vision and Pattern Recognition, 2016b. Yi Zhu, Yanzhao Zhou, Qixiang Ye, Qiang Qiu, and Jianbin Jiao. Soft proposal networks for weakly supervised object localization. arXiv preprint arXiv:1709.01829, 2017.
# A PROOF OF PROPOSITION 1
A.1 PROOF OF EQUATION (3)
Proof.
$$\mathbb { E } \left[ \frac { \sum _ { i = 1 } ^ { T } z _ { i } \mathbf { x } _ { i } } { \sum _ { i = 1 } ^ { T } z _ { i } } \right] = et { } { ' } \sum _ { i = 1 } ^ { T } \mathbb { E } [ z _ { i } / \sum _ { i = 1 } ^ { T } z _ { i } ] \mathbf { x } _ { i } .$$
In addition,
$$\mathbb { E } [ z _ { i } \big / \sum _ { i = 1 } ^ { T } z _ { i } ] = p _ { i } \times \mathbb { E } \left[ 1 / ( 1 + \sum _ { k = 1 , k \neq i } ^ { T } z _ { k } ) \right] + ( 1 - p _ { i } ) \times 0 = p _ { i } c _ { i } .$$
Thus, we achieve
$$\mathbb { E } \left[ \frac { \sum _ { i = 1 } ^ { T } z _ { i } \mathbf { x } _ { i } } { \sum _ { i = 1 } ^ { T } z _ { i } } \right] = \sum _ { i = 1 } ^ { T } c _ { i } p _ { i } \mathbf { x } _ { i } = \sum _ { i = 1 } ^ { T } \lambda _ { i } \mathbf { x } _ { i } .$$
A.2 PROOF OF $p _ { i } \geq p _ { j } \Leftrightarrow c _ { i } \geq c _ { j } \Leftrightarrow \lambda _ { i } \geq \lambda _ { j }$
Proof. Denote $\begin{array} { r } { S _ { T } = \sum _ { k = 1 , k \neq i , k \neq j } ^ { T } z _ { k } } \end{array}$ , then we have
$$\begin{array} { l } { c _ { i } - c _ { j } = \mathbb { E } [ 1 / ( 1 + \sum _ { k \neq i } z _ { k } ) ] - \mathbb { E } [ 1 / ( 1 + \sum _ { k \neq j } z _ { k } ) ] \qquad ( 1 - \sum _ { k \neq j } z _ { k } ) ] } \\ { = p _ { i } \mathbb { E } [ 1 / ( 2 + S _ { T } ) ] + ( 1 - p _ { i } ) \mathbb { E } [ 1 / ( 1 + S _ { T } ) ] - p _ { i } \mathbb { E } [ 1 / ( 2 + S _ { T } ) ] - ( 1 - p _ { i } ) \mathbb { E } [ 1 / ( 1 + S _ { T } ) ] } \end{array}$$
Since $\mathbb { E } \left[ 1 / ( 1 + S _ { T } ) \right] - \mathbb { E } \left[ 1 / ( 2 + S _ { T } ) \right] > 0$ , we achieve that $p _ { i } \geq p _ { j } \Leftrightarrow c _ { i } \geq c _ { j }$ . Since $\lambda _ { i } = c _ { i } p _ { i }$ and $\lambda _ { j } = c _ { j } p _ { j }$ , and $c _ { i } , c _ { j } , p _ { i } , p _ { j } \ge 0$ , it follows that $p _ { i } \geq p _ { j } \Leftrightarrow \lambda _ { i } \geq \lambda _ { j }$ .
# B PROOF OF PROPOSITION 2
$$\begin{array} { r } { \sum _ { i = 1 } ^ { T } c _ { i } p _ { i } = \sum _ { i = 1 } ^ { T } \mathbb { E } [ z _ { i } / \sum _ { i = 1 } ^ { T } z _ { i } ] = \mathbb { E } \left[ ( \sum _ { i = 1 } ^ { T } z _ { i } ) / ( \sum _ { i = 1 } ^ { T } z _ { i } ) \right] = 1 } \end{array}$$
When $p _ { 1 } = p _ { 2 } = \cdot \cdot \cdot = p _ { T }$ , we have $\lambda _ { 1 } = \lambda _ { 2 } = \cdot \cdot \cdot = \lambda _ { T }$ . Then inequality (4) trivially holds true. Without loss of generality, assume $p _ { 1 } \geq p _ { 2 } \geq \cdot \cdot \cdot \geq p _ { T }$ and there exists a strict inequality. Then $\exists k \in \{ 1 , . . . , T - 1 \}$ such that $c _ { i } \geq 1 / ( \sum _ { t = 1 } ^ { T } p _ { t } )$ for $1 \leq i \leq k$ and $c _ { j } \leq 1 / ( \sum _ { t = 1 } ^ { T } p _ { t } )$ for $k < j \le T$ . Otherwise, we obtain $c _ { i } \geq 1 / ( \sum _ { t = 1 } ^ { T } p _ { t } )$ or $c _ { i } \leq 1 / ( \sum _ { t = 1 } ^ { T } p _ { t } )$ for $1 \leq i \leq T$ and there exists a strict inequality. It follows that $\textstyle \sum _ { i = 1 } ^ { T } c _ { i } p _ { i } > 1$ or $\textstyle \sum _ { i = 1 } ^ { T } c _ { i } p _ { i } < 1$ , which contradicts PTi=1 cipi = 1. Thus, we obtain the set I 6= ∅.
Without loss of generality, for $1 \leq i \leq k$ and $i \le j \le T$ , we have $c _ { i } \geq 1 / ( \textstyle \sum _ { t = 1 } ^ { T } p _ { t } )$ and $p _ { i } \geq p _ { j }$ then we obtain that $c _ { i } \geq c _ { j }$ . It follows that
$$\begin{array} { r l } & { p _ { i } / ( \sum _ { t = 1 } ^ { T } p _ { t } ) - p _ { j } / ( \sum _ { t = 1 } ^ { T } p _ { t } ) - \left( \lambda _ { i } / ( \sum _ { t = 1 } ^ { T } \lambda _ { t } ) - \lambda _ { j } / ( \sum _ { t = 1 } ^ { T } \lambda _ { t } ) \right) } \\ & { = p _ { i } / ( \sum _ { t = 1 } ^ { T } p _ { t } ) - p _ { j } / ( \sum _ { t = 1 } ^ { T } p _ { t } ) - ( c _ { i } p _ { t } - c _ { j } p _ { j } ) } \\ & { = \left( 1 / ( \sum _ { t = 1 } ^ { T } p _ { t } ) - c _ { i } \right) p _ { i } - \left( 1 / ( \sum _ { t = 1 } ^ { T } p _ { t } ) - c _ { j } \right) p _ { j } } \\ & { \leq \left( 1 / ( \sum _ { t = 1 } ^ { T } p _ { t } ) - c _ { i } \right) p _ { i } - \left( 1 / ( \sum _ { t = 1 } ^ { T } p _ { t } ) - c _ { i } \right) p _ { j } } \\ & { = \left( 1 / ( \sum _ { t = 1 } ^ { T } p _ { t } ) - c _ { i } \right) ( p _ { i } - p _ { j } ) \leq 0 . } \end{array}$$
# C PROOF OF PROPOSITION 3
C.1 COMPUTATION OF $\mathbf { h } _ { t }$
$$\begin{array} { r l } { \mathbf { h } _ { t } = E [ \frac { \mathbf { Y _ { t } } } { Z _ { t } } ] = \displaystyle \sum _ { z _ { 1 } , z _ { 2 } , \ldots , z _ { t } } P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) \frac { \sum _ { j = 1 } ^ { t } z _ { j } \mathbf { x } _ { j } } { \sum _ { j = 1 } ^ { t } z _ { j } } } \\ { = \sum _ { i = 0 } ^ { t } \left( \displaystyle \sum _ { z _ { 1 } , z _ { 2 } , \ldots \ z _ { t } } \mathbf { 1 } \left( \sum _ { j = 1 } ^ { t } z _ { j } = i \right) P \left( z _ { 1 } , z _ { 2 } , \ldots , z _ { t } \right) \frac { \sum _ { j = 1 } ^ { t } z _ { j } \mathbf { x } _ { j } } { \sum _ { j = 1 } ^ { t } z _ { j } } \right) } \\ { = \sum _ { i = 0 } ^ { t } \displaystyle \sum _ { z _ { 1 } , z _ { 2 } , \ldots , z _ { t } } \mathbf { 1 } \left( \sum _ { j = 1 } ^ { t } z _ { j } = i \right) P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) \frac { \sum _ { j = 1 } ^ { t } z _ { j } \mathbf { x } _ { j } } { i } } \\ { = \sum _ { i = 0 } ^ { t } \mathbf { m } _ { i } ^ { t } , } \end{array}$$
where $\mathbf { 1 } ( \cdot )$ denotes the indicator function.
We achieve Eq. (26) by partitioning the summation into $t + 1$ groups . Terms belonging to group $i$ have $\textstyle \sum _ { j = 1 } ^ { t } z _ { j } = i$ .
Let $\begin{array} { r } { \mathbf { m } _ { i } ^ { t } = \underset { z _ { 1 } , z _ { 2 } , \cdots z _ { t } } { \sum } { \mathbf { 1 } } \left( \sum _ { j = 1 } ^ { t } z _ { j } = i \right) P \left( z _ { 1 } , z _ { 2 } , \cdot \cdot \cdot z _ { t } \right) \frac { \sum _ { j = 1 } ^ { t } z _ { j } \mathbf { x } _ { j } } { i } , } \end{array}$ and we achieve Eq. (28).
# C.2 PROOF OF RECURRENT FORMULA OF $m _ { i } ^ { t + 1 }$
We now give the proof of the recurrent formula of Eq. (29)
$$\mathbf { m } _ { i } ^ { t + 1 } = p _ { t + 1 } \left( b _ { i - 1 } \mathbf { m } _ { i - 1 } ^ { t } + ( 1 - b _ { i - 1 } ) q _ { i - 1 } ^ { t } \mathbf { x } _ { t + 1 } \right) + ( 1 - p _ { t + 1 } ) \mathbf { m } _ { i } ^ { t } .$$
Proof.
$$\begin{array} { l } { { \displaystyle { \bf { n } } _ { i } ^ { t + 1 } = \sum _ { z _ { 1 } , z _ { 2 } , \cdots z _ { t } , z _ { t + 1 } } { \bf { 1 } } \left( \sum _ { j = 1 } ^ { t + 1 } z _ { j } = i \right) P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t + 1 } \right) \frac { \sum _ { j = 1 } ^ { t + 1 } z _ { j } { \bf { x } } _ { j } } { i } } \eqno ( 3 0 ) } \\ { { \displaystyle \vphantom { \sum _ { j = 1 } ^ { t + 1 } z _ { 2 } , \cdots z _ { t } , z _ { t + 1 } } } } \\ { { \displaystyle = \sum _ { z _ { 1 } , z _ { 2 } , \cdots z _ { t } , z _ { t + 1 } } { \bf { 1 } } \left( \sum _ { j = 1 } ^ { t } z _ { j } + z _ { t + 1 } = i \right) P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) P ( z _ { t + 1 } ) \frac { \sum _ { j = 1 } ^ { t } z _ { j } { \bf { x } } _ { j } + z _ { t + 1 } { \bf { x } } _ { t + 1 } } { i } } } \end{array}$$
$$\begin{array} { r l } { \underset { + \leq t _ { 1 } , \ldots , \ldots , 1 } { \sum _ { i } } [ 1 ( \sum _ { j = 1 } ^ { \infty } z _ { j } + 1 - i ) P ( z _ { 1 } , z _ { 2 } , \ldots , z _ { k } ) ] P _ { + 1 } \sum _ { i , j = 1 } ^ { \infty } z _ { k } + \mathrm { s } _ { i } ] } \\ { = } & { \underset { + \sum _ { j = 1 } ^ { \infty } , \ldots , 1 } { \sum _ { i } } ( \sum _ { j = 1 } ^ { \infty } z _ { 3 } - 1 ) P ( z _ { 3 } , z _ { 2 } , \ldots , z _ { k } ) ( 1 - P _ { + k } ) \sum _ { i = 1 } ^ { \infty } z _ { k } } \\ & { } \\ { = } & { \underset { + \sum _ { j = 1 } ^ { \infty } , \ldots , 1 } { \sum _ { i , j = 1 } ^ { \infty } } ( \sum _ { j = 1 } ^ { \infty } z _ { j } + 1 - i ) P ( z _ { 3 } , z _ { 2 } , \ldots , \ldots , z _ { k } ) \rho _ { + 1 } \sum _ { i = 1 } ^ { \infty } z _ { k } ^ { \rho _ { + k } } ( 1 - i ) } \\ & { } \\ { = } & { 4 ( 1 - \rho _ { k + 1 } ) \underset { + \sum _ { j = 1 } ^ { \infty } , \ldots , 1 } { \sum _ { i , j = 1 } ^ { \infty } } ( \sum _ { j = 1 } ^ { \infty } z _ { 4 } - i ) P ( z _ { 4 } , z _ { 2 } , \ldots , \ldots , z _ { k } ) \frac { \sum _ { i = 1 } ^ { \infty } z _ { j } } { i } } \\ & { } \\ { = } & { R + \underset { + \sum _ { j = 1 } ^ { \infty } , \ldots , 1 } { \sum _ { i } } ( \sum _ { j = 1 } ^ { \infty } z _ { 5 } - i ) \int ( z _ { 1 } , z _ { 2 } , \ldots , z _ { k } ) \frac { \hat { \rho } _ { - k } ^ { - 1 } } { i } \frac { \sum _ { i = 1 } ^ { \infty } z _ { 5 } + \mathrm { s } _ { i } } { i } } \\ & { } \\ { = } & ( + \sum _ { j = 1 } ^ { \infty } \sum _ { i = 1 } ^ { \infty } ( \sum _ { j = 1 } ^ { \infty } z _ { j } - i ) \end{array}$$
Then, we have
$$\begin{array} { r l } { \mathbf { m } _ { i } ^ { t + 1 } = } & { \frac { p _ { t + 1 } b _ { i - 1 } } { z _ { 1 } , z _ { 2 } , \dots z _ { t } } \displaystyle \sum _ { z _ { i } \geq 1 } z _ { j } = i - 1 \int P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) \frac { \sum _ { j = 1 } ^ { t } z _ { j } \mathbf { x } _ { j } } { i - 1 } } \\ & { + p _ { t + 1 } ( 1 - b _ { i - 1 } ) \displaystyle \sum _ { z _ { 1 } , z _ { 2 } , \cdots z _ { t } } \mathbf { 1 } \left( \sum _ { j = 1 } ^ { t } z _ { j } = i - 1 \right) P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) \mathbf { x } _ { t + 1 } + ( 1 - p _ { t + 1 } ) \mathbf { m } _ { i } ^ { t } } \end{array}$$
Since $\begin{array} { r } { q _ { i - 1 } ^ { t } = { P } \left( \sum _ { j = 1 } ^ { t } z _ { j } = i - 1 \right) = \displaystyle \sum _ { z _ { 1 } , z _ { 2 } , \cdots z _ { t } } \mathbf { 1 } \left( \sum _ { j = 1 } ^ { t } z _ { j } = i - 1 \right) { P } \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) } \end{array}$ we can achieve
$$\mathbf { m } _ { i } ^ { t + 1 } = p _ { t + 1 } \left[ b _ { i - 1 } \mathbf { m } _ { i - 1 } ^ { t } + ( 1 - b _ { i - 1 } ) q _ { i - 1 } ^ { t } \mathbf { x } _ { t + 1 } \right] + ( 1 - p _ { t + 1 } ) \mathbf { m } _ { i } ^ { t } .$$
# C.3 PROOF OF RECURRENT FORMULA OF $\boldsymbol q _ { i } ^ { t + 1 }$
We present the proof of Eq. (39)
$$q _ { i } ^ { t + 1 } = p _ { t + 1 } q _ { i - 1 } ^ { t } + ( 1 - p _ { t + 1 } ) q _ { i } ^ { t }$$
Proof.
$$\begin{array} { r l } { d _ { t } ^ { ( d + 1 ) } = } & { \displaystyle \sum _ { z _ { j } , z _ { j } , \cdots \neq z _ { t } , z _ { t + 1 } } \mathbf { 1 } \left( \sum _ { j = 1 } ^ { t + 1 } z _ { j } = i \right) P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t + 1 } \right) } \\ { = } & { \displaystyle \sum _ { z _ { 1 } , z _ { j } , \cdots \neq z _ { t } , z _ { t + 1 } } \mathbf { 1 } \left( \sum _ { j = 1 } ^ { t } z _ { j } + z _ { t + 1 } = i \right) P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) P \left( z _ { k + 1 } \right) } \\ { = } & { \displaystyle \sum _ { z _ { 1 } , z _ { 2 } , \cdots \neq z _ { t } } \mathbf { 1 } \left( \sum _ { j = 1 } ^ { t } z _ { j } + 1 = i \right) P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) p _ { t + 1 } } \\ { + } & { \displaystyle \sum _ { z _ { 1 } , z _ { 2 } , \cdots \neq z _ { t } } \left( \sum _ { j = 1 } ^ { t } z _ { j } = i \right) P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) \left( 1 - p _ { t + 1 } \right) } \\ { = } & { p _ { t + 1 } \displaystyle \sum _ { z _ { 1 } , z _ { 2 } , \cdots \neq z _ { t } } \left( \sum _ { j = 1 } ^ { t } z _ { j } = i - 1 \right) P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) + ( 1 - p _ { t + 1 } ) q _ { t } ^ { i } } \\ { = } & { p _ { t + 1 } \displaystyle z _ { 1 } \displaystyle z _ { 2 } \cdots z _ { t } \left( \sum _ { j = 1 } ^ { t } z _ { j } = i - 1 \right) P \left( z _ { 1 } , z _ { 2 } , \cdots z _ { t } \right) + ( 1 - p _ { t + 1 } ) q _ { t } ^ { i } } \\ { = } & { p _ { t + 1 } q _ { t - 1 } ^ { i } + ( 1 - p _ { t + 1 } ) q _ { t } ^ { i } } \end{array}$$
# D RELATED WORK
Video Action Analysis. Researchers have developed quite a few deep network models for video action analysis. Two-stream networks (Simonyan & Zisserman, 2014) and 3D convolutional neural networks (C3D) (Tran et al., 2015) are popular solutions to learn video representations and these techniques, including their variations, are extensively used for video action analysis. Recently, a combination of two-stream networks and 3D convolutions, referred to as I3D (Carreira & Zisserman, 2017), was proposed as a generic video representation learning method, and served as an effective backbone network in various video analysis tasks such as recognition (Wang et al., 2016), localization (Shou et al., 2016), and weakly-supervised learning (Wang et al., 2017).
Weakly-Supervised Temporal Action Localization. There are only a few approaches based on weakly-supervised learning that rely solely on video-level class labels to localize actions in the temporal domain. Wang et al. (Wang et al., 2017) proposed a UntrimmedNet framework, where two softmax functions are applied across class labels and proposals to perform action classification and detect important temporal segments, respectively. However, using the softmax function across proposals may not be effective for identifying multiple instances. Singh et al. (Singh & Lee, 2017)
designed a Hide-and-Seek model to randomly hide some regions in a video during training and force the network to seek other relevant regions. However, the randomly hiding operation, as a data augmentation, cannot guarantee whether it is the action region or the background region that is hidden during training, especially when the dropout probabilities for all the regions are the same. Nguyen et al. (Nguyen et al., 2018) proposed a sparse temporal pooling network (STPN) to identify a sparse set of key segments associated with the actions through attention-based temporal pooling of video segments. However, the sparse constraint may force the network to focus on very few segments and lead to incomplete detection. In order to prevent the model from focusing only on the most salient regions, we are inspired to propose the MAAN model to explicitly take the expectation with respect to the average aggregated features of all the sampled subsets from the video.
Feature Aggregators. Learning discriminative localization representations with only video-level class labels requires the feature aggregation operation to turn multiple snippet-level representations into a video-level representation for classification. The feature aggregation mechanism is widely adopted in the deep learning literature and a variety of scenarios, for example, neural machine translation (Bahdanau et al., 2015), visual question answering (Hermann et al., 2015), and so on. However, most of these cases belong to fully-supervised learning where the goal is to learn a model that attends the most relevant features given the supervision information corresponding to the task directly. Many variant feature aggregators have been proposed, ranging from nonparametric max pooling and average pooling, to parametric hard attention (Gkioxari et al., 2015), soft attention (Vaswani et al., 2017; Sharma et al., 2015), second-order pooling (Girdhar & Ramanan, 2017; Kong & Fowlkes, 2017), structured attention (Kim et al., 2017; Mensch & Blondel, 2018), graph aggregators (Zhang et al., 2018a; Hamilton et al., 2017), and so on. Different from the fullysupervised setting where the feature aggregator is designed for the corresponding tasks, we develop a feature aggregator that is trained only with class labels, and then to be used to predict the dense action locations for test data. Different from the heuristic approaches (Wei et al., 2017; Zhang et al., 2018b) which can be considered as a kind of hard-code attention by erasing some regions with a hand-crafted threshold, we introduce the end-to-end differentiable marginalized average aggregation which incorporates learnable latent discriminative probabilities into the learning process.
# E MARGINALIZED AVERAGE AGGREGATION
<table><tr><td>Algorithm1 Marginalized Average Aggregation</td></tr><tr><td>Input: Feature Representations {x1, X2,·.· XT} , Sampling Probability {P1, P2,. pr}. Output: Aggregated Representation X Initialize mg=0,q=1,b=1; 2</td></tr><tr><td>for t = 1 to T do Set m= O,and q𝑡-1 = O and qt+1 = O;</td></tr><tr><td>fori=1 to tdo</td></tr><tr><td>q=ptq=1+(1-Pt)qt-1</td></tr><tr><td>m=pt (bi-1m1+(1-bi-1)a²=1xt)+(1-pt)mt-1</td></tr><tr><td>end for</td></tr><tr><td>end for</td></tr><tr><td>mT Return X=</td></tr></table>
# F EXPERIMENTS ON WEAKLY-SUPERVISED IMAGE OBJECT LOCALIZATION
# F.1 MODELS AND IMPLEMENTATION DETAILS
We also evaluate the proposed model on the weakly-supervised object localization task. For weaklysupervised object localization, we are given a set of images in which each image is labeled only with its category label. The goal is to learn a model to predict both the category label as well as the bounding box for the objects in a new test image.
Table 4: Localization error on CUB-200-2011 test set
<table><tr><td>Methods</td><td>top1 err@IoU0.5</td><td>top5 err@IoU0.5</td></tr><tr><td>GoogLeNet-GAP ((Zhou et al., 2016b))</td><td>59.00</td><td>-</td></tr><tr><td>weighted-CAM 4x4</td><td>58.51</td><td>51.73</td></tr><tr><td>weighted-CAM 7x7</td><td>58.11</td><td>50.21</td></tr><tr><td>MAAN 4x4</td><td>55.90</td><td>47.60</td></tr><tr><td>MAAN 7x7</td><td>53.94</td><td>44.13</td></tr></table>
Based on the model in (Zhou et al., 2016a) (denoted as CAM model), we replace the global average pooling feature aggregator with other kinds of feature aggregator, such as the weighted sum pooling and the proposed MAA by extending the original 1D temporal version in temporal action localization into a 2D spatial version. We denote the model with weighted sum pooling as the weighted-CAM model. For the weighted-CAM model and the proposed MAAN model, we use an attention module to generate the attention weight $\lambda$ in STPN or the latent discriminative probability $p$ in MAAN. The attention module consists of a 2D convolutional layer of kernel size $1 \times 1$ , stride 1 with 256 units, a LeakyReLU layer, a 2D convolutional layer of kernel size $1 \times 1$ , stride 1 with 1 unit, and a sigmoid non-linear activation.
# F.2 DATASET AND EVALUATION METRIC
We evaluate the weakly-supervised localization accuracy of the proposed model on the CUB-200- 2011 dataset (Wah et al., 2011). The CUB-200-2011 dataset has 11,788 images of 200 categories with 5,994 images for training and 5,794 for testing. We leverage the localization metric suggested by (Russakovsky et al., 2015) for comparison. This metric computes the percentage of images that is misclassified or with bounding boxes with less than $5 0 \%$ IoU with the groundtruth as the localization error.
# F.3 COMPARISONS
We compare our MAA aggregator (MAAN) with the weighted sum pooling (weighted-CAM) and global average pooling (CAM (Zhou et al., 2016b)). For MAAN and weighted-CAM, we pool the convolutional feature for aggregation into two different sizes, $4 \times 4$ and $7 \times 7$ . We fix all other factors (e.g. network structure, hyper-parameters, optimizer), except for the feature aggregators to evaluate the models.
# F.3.1 QUALITATIVE RESULTS
The localization errors for different methods are presented in Table 4, where the GoogLeNet-GAP is the CAM model. Our method outperforms GoogLeNet-GAP by $5 . 0 6 \%$ in a Top-1 error. Meanwhile, MAAN achieves consistently lower localization error than weighted-CAM on the two learning schemes. It demonstrates that the proposed MAAN can improve the localization performance in the weakly-supervised setting. Moreover, both MAAN and weighted-CAM obtain smaller localization error when employing the $7 \times 7$ learning scheme than the $4 \times 4$ learning scheme.
# F.3.2 VISUALIZATION
Figure 6 visualizes the heat maps and localization bounding boxes obtained by all the compared methods. The object localization heat maps generated by the proposed MAAN can cover larger object regions and obtain more accurate bounding boxes.
 Figure 6: Comparison with the baseline methods. The proposed MAAN can locate larger object regions to improve localization performance (ground-truth bounding boxes are in red and the predicted ones are in green).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243# TOWARDS NEURAL PHRASE-BASED MACHINE TRANSLATION
Po-Sen Huang?, Chong Wang∗†, Sitao Huang∗‡, Dengyong Zhou∗†, Li Deng∗ ?Microsoft Research, †Google, ‡University of Illinois at Urbana-Champaign, Citadel pshuang@microsoft.com, {chongw, dennyzhou}@google.com, shuang91@illinois.edu, l.deng@ieee.org
# ABSTRACT
In this paper, we present Neural Phrase-based Machine Translation (NPMT).1 Our method explicitly models the phrase structures in output sequences using SleepWAke Networks (SWAN), a recently proposed segmentation-based sequence modeling method. To mitigate the monotonic alignment requirement of SWAN, we introduce a new layer to perform (soft) local reordering of input sequences. Different from existing neural machine translation (NMT) approaches, NPMT does not use attention-based decoding mechanisms. Instead, it directly outputs phrases in a sequential order and can decode in linear time. Our experiments show that NPMT achieves superior performances on IWSLT 2014 German-English/EnglishGerman and IWSLT 2015 English-Vietnamese machine translation tasks compared with strong NMT baselines. We also observe that our method produces meaningful phrases in output languages.
# 1 INTRODUCTION
A word can be considered as a basic unit in languages. However, in many cases, we often need a phrase to express a concrete meaning. For example, consider understanding the following sentence, “machine learning is a field of computer science”. It may become easier to comprehend if we segment it as “[machine learning] [is] [a field of] [computer science]”, where the words in the bracket ‘[]’ are regarded as “phrases”. These phrases have their own meanings, and can often be reused in other contexts.
The goal of this paper is to explore the use of phrase structures aforementioned for neural networkbased machine translation systems (Sutskever et al., 2014; Bahdanau et al., 2015). To this end, we develop a neural machine translation method that explicitly models phrases in target language sequences. Traditional phrase-based statistical machine translation (SMT) approaches have been shown to consistently outperform word-based ones (Koehn et al., 2003; Koehn, 2009; Lopez, 2008). However, modern neural machine translation (NMT) methods (Sutskever et al., 2014; Bahdanau et al., 2015; Luong et al., 2015) do not have an explicit treatment on phrases, but they still work surprisingly well and have been deployed to industrial systems (Zhou et al., 2016; Wu et al., 2016). The proposed Neural Phrase-based Machine Translation (NPMT) method tries to explore the advantages from both kingdoms. It builds upon Sleep-WAke Networks (SWAN), a segmentation-based sequence modeling technique described in Wang et al. (2017a), where segments (or phrases) are automatically discovered given the data. However, SWAN requires monotonic alignments between inputs and outputs. This is often not an appropriate assumption in many language pairs. To mitigate this issue, we introduce a new layer to perform (soft) local reordering on input sequences. Experimental results show that NPMT outperforms attention-based NMT baselines in terms of the BLEU score (Papineni et al., 2002) on IWSLT 2014 German-English/English-German and IWSLT 2015 English-Vietnamese translation tasks. We believe our method is one step towards the full integration of the advantages from neural machine translation and phrase-based SMT.
 Figure 1: (a) The overall architecture of NPMT. (b) An illustration of using NPMT in German-English translation. Ideally, phrases in the source sentence (German) are first reordered. Given the new order, phrases can be translated one by one to the target phrases. These translated phrases then compose the target sentence (English). Phrase boundaries in the target language are not predefined, but automatically discovered by the model. No attention-based decoders are used here.
This paper is organized as follows. Section 2 presents the neural phrase-based machine translation model. Section 3 demonstrates the usefulness of our approach on several language pairs. We conclude our work with some discussions in Section 4.
# 2 NEURAL PHRASE-BASED MACHINE TRANSLATION
We first give an overview of the proposed NPMT architecture and some related work on incorporating phrases into NMT. We then describe the two key building blocks in NPMT: 1) SWAN, and 2) the soft reordering layer which alleviates the monotonic alignment requirement of SWAN. In the context of machine translation, we use “segment” and “phrase” interchangeably.
# 2.1 THE OVERALL ARCHITECTURE OF NPMT
Figure 1(a) shows the overall architecture of NPMT. The input sequence is first turned into embedding representations and then they go through a (soft) reordering layer (described below in Section 2.3). We then pass these “reordered” activations to the bi-directional RNN layers, which are finally fed into the SWAN layer to directly output target language in terms of segments (or phrases). While it is possible to replace bi-directional RNN layers with other layers (Gehring et al., 2017), in this paper, we have only explored this particular setting to demonstrate our proposed idea.
There have been several works that propose different ways to incorporate phrases into attentionbased neural machine translation, such as Tang et al. (2016); Wang et al. (2017b); Dahlmann et al. (2017). These approaches typically use predefined phrases (obtained by external methods, e.g., phrase-based SMT) to guide or modify the existing attention-based decoder. The major difference from our approach is that, in NPMT, we do not use attention-based decoding mechanisms, and our phrase structures for the target language are automatically discovered from the training data. Another line of related work is the segment-to-segment neural transduction model (SSNT) (Yu et al., 2016), which shows promising results on a Chinese-to-English translation task under a noisy channel framework (Yu et al., 2017). In SSNT, the segments are implicit, and the monotonic alignments between the inputs and outputs are achieved using latent variables. The latent variables are marginalized out during training using dynamic programming.
 Figure 2: Courtesy to Wang et al. (2017a). Symbol $\$ 1$ indicates the end of a segment. Given a sequence of inputs $x _ { 1 } , \ldots , x _ { 5 }$ , which is from the outputs from the bi-directional RNN of Figure 1(a), SWAN emits one particular segmentation of $y _ { 1 : 3 } = \pi ( a _ { 1 : 5 } )$ , where $\{ a _ { 1 } = \{ y _ { 1 } , \ S \} , a _ { 2 } = \{ \ S \} , a _ { 3 } = \{ \ S \} , a _ { 4 } = \{ y _ { 2 } , y _ { 3 } , \ S \} , a _ { 5 } = \{ \ S \} \}$ . Here $x _ { 1 }$ wakes (emitting segment $a _ { 1 }$ ) and $x _ { 4 }$ wakes (emitting segment $a _ { 4 }$ ) while $x _ { 2 }$ , $x _ { 3 }$ and $x _ { 5 }$ sleep (emitting empty segments $a _ { 2 } , a _ { 3 }$ and $a _ { 5 }$ respectively).
# 2.2 MODELING PHRASES WITH SWAN
Here we review the SWAN model proposed in Wang et al. (2017a). SWAN defines a probability distribution for the output sequence given an input sequence. It models all valid output segmentations of the output sequence as well as the monotonic alignments between the output segments and the input sequence. Empty segments are allowed in the output segmentations. It does not make any assumption on the lengths of input or output sequence.
Assume input sequence for SWAN is $x _ { 1 : T ^ { \prime } }$ , which is the outputs from bi-directional RNN of Figure 1(a), and output sequence is $y _ { 1 : T }$ . Let $\mathcal { S } _ { y }$ denote the set containing all valid segmentations of $y _ { 1 : T }$ , with the constraint that the number of segments in a segmentation is the same as the input sequence length, $T ^ { \prime }$ . Let $a _ { t }$ denote a segment or phrase in the target sequence. Empty segments are allowed to ensure that we can correctly align segment $a _ { t }$ to input element $x _ { t }$ . Otherwise, we might not have a valid alignment for the input and output pair. See Figure 2 for an example of the emitted segmentation of $y _ { 1 : T }$ . The probability of the sequence $y _ { 1 : T }$ is defined as the sum of the probabilities of all the segmentations in $S _ { y } \triangleq \{ a _ { 1 : T ^ { \prime } } : \pi ( a _ { 1 : T ^ { \prime } } ) = y _ { 1 : T } \}$ , 2
$$p ( y _ { 1 : T } | x _ { 1 : T ^ { \prime } } ) \stackrel { \triangle } { = } \sum _ { a _ { 1 : T ^ { \prime } } \in S _ { y } } \prod _ { t = 1 } ^ { T ^ { \prime } } p ( a _ { t } | x _ { t } ) ,$$
where the $p ( a _ { t } | \boldsymbol x _ { t } )$ is the segment probability given input element $x _ { t }$ , which is modeled using a recurrent neural network (RNN) with an additional softmax layer. $\pi ( \cdot )$ is the concatenation operator and the symbol $\$ 1$ , end of a segment, is ignored in the concatenation operator $\pi ( \cdot )$ . (An empty segment, which only contains $\$ 1$ will thus be ignored as well.) SWAN can be also understood via a generative model,
1. For $t = 1 , . . . , T ^ { \prime }$ : (a) Given an initial state of $x _ { t }$ , sample words from RNN until we reach an end of segment symbol $\$ 1$ . This gives us a segment $a _ { t }$ . 2. Concatenate $\{ a _ { 1 } , . . . , a _ { T ^ { \prime } } \}$ to obtain the output sequence via $\pi ( a _ { 1 : T ^ { \prime } } ) = y _ { 1 : T }$ .
Since there are more than one way to obtain the same $y _ { 1 : T }$ using the generative process above, the probability of observing $y _ { 1 : T }$ is obtained by summing over all possible ways, which is Eq. 1.
Note that $| S _ { y } |$ is exponentially large, direct summation quickly becomes infeasible when $T$ or $T ^ { \prime }$ is not small. Instead, Wang et al. (2017a) developed an exact dynamic programming algorithm to tackle the computation challenges.3 The key idea is that although the number of possible segmentations is exponentially large, the number of possible segments is polynomial— $O ( T ^ { 2 } )$ . In other words, it is possible to first compute all possible segment probabilities, $p ( a _ { t } | \boldsymbol x _ { t } )$ , $\forall a _ { t } , x _ { t }$ , and then use dynamic programming to calculate the output sequence probability $p \big ( y _ { 1 : T } \big | x _ { 1 : T ^ { \prime } } \big )$ in Eq. (1). The feasibility of using dynamic programming is due to a property of segmentations—a segmentation of a subsequence is also part of the segmentation of the entire sequence. In practice, a maximum length $L$ for a segment $a _ { t }$ is enforced to reduce the computational complexity, since the length of useful segments is often not very long. Wang et al. (2017a) also discussed a way to carry over information across segments using a separate RNN, which we will not elaborate here. We refer the readers to the original paper for the algorithmic details.
SWAN defines a conditional probability for an output sequence given an input one. It can be used in many sequence-to-sequence tasks. In practice, a sequence encoder like a bi-directional RNN can be used to process the raw input sequence (like speech signals or source language) to obtain $x _ { 1 : T ^ { \prime } }$ that is to be passed into SWAN for decoding. For example, Wang et al. (2017a) demonstrated the usefulness of SWAN in the context of speech recognition.
Greedy decoding for SWAN is straightforward. We first note that $p ( a _ { t } | x _ { t } )$ is modeled as an RNN with an additional softmax layer. Given each $p ( a _ { t } | x _ { t } ) , \forall t \in { 1 , \dots , T ^ { \prime } }$ , is independent of each other, we can run the RNN in parallel to produce an output segment (possibly empty) for each $p ( a _ { t } | x _ { t } )$ . We then concatenate these output segments to form the greedy decoding of the entire output sequence. The decoding satisfies the non-autoregressive property (Gu et al., 2018) and the decoding complexity is $O ( T ^ { \prime } L )$ . See Wang et al. (2017a) for the algorithmic details of the beam search decoder.
We finally note that, in SWAN (thus in NPMT), only output segments are explicit; input segments are implicitly modeled by allowing empty segments in the output. This is conceptually different from the traditional phrase-based SMT where both inputs and outputs are phrases (or segments). We leave the option of exploring explicit input segments as future work.
# 2.3 LOCAL REORDERING OF INPUT SEQUENCES
SWAN assumes a monotonic alignment between the output segments and the input elements. For speech recognition experiments in Wang et al. (2017a), this is a reasonable assumption. However, for machine translation, this is usually too restrictive. In neural machine translation literature, attention mechanisms were proposed to address alignment problems (Bahdanau et al., 2015; Luong et al., 2015; Raffel et al., 2017; Vaswani et al., 2017). But it is not clear how to apply a similar attention mechanism to SWAN due to the use of segmentations for output sequences.
One may note that in NPMT, a bi-directional RNN encoder for the source language can partially mitigate the alignment issue for SWAN, since it can access every source word. However, from our empirical studies, it is not enough to obtain the best performance. Here we augment SWAN with a reordering layer that does (soft) local reordering of the input sequence. This new model leads to promising results on the IWSLT 2014 German-English/English-German, and IWSLT 2015 EnglishVietnamese machine translation tasks. One additional advantage of using SWAN is that since SWAN does not use attention mechanisms, decoding can be done in parallel with linear complexity, as now we remove the need to query the entire input source for every output word (Raffel et al., 2017; Gu et al., 2018).
We now describe the details of the local reordering layer shown in Figure 3(a). Denote the input to the local reordering layer by $e _ { 1 : T ^ { \prime } }$ , which is the output from the word embedding layer of Figure 1(a), and the output of this layer by $h _ { 1 : T ^ { \prime } }$ , which is fed as inputs to the bi-directional RNN of Figure 1(a). We compute $h _ { t }$ as
$$h _ { t } = \operatorname { t a n h } \left( \sum _ { i = 0 } ^ { 2 \tau } \sigma \left( w _ { i } ^ { T } [ e _ { t - \tau } ; \ldots ; e _ { t } ; \ldots ; e _ { t + \tau } ] \right) e _ { t - \tau + i } \right) .$$
where $\sigma ( \cdot )$ is the sigmoid function, and $2 \tau + 1$ is the local reordering window size. Notation $\left[ e _ { t - \tau } ; \dots ; e _ { t } ; \dots ; e _ { t + \tau } \right]$ is the concatenation of vectors $e _ { t - \tau } , \ldots , e _ { t } , \ldots , e _ { t + \tau }$ . For $i = 0 , \ldots , 2 \tau$ , notation $w _ { i }$ is the parameter for the gate function at position $i$ of the input window. It decides the weight of $e _ { t - \tau + i }$ through the gate $\sigma \left( w _ { i } ^ { T } [ e _ { t - \tau } ; \dots ; e _ { t } ; \dots ; e _ { t + \tau } ] \right)$ . The final output $h _ { t }$ is a weighted linear combination of the input elements, $e _ { t - \tau } , \ldots , e _ { t } , \ldots , e _ { t + \tau }$ , in the window followed by a nonlinear transformation by the $\operatorname { t a n h } ( { \cdot } )$ function.
 Figure 3: (a) Example of a local reordering layer of window size 5 $\tau = 2 ,$ ) to compute $h _ { t }$ . Here $\sigma _ { t - 2 + i } \triangleq$ $\sigma ( \bar { w } _ { i } ^ { T } [ e _ { t - 2 } ; e _ { t - 1 } ; e _ { t } ; e _ { t + 1 } ; e _ { t + 2 } ] )$ , $i = 0 , \ldots , 4$ , are the gates that decides how much information $h _ { t }$ should accept from those elements from this input window. Note that all information available in this input window helps decides each gate. (b) An illustration of the reordering layer that swaps information between $e _ { 2 }$ and $e _ { 3 }$ and contributes to $h _ { 3 }$ and $h _ { 2 }$ , respectively.
Figure 3(b) illustrates how local reordering works. Here we want to (softly) select an input element from a window given all information available in this window. Suppose we have two adjacent windows, $( e _ { 1 } , e _ { 2 } , e _ { 3 } )$ and $( e _ { 2 } , e _ { 3 } , e _ { 4 } )$ . If $e _ { 3 }$ gets the largest weight $\mathrm { i } e _ { 3 }$ is picked) in the first window and $e _ { 2 }$ gets the largest weight $\stackrel { \cdot } { e } _ { 2 }$ is picked) in the second window, $e _ { 2 }$ and $e _ { 3 }$ are effectively reordered. Our layer is different from the attention mechanism (Bahdanau et al., 2015; Luong et al., 2015; Raffel et al., 2017; Vaswani et al., 2017) in following ways. First, we do not have a query to begin with as in standard attention mechanisms. Second, unlike standard attention, which is top-down from a decoder state to encoder states, the reordering operation is bottom-up. Third, the weights $\{ w _ { i } \} _ { i = 0 } ^ { 2 \tau }$ capture the relative positions of the input elements, whereas the weights are the same for different queries and encoder hidden states in the attention mechanism (no positional information). The reordering layer performs locally similar to a convolutional layer and the positional information is encoded by a different parameter $w _ { i }$ for each relative position $i$ in the window. Fourth, we do not normalize the weights for the input elements $e _ { t - \tau } , \ldots , e _ { t } , \ldots , e _ { t + \tau }$ . This provides the reordering capability and can potentially turn off everything if needed. Finally, the gate of any position $i$ in the reordering window is determined by all input elements $e _ { t - \tau } , \ldots , e _ { t } , \ldots , e _ { t + \tau }$ in the window. We provide a visualizing example of the reordering layer gates that performs input swapping in Appendix A.
One related work to our proposed reordering layer is the Gated Linear Units (GLU) (Dauphin et al., 2017) which can control the information flow of the output of a traditional convolutional layer. But GLU does not have a mechanism to decide which input element from the convolutional window to choose. From our experiments, neither GLU nor traditional convolutional layer helped our NPMT. Another related work to the window size of the reordering layer is the distortion limit in traditional phrase-based statistical machine translation methods (Brown et al., 1993). Different window sizes restrict the context of each position to different numbers of neighbors. We provide an empirical comparison of different window sizes in Appendix B.
# 3 EXPERIMENTS
In this section, we evaluate our model on the IWSLT 2014 German-English (Cettolo et al., 2014), IWSLT 2014 English-German, and IWSLT 2015 English-Vietnamese (Cettolo et al., 2015) machine translation tasks. We note that, in this paper, we limit the applications of our model to relatively small datasets to demonstrate the usefulness of our method. We plan to conduct more large scale experiments in future work.
Table 1: Translation results on the IWSLT 2014 German-English test set. MIXER Ranzato et al. (2015) uses a convolutional encoder and simpler attention. LL (attention model with log likelihood) and BSO (beam search optimization) of Wiseman & Rush (2016), and LL, $\mathsf { R F - C + L L }$ , and $\mathrm { \ A C + L L }$ of Bahdanau et al. (2017) use a one-layer GRU encoder and decoder with attention. (RF- $\mathrm { C + L L }$ and $\mathrm { \ A C + L L }$ are different settings of actor-critic algorithms combined with LL.) $\mathrm { L L ^ { * } }$ stands for a well-tuned attention model with log likelihood with the same word embedding size, and encoder and decoder size as NPMT.
<table><tr><td></td><td colspan="2">BLEU</td></tr><tr><td>MIXER (Ranzato et al., 2015)</td><td>Greedy 20.73</td><td>Beam Search 21.83</td></tr><tr><td>LL(Wiseman & Rush,2016)</td><td>22.53</td><td>23.87</td></tr><tr><td>BSO (Wiseman & Rush,2016)</td><td>23.83</td><td>25.48</td></tr><tr><td>LL (Bahdanau et al., 2017)</td><td>25.82</td><td>27.56</td></tr><tr><td>LL*</td><td>26.17</td><td>27.61</td></tr><tr><td>RF-C+LL (Bahdanau et al., 2017)</td><td>27.70</td><td>28.30</td></tr><tr><td>AC+LL (Bahdanau et al., 2017)</td><td>27.49</td><td>28.53</td></tr><tr><td>NPMT (this paper)</td><td>28.57</td><td>29.92</td></tr><tr><td>NPMT+LM (this paper)</td><td>1</td><td>30.08</td></tr></table>
# 3.1 IWSLT14 GERMAN-ENGLISH
We evaluate our model on the German-English machine translation track of the IWSLT 2014 evaluation campaign (Cettolo et al., 2014). The data comes from translated TED talks, and the dataset contains roughly 153K training sentences, 7K development sentences, and 7K test sentences. We use the same preprocessing and dataset splits as in Ranzato et al. (2015); Wiseman & Rush (2016); Bahdanau et al. (2017). The German and English vocabulary sizes are 32,010 and 22,823 respectively.
We report our IWSLT 2014 German-English experiments using one reordering layer with window size 7, two layers of bi-directional GRU encoder (Gated recurrent unit, Chung et al. (2014)) with 256 hidden units, and two layers of unidirectional GRU decoder with 512 hidden units. We add dropout with a rate of 0.5 in the GRU layer. We choose GRU since baselines for comparisons were using GRU. The maximum segment length is set to 6. Batch size is set as 32 (per GPU) and the Adam algorithm (Kingma & Ba, 2014) is used for optimization with an initial learning rate of 0.001. For decoding, we use greedy search and beam search with a beam size of 10. As reported in Maas et al. (2014); Bahdanau et al. (2017), we find that penalizing candidate sentences that are too short was required to obtain the best results. We add the middle term of Eq. (3) to encourage longer candidate sentences. All hyperparameters are chosen based on the development set. NPMT takes about 2–3 days to run to convergence (40 epochs) on a machine with four M40 GPUs. The results are summarized in Table 1. In addition to previous reported baselines in the literature, we also explored the best hyperparameter using the same model architecture (except the reordering layer) using sequence-to-sequence model with attention as reported as $\mathrm { L L ^ { * } }$ of Table 1.
NPMT achieves state-of-the-art results on this dataset as far as we know. Compared to the supervised sequence-to-sequence model, LL (Bahdanau et al., 2017), NPMT achieves 2.4 BLEU gain in the greedy setting and 2.25 BLEU gain using beam-search. Our results are also better than those from the actor-critic based methods in Bahdanau et al. (2017). But we note that our proposed method is orthogonal to the actor-critic method. So it is possible to further improve our results using the actor-critic method.
We also run the following two experiments to verify the sources of the gain. The first is to add a reordering layer to the original sequence-to-sequence model with attention, which gives us BLEU scores of 25.55 (greedy) and 26.91 (beam search). Since the attention mechanism and reordering layer capture similar information, adding the reordering layer to the sequence-to-sequence model with attention does not improve the performance. The second is to remove the reordering layer from NPMT, which gives us BLEU scores of 27.79 (greedy) and 29.28 (beam search). This shows that the reordering layer and SWAN are both important for the effectiveness of NPMT.
 Figure 4: An example of NPMT greedy decoding output for German-English translation. The example corresponds to the first example of Table 2. Note that for illustrating the input and output segments, we do not take into account of the behavior of the reordering layer and bi-directional RNN—the index mappings from source to target assumes monotonic alignments so some of them might be inaccurate.
Table 2: Examples of German-English translation outputs with their segmentations. We label the indexes of the words in the source sentence and we use those indexes to indicate where the output segment is emitted. For example, in greedy decoding results, $\cdots \ r { w o r d 1 } , \ldots , \ r { w o r d _ { m } } ^ { , }$ denotes $_ { i }$ -th word in the source sentence emits words $\mathtt { w o r d 1 } , \dots , \mathtt { w o r d } _ { m }$ during decoding (assuming monotonic alignments). The $\because$ represents the segment boundary in the target output. See Figure 4 for a visualization of row 1 in this table.
<table><tr><td>source greedy decoding target ground truth</td><td>1danke², aber 4dasbestekommt7noch8. 1thank you .²,. 3but · 5the best thing ·is stillcoming 8. thanks .i haven 't come to the best part .</td></tr><tr><td>source</td><td>1sie ²konnen einen 4schalter dazwischen einfugen und so haben 10sie 11einen 12kleinen13UNK14erstellt 15.</td></tr><tr><td>greedy decoding</td><td>1you can put · 4a switch · 5in between · 7and · 8so . 10they created . 12a little . 13UNK 14.</td></tr><tr><td>target ground truth source</td><td>you can put a knob in between and now you 've made a little UNK . sie²wollen die4entscheidungwirklichrichtig7treffen 8,9wenn 10es1fur</td></tr><tr><td>greedy decoding</td><td>12alle13ewigkeit14ist1516richtig 17? 1you really want to make· 4the decision · right . 8, 9if . 10it's . 11for ·</td></tr><tr><td>target ground truth</td><td>12all.13eternity .15.16right 17? you really want to get the decision right if it 's forall eternity,right ?</td></tr><tr><td>source</td><td>es²gibt zehntausende4maschinenrundum7dieweltdiekleine stuicke 12von 13dna14herstellen 15konnen 16,1730 18bis 1950 2buchstaben 211ang 22aber 23es</td></tr><tr><td>greedy decoding</td><td>24ist 25ein 26UNK 27 28,29als0 33ein 4stick 5macht 36, prozess 37umso8mehrfehler opasseren41. , 1there are · 3tens of thousands of · 4machines · around · 8the world ·9can make · 10litle11pieces .12of.13dna.16.1730.18to.1950.201eters .211ong .22, but o23it’'s s 26a more UNK .27process 8. 29so . 31the longer. 32you make'</td></tr><tr><td>target ground truth</td><td>34a piece . 36, 38the more 39mistakes 40happen 41. there are tens of thousands of machines around the world that make small pieces of dna - 30 to 5O letters - in length - and it 's a UNK process , so the longer you make the piece ,the more errors there are .</td></tr></table>
In greedy decoding, we can estimate the average segment length4 for the output. The average segment length is around 1.4–1.6, indicating phrases with more than one word are being decoded. Figure 4 shows an example of the input and decoding results with NPMT. We can observe phraselevel translation being captured by the model (e.g., “danke” “thank you”). The model also knows when to sleep before outputting a phrase (e.g., “das” $ ^ { 6 6 } \bar { \Phi } ^ { \bullet }$ ). We use the indexes of words in the source sentence to indicate where the output phrases are from. Table 2 shows some sampled examples. We can observe there are many informative segments in the decoding results, e.g., “tens of thousands of”, “the best thing”, “a little”, etc. There are also mappings from phrase to phrase, word to phrases, and phrase to word in the examples. Following the analysis, we show the most frequent phrase mappings in Appendix C.
We also explore an option of adding a language-model score during beam search as the traditional statistical machine translation does. This option might not make much sense in attention-based approaches, since the decoder itself is usually a neural network language model. In SWAN, however, there is no language models directly involved in the segmentation modeling,5 and we find it useful to have an external language model during beam search. We use a 4th-order language model trained using the KenLM implementation (Heafield et al., 2013) for English target training data. So the final beam search score we use is
$$Q ( y ) = \log p ( y | x ) + \lambda _ { 1 } \mathrm { w o r d \_ c o u n t } ( y ) + \lambda _ { 2 } \log p _ { \mathrm { l m } } ( y ) ,$$
where we empirically find that $\lambda _ { 1 } = 1 . 2$ and $\lambda _ { 2 } = 0 . 2$ give good performance, which are tuned on the development set. The results with the external language model are denoted by NPMT+LM in Table 1. If no external language models are used, we set $\lambda _ { 2 } = 0$ . This scoring function is similar to the one for speech recognition in Hannun et al. (2014).
# 3.2 IWSLT14 ENGLISH-GERMAN
We also evaluate our model on the opposition direction, English-German, which translates from a more segmented text to a more inflectional one. Following the setup in Section 3.1, we use the same dataset with the opposite source and target languages. We use the same model architecture, optimization algorithm and beam search size as the German-English translation task. NPMT takes about 2–3 days to run to convergence (40 epochs) on a machine with four M40 GPUs.
Given there is no previous sequence-to-sequence attention model baseline for this setup, we create a strong one and tune hyperparameters on the development set. The results are shown in Table 3. Based on the development set, we set $\lambda _ { 1 } = 1$ and $\lambda _ { 2 } = 0 . 1 5$ in Eq. (3). Our model outperforms sequence-to-sequence model with attention by 2.46 BLEU and 2.49 BLEU in greedy and beam search cases. We can also use a 4th-order language model trained using the KenLM implementation for German target training data, which further improves the performance. Some sampled examples are shown in Table 4. Several informative segments/phrases can be found in the decoding results, e.g., “some time ago” “vor enniger zeit”.
Table 3: Translation results on the IWSLT 2014 English-German test set.
<table><tr><td></td><td colspan="2">BLEU</td></tr><tr><td></td><td>Greedy</td><td>Beam Search</td></tr><tr><td>Sequence-to-sequence with attention</td><td>21.26</td><td>22.59</td></tr><tr><td>NPMT (this paper)</td><td>23.62</td><td>25.08</td></tr><tr><td>NPMT+LM (this paper)</td><td>1</td><td>25.36</td></tr></table>
# 3.3 IWSLT15 ENGLISH-VIETNAMESE
In this section, we evaluate our model on the IWSLT 2015 English to Vietnamese machine translation task. The data is from translated TED talks, and the dataset contains roughly 133K training sentence pairs provided by the IWSLT 2015 Evaluation Campaign (Cettolo et al., 2015). Following the same preprocessing steps in Luong & Manning (2015); Raffel et al. (2017), we use the TED tst2012 (1553 sentences) as a validation set for hyperparameter tuning and TED tst2013 (1268 sentences) as a test set. The Vietnamese and English vocabulary sizes are 7,709 and 17,191 respectively.
Table 4: Examples of English-German translation outputs with their segmentations. The meanings of the superscript indexes and the “•” symbol are the same as those in Table 2.
<table><tr><td>source greedy decoding target ground truth</td><td>1how ²would you 4guysdescribeyour7brand ? 1 wie · ²wurdet · Зsie ·ihre marke ·&beschreiben ? wie wirdet ihr eure marke beschreiben ?</td></tr><tr><td>source greedy decoding target ground truth</td><td>1if²themuseum 4has given us7theimage9,10youclick 12on1it 14. 1wenn . ²das museum uns 7das bild 9gegeben hat , 10klicken sie . i3darauf 14. wenn das museum uns das bild gegeben hat,klicken sie darauf </td></tr><tr><td>source greedy decoding</td><td>theyarefrustratedashellwithit8buttheyre2notcomplaining 1about5it16ey8in2it2 1sie sind . 3frustriert 8, . 9aber 10sie UNK sich . 12nicht ·</td></tr><tr><td>target ground truth</td><td>15daruber . 16,. 17sie reparieren . 20es . 21. sie sie sind furchterlich frustriert mit ihr,aber sie beschweren sich nicht daruber,</td></tr><tr><td>source</td><td>sie reparieren sie.? 1now²some time 4ago 5,if 7you wantedto 10win 12 formula 13114race 17take 18a1 1516 19budget2 2021 22, 23bet you and 2you</td></tr><tr><td>greedy decoding</td><td>24your 25budget 26on 28 129driver 30 31 32 2good 33car34. good Pand a 2yoreiniger zeit wenn.man 11eine formel 15 5gewinnen will, . 18ein budget . 21und 23 24ihr budget ·2 27 auf einem guten .2 29fahrer · 31ein gutes · : ,dass·</td></tr><tr><td>target ground truth</td><td>33auto . 34 vor einiger zeit war es so ,dass wenn sie ein formel 1 rennen gewinnen wollten, dann nahmen sie ihr budget und setzten ihr geld auf einen guten fahrer und ein gutes auto</td></tr></table>
We use one reordering layer with window size 7, two layers of bi-directional LSTM (Long shortterm memory, Hochreiter & Schmidhuber (1997)) encoder with 512 hidden units, and three layers of unidirectional LSTM decoder with 512 hidden units. We add dropout with a rate of 0.4 in the LSTM layer. We choose LSTM since baselines for comparisons were using LSTM. The maximum segment length is set to 7. Batch size is set as 48 (per GPU) and the Adam algorithm Kingma & Ba (2014) is used for optimization with an initial learning rate of 0.001. For decoding, we use greedy decoding and beam search with a beam size of 10. The results are shown in Table 5. Based on the development set, we set $\lambda _ { 1 } = 0 . 7$ and $\lambda _ { 2 } = 0 . 1 5$ in Eq. (3). NPMT takes about one day to run to convergence (15 epochs) on a machine with $4 ~ \mathrm { M 4 0 }$ GPUs. Our model outperforms sequence-tosequence model with attention by 1.41 BLEU and 1.59 BLEU in greedy and beam search cases. We also use a 4th-order language model trained using the KenLM implementation for Vietnamese target training data, which further improves the BLEU score. Note that our reordering layer relaxes the monotonic assumption as in Raffel et al. (2017) and is able to decode in linear time. Empirically we outperform models with monotonic attention. Table 6 shows some sampled examples.
Table 5: Translation results on the IWSLT 2015 English-Vietnamese tst2013 test set. The result of the sequence-to-sequence model with attention is obtained from an open source model provided by the authors.7
<table><tr><td></td><td colspan="2">BLEU</td></tr><tr><td></td><td>Greedy</td><td>Beam Search</td></tr><tr><td>Hard monotonic (Raffel et al., 2017)</td><td>23.00</td><td></td></tr><tr><td>Luong & Manning (2015)</td><td>-</td><td>23.30</td></tr><tr><td>Sequence-to-sequence model with attention</td><td>25.50</td><td>26.10</td></tr><tr><td>NPMT (this paper)</td><td>26.91</td><td>27.69</td></tr><tr><td>NPMT+LM (this paper)</td><td>1</td><td>28.07</td></tr></table>
# 4 CONCLUSION
We proposed NPMT, a neural phrase-based machine translation system that models phrase structures in the target language using SWAN. We also introduced a local reordering layer to mitigate the monotonic alignment requirement in SWAN. Our experimental results showed promising results on IWSLT 2014 German-English, English-German, and IWSLT 2015 English-Vietnamese machine translation tasks. The results suggest that NPMT can potentially be extended to explore the structures in other challenging sequence-to-sequence problems. In future work, we will explore two directions: 1) speed up NPMT and apply it to larger datasets and more language pairs; 2) investigate how to learn input and output phrases simultaneously.
Table 6: Examples of English-Vietnamese translation outputs with their segmentations. The meanings of the superscript indexes and the $\because$ symbol are the same as those in Table 2.
<table><tr><td>source greedy decoding target ground truth</td><td>1And²1³figured4,5thishas7to8stop9. 1Va · ²toi · 3nhan ra rang · 4, . 5dieu nay · phaio 8dung lai 9. Va toi nhan ra rang diéu do phai cham dut .</td></tr><tr><td>source greedy decoding</td><td>1So ²great progress 4and treatment has 7been 8madeover 10the 1years 12 1Vi vay,.²tien boo 4va . 5dieu tri da.7duoc .8tao ra trong ·10nhung ·</td></tr><tr><td>target ground truth</td><td>11nam.12. Trong suot nhung nam qua da có su tién bo to lon trong qua trinh diéu tri .</td></tr><tr><td>source</td><td>The²passion that4theperson has7forherowngrowth 1is 1²the 13most14 important15 thing1 16</td></tr><tr><td>greedy decoding</td><td>1Niem dam me · 3rang · 5nguoi . 6c6· 7 cho · 8su phat trien . 10cua co ay . 111a · 13dieu14quan trong 15nhat 16.</td></tr><tr><td>target ground truth source</td><td>Cai khat vong cua nguoi phu nu c6 cho su phat trien cua ban than la thu quan trong nhat . 1We 2haveeightspeciesofUNK that occur in 10Kenya 1112of13which4six</td></tr><tr><td>greedy decoding</td><td>15are16highly17threatened 18with 19 extinction 20. 1Chung ta .2c6.38 41oai *6 UNK 8xay ra .9%. 10Kenya.11,. 146.</td></tr><tr><td>target ground truth</td><td>17bi de doa . 19tuyet chung 20.</td></tr><tr><td></td><td>Chung ta c6 8 loai kén kén xuat hien tai Kenya ,trong dó có 6 loai bi de doa voi nguy cd tuyet chung cao.</td></tr></table>
# 5 ACKNOWLEDGMENTS
We thank Jacob Devlin, Adith Swaminathan, Frank Seide, Xiaodong He, and anonymous reviewers for their valuable feedback.
# REFERENCES
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations, 2015.
Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron C. Courville, and Yoshua Bengio. An actor-critic algorithm for sequence prediction. In International Conference on Learning Representations, 2017.
Peter F Brown, Vincent J Della Pietra, Stephen A Della Pietra, and Robert L Mercer. The mathematics of statistical machine translation: Parameter estimation. Computational linguistics, 19(2): 263–311, 1993.
Mauro Cettolo, Jan Niehues, Sebastian Stuker, Luisa Bentivogli, and Marcello Federico. Report on ¨ the 11th IWSLT evaluation campaign, IWSLT 2014. In Proceedings of IWSLT, 2014.
Mauro Cettolo, Jan Niehues, Sebastian Stuker, Luisa Bentivogli, Roldano Cattoni, and Marcello ¨ Federico. The IWSLT 2015 evaluation campaign. In International Conference on Spoken Language, 2015.
Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
Leonard Dahlmann, Evgeny Matusov, Pavel Petrushkov, and Shahram Khadivi. Neural machine translation leveraging phrase-based models in a hybrid search. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 1422–1431, 2017.
Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In International Conference on Machine Learning (ICML), 2017.
Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. In ICML, 2017.
Jiatao Gu, James Bradbury, Caiming Xiong, Victor O.K. Li, and Richard Socher. Nonautoregressive neural machine translation. In International Conference on Learning Representations, 2018.
Awni Hannun, Carl Case, Jared Casper, Bryan Catanzaro, Greg Diamos, Erich Elsen, Ryan Prenger, Sanjeev Satheesh, Shubho Sengupta, Adam Coates, et al. Deep speech: Scaling up end-to-end speech recognition. arXiv preprint arXiv:1412.5567, 2014.
Kenneth Heafield, Ivan Pouzyrevsky, Jonathan H. Clark, and Philipp Koehn. Scalable modified Kneser-Ney language model estimation. In Proceedings of the 51th Annual Meeting of the Association for Computational Linguistics: Short Papers-Volume 2, pp. 690–696, 2013.
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 9(8): 1735–1780, 1997.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
Philipp Koehn. Statistical Machine Translation. Cambridge University Press, 2009.
Philipp Koehn, Franz Josef Och, and Daniel Marcu. Statistical phrase-based translation. In Proceedings of the 2003 Conference of the North American Chapter of the Association for Computational Linguistics on Human Language Technology-Volume 1, pp. 48–54, 2003.
Adam Lopez. Statistical machine translation. ACM Computing Surveys (CSUR), 40(3):8, 2008.
Minh-Thang Luong and Christopher D Manning. Stanford neural machine translation systems for spoken language domains. In Proceedings of the International Workshop on Spoken Language Translation, 2015.
Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attentionbased neural machine translation. arXiv preprint arXiv:1508.04025, 2015.
Andrew L. Maas, Awni Y. Hannun, Daniel Jurafsky, and Andrew Y. Ng. First-pass large vocabulary continuous speech recognition using bi-directional recurrent DNNs. CoRR, abs/1408.2873, 2014.
Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. BLEU: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting on Association for Computational Linguistics, pp. 311–318, 2002.
Colin Raffel, Thang Luong, Peter J Liu, Ron J Weiss, and Douglas Eck. Online and linear-time attention by enforcing monotonic alignments. In International Conference on Machine Learning (ICML), 2017.
Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. CoRR, abs/1511.06732, 2015.
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.
Yaohua Tang, Fandong Meng, Zhengdong Lu, Hang Li, and Philip LH Yu. Neural machine translation with external phrase memory. arXiv preprint arXiv:1606.01792, 2016.
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017.
Chong Wang, Yining Wang, Po-Sen Huang, Abdelrahman Mohamed, Dengyong Zhou, and Li Deng. Sequence modeling via segmentations. In International Conference on Machine Learning (ICML), 2017a.
Xing Wang, Zhaopeng Tu, Deyi Xiong, and Min Zhang. Translating phrases in neural machine translation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 1432–1442. Association for Computational Linguistics, 2017b.
Sam Wiseman and Alexander M. Rush. Sequence-to-sequence learning as beam-search optimization. CoRR, abs/1606.02960, 2016.
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.
Lei Yu, Jan Buys, and Phil Blunsom. Online segment to segment neural transduction. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 1307–1316, 2016.
Lei Yu, Phil Blunsom, Chris Dyer, Edward Grefenstette, and Tomas Kocisky. The neural noisy channel. In International Conference on Learning Representations, 2017.
Jie Zhou, Ying Cao, Xuguang Wang, Peng Li, and Wei Xu. Deep recurrent models with fast-forward connections for neural machine translation. Transactions of the Association for Computational Linguistics, 4:371–383, 2016.
# A REORDERING LAYER ANALYSIS
To further understand the behavior of the reordering layer, we examine the values of the gate $\sigma \left( w _ { i } ^ { T } [ e _ { t - \tau } ; \dots ; e _ { t } ; \dots ; e _ { t + \tau } ] \right)$ in Eq. (2). We study the NPMT English-German model in Section 3.2. In Figure 5, we show an example that translates from “can you translate it $? ^ { \ast }$ to ”konnen ¨ man es ubersetzen¨ $? ^ { \mathfrak { s } }$ , where the mapping between words are as follows: “can konnen”, “you ¨ $ \mathrm { { m a n } ^ { \prime } }$ , “translate ubersetzen”, “it ¨ $ \mathrm { e s } ^ { \prime \prime }$ and $? ? ^ { \prime }$ . Note that the example needs to be reordered from “translate it” to ”es ubersetzen”. Each row of Figure 5 represents a window of size ¨ 7 that is centered at a source sentence word. The values in the matrix represent the gate values for the corresponding words. The gate values will later be multiplied with the embedding $e _ { t - \tau + i }$ of Eq. (2) and contribute to the hidden vector $h _ { t }$ . The y-axis represents the word/phrases emitted from the corresponding position. We can observe that the gates mostly focus on the central word since the first part of the sentence only requires monotonic alignment. Interestingly, the model outputs $\mathbf { \vec { \nabla } } \Phi ^ { , , }$ (empty) when the model has the word “translate” in the center of the window. Then, the model outputs “es” when the model encounters “it”. Finally, in the last window (top row), the model not only has a large gate value to the center input “?”, but the model also has a relatively large gate value to the word “translate” in order to output the translation “ubersetzen ?”. This shows an example of ¨ the reordering effect achieved by using the gating mechanism of the reordering layer.
 Figure 5: Visualizing reordering gates in the NPMT English-German translation model.
# B EFFECT OF WINDOW SIZES IN THE REORDERING LAYER
In this section, we examine the effect of window sizes in the reordering layer. Following the setup in Section 3.2, we evaluate the performance of different window sizes on the IWSLT 2014 EnglishGerman translation task. Table 7 summarizes the results. We can observe that the performance reaches the peak with a windows size of 7. With a window size of 5, the performance drops 0.88 BLEU in greedy decoding and 0.72 BLEU using beam search. It suggests that the context window is not large enough to properly perform reordering. When the window sizes are 9 and 11, we do not observe further improvements. It might be because the translation between English and German mostly requires local word reordering.
# C PHRASE MAPPING EXAMPLES
Following the examples of Table 2, we analyze the decoding results on the test set of the GermanEnglish translation task. Given we do not have explicit input segments in NPMT, we assume input words that emit $\mathbf { \hat { \Delta } } \Psi ^ { \prime }$ symbol are within the same group as the next non- $\because \$ 3$ word. For example, in Figure 4, input words “das beste” are considered as an input segment. We then can aggregate all the input, output segments (phrases) and sort them based on the frequency. Tables $\textrm { C }$ and C show the most-frequent input, output phrase mappings.
Table 7: Analyze the effect of reordering layer window sizes in translation results on the IWSLT 2014 EnglishGerman test set.
<table><tr><td colspan="3">BLEU</td></tr><tr><td>Window Size</td><td>Greedy</td><td>Beam Search</td></tr><tr><td>5</td><td>22.74</td><td>24.36</td></tr><tr><td>7</td><td>23.62</td><td>25.08</td></tr><tr><td>9</td><td>23.11</td><td>24.68</td></tr><tr><td>11</td><td>23.12</td><td>24.65</td></tr></table>
Table 8: German-English phrase mapping results. We show the top 10 input, output phrase mappings in five categories (“One” stands for single word and “Many” stands for multiple words.). In the last column, Many Many∗, we remove the phrases with the “UNK” word as the “UNK” appears often.
<table><tr><td rowspan=1 colspan=1>One→One</td><td rowspan=1 colspan=1>One→Many</td><td rowspan=1 colspan=1>Many→One</td><td rowspan=1 colspan=1>Many→Many</td><td rowspan=1 colspan=1>Many→Many*</td></tr><tr><td rowspan=1 colspan=1>,→,</td><td rowspan=1 colspan=1>es→it's</td><td rowspan=1 colspan=1>,dass→that</td><td rowspan=1 colspan=1>die UNK -→ the UNK</td><td rowspan=1 colspan=1>wissen sie →you know</td></tr><tr><td rowspan=1 colspan=1>.→</td><td rowspan=1 colspan=1>UNK → the UNK</td><td rowspan=1 colspan=1>in der→in</td><td rowspan=1 colspan=1>der UNK →the UNK</td><td rowspan=1 colspan=1>in diesem→in this</td></tr><tr><td rowspan=1 colspan=1>und→and</td><td rowspan=1 colspan=1>und→,and</td><td rowspan=1 colspan=1>UNK.→.</td><td rowspan=1 colspan=1>ein UNK→a UNK</td><td rowspan=1 colspan=1>die welt -→the world</td></tr><tr><td rowspan=1 colspan=1>UNK →UNK</td><td rowspan=1 colspan=1>das→this is</td><td rowspan=1 colspan=1>UNK,→,</td><td rowspan=1 colspan=1>das UNK →the UNK</td><td rowspan=1 colspan=1>ist es→it's</td></tr><tr><td rowspan=1 colspan=1>aber→but</td><td rowspan=1 colspan=1>das,→that's</td><td rowspan=1 colspan=1>,die→that</td><td rowspan=1 colspan=1>eine UNK →a UNK</td><td rowspan=1 colspan=1>”.→.”</td></tr><tr><td rowspan=1 colspan=1>”→”</td><td rowspan=1 colspan=1>UNK →a UNK</td><td rowspan=1 colspan=1>ist.→.</td><td rowspan=1 colspan=1>in UNK→in UNK</td><td rowspan=1 colspan=1>ein paar→a few</td></tr><tr><td rowspan=1 colspan=1>ist→is</td><td rowspan=1 colspan=1>ich →ithink</td><td rowspan=1 colspan=1>in den→in</td><td rowspan=1 colspan=1>den UNK → the UNK</td><td rowspan=1 colspan=1>gibt es→there's</td></tr><tr><td rowspan=1 colspan=1>der→of</td><td rowspan=1 colspan=1>es→it was</td><td rowspan=1 colspan=1>ist,→,</td><td rowspan=1 colspan=1>wissen sie→you know</td><td rowspan=1 colspan=1>der welt →→ the world</td></tr><tr><td rowspan=1 colspan=1>von→of</td><td rowspan=1 colspan=1>dies→this is</td><td rowspan=1 colspan=1>sind.→.</td><td rowspan=1 colspan=1>in diesem→in this</td><td rowspan=1 colspan=1>die frage → the question</td></tr><tr><td rowspan=1 colspan=1>mit→with</td><td rowspan=1 colspan=1>es→there 's</td><td rowspan=1 colspan=1>,wenn→if</td><td rowspan=1 colspan=1>dem UNK →the UNK</td><td rowspan=1 colspan=1>haben wir→we have</td></tr></table>
<table><tr><td rowspan=1 colspan=1>Phraseswith3words</td><td rowspan=1 colspan=1>Phraseswith4words</td></tr><tr><td rowspan=1 colspan=1>auf der ganzen→all over the</td><td rowspan=1 colspan=1>auf der ganzen→a little bit of</td></tr><tr><td rowspan=1 colspan=1>gibt eine menge→a lot of</td><td rowspan=1 colspan=1>weiβ nicht,was-→what 's going to be</td></tr><tr><td rowspan=1 colspan=1>dann hat er-→he doesn 'thave</td><td rowspan=1 colspan=1>tun,das wir→we can 't do</td></tr><tr><td rowspan=1 colspan=1>,die man→you can do</td><td rowspan=1 colspan=1>tat,das ich→ididn't do</td></tr><tr><td rowspan=1 colspan=1>das konnen wir→we can do that</td><td rowspan=1 colspan=1>zu verbessern,die →that can be done</td></tr></table>
Table 9: German-English longer phrase mapping results. We show the top 5 input, output phrase mappings for two categories: input and output phrases with three words, and input and output phrases with four words.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314# DEEP REINFORCEMENT LEARNING WITH RELATIONAL INDUCTIVE BIASES
Vinicius Zambaldi∗, David Raposo∗, Adam Santoro∗, Victor Bapst, Yujia Li, Igor Babuschkin, Karl Tuyls, David Reichert, Timothy Lillicrap, Edward Lockhart, Murray Shanahan, Victoria Langston, Razvan Pascanu, Matthew Botvinick, Oriol Vinyals, Peter Battaglia
DeepMind, London, UK {vzambaldi,draposo,adamsantoro}@google.com
# ABSTRACT
We introduce an approach for augmenting model-free deep reinforcement learning agents with a mechanism for relational reasoning over structured representations, which improves performance, learning efficiency, generalization, and interpretability. Our architecture encodes an image as a set of vectors, and applies an iterative message-passing procedure to discover and reason about relevant entities and relations in a scene. In six of seven StarCraft II Learning Environment mini-games, our agent achieved state-of-the-art performance, and surpassed human grandmasterlevel on four. In a novel navigation and planning task, our agent’s performance and learning efficiency far exceeded non-relational baselines, it was able to generalize to more complex scenes than it had experienced during training. Moreover, when we examined its learned internal representations, they reflected important structure about the problem and the agent’s intentions. The main contribution of this work is to introduce techniques for representing and reasoning about states in model-free deep reinforcement learning agents via relational inductive biases. Our experiments show this approach can offer advantages in efficiency, generalization, and interpretability, and can scale up to meet some of the most challenging test environments in modern artificial intelligence.
# 1 INTRODUCTION
Recent deep reinforcement learning (RL) systems have achieved remarkable performance in very challenging problem domains (Mnih et al., 2015; Silver et al., 2016), in large part because of their flexibility in how they learn and exploit the statistical structure underlying observations and reward signals. But the downsides to such flexibility often include low sample efficiency and poor transfer beyond the specifics of the training environment (Zhang et al., 2018; Lake et al., 2017; Kansky et al., 2017). Various structured approaches to RL (e.g. Dzeroski et al. (2001); Driessens & Dzeroski (2004); Diuk et al. (2008); Garnelo et al. (2016)) have attempted to overcome these limitations by explicitly incorporating entity-based and symbolic representations, and specialized building blocks for solving the task at hand. Although these approaches are often highly efficient, they constrain the representations and admissible learning algorithms, they struggle to learn rich representations, and they are therefore confined to relatively simple tasks and data conditions.
To strike favorable tradeoffs between flexibility and efficiency, a number of recent approaches have explored using relational inductive biases in deep learning, to reap the benefits of flexible statistical learning and more structured approaches. Methods such as “graph networks” (Scarselli et al., 2009; Li et al., 2015; Battaglia et al., 2018) explicitly represent entities and their relations using using sets and graphs, and perform relational reasoning using learned message-passing (Gilmer et al., 2017) and attention (Vaswani et al., 2017; Hoshen, 2017; Velickovic et al., 2017; Wang et al., 2017) schemes. Because they are implemented using deep neural networks, they can learn transformations from input observations into task-relevant entities, as well as functions for computing rich interaction among these entities. This provides a powerful capacity for combinatorial generalization, where their learned building blocks can be composed to represent and reason about novel scenarios (Battaglia et al., 2016; Raposo et al., 2017; Dai et al., 2017; Wang et al., 2018; Selsam et al., 2018; Hamrick et al., 2018; Kipf et al., 2018; Sanchez-Gonzalez et al., 2018).
 Figure 1: Box-World and StarCraft II tasks demand reasoning about entities and their relations.
Drawing on several lines of work, we introduce an approach for incorporating relational inductive biases for entity- and relation-centric state representations, and iterated relational reasoning, into a deep RL agent. In contrast with prior work exploring relational inductive biases in deep RL (e.g., Wang et al., 2018), our approach does not rely on a priori knowledge of the structure of the problem and is agnostic to the particular relations that need to be considered. To handle raw visual input data, our architecture used a convolutional front-end to compute embeddings of sets of entities, similar to previous work in visual question answering, physical prediction, and video understanding (Santoro et al., 2017; Watters et al., 2017; Wang et al., 2017). To perform relational reasoning, we used a self-attention mechanism (Vaswani et al., 2017; Hoshen, 2017; Velickovic et al., 2017) applied iteratively within each timestep, which can be viewed as learned message-passing (Li et al., 2015; Gilmer et al., 2017). Our deep RL agent is based on an off-policy advantage actor-critic (A2C) method which is very effective across a range of standard RL environments (Espeholt et al., 2018).
Our results show that this relational deep RL agent scale to very challenging tasks, achieving state-ofthe-art performance on six out of seven StarCraft II mini-games (Vinyals et al., 2017), surpassing grandmaster level on four mini-games. Additionally, we introduce a novel navigation and planning task, called “Box-World”, which stresses the planning and reasoning components of the policy, factoring out other challenges like complex vision or large action spaces. Our agent reaches higher ceiling performance, more efficiently, than non-relational baseline, and is able to generalize to solve problems with more complex solutions than it had been trained on within this task. We also found that the intermediate representations involved in the relational computations were interpretable, and suggest that the agent has rich understanding of the underlying structure of the problem.
# 2 RELATIONAL DEEP RL AGENT ARCHITECTURE
# RL ALGORITHM
We started with a deep RL algorithm based on a distributed advantage actor-critic (A2C) method (Espeholt et al., 2018), which the schematic on the left of Figure 2 summarizes. The agent creates an embedded state representation, $S$ from its input observation, which is then used to compute as output a policy, $\pi$ (the “actor”), and a baseline value, $B$ (the “critic”). The $\pi$ consists of logits over the set of possible actions, from which an action to perform is sampled, and the $B$ is an estimate of the statevalue function at the current state. During learning, the $B$ is used to compute the temporal-difference error, which is used both to optimize $\pi$ to generate actions with greater returns than $B$ predicts, and to optimize $B$ to more accurately estimate state values. For further algorithmic details, including the distributed actor/learner framework and off-policy correction methods, please see Espeholt et al. (2018).
 Figure 2: Box-World agent architecture and multi-head dot-product attention. $E$ is a matrix that compiles the entities produced by the visual front-end; $g _ { \theta }$ is a multilayer perceptron applied in parallel to each row of the output of an MHDPA step, $A$ , and producing updated entities, $\widetilde { E }$ .
# INPUT MODULE
Our agent takes as input an image of a scene, transforms it into an embedded state representation, $S$ , which is a spatial feature map returned by a convolutional neural network (CNN). The relational module (Figure 2) operated on a set of entities, so our architecture transformed the $m \times n \times f$ feature map into an $N \times f$ (where $N = m \cdot n$ ) set of “entity vectors”, $E$ , by reshaping $S$ so that each of $E$ ’s row, $\mathbf { e } _ { i }$ , corresponded to a feature vector, $\mathbf { s } _ { x , y }$ , at a particular $x , y$ location in the embedded scene. Crucially, this allowed for non-local computation between entities (Wang et al., 2017), unconstrained by their coordinates in the spatial feature map. Because removing the spatial map’s coordinate structure could prevent spatial information from being available for downstream computation, we concatenated the spatial $x , y$ coordinates of each $\mathbf { s } _ { x , y }$ onto the corresponding $\mathbf { e } _ { i }$ to ensure it was preserved. This feature-to-entity transformation procedure is analogous to how relation networks, visual interaction networks, and the general class of non-local neural networks (Santoro et al., 2017; Watters et al., 2017; Wang et al., 2017) process input images.
# RELATIONAL MODULE
To perform one step of relational reasoning, our architecture computed pairwise interactions between each entity and all others (including itself), denoted $\mathbf { p } _ { i , j }$ , and updated each entity by accumulating information about all of its interactions, $\tilde { \mathbf { e } } _ { i } \gets \{ \mathbf { p } _ { i , j } \} _ { j = 1 : N }$ . This is analogous to how the general class of graph neural networks and their relatives perform entity-wise relational updates (Scarselli et al., 2009; Gilmer et al., 2017). To perform these one-step relational computations, we used self-attention (Vaswani et al., 2017; Hoshen, 2017; Velickovic et al., 2017; Wang et al., 2017), though various other implementations (e.g., those reviewed in Battaglia et al. (2018)) should also be viable.
Our specific self-attention implementation was based on Vaswani et al. (2017)’s multi-head dotproduct attention (MHDPA), which we explain in detail to make clear its role as a mechanism of relational reasoning. MHDPA (see Figure 2’s expanded box) projects the entities, $E$ , into matrices of query, key, and value vectors, $Q , K$ , and $V$ , respectively (which are normalized via “layer normalization” (Ba et al., 2016)). The similarities between query $\mathbf { q } _ { i }$ and all keys, $\mathbf { k } _ { j = 1 : N }$ are computed by a dot-product, which are normalized into attention weights, $\mathbf { w } _ { i }$ , via a softmax function, and then used to compute the pairwise interaction terms, $\mathbf { p } _ { i , j } = w _ { i , j } \mathbf { v } _ { j }$ . The accumulation of the interactions for each entity is the sum of these pairwise interactions, $\begin{array} { r } { \mathbf { a } _ { i } = \sum _ { j = 1 : N } \mathbf { p } _ { i , j } } \end{array}$ . This can be efficiently computed using matrix multiplications, $A = \mathrm { s o f t m a x } ( d ^ { - { \frac { 1 } { 2 } } } Q K ^ { T } ) V$ , where $d$ is the dimensionality of the query and key vectors (i.e. $Q$ and $K$ have shape $N \times d )$ . Like Vaswani et al. (2017), we also use multiple, independent attention “heads”, applied in parallel (which our attention analyses in Results 3.1 suggests the heads may assume distinct relational semantics through training). The updated entities are computed as a function of the accumulated interactions, $\tilde { \mathbf { e } } _ { i } = \breve { g _ { \theta } } \left( \mathbf { a } _ { i } ^ { h = 1 : \breve { H } } \right)$
 Figure 3: Box-World task: example observations (left), underlying graph structure that determines the proper path to the goal and the distractor branches (middle), and training curves (right).
(where $h$ indexes the head) by concatenating all $\mathbf { a } _ { i } ^ { h = 1 : H }$ together, passing them to a multilayer perceptron (MLP), summing the output with $\mathbf { e } _ { i }$ (i.e. a residual connection), and applying a final stage of layer normalization (Ba et al., 2016). We included this non-linear transformation $\left( g _ { \boldsymbol { \theta } } \right)$ to facilitate the computation of more complex relationships between the entities. This is analogous to what is done in Santoro et al. (2017).
This one-step relational update process, which we term a “block”, can be applied iteratively using shared (recurrent) or unshared (deep) parameters, to compute higher order interactions among entities, analogous to message-passing on graphs (Li et al., 2015; Gilmer et al., 2017). Here we refer to the stack of multiple relational blocks as the relational module.
# OUTPUT MODULE
The relational module’s final output, $\tilde { E }$ , is then used to compute $\pi$ and $B$ as follows. The $\tilde { E }$ matrix, with shape $N \times f$ , is reduced to an $f$ -dimensional vector by max-pooling over the entity dimension. This pooled vector is then passed to a small MLP, which returns an $( c + 1 )$ -dimensional vector. This vector is split into a $c$ -dimensional vector of $\pi$ ’s logits (where $c$ is the number of discrete actions), and a scalar baseline value estimate, $B$ . The $\pi$ logits are normalized using a softmax function, and used as probability parameters for a multinomial distribution, from which an action is randomly sampled.
# 3 EXPERIMENTS AND RESULTS
# 3.1 BOX-WORLD
TASK DESCRIPTION
We first introduce a controlled navigation environment, called Box-World1, which we designed to be perceptually simple, but combinatorially complex, and require abstract relational reasoning and planning. It consists of a $1 2 \times 1 2$ pixel room with keys and boxes scattered randomly. The room also contains an agent, represented by a single dark gray pixel, which can move in four directions: $u p$ down, left, right (see Figure 1).
Keys are represented by a single colored pixel. The agent can pick up a loose key (i.e., one not adjacent to any other colored pixel) by walking the avatar (i.e. the visual depiction of the agent’s location) over it. Boxes are represented by two adjacent colored pixels – the pixel on the right represents the box’s lock and its color indicates which key can be used to open that lock; the pixel on the left indicates the content of the box which is inaccessible while the box is locked.
To collect the content of a box the agent must first collect the key that opens the box (the one that matches the lock’s color), and then walk over the lock, which makes the lock disappear. At this point the content of the box becomes accessible and can be picked up by the agent. Most boxes contain keys that, if made accessible, can be used to open other boxes. One of the boxes contains a gem, represented by a single white pixel. The agent’s goal is to acquire the gem by unlocking the box that contains it and picking it up by walking over it. Keys that an agent has in its possession are depicted in the input observation as a pixel in the top-left corner.
In each level there is a unique sequence of boxes that need to be opened in order to reach the gem. Opening one wrong box (a distractor box) consumes the held key and leads to a dead-end, where the gem cannot be reached and the level becomes unsolvable. There are three user-controlled parameters that contribute to the difficulty of the level: 1) the number of boxes in the path to the goal (solution length); 2) the number of distractor branches; 3) the length of the distractor branches. In general, the task is computationally difficult for a few reasons. First, a key can only be used once, so the agent must be able to reason about whether a particular box is along a distractor branch or along the solution path. Second, keys and boxes appear in random locations in the room, demanding a capacity to reason about keys and boxes based on their abstract relations, rather than based on their spatial proximity.
# RL AGENTS FOR BOX-WORLD
Our agent follows the reinforcement learning setup and architecture described in section (Sec. 2). For a non-relational baseline, we replaced the agent’s relational module with a variable number of residual convolution blocks. See the Appendix for further details of the input, relational, and output modules, including hyperparameters and training procedures.
# RESULTS
The training set-up consisted of Box-World levels with solution lengths of at least 1 and up to 4. This ensured that an untrained agent would have a small probability of reaching the goal by chance, at least on some levels.2 The number of distractor branches was randomly sampled from 0 to 4. Training was split into two variants of the task: one with distractor branches of length 1; another one with distractor branches of length 3 (see Figure 3).
Agents augmented with our relational module achieved close to optimal performance in the two variants of this task, solving more than $98 \%$ of the levels. In the task variant with short distractor branches, an agent with a single relational block was able to achieve top performance. In the variant with long distractor branches, a greater number of relational blocks was required, consistent with the conjecture that more blocks allow higher-order relational computations. In contrast, our baseline agents, which can only rely on convolutional and fully-connected layers, performed significantly worse, solving less than $7 5 \%$ of the levels across the two task variants. We observed similar results when we repeated the experiments using two alternative RL algorithms: asynchronous advantage actor-critic (A3C, Mnih et al., 2016) and distributed Q-learning with prioritized experience replay (Horgan et al., 2018). We note that with Q-learning training took significantly longer (see Figure 7 in Appendix).
We also repeated these experiments, but with backward branching in the underlying graph used to generate the level. With backward branching the agent does not need to plan far into the future; when it is in possession of a key, a successful strategy is always to open the matching lock. In contrast, with forward branching scenes, the agent can use a key on the wrong lock (i.e. on a lock along a distractor branch). Thus, forward branching demands more complicated forward planning to determine the correct locks to open, which contrasts with backward branching scenarios where an agent can adopt a more reactive policy, always opting to open the lock that matches the key in possession. Indeed, the baseline agents performed much better in backward (versus forward) branching scenes, which suggests that its weak relational reasoning capacity is to blame for its poor performance in the forward branching condition (see Figure 8 in Appendix).
 Figure 4: Visualization of attention weights. (a) The underlying graph of one example level; (b) the result of the analysis for that level, using each of the entities along the solution path (1–5) as the source of attention. Arrows point to the entities that the source is attending to. An arrow’s transparency is determined by the corresponding attention weight.
# VISUALIZATION OF ATTENTION WEIGHTS
We next looked at specific rows of the attention weight matrix, $\mathbf { w } _ { i }$ , which corresponded to relevant objects in the scene. Figure 4 shows the result of this analysis when the attending entities (source of the attention) are objects along the solution path. For one of the attention heads, each key attends mostly to the locks that can be unlocked with that key. In other words, the attention weights reflect the options available to the agent once a key is collected. For another attention head, each key attends mostly to the avatar’s entity vector. This suggests that object-avatar relations are important, which may help measure of relative position and support navigation.
In the case of RGB pixel inputs, the relationship between keys and locks that can be opened with that key is confounded with the fact that keys and the corresponding locks have the same RGB representation. We therefore repeated the analysis, this time using one-hot representation of the input, where the mapping between keys and the corresponding locks is arbitrary. We found evidence that: 1) keys attend to the locks they can unlock; 2) locks attend to the keys that can be used to unlock them; 3) all the objects attend to the avatar’s location; 4) the avatar and gem attend to each other and themselves.
# GENERALIZATION CAPABILITY: TESTING ON WITHHELD ENVIRONMENTS
As we observed, the attention weights captured a link between a key and its corresponding lock, using a shared computation across entities. If the function used to compute the weights (and hence, used to determine that certain keys and locks are related) has learned to represent some general, abstract notion of what it means to “unlock” – e.g., unlocks(key, lock) – then this function should be able to generalize to key-lock combinations that it has never observed during training. Similarly, a capacity to understand “unlocking” shouldn’t necessarily be affected by the number of locks that need to be unlocked to reach a solution.
We thus tested the model under two conditions, without further training: 1) on levels that required opening a longer sequence of boxes than it had ever observed (6, 8 and 10), and 2) on levels that required using a key-lock combination that was never required for reaching the gem during training, instead only being placed on distractor paths. As shown in Figure 5, in the first condition, the agent with the relational module solved more than $8 8 \%$ of the levels, across all three solution length conditions. In contrast, the performance of the agent trained without the relational module collapsed to $5 \%$ when tested on sequences of 6 boxes, and to $0 \%$ on sequences of 8 and 10. On levels with new key-lock combinations, the agent augmented with a relational module solved $9 7 \%$ of the new levels. The agent without the relational module performed poorly, reaching only $13 \%$ . Together, these results show that the relational module offers a greater capacity for zero-shot transfer to more complex and previously unseen problems. This is likely a consequence of our approach’s object- and relation-centric learning, which is less sensitive to the specific conjunctions of objects and relations it has experienced during training.
 Figure 5: Generalization in Box-World. Zero-shot transfer to levels that required: (a) opening a longer sequence of boxes; (b) using a key-lock combination that was never required during training.
# 3.2 STARCRAFT II MINI-GAMES
# TASK DESCRIPTION
StarCraft II is a popular video game that presents a difficult challenge for RL agents. It is a multiagent game where each player controls a large number (hundreds) of units that need to interact and collaborate (see Figure 1). It is partially observable and has a large state and action space, with more than 100 possible actions. The consequences of any single action – in particular, early decisions in the game – are typically only observed many frames later, posing difficulties in temporal credit assignment and exploration.
We trained our agents on the suite of 7 mini-games developed for the StarCraft II Learning Environment (SC2LE, Vinyals et al., 2017). These mini-games were proposed as a set of specific scenarios that are representative of the mechanics of the full game and can be used to test agents in a simpler set up with a better defined reward structure, compared to the full game. The 7 mini-games demand different strategies and skills. Notably, Collect Mineral Shards (CMS), Defeat Roaches (DR) and Defeat Zerglings and Banelings (DZB), require controlling multiple units with precision and in a coordinated manner. To achieve a high score in CMS, the player (or agent) needs to command the two marines independently, defining navigation paths that do not overlap too much in order to efficiently cover most of the ground. In DR, the player must focus-fire to succeed, which requires selecting the same attack target, one at a time, for all the marines. In DZB, the enemy units have different abilities, so a good strategy may involve splitting the army into groups with different roles.
# RL AGENTS FOR STARCRAFT II
For StarCraft II (SC2), we start by first constructing a strong control baseline to test against our relational agent. The architecture is similar to that of the Box-World agent, with changes to accommodate specific features of the SC2 environment. We increased the model capacity by using 2 residual convolutional blocks in the input module, each consisting of 3 convolutional layers. We added a 2D-ConvLSTM immediately downstream of the residual blocks, so the subsequent computations were sensitive to the recent history of observations, rather than only the current observation, thus accounting for partial observability. Including this memory mechanism was important because the actions a StarCraft agent issues to units are carried out over multiple timesteps (e.g., MOVE UNIT 3 TO COORDINATE (1, 5)), and the agent needs a way of not “forgetting” what actions it has issued previously. Otherwise it might keep reissuing the same action to a unit, rather than choosing another action for another unit. Finally, the relational module depicted in section (Sec. 2) was replaced by a stack of residual convolutional blocks in the control agent.
For the agent’s output, alongside action $a$ and value $V$ , the network produces two sets of action-related arguments: non-spatial arguments (Args) and spatial arguments $( A r g s _ { x , y } )$ . These arguments are used as modifiers of particular actions (see (Vinyals et al., 2017)). Args are produced from the output of the aggregation function, whereas $A r g s _ { x , y }$ result from upsampling the output of the relational module. See the Appendix for further details.
 Figure 6: Final performance across StarCraft II mini-games. The relational-agent achieved above grandmaster scores in 4 out of 7 levels. The main difference between our new control agent and the relational agent is most relevant in the Defeat Zerglings and Banelings task. Here, the underlying strategy requires agents to split their army and kite enemy units in order to alleviate the incoming impact (as Banelings incur area damage); a strategy requiring reasoning and fine control over many units. A relational agent with iterative blocks of attention was required for this strategy to emerge. For more details, see Table 1 in the Appendix.
# RESULTS
For these results we used the full action set provided by SC2LE and performance was measured as the mean score over 30 episodes of the best run for each mini-game. Our agent implementations achieved high scores across all the mini-games (Figure 6), consistently outperforming the previous best models. In particular, the agent augmented with a relational module achieved state-of-the-art results in six mini-games and its performance surpassed that of the human grandmaster in four of them3.
Head-to-head comparisons between our two implementations show that the agent with the relational component (relational) achieves similar or better results than the one without (control). Concretely, for Collect Mineral Shards, Defeat Roaches and Defeat Zerglings and Banelings, the relational agent improved relative to the control agent by 9, 8 and 134 points, with a standard error of 1.5, 6.4 and 18.2, respectively.
We note that both models improved substantially over the previous best (Vinyals et al., 2017), and in some mini-games, they approach an empirical ceiling performance. This can be attributed to a combination of factors: improved RL algorithm (Espeholt et al., 2018), more robust architecture, better hyperparameter tuning to address issues of credit assignment and exploration, better action selection procedure, and longer training. Next, we focus on differences afforded by relational inductive biases and turn to particular generalization tests to determine the behavioural traits of the control and relational agents.
# GENERALIZATION CAPABILITY
As observed in Box-World, a capacity to better understand underlying relational structure – rather than latch onto superficial statistics – may manifest in better generalization to never-before-seen situations. To test generalization in SC2 we took agents trained on Collect Mineral Shards, which involved using two marines to collect randomly scattered minerals and tested them, without further training, on modified levels that allowed the agents to instead control up to ten marines. It’s worth highlighting the agents have never been exposed to a single observation present in these generalization experiments. Intuitively, if an agent understands that marines are independent units that can be coordinated, yet controlled independently to collect resources, then increasing the number of marines available should only affect the underlying strategy of unit deployment, and should not catastrophically break model performance.
We observed that—at least for medium sized networks—some interesting generalization capabilities emerge, with the best seeds of the relational agent achieving better generalization scores in the test scenario. However, we noticed high variability in these quantitative results, with the effect diminishing when using larger models (which may be more prone to overfitting on the training set). Qualitative analysis of the policies revealed distinct behaviours for the best performing control and relational agents: while the former adopted a "land sweep strategy", controlling many units as a group to cover the space, the latter managed to independently control several units simultaneously, suggesting a finer grained understanding of the game dynamics. Further work is required to draw firm conclusions about the generalization capabilities of a relational agent in more complex domains such as StarCraft II (see Figure 9 in Appendix).
Given the combinatoric richness and multi-agent aspects of the full StarCraft II game, an agent is frequently exposed to situations in which it might not have been trained on. Thus, an improved capability to generalize to new, unseen situations aided by a better understanding of underlying abstract entities and their relations is fundamental.
# 4 CONCLUSION
By introducing structured perception and relational reasoning into deep RL architectures, our agents can learn interpretable representations, and exceed baseline agents in terms of sample complexity, ability to generalize, and overall performance. Behavioral analyses showed that the learned representations allowed for better generalization, which is characteristic of relational representations. Analysis of attention weights showed that the model’s internal computations were interpretable, and congruent with the computations we would expect from a model computing task-relevant relations.
One important future direction is to explore ways to scale our approach to larger inputs spaces, without suffering, as this and other approaches do (e.g., Wang et al., 2017; Santoro et al., 2017), from the quadratic complexity that results from considering all input pairs. Possible avenues involve using a distinct attentional mechanisms that scales linearly with the number of inputs (Hoshen, 2017) or filtering out unimportant relations (Malinowski et al., 2018). Other future directions include exploring perceiving complex scenes via more structured formats, such as scene graphs (Xu et al., 2017; Chen et al., 2018), which could be powerful additions to our approach’s input module. More complex relational modules could be explored, such as richer graph network implementations (Battaglia et al., 2018), learned approaches for inducing compositional programs (Reed & De Freitas, 2015; Parisotto et al., 2017; Allamanis et al., 2017; Devlin et al., 2017) and reasoning about structured data (Neelakantan et al., 2015; Liang et al., 2016), or even explicit logical reasoning over structured internal representations (Evans et al., 2018), drawing inspiration from more symbolic approaches in classic AI. Our approach may also interface well with approaches for hierarchical RL (Vezhnevets et al., 2017), planning (Guez et al., 2018), and structured behavior representation (Huang et al., 2018), so that the structured internal representations and patterns of reasoning can translate into more structured behaviors.
More speculatively, this work blurs the line between model-free agents, and those with a capacity for more abstract planning. An important feature of model-based approaches is making general knowledge of the environment available for decision-making. Here our inductive biases for entityand relation-centric representations and iterated reasoning reflect key knowledge about the structure of the world. While not a model in the technical sense, it is possible that the agent learns to exploit this relational architectural prior similarly to how an imagination-based agent’s forward model operates (Hamrick et al., 2017; Pascanu et al., 2017; Weber et al., 2017). More generally, our work opens new directions for RL via a principled hybrid of flexible statistical learning and more structured approaches.
# REFERENCES
Miltiadis Allamanis, Pankajan Chanthirasegaran, Pushmeet Kohli, and Charles Sutton. Learning continuous semantic representations of symbolic expressions. In Proceedings of the International Conference on Machine Learning (ICML), 2017.
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, et al. Interaction networks for learning about objects, relations and physics. In Advances in neural information processing systems, pp. 4502–4510, 2016.
Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
Xinlei Chen, Li-Jia Li, Li Fei-Fei, and Abhinav Gupta. Iterative visual reasoning beyond convolutions. arXiv preprint arXiv:1803.11189, 2018.
Hanjun Dai, Elias Khalil, Yuyu Zhang, Bistra Dilkina, and Le Song. Learning combinatorial optimization algorithms over graphs. In Advances in Neural Information Processing Systems, pp. 6351–6361, 2017.
Jacob Devlin, Jonathan Uesato, Rishabh Singh, and Pushmeet Kohli. Semantic code repair using neuro-symbolic transformation networks. arXiv preprint arXiv:1710.11054, 2017.
Carlos Diuk, Andre Cohen, and Michael L Littman. An object-oriented representation for efficient reinforcement learning. In Proceedings of the 25th international conference on Machine learning, pp. 240–247. ACM, 2008.
Kurt Driessens and Saso Dzeroski. Integrating guidance into relational reinforcement learning. Machine Learning, 57(3):271–304, 2004.
Saso Dzeroski, Luc De Raedt, and Kurt Driessens. Relational reinforcement learning. Machine Learning, 43(1/2):7–52, 2001.
Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymir Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018.
Richard Evans, David Saxton, David Amos, Pushmeet Kohli, and Edward Grefenstette. Can neural networks understand logical entailment? In Proceedings of the International Conference on Learning Representations (ICLR), 2018.
Marta Garnelo, Kai Arulkumaran, and Murray Shanahan. Towards deep symbolic reinforcement learning. arXiv preprint arXiv:1609.05518, 2016.
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.
Arthur Guez, Théophane Weber, Ioannis Antonoglou, Karen Simonyan, Oriol Vinyals, Daan Wierstra, Rémi Munos, and David Silver. Learning to search with mctsnets. arXiv preprint arXiv:1802.04697, 2018.
Jessica B Hamrick, Andrew J Ballard, Razvan Pascanu, Oriol Vinyals, Nicolas Heess, and Peter W Battaglia. Metacontrol for adaptive imagination-based optimization. arXiv preprint arXiv:1705.02670, 2017.
Jessica B Hamrick, Kelsey R Allen, Victor Bapst, Tina Zhu, Kevin R McKee, Joshua B Tenenbaum, and Peter W Battaglia. Relational inductive bias for physical construction in humans and machines. arXiv preprint arXiv:1806.01203, 2018.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision, pp. 630–645. Springer, 2016.
Dan Horgan, John Quan, David Budden, Gabriel Barth-Maron, Matteo Hessel, Hado Van Hasselt, and David Silver. Distributed prioritized experience replay. arXiv preprint arXiv:1803.00933, 2018.
Yedid Hoshen. Vain: Attentional multi-agent predictive modeling. In Advances in Neural Information Processing Systems, pp. 2701–2711, 2017.
De-An Huang, Suraj Nair, Danfei Xu, Yuke Zhu, Animesh Garg, Li Fei-Fei, Silvio Savarese, and Juan Carlos Niebles. Neural task graphs: Generalizing to unseen tasks from a single video demonstration. arXiv preprint arXiv:1807.03480, 2018.
Max Jaderberg, Valentin Dalibard, Simon Osindero, Wojciech M Czarnecki, Jeff Donahue, Ali Razavi, Oriol Vinyals, Tim Green, Iain Dunning, Karen Simonyan, et al. Population based training of neural networks. arXiv preprint arXiv:1711.09846, 2017.
Ken Kansky, Tom Silver, David A Mély, Mohamed Eldawy, Miguel Lázaro-Gredilla, Xinghua Lou, Nimrod Dorfman, Szymon Sidor, Scott Phoenix, and Dileep George. Schema networks: Zero-shot transfer with a generative causal model of intuitive physics. arXiv preprint arXiv:1706.04317, 2017.
Thomas Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard Zemel. Neural relational inference for interacting systems. arXiv preprint arXiv:1802.04687, 2018.
Brenden M Lake, Tomer D Ullman, Joshua B Tenenbaum, and Samuel J Gershman. Building machines that learn and think like people. Behavioral and Brain Sciences, 40, 2017.
Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
Chen Liang, Jonathan Berant, Quoc Le, Kenneth D Forbus, and Ni Lao. Neural symbolic machines: Learning semantic parsers on freebase with weak supervision. arXiv preprint arXiv:1611.00020, 2016.
Mateusz Malinowski, Carl Doersch, Adam Santoro, and Peter Battaglia. Learning visual question answering by bootstrapping hard attention. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 3–20, 2018.
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
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.
Arvind Neelakantan, Quoc V Le, and Ilya Sutskever. Neural programmer: Inducing latent programs with gradient descent. arXiv preprint arXiv:1511.04834, 2015.
Emilio Parisotto, Abdel-rahman Mohamed, Rishabh Singh, Lihong Li, Dengyong Zhou, and Pushmeet Kohli. Neuro-symbolic program synthesis. In Proceedings of the International Conference on Learning Representations (ICLR), 2017.
Razvan Pascanu, Yujia Li, Oriol Vinyals, Nicolas Heess, Lars Buesing, Sebastien Racanière, David Reichert, Théophane Weber, Daan Wierstra, and Peter Battaglia. Learning model-based planning from scratch. arXiv preprint arXiv:1707.06170, 2017.
David Raposo, Adam Santoro, David Barrett, Razvan Pascanu, Timothy Lillicrap, and Peter Battaglia. Discovering objects and their relations from entangled scene representations. arXiv preprint arXiv:1702.05068, 2017.
Scott Reed and Nando De Freitas. Neural programmer-interpreters. arXiv preprint arXiv:1511.06279, 2015.
Alvaro Sanchez-Gonzalez, Nicolas Heess, Jost Tobias Springenberg, Josh Merel, Martin Riedmiller, Raia Hadsell, and Peter Battaglia. Graph networks as learnable physics engines for inference and control. arXiv preprint arXiv:1806.01242, 2018.
Adam Santoro, David Raposo, David G Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Tim Lillicrap. A simple neural network module for relational reasoning. In Advances in neural information processing systems, pp. 4974–4983, 2017.
Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2009.
Daniel Selsam, Matthew Lamm, Benedikt Bunz, Percy Liang, Leonardo de Moura, and David L Dill. Learning a sat solver from single-bit supervision. arXiv preprint arXiv:1802.03685, 2018.
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.
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. 6000–6010, 2017.
Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
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.
Oriol Vinyals, Timo Ewalds, Sergey Bartunov, Petko Georgiev, Alexander Sasha Vezhnevets, Michelle Yeo, Alireza Makhzani, Heinrich Küttler, John Agapiou, Julian Schrittwieser, et al. Starcraft ii: a new challenge for reinforcement learning. arXiv preprint arXiv:1708.04782, 2017.
Tingwu Wang, Renjie Liao, Jimmy Ba, and Sanja Fidler. Nervenet: Learning structured policy with graph neural networks. Proceedings of the International Conference on Learning Representations (ICLR), 2018.
Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. arXiv preprint arXiv:1711.07971, 2017.
Nicholas Watters, Andrea Tacchetti, Theophane Weber, Razvan Pascanu, Peter Battaglia, and Daniel Zoran. Visual interaction networks. arXiv preprint arXiv:1706.01433, 2017.
Théophane Weber, Sébastien Racanière, David P Reichert, Lars Buesing, Arthur Guez, Danilo Jimenez Rezende, Adria Puigdomènech Badia, Oriol Vinyals, Nicolas Heess, Yujia Li, et al. Imagination-augmented agents for deep reinforcement learning. arXiv preprint arXiv:1707.06203, 2017.
Danfei Xu, Yuke Zhu, Christopher B Choy, and Li Fei-Fei. Scene graph generation by iterative message passing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, volume 2, 2017.
Chiyuan Zhang, Oriol Vinyals, Remi Munos, and Samy Bengio. A study on overfitting in deep reinforcement learning. arXiv preprint arXiv:1804.06893, 2018.
# APPENDIX
A BOX-WORLD
TASK
Each level in Box-world is procedurally generated. We start by generating a random graph (a tree) that defines the correct path to the goal – i.e., the sequence of boxes that need to be opened to reach the gem. This graph also defines multiple distractor branches – boxes that lead to dead-ends. The agent, keys and boxes, including the one containing the gem, are positioned randomly in the room, assuring that there is enough space for the agent to navigate between boxes. There is a total of 20 keys and 20 locks that are randomly sampled to produce the level. An agent receives a reward of $+ 1 0$ for collecting the gem, $+ 1$ for opening a box in the solution path and $- 1$ for opening a distractor box. A level terminates immediately after the gem is collected or a distractor box is opened.
The generation process produces a very large number of possible trees, making it extremely unlikely that the agent will face the same level twice. The procedural generation of levels also allows us to create different training-test splits by withholding levels that conform to a particular case during training and presenting them to the agent at test time.
 Figure 7: Alternative RL algorithms produced similar results on Box-World. The difference in performance that we observed between relational and baseline agents using the RL algorithm proposed by Espeholt et al. (2018) was still present when using A3C or distributed DQN. These experiments were done using $1 0 \times 1 0$ pixel maps, solution sequences of up to 3 boxes and up to 3 distractor branches.
 Figure 8: Box-World: forward branching versus backward branching. With backward branching, any given key can only open one box; however, each key type (i.e. color), can appear in multiple boxes. This means that an agent can adopt a more reactive policy without planning beyond which box to open next.
Mini-game Table 1: Mean scores achieved in the StarCraft II mini-games using full action set. $\uparrow$ denotes a score that is higher than a StarCraft Grandmaster. Mini-games: 1–Move To Beacon, 2–Collect Mineral Shards, 3–Find And Defeat Zerglings, 4–Defeat Roaches, 5–Defeat Zerglings And Banelings, 6–Collect Minerals And Gas, 7–Build Marines.
<table><tr><td>Agent</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>DeepMind Human Player (Vinyals et al., 2017)</td><td>26</td><td>133</td><td>46</td><td>41</td><td>729</td><td>6880</td><td>138</td></tr><tr><td>StarCraft Grandmaster (Vinyals et al.,2017)</td><td>28</td><td>177</td><td>61</td><td>215</td><td>727</td><td>7566</td><td>133</td></tr><tr><td>Random Policy (Vinyals et al., 2017)</td><td>1</td><td>17</td><td>4</td><td>1</td><td>23</td><td>12</td><td><1</td></tr><tr><td>FullyConv LSTM (Vinyals et al., 2017)</td><td>26</td><td>104</td><td>44</td><td>98</td><td>96</td><td>3351</td><td>6</td></tr><tr><td>PBT-A3C (Jaderberg et al., 2017)</td><td>1</td><td>101</td><td>50</td><td>132</td><td>125</td><td>3345</td><td>0</td></tr><tr><td>Relational agent</td><td>27</td><td>196个</td><td>62个</td><td>303 个</td><td>736个</td><td>4906</td><td>123</td></tr><tr><td>Control agent</td><td>27</td><td>187↑</td><td>61</td><td>295个</td><td>602</td><td>5055</td><td>120</td></tr></table>
# B RL TRAINING PROCEDURE
We used distributed A2C agents with off-policy corrections (Espeholt et al., 2018). Each agents consisted of 100 actors generating trajectories of experience, and a single learner, which learns $\pi$ and $B$ using the actors’ experiences. The model updates were performed on GPU using mini-batches of 32 trajectories provided by the actors via a queue. The agents used an entropy cost of 0.005, discount $( \gamma )$ of 0.99 and unroll length of 40 steps.
Training was done using RMSprop optimiser with momentum of 0, $\epsilon$ of 0.1 and a decay term of 0.99. The learning rate was tuned, taking values between 1e−5 and $2 \mathrm { e } { - 4 }$ .
# AGENT ARCHITECTURE
The input module contained two convolutional layers with 12 and 24 kernels, $2 \times 2$ kernel sizes and a stride of 1, followed by a rectified linear unit (ReLU) activation function. The output was tagged with two extra channels indicating the spatial position ( $\mathbf { \chi } _ { x }$ and $y$ ) of each cell in the feature map using evenly spaced values between $- 1$ and 1. This was passed to the relational module, consisting of relational blocks, with shared parameters. Queries, keys and values were produced by 2 to 4 attention heads and had an embedding size $( d )$ of 64. The output of this module was aggregated using a feature-wise max pooling function and passed to 4 fully connected layers, each followed by a ReLU. Policy logits $\pi$ , size 4) and baseline function $B$ , size 1) were produced by a linear projection. The policy logits were normalized and used as multinomial distribution from which the action $( a )$ was sampled.
# BASELINE AGENT ARCHITECTURE
As a baseline agent we used the same architecture as the relational agent but replaced the relational module with a variable number (3 to 6) of residual-convolutional blocks. Each residual block comprised two convolutional layers, with $3 \times 3$ kernels, stride of 1 and 26 output channels.
# C STARCRAFT II MINI-GAMES
StarCraft II agents were trained with Adam optimiser for a total of 10 billion steps using batches of 32 trajectories, each unrolled for 80 steps. A linear decay was applied to the optimiser learning rate and entropy loss scaling throughout training (see Table 2 for details). We ran approximately 100 experiments for each mini-game, using the hyperparameter settings indicated in Table 4 combined with 3 seeds.
 Figure 9: Generalization results on the StarCraft II mini-game Collect Mineral Shards. Agents were trained on levels with 2 marines and tested on levels with 1, 2, 3, 4, 5 or 10 marines. Colored bars indicate mean score over the ten best runs; error bars indicate standard error.
RELATIONAL AGENT ARCHITECTURE
The StarCraft II (SC2) agent architecture follows closely the one we adopted in Box-World. Here we highlight the changes needed to satisfy SC2 constraints.
Input-preprocessing. At each time step agents are presented with 4 sources of information: minimap, screen, player, and previous-action. These tensors share the same pre-processing: numerical features are re-scaled with a logarithmic transformation and categorical features are embedded into a continuous 10-dimensional space.
State encoding. Spatially encoded inputs (minimap and screen) are tiled with binary masks denoting whether the previous action constituted a screen- or minimap-related action. These tensors are then fed to independent residual convolutional blocks, each consisting of one convolutional layer $( 4 \times 4$ kernels and stride 2) followed by a residual block with 2 convolutional layers ( $3 \times 3$ kernels and stride 1), which process and downsample the inputs to $[ 8 \times 8 \times \# c h a n n e l s _ { 1 } ]$ outputs. These tensors are concatenated along the depth dimension to form a singular spatial input $( i n p u t s _ { 3 D }$ , with shape $[ 8 \times 8 \times \# c h a n n e l s _ { 1 } + \# c h a n n e l s _ { 1 } ] )$ . The remaining inputs (player and previous-action) are concatenated and passed to a 2-layer MLP (128 units, ReLU, 64 units) to form a singular non-spatial input $( i n p u t s _ { 2 D } )$ .
Memory processing. Next, inputs $_ { 3 D }$ is passed to the Conv2DLSTM along with its previous state to produce a new state and outputs $_ { 3 D }$ (shape $[ 8 \times 8 \times \# c h a n n e l s _ { 2 } ] )$ , which represents an aggregated history of input observations.
Relational processing. outputs $3 D$ is flattened along the first two dimensions (forming a 2D tensor of shape $[ 6 4 \times$ #channels2] and passed to the stacked MHDPA blocks (see Table 3 for details). Its output tensors (of shape $6 4 \times$ attention embedding size $^ *$ number of attention heads]) follow two separate pathways – relational-spatial: reshapes the tensors to their original spatial shape $[ 8 \times 8 ]$ ; relational-nonspatial: aggregates through a feature-wise max-pooling operation (combining the 64 embeddings into a flat tensor) and further processes using a 2-layer MLP (512 units per layer, ReLU activations).
Output processing. $i n p u t s _ { 2 D }$ and relational-nonspatial are concatenated to form a set of shared features. Policy logits are produced by feeding shared features to a 2-layer MLP (256 units, ReLU, $| a c t i o n s |$ units) and masking unavailable actions (following Vinyals et al. (2017)). Similarly, baselines values $V$ are generated by feeding shared features to a separate 2-layer MLP (256 units, ReLU, 1 unit).
Actions are sampled using computed policy logits and embedded into a 16 dimensional vector. This embedding is used to condition shared features and generate logits for non-spatial arguments (Args) through independent linear combinations (one for each argument). Finally, spatial arguments $( A r g s _ { x , y } )$ are obtained by first deconvolving relational-spatial to $[ 3 2 \times 3 2 \times \# c h a n n e l s _ { 3 } ]$ tensors using Conv2DTranspose layers, conditioned by tiling the action embedding along the depth dimension and passed by $1 \times 1 \times 1$ convolution layers (one for each spatial argument). Spatial arguments $( x , y )$ are produced by sampling resulting tensors and selecting the corresponding row and column indexes.
Table 2: Shared fixed hyperparameters across mini-games.
<table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Conv2DLSTM</td><td></td></tr><tr><td>Output channels(#channels2)</td><td>96</td></tr><tr><td>Kernel shape</td><td>(3,3)</td></tr><tr><td>Stride</td><td>(1,1)</td></tr><tr><td>Conv2DTranspose</td><td></td></tr><tr><td>Output channels (#channels3)</td><td>16</td></tr><tr><td>Kernel shape</td><td>(4, 4)</td></tr><tr><td>Stride</td><td>(2,2)</td></tr><tr><td>Discount (γ)</td><td>0.99</td></tr><tr><td>Batch size</td><td>32</td></tr><tr><td>Unroll Length</td><td>80</td></tr><tr><td>Baseline loss scaling</td><td>0.1</td></tr><tr><td>Clip global gradient norm</td><td>100.0</td></tr><tr><td>Adam β1</td><td>0.9</td></tr><tr><td>Adam β2</td><td>0.999</td></tr><tr><td>Adam e</td><td>1e-8</td></tr></table>
Table 3: Fixed MHDPA settings for StarCraft II mini-games.
<table><tr><td>Setting Value</td></tr><tr><td>MLP layers 2</td></tr><tr><td>Units per MLP layer 384</td></tr><tr><td>MLP activations ReLU</td></tr><tr><td>Attention embedding size 32</td></tr><tr><td>Weight sharing shared MLP across blocks</td></tr><tr><td>shared embedding across blocks</td></tr></table>
# CONTROL AGENT ARCHITECTURE
The control agent architecture only differs on the relational processing part of the pipeline. Analogous to the relational agent, output $\beta _ { 2 D }$ are obtained from Conv2DLSTM layers. These tensors are first passed to a 12-layer deep residual model – comprising 4 blocks of 3 convolutions layers (32 output channels, $4 \times 4$ kernel for the first convolution and $3 \times 3$ for the second and third, and stride 1) interleaved with ReLU activations and skip-connections – as proposed by He et al. (2016), to form the relational-spatial outputs. These tensors also follow a separate pathway where they are flattened and passed to a 2-layer MLP (512 units per layer, ReLU activations) to produce what we refer to above as relational-nonspatial. The remaining architecture is identical to the relational agent.
Table 4: Swept hyperparameters across mini-games.
<table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Relational module</td><td></td></tr><tr><td>Number of heads</td><td>[1,3]</td></tr><tr><td>Number of blocks</td><td>[1, 3, 5]</td></tr><tr><td>Entropy loss scaling</td><td>[le-1,le-2,le-3]</td></tr><tr><td>Adam learning rate</td><td>[le-4,le-5]</td></tr></table>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400# ACTRCE: AUGMENTING EXPERIENCE V I A TEACHER’S ADVICE
Anonymous authors Paper under double-blind review
# ABSTRACT
Sparse reward is one of the most challenging problems in reinforcement learning (RL). Hindsight Experience Replay (HER) attempts to address this issue by converting a failure experience to a successful one by relabeling the goals. Despite its effectiveness, HER has limited applicability because it lacks a compact and universal goal representation. We present Augmenting experienCe via TeacheR’s adviCE (ACTRCE), an efficient reinforcement learning technique that extends the HER framework using natural language as the goal representation. We first analyze the differences among goal representation, and show that ACTRCE can efficiently solve difficult reinforcement learning problems in challenging 3D navigation tasks, whereas HER with non-language goal representation failed to learn. We also show that with language goal representations, the agent can generalize to unseen instructions, and even generalize to instructions with unseen lexicons. We further demonstrate it is crucial to use hindsight advice to solve challenging tasks, but we also found that little amount of hindsight advice is sufficient for the learning to take off, showing the practical aspect of the method.
# 1 INTRODUCTION
Many impressive deep reinforcement learning (deep RL) applications rely on carefully-crafted reward functions to encourage the desired behavior. However, designing a good reward function is nontrivial $\mathrm { N g }$ et al., 1999), and requires a significant engineering effort. For example, even for the seemingly simple task of stacking Lego blocks, Popov et al. (2017) needed 5 complicated reward terms with different importance weights. Moreover, handcrafted reward shaping (Gullapalli & Barto, 1992) can lead to biased learning, which may cause the agent to learn unexpected and undesired behaviors (Clark & Amodei, 2016).
One approach to avoid defining a complicated reward function is to use a sparse and binary reward function, i.e., give only a positive or negative reward at the terminal state, depending on the success of the task. However, the sparse reward makes learning difficult.
Hindsight Experience Replay (HER) (Andrychowicz et al., 2017) attempts to address this issue. The main idea of HER is to utilize failed experiences by substituting with a fake goal in order to convert them to successful experiences. For their algorithm to work, Andrychowicz et al. made the non-trivial assumption that for every state in the environment, there exists a goal which is achieved in that state. As the authors pointed out, this assumption can be trivially satisfied by choosing the goal space to be the state space. However, representing the goal using the enormous state space is very inefficient and contains much redundant information. For example, if we want to ask an agent to avoid collisions while driving where the state is the raw pixel value from the camera, then there can be many states (i.e. frames) that achieve this goal. It is redundant to represent the goal using each state.
Therefore, we need a goal representation that is (1) expressive and flexible enough to satisfy the assumption in HER, while also being (2) compact and informative where similar goals are represented using similar features. Natural language representation of goals satisfies both requirements. First, language can flexibly describe goals across tasks and environments. Second, language representation is abstract, hence able to compress any redundant information in the states. Recall the previous driving example, for which we can simply describe “avoid collisions" to represent all states that satisfy this goal. Moreover, the compositional nature of language provides transferable features for generalizing across goals.
In this paper, we combine the HER framework with natural language goal representation, and propose an efficient technique called Augmenting experienCe via TeacheR’s adviCE (ACTRCE; pronounced “actress”) to a broad range of reinforcement learning problems. Our method works as follows. Whenever an agent finishes an episode, a teacher gives advice in natural language to the agent based on the episode. The agent takes the advice to form a new experience with a corresponding reward, alleviating the sparse reward problem. For example, a teacher can describe what the agent has achieved in the episode, and the agent can replace the original goal with the advice and a reward of 1. We show many benefits brought by language goal representation when combining with hindsight advice. The agent can efficiently solve reinforcement learning problems in challenging 2D and 3D environments; it can generalize to unseen instructions, and even generalize to instruction with unseen lexicons. We further demonstrate it is crucial to use hindsight advice to solve challenging tasks, but we also found that little amount of hindsight advice is sufficient for the learning to take off, showing the practical aspect of the method.
We note that our work is also interesting from a language learning perspective. Learning to achieve goals described in natural language is part of a class of problem called language grounding (Harnad, 1990), which has recently received increasing interest, as grounding is believed to be necessary for more general understanding of natural language. Early attempts to ground language in a simulated physical world (Winograd, 1972; Siskind, 1994) consisted of hard coded rules which could not scale beyond their original domain. Recent work has been using reinforcement learning techniques to address this problem (Hermann et al., 2017; Chaplot et al., 2017b). Our work combines reinforcement learning and rich language advice, providing an efficient technique for language grounding.
# 2 BACKGROUND
# 2.1 REINFORCEMENT LEARNING AND DEEP Q-NETWORKS
We first review the traditional reinforcement learning setting, where an agent interacts with an infinite-horizon, discounted Markov Decision Process $( \boldsymbol { S } , \bar { \boldsymbol { A } _ { \ l } } , \boldsymbol { \gamma } , P , \boldsymbol { r } )$ . Here, $s$ is the state space, $\mathcal { A }$ is the action space, $\gamma$ the discount factor, $P$ the transition model and $r$ is a reward function $r : S \times \mathcal { A } \mathbb { R }$ . We consider a policy $\pi _ { \boldsymbol { \theta } } ( a | \boldsymbol { s } )$ parameterized by $\theta$ . At time $t$ , the agent chooses an action $a _ { t } \in \mathcal A$ according to its policy $\pi _ { \boldsymbol { \theta } } ( \boldsymbol { a } | \boldsymbol { s } _ { t } )$ where $s _ { t } \in S$ is the current state. The environment in turn produces a reward $r ( s _ { t } , a _ { t } )$ and transitions to the next state $s _ { t + 1 }$ according to the transition probability $\textstyle P ( s _ { t + 1 } | s _ { t } , a _ { t } )$ . The goal of the agent is to maximize the expected $\gamma$ -discounted cumulative return $\begin{array} { r } { \mathbb { E } _ { \pi } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) ] } \end{array}$ with respect to the policy parameters $\theta$ . The action-value function is denoted as $\begin{array} { r } { Q ^ { \pi } ( s _ { t } , a _ { t } ) = \mathbb { E } _ { \pi } [ \sum _ { i = t } ^ { \infty } \gamma ^ { i - t } r ( s _ { i } , a _ { i } ) | s = s _ { t } , a = a _ { t } ] } \end{array}$ , which is the expected discounted sum of rewards obtained by performing an action $a$ at state $s$ and following the policy thereafter. We denote $\pi ^ { * }$ as the optimal policy such that $Q ^ { \pi ^ { * } } ( s , a ) \geq Q ^ { \pi } ( s , a )$ for every $s \in S$ , $a \in { \mathcal { A } }$ and policy $\pi$ . The optimal $Q$ -function $Q ^ { * } = Q ^ { \pi ^ { * } }$ satisfies the Bellman equation:
$$Q ^ { * } ( s , a ) = \mathbb { E } _ { s ^ { \prime } \sim p ( \cdot \vert s , a ) } \bigg [ r ( s , a ) + \gamma \operatorname* { m a x } _ { a ^ { \prime } \in A } Q ^ { * } ( s ^ { \prime } , a ^ { \prime } ) \bigg ]$$
Q-learning (Sutton & Barto, 2018) is an off-policy, model-free RL algorithm that is based on the Bellman equation. The algorithm uses semi-gradient descent (Sutton & Barto, 2018) to minimize the squared Temporal Difference (TD) error: $\mathcal { L } \ = \ \mathbb { E } ( Q ( s _ { t } , a _ { t } ) \ - \ y _ { t } ) ^ { 2 }$ , where the $y _ { t } = r _ { t } + \gamma \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } Q ( s _ { t + 1 } , a ^ { \prime } )$ is the $T D$ target. Deep Q-Network (Mnih et al., 2013) builds on the Q-learning algorithm and uses a neural network to approximate $Q ^ { * }$ . It also uses a replay buffer as well as a target network to improve training stability.
# 2.2 GOAL ORIENTED REINFORCEMENT LEARNING
We review the goal-oriented reinforcement learning framework following Schaul et al. (2015). We augment the previously defined infinite-horizon, discounted Markov Decision Process with a goal space $\mathcal { G }$ . A goal $g$ is chosen from $\mathcal { G }$ and stays fixed for each episode. The goal induces a reward function $r _ { g } : S \times \mathcal { A } \mathbb { R }$ , that assigns reward to a state conditioned on the given goal. At time step $t$ the agent $\bar { \pi } ( a _ { t } | s _ { t } , g )$ chooses an action conditioned on the current state $s _ { t }$ , as well as the current goal $g$ . The agent’s objective is to maximize the expected discounted cumulative return given the goal, i.e., $\begin{array} { r } { \mathbb { E } _ { \pi } [ \sum _ { t = 0 } ^ { \infty ^ { - } } \gamma ^ { t } r ( s _ { t } , \bar { a } _ { t } , g ) ] } \end{array}$ .
 Figure 1: The diagram illustrates our model architecture.
# 2.3 HINDSIGHT EXPERIENCE REPLAY (HER)
We follow Andrychowicz et al. (2017) and consider a specific family of goal conditioned reward functions, where the reward is either 0 or 1, depending on the resulting state, $r _ { g } ( s _ { t } , a _ { t } ) = f _ { g } ( s _ { t + 1 } )$ , where $f _ { g } : { \mathcal { S } } \{ 0 , 1 \}$ . In many scenarios, the function $f _ { g }$ acts as a predicate that determines whether the agent is successful or not according to $g$ , and only assigns positive reward at the terminal state. Hence the reward function is very sparse and makes it difficult for an agent to learn.
HER proposes a solution to this problem. The agent first collects an episode of experiences $s _ { 0 } , a _ { 0 } , r _ { 1 } , . . . , s _ { T - 1 } , a _ { T - 1 } , r _ { T } , s _ { T }$ under the goal $g$ , where $r _ { T } = r _ { g } ( s _ { T - 1 } \bar { , } a _ { T - 1 } ) $ is the terminal reward. If $r _ { T }$ is zero, one can replace $g$ with $g ^ { \prime } \in \mathcal G$ such that $r _ { g ^ { \prime } } ( s _ { T - 1 } , a _ { T - 1 } ) = 1$ . With an off-policy algorithm, one is able to learn from the goal transformed experience. In order to flexibly relabel with a desirable goal, the authors assume that there exists a representation map from the state space to the goal space $\mathbf { \bar { T } } : \mathcal { S } \mathcal { G }$ , so that for each $s \in S$ , the corresponding goal representation satisfies the predicate $f _ { g } \left( \mathbb { T } ( s ) \right) = 1$ . However, such mapping is not simple to construct. Although the author pointed out a trivial construction can be done by taking ${ \mathcal { G } } = { \mathcal { S } }$ and $f _ { g } ( s ) = [ g = \overline { { s } } ]$ such goal representation is redundant and uninformative, and largely limits the applicability of the algorithm. Consider an example where the state is the first-person raw pixel observation in a 3-D environment, and the goal is to walk towards a particular object. There are many possible directions to approach the object from, which results in many different possible states that satisfy the goal. However, no subset of the raw pixel observation can abstractly represent the goal.
# 3 AUGMENTING EXPERIENCE VIA TEACHER’S ADVICE (ACTRCE)
For a goal oriented MDP, $\{ S , \mathcal { G } , \mathcal { A } , \gamma , P , r _ { g } \}$ , and a parameterized agent $\pi ( a _ { t } | s _ { t } , g )$ , our objective is to maximize the expected discounted cumulative return, i.e., $\begin{array} { r } { \mathbb { E } _ { \pi } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { g } ( s _ { t } , a _ { t } ) ] } \end{array}$ for each $g \in { \mathcal { G } }$ Following HER, we assume there exists one or more more goal representation mappings $\mathbb { T } : \mathcal { S } \mathcal { G }$ which describe what goal is satisfied at each state. For example, in the original HER paper, the mapping $\mathbb { T }$ is simply a subspace projection from the state. Such representation can work well for their robotic tasks, where subset of the state (i.e., the coordinates of objects and body parts) can reasonably well represent the goal. However, in general, such mapping can not abstract meaningful information about the goal, and will cause redundancy.
Language provides an abstract representation for a goal and hence reduces redundancy in representation. This motivates our proposal to use natural language for representing the goal space. Concretely, for each state $s \in S$ , we define $\mathbb { T }$ as a teacher that gives an advice $\mathbb { T } ( s )$ , a natural language description of the goal that is achieved in the state $s$ . To implement such a teacher, one can ask a human to look at a state and describe the goal in words, or generate a goal description automatically, as part of a narration or accessibility feature in a game. Given $\mathbb { T }$ , we can convert a failure trajectory to a successful one by relabeling the original goal with the teacher advice. To illustrate, say the original goal for the episode is "Go to the armor", but at this particular time step, the agent has reached the blue torch instead. The teacher then tells the agent that the goal that reflects the current state is "Go to blue torch". The agent can hence take the advice and use it as a positive experience.
Besides positive reward signals, we also find that negative experience is necessary for training. Hence, in addition to a teacher who describes the achieved goal with a positive reward, we also introduce a teacher who gives negative reward with a description of a goal that has not been achieved. We further consider the scenario where there is more than one goal that can be satisfied in a state, e.g.,
# Algorithm 1 Augmenting Experience via Teacher’s Advice (ACTRCE)
Given: • an off-policy RL algorithm A, and replay buffer R. . e.g. DQN, DDPG, NAF, SDQN • A language goal space $\mathcal { G }$ and a desired goal space $\mathcal { G } _ { d }$ . • A group of teachers $\{ \mathbb { T } \}$ for episode $= 1$ , $M$ do Sample a desirable goal description $g \in { \mathcal { G } } _ { d }$ and an initial state $s _ { 0 }$ . for $t = 0$ , $T - 1$ do Sample an action $a _ { t }$ using the behavioral policy from A: $a _ { t } \pi _ { b } ( s _ { t } | | g )$ . $| |$ denotes concatenation end for for every teacher $\mathbb { T }$ do Compute advice $g ^ { \prime } = \mathbb { T } ( s _ { T } )$ . . Teacher’s advice in natural language for $t = 0$ , $T - 1$ do $r = r _ { g ^ { \prime } } ( s _ { t } , a _ { t } )$ Store transitions $\left\{ ( s _ { t } | | g ^ { \prime } , a _ { t } , r , s _ { t + 1 } | | g ^ { \prime } ) \right\} \mathrm { i }$ in $R$ . HER end for end for Perform training with A and a minibatch $B$ from the replay buffer. end for
the state that is described as “Reach a blue torch" may also be described as “Reach the largest blue object". Each different description of the goal corresponds to a different teacher (see more discussions and experiments on variations of teachers in Appendix E). Therefore, in general, there is a group of teachers of different kinds, each giving different advice. We then relabel the original goal with each advice and corresponding positive or negative reward, and augment the replay buffer with these trajectories. Algorithm 1 describes our proposed approach formally.
Note that in the above formulation, we assume a MDP setting, and let the teacher give advice based solely on the terminal state $g ^ { \prime } = \mathbb { T } ( s _ { T } )$ . By contrast, in the POMDP setting, we ask the teacher to give advice based on the history of states and actions during the episode, i.e., $\mathbf { \bar { \boldsymbol { g } } } ^ { \prime } = \mathbb { T } ( \{ s _ { 0 } , a _ { 0 } , \dots , s _ { T } \} )$ .
# 3.1 LANGUAGE REPRESENTATION
There remains a question of how we deal with the natural language goal representation, a sequence of discrete symbols. In this paper, we explore two standard ways to convert a language goal into a continuous vector representation for neural network training. One way is to represent each word as a one-hot vector, and use a recurrent neural network (RNN) to sequentially embed each word into its hidden state. We can then obtain some function of its hidden states (e.g., last hidden state, an attention over all hidden states) as the representation of the goal. The other way is to use a pre-trained language component obtained by other approaches and dataset (e.g. Mikolov et al. (2013)) to represent the given language instructions. Since a pre-trained sentence embedding defines a reasonable similarity metric among sentences, one can expect the agent to understand unseen lexicons that are closely related to the language goals in training. This allows the agent to gain better natural language understanding, and potentially be more robust to the language advice it gets from teachers (advice from humans can be quite noisy).
To integrate language representation of goals into the model, we design the architecture as follows. The architecture consists of 3 modules. One language component that takes an instruction and convert it into a continuous vector, and we apply an attention vector. The second component processes the observation to obtain a image representation using convolution neural networks. We then use gated attention from Chaplot et al. (2017b) to fuse goal information and the observation. The third component then take the result of the fused representation and compute the output value. Figure.(1) shows the computational graph.
# 4 EXPERIMENTS
In the following experiments, we demonstrate the effectiveness of the proposed method and discuss qualitative differences from the baseline. We first describe the experimental set up with our 2 environments, KrazyGrid World and ViZDoom. In the subsequent sections, we investigate:
 Figure 2: Performance in average success rate during training, comparing between different sentence embedding methods for the single target and composition task on ViZDoom.
1. A comprehensive comparison between goal representations in hindsight advice, generalization, and semantic similarities. We compare different goal representations: a naive one hot vector for each instruction, a Gated Recurrent Unit (GRU) (Chung et al., 2014) that embeds the discrete language tokens, and a pre-trained word embedding. We show that as the number of instructions increases, the one hot approach does not scale as well as the GRU and pre-trained embedding. From visualizing the representation, we can see that structures emerge from GRU and pre-trained embeddings. We also demonstrate that pre-trained embedding representation can generalize to goals containing out of training vocabulary words.
2. Does the hindsight language advice help with learning? How much advice do we need? We show significant improvement in sample efficiency by using advice from teachers. In many of the challenging tasks, the agent cannot learn at all without teachers’ advice. We also show that significant improvement can be achieved even if we provide limited amount of teachers’ advice, showing low burden of the method in practice.
# 4.1 ENVIRONMENTS AND TRAINING
We tested our method in a 2D grid world (KrazyGrid World (Stadie et al., 2018)), as well as a 3D environment (ViZDoom (Chaplot et al., 2017b)). We describe the environment and our modifications below.
KrazyGrid World (KGW) (Stadie et al., 2018): KrazyGrid World is a 2D grid environment. For our experiments we chose to use 4 functionality of tiles: Goal, Lava, Normal, and Agent. We added an additional colour attribute in: Red, Blue, Green. The desired goals in this environment is to reach goals of different colours. Appendix A lists all language goals and additional environment details.
ViZDoom(Kempka et al., 2016; Chaplot et al., 2017b): The 3D learning environment is based on the first person shooter game Doom. The state is a raw pixel image from first person perspective of a room containing several random doom objects of various types, colours, and sizes. The goal for the episode is a natural language instruction in the form "Go to the [target attribute] [object]", such as "Go to the green torch". See Appendix B for list of instructions and more description of ViZDoom.
Compositions of goals. We refer language goals introduced in KGW and ViZDoom sections as singleton tasks. We further consider a set of more challenging tasks – tasks that are composed of singleton tasks. Given two singleton tasks $A$ , $B$ , we take composition function “and" and “or" to form two new tasks “ $A$ and $B "$ , and “ $A$ or $B "$ . The task “ $A$ and $B "$ is considered as complete when the agent completes both $A$ and $B$ within an episode, and “ $A$ or $B "$ is considered as complete when one of the task is achieved. In our experiments, we consider all combinations of singleton tasks with both compositions “and" and “or" for KGW, and “and" for ViZDoom.
Training details. We used the DQN algorithm as the base reinforcement learning algorithm in both environments. A detailed architecture description for all of our experienments can be found in Appendix C. We carried out multi environment training as follows. First we sample 16 different environments. We collected data from all 16 environments. We updated the agents with an average gradient. We then resampled 16 environments. Further training details can be found in Appendix D.
 Figure 3: Comparison among different sentence embedding methods showing the pairwise correlation between the sentence embedding vectors for each of the singleton instructions. The darker the colour, the higher the correlation.
# 4.2 INVESTIGATING DIFFERENT TYPES OF GOAL REPRESENTATION
In this section, we investigate the hypothesis that using language for goal representation helps learning in various aspects. We compare language-based goal representations and a non-language goal representation. In summary, we show that when the difficulty of the tasks increases, language goal representations became more effective in providing learning signals. We also show how one can use language goal representation to generalize to unseen goals in training, whereas non-language goal representation could not. With a pre-trained sentence embedding, we can even generalize to instructions consisting of unseen lexicons, showing the robustness of the language goal representation. Three goal representations are described as follows,
Language Sentence Representation with GRUs: For each instruction, we represent each word as a one hot vector, and sequentially embed words into a GRU. We use take the last hidden state representation of the GRU for representing the instruction. We use the same GRU architecture from Chaplot et al. (2017b), with hidden size 256.
Pre-trained Language Sentence Representation: We also consider models where the language component is pre-trained. We use InferLite (Kiros & Chan, 2018) as the pre-trained sentence representation and hold the parameters fixed during training. InferLite is a lightweight form of generic sentence encoder trained to perform natural language inference (Bowman et al., 2015; Williams et al., 2018) resembling InferSent (Conneau et al., 2017) but without the use of RNNs. The original sentence embedding vector is of dimension 4096, and we use a learned linear layer to project it down to 256 for keeping every other part of the model same as the other two.
One-Hot Representation: The non-language baseline represents each instruction as a one hot vector, which does not contain any language structure. We embed this one-hot goal representation to a vector with the same number of dimensions as the GRU representation. This embedding is learned independently for each goal encountered.
# 4.2.1 HOW DOES EACH GOAL REPRESENTATION PERFORM?
We use all three goal representations with hindsight advice for learning both singleton tasks and compositional tasks of ViZDoom environment. The singleton tasks consists of 7 objects, and the compositional tasks consists of 5 objects. The result of comparisons is plotted in Figure 2. We see that in an easier benchmark—singleton—tasks, agents using one-hot goal representations are still able to learn as quickly as agents using the other two goal representations. However, in a much more challenging benchmark— compositional–tasks, the one-hot representations can only achieve a $2 4 \%$ success rates, whereas ACTRCE with language representations can achieve $9 7 \%$ . Since one hot representations represent each goal independently, the agent is unable to generalize to any new unseen instructions. With language representation, we can easily generalize to unseen instructions that consists of seen lexicons. We reported the generalization results in Table 1, under “ZSL" (zero-shot learning). Remarkably, with GRU language goal representation, the agent is able to generalize to unseen instructions $83 \%$ of the time, showing great generalization ability of language goal representations.
# 4.2.2 VISUALIZATION OF LEARNED EMBEDDINGS
We carried out a visualization analysis to see the statistical relations between the learned embeddings of goals. We took the model trained in the singleton VizDoom benchmark, where the agent was able
<table><tr><td rowspan="2">Method</td><td rowspan="2">MT</td><td rowspan="2">Single (7 objects) ZSL</td><td colspan="2">Composition (5 objects)</td></tr><tr><td>MT</td><td>ZSL</td></tr><tr><td>DQN (GRU)</td><td>0.08 ± 0.01</td><td>0.065 ± 0.007</td><td>0.115 ± 0.007</td><td>0.07 ±0.04</td></tr><tr><td>DQN (InferLite)</td><td>0.05 ± 0.07</td><td>0.04± 0.06</td><td>0.10±0.02</td><td>0.13 ± 0.07</td></tr><tr><td>DQN (OneHot)</td><td>0.035 ± 0.007</td><td></td><td>0.02 ± 0.03</td><td></td></tr><tr><td>ACTRCE (GRU)</td><td>0.80 ± 0.06</td><td>0.76 ± 0.03</td><td>0.97 ± 0.04</td><td>0.83 ± 0.09</td></tr><tr><td>ACTRCE (InferLite)</td><td>0.80 ± 0.01</td><td>0.76 ± 0.02</td><td>0.88 ±0.05</td><td>0.62 ± 0.01</td></tr><tr><td>ACTRCE (One Hot)</td><td>0.80 ± 0.03</td><td></td><td>0.24± 0.05</td><td>1</td></tr></table>
Table 1: The table shows the averaged success rates, calculated over 100 episodes, in multitask and zero-shot scenario for the model trained with DQN versus DQN with ACTRCE. The standard deviations are calculated across 2 seeds. In the Multitask (MT) scenario, the goal for the episode is sampled from the training set of instructions but with a random environment initialization. For Zero-Shot (ZSL), the instruction is sampled from the held out test instruction set and with a random environment initialization.
to learn with all three goal representations. However, we find there are huge differences in learned embeddings. For each goal instruction, we extract the corresponding learned embedding for all three goal representation, which is the continuous vector before the attention layer (recall Fig.(1)), all of size 256. We then calculated the correlation matrix for each goal representations. We plot all three correlation matrices in Figure.(3). The rows and columns are grouped by object type, then colour and size. We found that GRU and InferLite embeddings have very similar block-like structure, due to clustering of colours and shapes, while each one-hot goal embeddings share almost no correlation between each other. We further performed t-SNE (Maaten & Hinton, 2008) embeddings and observe meaningful clustering with language goal representations and sporadic embeddings for one-hot goals. See more details in Appendix K.1.
# 4.2.3 GENERALIZING TO UNSEEN LEXICONS WITH PRE-TRAINED WORD EMBEDDING
We now show how to use pre-trained embeddings to allow our model to generalize to unseen lexicons at test time through representation transfer, similar in spirit to DeViSE (Frome et al., 2013) that was used for image classification with unseen classes. We took the agent trained in singleton tasks with InferLite goal representations, and replaced one word in each original instruction with its synonym1. We evaluate the performance of the agent on these new instructions that contain unseen lexicons. The results are shown in Tab.(3). We find the agent is able to achieve tasks above $6 6 \%$ of time. The ability of understanding sentences of similar meanings become useful when one implements the method with advice comes from humans. Since humans can describe the same meaning in many different ways, understanding synonyms can improve the robustness of learning in general noisy settings.
Table 2: Multitask evaluation with synonym and Zero-shot with synonym using InferLite.
<table><tr><td>Method</td><td>MT + Synonym</td><td>ZSL + Synonym</td></tr><tr><td>ACTRCE (InferLite)</td><td>0.66 ± 0.05</td><td>0.62 ± 0.02</td></tr></table>
# 4.3 DO WE NEED HINDSIGHT ADVICE?
In the previous section, we demonstrate the effectiveness of language goal representation from various perspectives. In this section, we show how hindsight advice plays an important role in learning. We compared our method (denoted as “ACTRCE") to the algorithm DQN, the base algorithm without any hindsight language advice. We show that without hindsight advice, DQN is not able to learn many challenging tasks. However, we also found that little advice $( 1 \% )$ is sufficient for learning to take off, showing the practicality of our method. For language representation, we chose to use recurrent neural networks for embedding language goals, for both our method and the baseline method.
# 4.3.1 COMPARISON OF ACTRCE TO DQN
Singleton tasks. For experiments on KGW, we tried two different kind of grids, one with 3 lavas and the other with 6 lavas, and both with 3 goals of different colours. Fig. 4 (a) and (b) show the average success rate over all goals on 16-environments training. The shaded area represents the standard deviation over 2 random seeds. The baseline DQN is shown in blue curve, which failed to learn anything at all. Our method (shown in green) quickly learned and achieved good results on both environments (around $8 0 \%$ success rate). In ViZDoom experiments, we trained our agent in 3 configurations: 5 objects in (1) easy and (2) hard mode, and (3) 7-objects in the hard mode with $50 \%$ larger room size. While the DQN and A3C implementation from Chaplot et al. (2017a) were able to learn in the 5 objects task (see Appendix G for details), we found that in the more difficult 7-objects environment, only the agent trained with ACTRCE was able learn at all. Figure 4 (e) illustrates the training instruction average success rate (over 100 episode chunks) vs. the number of frames set, when using ACTRCE versus DQN baseline. Table 1 summarizes the agent’s Multitask and Zero-Shot generalization performance.
 Figure 4: Performance comparisons on KGW and ViZDoom environments. The success rates are calculated over all desired goals and 16 different environments. Shaded area represents standard deviation 2 random seeds.
Compositional tasks. In KGW, we carried out the experiments in a grid with 3 goals and 3 lavas. A comparison of average success rates over all goals of ACTRCE, and baseline DQN is shown in in Fig. 4 (C). The shaded area represents the standard deviation over 2 random seeds. We observed that the baseline still could not learn the task while ACTRCE learned efficiently and achieved good performance in this highly challenging environment. In ViZDoom, we chose to use 5 objects in easy mode for the compositional task, where all 5 objects appeared in front of the agent at the beginning of the episode. Figure 4 (b) shows the average success rate when using ACTRCE vs. baseline DQN. Likewise, our agent was able to learn very well with hindsight advice, whereas the baseline DQN failed to learn.
# 4.3.2 HOW MUCH ADVICE DO WE NEED?
We consider a variant of ACTRCE where the teacher provides hindsight advice only in the first $\{ 1 0 \% , 1 \% \}$ of frames during training, and stops giving any advice for the remaining portion of the training. We perform this experiment in the ViZDoom environment single target mode with 7 objects, using the GRU as the sentence embedding. Figure 4 illustrates the training average success rate over the frames, and Table 5 lists the final MT and ZSL performance on the trained agents. We observe that the agent is still able to learn comparably well even given very little $( 1 \% )$ advice, indicating of the method’s robustness in practical settings.
# 5 RELATED WORK
Several approaches have used natural language in the context of reinforcement learning. In pioneering work, Maclin & Shavlik (1994) translated language advice into a short program, implemented as a neural network. This advice network encouraged the policy to take the suggested action. Similarly, Kuhlmann et al. (2004) exploited natural language advice for a RL agent learning to play a (simulated) soccer game. In Ling & Fidler (2017), human feedback in the form of natural language was exploited to shape the reward of an image captioning RL agent. Kaplan et al. (2017) introduced an agent that learns to use English instructions to self-monitor its progress to beat Atari games. This was accomplished by implementing a multi-modal embedding of the pairs of game frames and instructions to determine if the instruction is satisfied, then provide additional reward to the agent. Andreas et al. (2017) proposed to use language as the latent parameter space for few-shot learning problems, including policy search.
The reverse has also been studied: using reinforcement learning to learn grounded language, referred to as task-oriented language grounding. Misra et al. (2017) mapped language instructions and visual observations to actions for manipulating blocks on a 2D plane. Yu et al. (2018) grounded language in 2D maze environment, via sentence-directed navigation and question answering task. They introduced the notion of extrapolation zero-shot sentence, where new words are transferred from other use cases and models. In their work, the unseen word in the navigation sentence was seen (transferred from) during the question answering task. In contrast, we transfer the unseen synonym words from a pre-trained sentence embedding InferLite model. Hermann et al. (2017) presented an agent that learns to execute written instructions in a 3D environment through reinforcement learning and unsupervised learning. Our work builds on Chaplot et al. (2017b) who proposed a gated-attention architecture for combining the language and image features to learn a policy that execute written instruction in a 3D environment.
Our work also relates to augmenting the experience using a experience replay buffer. Lin (1992) introduced experience replay (ER) to speed up the credit assignment process. The technique was later popularized by DQN (Mnih et al., 2013) for Atari games. Further works focus on sampling techniques from the replay buffer to accelerate learning. Hindsight Experience Replay (Andrychowicz et al., 2017) builds on ER by providing additional experiences in a goal conditional task. Our work extends this technique to use a natural language goal representation.
# 6 CONCLUSION
In this work, we propose the ACTRCE method that uses natural language as a goal representation for hindsight advice. The main point of the paper is to show that using language as goal representations can bring many benefits, when combined with hindsight advice. We analyzed the differences among goal representation, and show that ACTRCE can efficiently solve difficult reinforcement learning problems in challenging 3D navigation tasks, whereas HER with non-language goal representation failed to learn. We also show that with language goal representations, the agent can generalize to unseen instructions. With pre-trained language component, the agent can even generalize to instructions with unseen lexicons, demonstrating its potential to deal with noisy natural language advice from humans. Although ACTRCE algorithm crucially relies on hindsight advice, we showed that little amount of advice is sufficient for the learning to take off, showing its great practicality.
# REFERENCES
J. Andreas, D. Klein, and S. Levine. Learning with Latent Language. ArXiv e-prints, November 2017. Marcin Andrychowicz, Dwight Crow, Alex K Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. In NIPS, 2017. Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large annotated corpus for learning natural language inference. In EMNLP, 2015. Devendra Singh Chaplot, Kanthashree Mysore Sathyendra, Rama Kumar Pasumarthi, Dheeraj Rajagopal, and Ruslan Salakhutdinov. Gated-attention architectures for task-oriented language grounding (code). https://github.com/devendrachaplot/DeepRL-Grounding, 2017a.
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, 2017b.
J. Chung, C. Gulcehre, K. Cho, and Y. Bengio. Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling. ArXiv e-prints, December 2014.
Jack Clark and Dario Amodei. Faulty reward functions in the wild, 2016. URL https://blog. openai.com/faulty-reward-functions/.
Alexis Conneau, Douwe Kiela, Holger Schwenk, Loïc Barrault, and Antoine Bordes. Supervised learning of universal sentence representations from natural language inference data. In EMNLP, 2017.
Andrea Frome, Greg S Corrado, Jon Shlens, Samy Bengio, Jeff Dean, Tomas Mikolov, et al. Devise: A deep visual-semantic embedding model. In NIPS, 2013.
V. Gullapalli and A. G. Barto. Shaping as a method for accelerating reinforcement learning. In Proceedings of the 1992 IEEE International Symposium on Intelligent Control, pp. 554–559, Aug 1992. doi: 10.1109/ISIC.1992.225046.
Stevan Harnad. The symbol grounding problem. Physica D: Nonlinear Phenomena, 42(1):335 – 346, 1990. ISSN 0167-2789. doi: https://doi.org/10.1016/0167-2789(90)90087-6. URL http: //www.sciencedirect.com/science/article/pii/0167278990900876.
Hado vang Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, AAAI’16, pp. 2094–2100. AAAI Press, 2016. URL http://dl.acm.org/citation.cfm?id $=$ 3016100.3016191.
K. M. Hermann, F. Hill, S. Green, F. Wang, R. Faulkner, H. Soyer, D. Szepesvari, W. M. Czarnecki, M. Jaderberg, D. Teplyashin, M. Wainwright, C. Apps, D. Hassabis, and P. Blunsom. Grounded Language Learning in a Simulated 3D World. ArXiv e-prints, June 2017.
Russell Kaplan, Christopher Sauer, and Alexander Sosa. Beating atari with natural language guided reinforcement learning. ArXiv e-prints, 04 2017.
Michał Kempka, Marek Wydmuch, Grzegorz Runc, Jakub Toczek, and Wojciech Jaskowski. ViZ- ´ Doom: A Doom-based AI research platform for visual reinforcement learning. In IEEE Conference on Computational Intelligence and Games, pp. 341–348, Santorini, Greece, Sep 2016. IEEE. URL http://arxiv.org/abs/1605.02097. The best paper award.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
Jamie Ryan Kiros and William Chan. Inferlite: Simple universal sentence representations from natural language inference data. In EMNLP, 2018.
G. Kuhlmann, P. Stone, R. Mooney, and J. Shavlik. Guiding a reinforcement learner with natural language advice: Initial results in robocup soccer. In AAAI Workshop on Supervisory Control of Learning and Adaptive Systems, 2004.
Guillaume Lample. Arnold. https://github.com/glample/Arnold, 2017.
Guillaume Lample and Devendra Singh Chaplot. Playing fps games with deep reinforcement learning. In Proceedings of AAAI, 2017.
Long-Ji Lin. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine Learning, 8(3):293–321, May 1992. ISSN 1573-0565. doi: 10.1007/BF00992699. URL https://doi.org/10.1007/BF00992699.
Huan Ling and Sanja Fidler. Teaching machines to describe images via natural language feedback. In NIPS, 2017.
Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attention-based neural machine translation. In EMNLP, 2015.
Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. In JMLR, 2008.
Richard Maclin and Jude W. Shavlik. Incorporating advice into agents that learn from reinforcements. In National Conference on Artificial Intelligence, pp. 694–699, 1994.
Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In C. J. C. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 26, pp. 3111–3119. Curran Associates, Inc., 2013.
Dipendra Misra, John Langford, and Yoav Artzi. Mapping instructions and visual observations to actions with reinforcement learning. EMNLP, 2017.
V. Mnih, A. Puigdomènech Badia, M. Mirza, A. Graves, T. P. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous Methods for Deep Reinforcement Learning. ArXiv e-prints, February 2016.
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin A. Riedmiller. Playing atari with deep reinforcement learning. CoRR, abs/1312.5602, 2013.
Andrew Y. $\mathrm { N g }$ , Daishi Harada, and Stuart J. Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In Proceedings of the Sixteenth International Conference on Machine Learning, ICML ’99, pp. 278–287, San Francisco, CA, USA, 1999. Morgan Kaufmann Publishers Inc. ISBN 1-55860-612-2. URL http://dl.acm.org/citation.cfm?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 645528.657613.
Ivaylo Popov, Nicolas Heess, Timothy P. Lillicrap, Roland Hafner, Gabriel Barth-Maron, Matej Vecerik, Thomas Lampe, Yuval Tassa, Tom Erez, and Martin A. Riedmiller. Data-efficient deep reinforcement learning for dexterous manipulation. CoRR, abs/1704.03073, 2017.
Tom Schaul, Dan Horgan, Karol Gregor, and David Silver. Universal value function approximators. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 1312–1320. JMLR.org, 2015. URL http://dl.acm. org/citation.cfm?id=3045118.3045258.
Jeffrey Mark Siskind. Grounding language in perception. Artificial Intelligence Review, 8(5):371–391, Sep 1994. ISSN 1573-7462. doi: 10.1007/BF00849726. URL https://doi.org/10.1007/ BF00849726.
Bradly Stadie, Ge Yang, Rein Houthooft, Xi Chen, Yan Duan, Yuhuai Wu, Pieter Abbeel, and Ilya Sutskever. Some considerations on learning to explore via meta-reinforcement learning. ICLR, 2018.
Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. MIT Press, Cambridge, MA, USA, 2nd edition, 2018. ISBN 9780262193986.
Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL, 2018.
Terry Winograd. Understanding natural language. Cognitive Psychology, 3(1):1 – 191, 1972. ISSN 0010-0285. doi: https://doi.org/10.1016/0010-0285(72)90002-3. URL http://www. sciencedirect.com/science/article/pii/0010028572900023.
Haonan Yu, Haichao Zhang, and Wei Xu. Interactive grounded language acquisition and generalization in a 2d world. ICLR, 2018.
# A KRAZYGRID WORLD LANGUAGE GOALS
# A.1 MORE DETIALS ON THE ENVIRONMENT
KrazyGrid World is a 2D grid environment. For our experiments we chose to use 4 functionality of tiles: Goal, Lava, Normal, and Agent. We added an additional colour attribute ranging in 3 colours: Red, Blue, Green. There are 4 discrete actions, “up", “down", “right", “left". The desired goals in this environment is to reach goals of different colours. We use a global view of the grid state as the observation to the agent. Each tile in the grid is represented by a concatenation of its functionality and colour attribute, both in one hot vectors. The grid state also includes a one hot vector that represents the agent’s position. In our experiments, we use an environment of grid size $9 \times 9$ , with 3 goals in the environment, each has a distinct colour. We tried various number of lavas in the environment, and made sure there is at least 1 lava of each colour. In the simple task setting, the episode terminates when the agent reaches a lava or a goal, or the episode runs over a maximum time step $T = 2 5$ . We automatically generates descriptions give any states of the environment as the teacher.
Compositional We enlarged the goal space by considering the task of compositions of goals. As the goal space changed, we also had to make several modifications to the environment. We let the episode terminate when the agent reaches a lava or reaches 2 different goals, or runs over the maximum time step of 50. Since we still included simple goals (e.g., “Reach blue goal") in the goal space, we added an extra action called “flag". This action can be used for the agent to terminate the episode when it thinks the given goal is accomplished. The environment will be terminated if the agent indeed has accomplished the given task, and will stay unchanged otherwise.
# A.2 LIST OF LANGUAGE INSTURCTIONS
Single goal setting The entire goal space $\mathcal { G }$ consists of 8 goals: {Reach red goal, Reach blue goal, Reach green goal, Reach red lava, Reach blue lava, Reach green lava, Avoid any lava, Avoid any goal}. The desired goal space $\mathcal { G } _ { d }$ consists of 3 goals {Reach red goal, Reach blue goal, Reach green goal}.
Compositional goal setting The desired goal space $\mathcal { G } _ { d }$ consists of 21 goals {Reach red goal, Reach blue goal, Reach green goal, Reach red goal and Reach blue goal, Reach blue goal and Reach red goal, Reach red goal or Reach blue goal, Reach blue goal or Reach red goal, Reach red goal and Reach green goal, Reach green goal and Reach red goal, Reach red goal or Reach green goal, Reach green goal or Reach red goal, Reach blue goal and Reach green goal, Reach green goal and Reach blue goal, Reach blue goal or Reach green goal, Reach green goal or Reach blue goal, Reach red goal and Avoid any lava, Avoid any lava and Reach red goal, Reach blue goal and Avoid any lava, Avoid any lava and Reach blue goal, Reach green goal and Avoid any lava, Avoid any lava and Reach green goal}.
The entire goal space $\mathcal { G }$ has another of 17 goals: {Reach red lava or Reach blue lava, Reach blue lava or Reach red lava, Reach red lava or Reach green lava, Reach green lava or Reach red lava, Reach blue lava or Reach green lava, Reach green lava or Reach blue lava, Reach red lava, Reach red lava and Avoid any goal, Avoid any goal and Reach red lava, Reach blue lava, Reach blue lava and Avoid any goal, Avoid any goal and Reach blue lava, Reach green lava, Reach green lava and Avoid any goal, Avoid any goal and Reach green lava, Avoid any lava and Avoid any goal, Avoid any goal and Avoid any lava $\}$ .
# B VIZDOOM ENVIRONMENT DETAIL
# B.1 ENVIRONMENT DESCRIPTION
ViZDoom(Kempka et al., 2016; Chaplot et al., 2017b): The 3D learning environment is based on the first person shooter game Doom. At each time step, the state is a raw pixel image from first person perspective of the 3D environment. The environment consists of a room containing several random doom objects of various types, colours, and sizes. The agent can navigate the environment via 3 possible actions: turn left, turn right, and move forward. The goal for the episode is a natural language instruction in the form "Go to the [target attribute] [object]", such as "Go to the green torch". Only one target object is present in each episode. The episode terminates either when the agent reaches an object (regardless of whether it is correct or not), or the maximum time step is reached $T = 3 0$ ). A reward of 1 is given if the correct object is reached, otherwise a reward of 0 is given. The environment has several difficulty modes, depending on how the objects and the agent are distributed at the beginning of the episode. In the easy mode, the agent is spawned at a fixed location facing forward. The objects are placed evenly spaced apart along a horizontal row in front of the agent. In hard, both the objects and the agent are randomly spawned, and the objects are not necessarily in view. We focus on the easy and hard mode for our experiments.
# B.2 VIZDOOM COMPOSITION INSTRUCTIONS
The compositional instructions consist of two single object instructions from the original training set joined by the word "and", such as "Go to the red torch and Go to the pillar". We did not include any superlative instructions, such as "Go to the largest object".
We ensured that the desirable instructions were unambiguous–given two instructions, the set of objects satisfying the first instruction is mutually exclusive from the set of objects satisfied in the second instruction. For example, "Go to the torch and Go to the pillar" have mutually exclusive set of valid objects. An ambiguous compositional instruction may have objects that satisfy both instructions. For example, "Go to the blue object and Go to the torch" is ambiguous because a blue torch satisfies both instructions. This is illustrated in Figure 5.
 Figure 5: Example of (a) unambiguous composition of instructions and (b) ambiguous composition of instructions
B.3 VIZDOOM COMPOSITION: MODIFICATION FOR STATE
For the ViZDoom composition task, we modify the raw pixel image of the environment to include a basic head-up display (HUD) consisting of black rectangle in the bottom left of the screen. When the agent reaches an object, a small thumbnail image of the reached object will appear inside the HUD. The HUD can show up to 2 objects reached, and the episode terminates once the again has reached a second object. Figure 6 illustrates what the agent sees as the input image throughout a composition task episode.
 Figure 6: Example state input screens seen by the agent in a ViZDoom composition task episode. The composition instruction for this episode is "Go to the green short torch and Go to the green short pillar". (a) Shows the starting state. (b) is the state when the agent has reached the green short pillar. (c) is the final state once the agent reached the short green torch.
# B.4 VIZDOOM SYNONYM INSTRUCTIONS
We generate the synonym instructions by replacing an original word in the instruction with one of the synonyms listed in Table 3.
Table 3: Original vocabulary and corresponding synonyms
<table><tr><td>Original Word</td><td>Synonym</td></tr><tr><td>Go to</td><td>Reach, Approach, Get to</td></tr><tr><td>largest</td><td>biggest</td></tr><tr><td>smallest</td><td>littlest</td></tr><tr><td>small</td><td>tiny</td></tr><tr><td>large</td><td>big, huge</td></tr><tr><td>short</td><td>low, little</td></tr><tr><td>tall</td><td>big, towering</td></tr><tr><td>red</td><td>crimson</td></tr><tr><td>blue</td><td>indigo, teal</td></tr><tr><td>green</td><td>olive, lime</td></tr><tr><td>yellow</td><td>amber, gold, sunny</td></tr><tr><td>torch</td><td>lamp,beacon,lantern, flaming object</td></tr><tr><td>pillar</td><td>column, pedestal</td></tr><tr><td>skull</td><td>cranium, head</td></tr><tr><td>key</td><td>opener,unlocker</td></tr><tr><td>card</td><td>badge, pass</td></tr><tr><td>armor</td><td>shield</td></tr><tr><td>object</td><td>thing, item</td></tr></table>
# B.5 VIZDOOM TEACHER ADVICE GENERATION
Singleton task. When the agent does reach an object (correct or incorrect), we generate a positive teacher advice by sampling from the training set of instructions that can describe the reached object. Additionally, we also generate a negative feedback by randomly picking one of the object in the current environment that was not reached, then sampling an instruction that described that unreached object, while ensuring that it will not describe the reached object.
When the agent did not reach any object, we simply do not give any positive teacher advice (i.e. the achieved goal). We had originally tried to give the advice of “Reach no object” when the agent did not reach any objects at the end of the episode, but it did not improve the performance. However, we still give the unachieved goal, from any of the objects in the current environment.
Compositional task. We follow a similar process for compositional task, depending on the number of objects reached. If the agent reached 0 or 1 object only, we generate a singleton advice in similar fashion as singleton task. We later found that not giving any advice when reaching 0/1 object also performed equally well and slightly faster learning. If the agent reached 2 objects during the episode, for positive advice we sample generate singleton instructions for each of the two objects, ensuring that they were not the same instructions, then merge them with "and" keyword. For negative advice, we generate singleton instructions for the unreached objects and combine two of them, ensuring that the instructions do not refer to the reached objects at all.
# C ARCHITECTURES
# KrazyGrid World
• Singleton We use series of convolution layers follows with ReLU activation functions for prepossessing the grid observation: 32 of $\mathrm { \bar { 3 } } \mathrm { x } 3$ kernel with stride 1, followed by 64 of $3 { \tt X } 3$ kernel size with stride of 2 and then 64 of 3x3 kernel with a stride of 1 and 128 of 3x3 kernel with a stride of 2. We input the language sentences as word level one hot vectors to a LSTM of hidden size 128. The LSTM’s last hidden vector is passed into a fully connected layer with 128 output units with sigmoid activation. This acts as the attention vector that is multiplied channel-wise with the 64 feature maps from the convolutional later. The gated feature maps are then flattened and passed through a fully connected layer with ReLU activation with 256 units. We then pass into a linear layer to predict the 4 action values.
• Compositional We use series of convolution layers follows with ReLU activation functions for prepossessing the grid observation: 32 of 1x1 kernel with stride 1, followed by 32 of 3x1 kernel size with stride of 2. We input the language sentences as word level one hot vectors to a bidirection LSTM, of hidden size 40. After obtaining the preprocessed observation, we augment with the history vector provided by the environment as a query to attend to all the hidden states in the Bi-direction LSTMs via Luong attention Luong et al. (2015). We then keep processing the observation using two more convolution layers follows with ReLU activation functions: 64 of 3x3 kernel with stride 2, followed by 64 of 3x3 kernel size with stride of 2. At each of these two layers, we use the context vector formed by language attention to attend back the observation by gating on 64 feature maps in a channel-wise fashion. The final gated feature maps are then flattened and passed through a fully connected layer with ReLU activation with 256 units. We then pass into a linear layer to predict the 5 action values.
ViZDooms Our architecture is almost identical to Chaplot et al. (2017b), except that we uses a linear output layer for the action values, and we did not use dueling architecture. The state input to the network is RGB image of size $3 \times 3 0 0 \times 1 6 8$ . A series of convolution layers follows with ReLU activation functions: 128 of 8x8 kernel with stride 4, followed by 64 of 4x4 kernel size with stride of 2 and then 64 of $4 \mathrm { x } 4$ kernel with a stride of 2. To process the language input, we first use an embedding matrix to embed the voculary to a vector of size 32. We use the Gated Recurrent Unit (GRU) Chung et al. (2014) of size 256 as the recurrent cell to process word embeddings. The GRU’s last hidden vector is passed into a fully connected layer with 64 output units with sigmoid activation. This acts as the attention vector that is multiplied channel-wise with the 64 feature maps from the convolutional later. The gated feature maps are then flattened and passed through a fully connected layer with ReLU activation with 256 units. We then pass into the LSTM with 256 hidden units, and its hidden units go through a linear layer to predict the 3 action values.
# D TRAINING DETAILS
KrazyGrid World For KrazyGrid World experiments, we tune the following hyperparameters within corresponding range: learning rate $\{ 0 . 0 0 0 3 , 0 . 0 0 1 , 0 . 0 0 3 \}$ , replay buffer size of $\{ 5 0 0 0 , 1 0 0 0 0 \}$ , training the network every $\{ 1 , 2 , 4 \}$ frames. We generate episodes with $\epsilon$ -greedy policy starting at $\epsilon = 1 . 0$ then decaying linearly to 0.01 by 10000 frames and remain at 0.01. We use Double DQN Hasselt et al. (2016) to reduce the Q-value overestimation and Huber loss ( $\delta = 1$ ) for stable gradients.
ViZDoom For ViZDoom environment, we use the same set of 56 training instructions to train the agent, and a set of 15 held out test instructions for zero-shot evaluation as in Chaplot et al. (2017b). We also used their code Chaplot et al. (2017a) for reproducing training using Asynchronous Advantage Actor Critic (A3C) Mnih et al. (2016). We implemented our version of DQN on top of the implementation of Arnold Lample & Chaplot (2017); Lample (2017). The cyclic buffer replay buffer contains the last 10000 and 20000 most recent transitions for the easy and hard mode, respectively, chosen from the range $\{ 1 0 0 0 , 1 0 0 0 0 , 1 0 0 0 0 0 \}$ and fine tuned. We generate episodes with $\epsilon$ -greedy policy starting at $\epsilon = 1 . 0$ then decaying linearly to 0.01 by 10000 frames and remain at 0.01. We found that this performed better than using a larger epsilon $= 0 . 1$ . Only after the first 1000 frames have been collected that the training begins, selected from a range of $\{ 1 0 0 0 , 1 0 0 0 0 , 1 0 0 0 0 0 \}$ . We use Double DQN Hasselt et al. (2016) to reduce the $\mathbf { Q }$ -value overestimation and Huber loss $\bar { \delta } = 1 $ )
for stable gradients. We use the Adam optimizer Kingma & Ba (2014) with a learning rate of 0.0001. The network is updated every 4 frames on easy and 16 frames on difficult mode. While updating less often reduces sample efficiency, in practice we found that this speeds up training wall clock time and converges to a better performance. When sampling from the replay buffer, we sample the start a random episode and select 32 consecutive frames from the replay buffer. This approach leads to more accurate estimates of the hidden state of the LSTM. In addition, the sequential mini-batch allows us to perform $n$ -step Q learning as outlined in Mnih et al. (2016). The correlation between samples in the mini-batch is alleviated by running 16 parallel threads to send gradient updates to the shared network parameters. We synchronize the training thread model with the shared network each time before computing the training loss and gradient. The target network is synchronized with the current model once every 500 time steps. and use one additional thread to evaluate the multi-task success rate throughout the training process.
# E DIFFERENT TYPES OF TEACHERS
In this section we described the details of teacher types. Firstly, note that not all of the language descriptions describe favorable behaviors. For example, in the KGW, a desirable goal is “reach a goal", but there are also undesirable states that corresponds to goal “reach a lava". Hence we consider a subset $\mathcal { G } _ { d } \subseteq \mathcal { G }$ to denote all desired goals that the agent is expected to perform. At each episode, we first sample a goal $g \in { \mathcal { G } } _ { d }$ from the set of all desired language goal spaces, and ask the agent to explore the environments conditioned on the goal. When the episode ends, we obtained an advice from a teacher $\mathbb { T }$ by observing the terminal state, $g ^ { * } = \mathbb { T } ( s _ { T } )$ . Depending on the kind of teacher, we obtain a different kind of advice or no advice. We consider three kinds of teacher as follows:
• Optimistic A teacher who gives advice only when the agent achieved a desirable goal, i.e., when $g ^ { \ast } \in \mathcal { G } _ { d }$ . When the agent performs poorly, there is no advice from this teacher. • Knowledgeable A teacher who describes what the agent has achieved in all scenarios, including the undesirable behaviors, as advice to the agent. Discouraging A teacher who describes a desired goal $g ^ { \ast } \in \mathcal G _ { d }$ that the agent has not achieved as advice to the agent. In this case, the trajectory with goal replaced by the teacher’s advice will receive a reward of 0.
# E.1 HOW DOES EACH TEACHER PERFORM?
In this section, we investigated how different teachers help in giving advice. We compared our method to the DQN algorithm. We denote the method using only optimistic and discouraging teachers as “ACTRCE−". We denote the method using knowledgeable teachers as well as discouraging teachers as ACTRCE (this is the version we use in the main paper). We evaluated three methods in KrazyGrid World and the results are as follows.
We tried two different kind of grids, one with 3 lavas and the other with 6 lavas, and both with 3 goals of different colours. Fig. 4 (a) and (b) show the average success rate over all goals on 16-environments training. The shaded area represents the standard deviation over 2 random seeds. The baseline DQN is shown in blue curve, which failed to learn anything at all. “ACTRCE−" (shown in orange) quickly learned and achieved good results on both environments. However, we observed that when the number of lavas increased, the task became harder, and $\mathrm { \Delta A C T R C E ^ { - } }$ performed worse after 32 millions frames of training (the performance dropped from $8 3 \%$ to $6 3 \%$ ). On the other hand, we observed that having knowledgeable teachers always helped speed up learning. In particular, when the number of lavas increased, the task became harder for $\mathrm { \Delta A C T R C E ^ { - } }$ . However, with knowledgeable teachers, language advice was provided even when the agent reached lava, and hence the amount of advice per step was kept the same in the more difficult setting. Therefore, we observed ACTRCE learning at a similar rate in the more difficult setting, leaving a big gap from ACTRCE− after 32 millions frames of training $8 0 \%$ vs $6 3 \%$ ).
# F CAN LEARNING EASY GOALS HELP LEARNING DIFFICULT GOALS?
As we mentioned, there are desirable tasks as well as undesirable tasks. One would worry what if the desirable tasks are very difficult, would the agent only learns to accomplish easier tasks which are undesirable? Hence, we would like to ask whether learning the easier tasks from hindsight can provide any learning signal for more difficult tasks. We hypothesize that it is possible in the KGW setting as learning to “reach lava" can aid learning controllers, which is used to “reach goals".
 Figure 7: Performance comparisons on KrazyGrid World environments. The success rates are calculated over all desired goals and 16 different environments. Shaded area represents standard deviation 2 random seeds.
We designed the following transfer learning experiment to further our hypothesis. First, we artificially constructed a pessimistic teacher who only gives advice when the agent achieved undesirable goals, i.e., when $g ^ { \ast } \in \mathcal { G } \backslash \mathcal { G } _ { d }$ . We pretrained the agents with only the pessimistic teacher for 5 million frames. Now, we carried out training using $\mathrm { \Delta A C T R \mathrm { \bar { K } C E ^ { - } } }$ (with optimistic and discouraging teachers) with the pretrained agent and compared to unpretrained ones. Results are shown in Figure 8. We found that by pretraining the agent using pessimistic agents, even though the language goals in the pretraining phase have no overlapping with the actual training goals, the agent learned much faster than the unpretrained ones. In particular, in the environment with 3 lavas, the pretrained agent learned the fastest. In the environment with 6 lavas, pretrained agents learned as fast as ACTRCE, leaving a big gap from $\mathbf { A C T R C E ^ { - } }$ , even though it was given the same amount of advice during training as $\mathrm { \Delta A C T R C E ^ { - } }$ . This provides an evidence that learning easier goals can sometimes provide learning signals for harder goals, especially when both tasks require similar modules.
 Figure 8: Transfer experiments that demonstrate pre-training with easier goals can aid learning more difficult goals.
# G VIZDOOM 5 OBJECTS SINGLE TARGET EXPERIMENTS
In this section we show experiments done on ViZDoom with single target for 5 objects on easy and hard mode. On the easy task, the baseline DQN is able to consistently learn to solve the task, and with ACTRCE the performance was similar. However, as the task difficulty increased to the 5 objects on hard mode, we found that DQN’s learning was less consistent across seeds, in contrast with ACTRCE’s low variance across seeds. We also ran the A3C baseline from Chaplot et al. (2017b), from their implementation available online (Chaplot et al. (2017a)) using the hyperparameter settings stated in their paper. On the easy task, we were able to solve the task with A3C, but with an order of magnitude less sample efficiency compared to our DQN/ACTRCE implementation. On the hard task, we were unable to reproduce the results with our limited computational budget. A similar trend of an order of magnitude difference in sample efficiency is observed between A3C and DQN/ACTRCE on the hard task.
Table 4: The table shows the averaged success rates in multitask and zero-shot scenario for the model trained with DQN versus DQN with ACTRCE, compared to A3C published and reproduced result, on ViZDoom single target 5 objects hard mode. The standard deviations are calculated across 2 seeds. MT was evaluated throughout the training process, while ZSL was evaluated at the end of training.
<table><tr><td></td><td colspan="4">MT</td><td colspan="3">ZSL</td></tr><tr><td># of frames</td><td>8M</td><td>16M</td><td>150M</td><td>N/A</td><td>16M</td><td>150M</td><td>N/A</td></tr><tr><td>A3C[1]</td><td>-</td><td>1</td><td>1</td><td>0.83</td><td>1</td><td>1</td><td>0.73</td></tr><tr><td>A3C (Reprod.)</td><td>0.10 ± 0.01</td><td>0.09 ± 0.04</td><td>0.73 ± 0.01</td><td>1</td><td>1</td><td>0.71 ± 0.02</td><td>1</td></tr><tr><td>DQN</td><td>0.4±0.2</td><td>0.73± 0.08</td><td></td><td>=</td><td>0.75 ± 0.05</td><td></td><td>=</td></tr><tr><td>ACTRCE</td><td>0.69 ± 0.04</td><td>0.83 ± 0.02</td><td></td><td>=</td><td>0.77 ± 0.02</td><td></td><td>=</td></tr></table>
 Figure 9: ViZDoom experiment with 5 objects in easy mode for single target case.
 Figure 10: ViZDoom experiment with 5 objects in hard mode for single target case.
# H VIZDOOM AVERAGE EPISODE LENGTH
We report on the average episode length (averaged over 100 episodes) during training for 3 ViZDoom scenarios: single target 5 and 7 objects in hard mode, and composition target 5 objects in easy mode. The GRU hidden state representation of the sentence were used in the plots in Figure 11. We observe that the average episode length is slowly decreasing when using ACTRCE, while the baseline DQN remains fairly flat for the harder 7 objects (single target) and 5 objects (compositional).
 Figure 11: Average training episode lengths in VizDoom environments. (a) 5 objects in hard mode, in single target case. (b) 7 objects in hard mode, in single target case. (c) 5 objects in easy mode, in composition case.
# I VIZDOOM CUMULATIVE SUCCESS RATE VS. EPISODE LENGTH CURVE
We take the final trained model and run 100 episodes, noting whether each run was successful or not (binary value). We construct a cumulative success rate (CSR) versus episode length curve, where the $\mathbf { X }$ -axis is the episode length, and the y-axis is the fraction of total number of episodes that were successful and had episode length less than or equal to the $\mathbf { X }$ -axis value:
$$\operatorname { C S R } ( x ) = { \frac { \mathrm { N u m b e r ~ o f ~ s u c c e s s f u l ~ e p i s o d e s ~ w i t h ~ e p i s o d e ~ l e n g t h } \leq x } { \mathrm { T o t a l ~ n u m b e r ~ o f ~ e p i s o d e s } } }$$
Therefore, the curve is monotonically increasing, with the y-axis being the overall success rate when the $\mathbf { X }$ -axis value is the maximum episode length. The better the model, the larger the area under this curve will be—similar in spirit to the precision-recall curve—because it will be able to have more of successful trajectories that are short early on.
Figure 12 shows the Multi-task (MT) cumulative success rate for the 3 ViZDoom environment tasks, using GRU hidden state language encoding: single target 5 and 7 objects in hard mode, and composition target 5 objects in easy mode. In the 5 objects hard mode (Figure 12a), we observe that all 3 training algorithms had similar performance until around episode length of 20, where ACTRCE has more successful trajectories which are longer. In the 7 objects hard mode (Figure 12b), ACTRCE maintains a similar behaviour while the baseline DQN essentially was only able to get success on very short episodes (i.e. when the target object was very close by). Lastly, in the 5 objects composition task (Figure 12c), the curve for ACTRCE indicates that there were 2 groups of trajectories: one requiring less than 10 time-steps, while another requiring over 20 time-steps. The former group occurs when the two target objects are adjacent to one another, making it easy to reach the second object after the first in only a few time steps. The latter group occurs when the target objects are not adjacent to each other, and thus requires the agent to more carefully turn around and avoid hitting other objects when trying to reach the second target.
 Figure 12: Multi-task (MT) cumulative success rate versus episode in ViZDoom environments, using GRU hidden state sentence representation. (a) 5 objects in hard mode, in single target case. (b) 7 objects in hard mode, in single target case. (c) 5 objects in easy mode, in composition case.
# J ADDITIONAL DETAILS ON HINDSIGHT ADVICE ANNEALING
We report the results for the hindsight advice annealing when using InferLite and One-Hot representation when providing hindsight advice on the first $10 \%$ and $1 \%$ of training:
<table><tr><td>Method</td><td>MT</td><td>ZSL</td></tr><tr><td>ACTRCE(GRU)1.0 ACTRCE (GRU) 0.1 ACTRCE(GRU) 0.01</td><td>0.80± 0.06 0.75 ± 0.01 0.73 ± 0.04</td><td>0.76± 0.03 0.74±0.06 0.66 ± 0.05</td></tr><tr><td>ACTRCE (InferLite) 1.0 ACTRCE (InferLite) 0.1</td><td>0.80± 0.01</td><td>0.76±0.02</td></tr><tr><td>ACTRCE (InferLite) 0.01</td><td>0.78 ±0.04 0.76 ± 0.01</td><td>0.68 ± 0.01</td></tr><tr><td>ACTRCE (OneHot) 1.0</td><td></td><td>0.68 ± 0.01</td></tr><tr><td>ACTRCE(OneHot) 0.1</td><td>0.80± 0.03</td><td></td></tr><tr><td>ACTRCE (OneHot) 0.01</td><td>0.74± 0.06 0.70 ± 0.06</td><td></td></tr></table>
 Table 5: Comparing the Multitask and Zero-shot Generalization when the agent has limited hindsight advice to only the beginning of training. Figure 13: Performance comparisons on VizDoom environment.
# K VISUALIZATION
For each single-target instruction in the training and test set (70 instructions), we obtain an embedding vector of dimension 256 using either GRU, InferLite, or One Hot (storing entire embedding). From this embedding matrix, we can visualize the learned instruction embedding in several ways.
# K.1 EMBEDDING CORRELATION COMPARISON
For each pair of instructions $i$ and $j$ , we obtain their embeddings vectors $v _ { i }$ and $v _ { j }$ , and compute their correlation distance, cdist $( v _ { i } , v _ { j } )$ . We define the correlation distance between two vectors $u$ and $v$ as:
$${ \mathrm { c d i s t } } ( u , v ) = 1 - { \frac { ( u - \bar { u } ) \cdot ( v - \bar { v } ) } { | | ( u - \bar { u } ) | | _ { 2 } | | ( v - \bar { v } ) | | } }$$
We divide each matrix by the maximum entry as to scale the results to $[ 0 , 1 ]$ .
 Figure 14: Correlation matrix for GRU (left) and InferLite (right). Best seen in electronic form.
# K.2 T-SNE PLOT COMPARISON
We use t-SNE to visualize the space of instruction embeddings. In the following figure, the shape of the datapoint indicates the type of object, such as triangle for armor, diamond for pillar, etc., and the colour indicate the object’s colour, with black being used for when no colour is specified. Finally the size of the data point corresponds to the size indicated in the object, from ’smallest’, ’small’, none specified, ’large’, and ’largest’. For the instructions with synonym word replacement, we simply leave the colour as black and the default size.
 Figure 15: t-SNE plots of instruction embeddings for GRU (top left), InferLite (top right), One-hot (bottom left) and Inferlite synonyms (bottom right). Best seen in electronic form.md/train/B1Kh0SVodY/B1Kh0SVodY.mdAdded+347
md/train/B9t708KMr9d/B9t708KMr9d.mdAdded+279
md/train/BJQRKzbA-/BJQRKzbA-.mdAdded+299
md/train/Bkgq9ANKvB/Bkgq9ANKvB.mdAdded
md/train/ByJbJwxCW/ByJbJwxCW.mdAdded+327
md/train/ByOExmWAb/ByOExmWAb.mdAdded+381
md/train/ByghKiC5YX/ByghKiC5YX.mdAdded
md/train/ByxPYjC5KQ/ByxPYjC5KQ.mdAdded+477
md/train/D04TGKz5rfF/D04TGKz5rfF.mdAdded+540
md/train/GhMZNcr54zt/GhMZNcr54zt.mdAdded+201
md/train/HJgJNCEKPr/HJgJNCEKPr.mdAdded+286
md/train/Hk8rlUqge/Hk8rlUqge.mdAdded+284
md/train/HkSOlP9lg/HkSOlP9lg.mdAdded+297
md/train/Hke0K1HKwr/Hke0K1HKwr.mdAdded+302
md/train/Hkl1iRNFwS/Hkl1iRNFwS.mdAdded+257
md/train/HkljioCcFQ/HkljioCcFQ.mdAdded+441
md/train/HktJec1RZ/HktJec1RZ.mdAdded+243
md/train/HkxaFoC9KQ/HkxaFoC9KQ.mdAdded+314
md/train/HyM8V2A9Km/HyM8V2A9Km.mdAdded+400
md/train/HygOjhEYDH/HygOjhEYDH.mdAdded
md/train/Hyl9xxHYPr/Hyl9xxHYPr.mdAdded
md/train/HyxY6JHKwr/HyxY6JHKwr.mdAdded
md/train/KG2RTUXXU7/KG2RTUXXU7.mdAdded
md/train/NTEz-6wysdb/NTEz-6wysdb.mdAdded
md/train/OEgDatKuz2O/OEgDatKuz2O.mdAdded
md/train/QbVza2PKM7T/QbVza2PKM7T.mdAdded
md/train/S1lhbnRqF7/S1lhbnRqF7.mdAdded
md/train/SJZsR7kCZ/SJZsR7kCZ.mdAdded
md/train/SJl7DsR5YQ/SJl7DsR5YQ.mdAdded
md/train/SJyEH91A-/SJyEH91A-.mdAdded
md/train/SkeRTsAcYm/SkeRTsAcYm.mdAdded
md/train/SkfTIj0cKX/SkfTIj0cKX.mdAdded
md/train/Skgxcn4YDS/Skgxcn4YDS.mdAdded
md/train/SklVEnR5K7/SklVEnR5K7.mdAdded
md/train/SklsBJHKDS/SklsBJHKDS.mdAdded
md/train/SkxpxJBKwS/SkxpxJBKwS.mdAdded
md/train/URc7gYBcjVn/URc7gYBcjVn.mdAdded
md/train/aohkNJxjYJX/aohkNJxjYJX.mdAdded
md/train/bqGK5PyI6-N/bqGK5PyI6-N.mdAdded
md/train/cdlzxKUBr-A/cdlzxKUBr-A.mdAdded
md/train/iVaPuvROtMm/iVaPuvROtMm.mdAdded
md/train/qbH974jKUVy/qbH974jKUVy.mdAdded
md/train/r1Ddp1-Rb/r1Ddp1-Rb.mdAdded
md/train/r1gdj2EKPB/r1gdj2EKPB.mdAdded
md/train/r1lUOzWCW/r1lUOzWCW.mdAdded
md/train/r1lrAiA5Ym/r1lrAiA5Ym.mdAdded
md/train/r1lyTjAqYX/r1lyTjAqYX.mdAdded
md/train/rkgs0oAqFQ/rkgs0oAqFQ.mdAdded
md/train/ry3iBFqgl/ry3iBFqgl.mdAdded
md/train/rylDfnCqF7/rylDfnCqF7.mdAdded