ZHANGYUXUAN-zR commited on
Commit
d70b2b2
·
verified ·
1 Parent(s): 828ff43

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. md/train/3-GCM92yaB3/3-GCM92yaB3.md +331 -0
  2. md/train/4AWko4A35ss/4AWko4A35ss.md +350 -0
  3. md/train/4JLiaohIk9/4JLiaohIk9.md +263 -0
  4. md/train/4fLr7H5D_eT/4fLr7H5D_eT.md +310 -0
  5. md/train/4i23Bjlh4Y9/4i23Bjlh4Y9.md +561 -0
  6. md/train/5k8F6UU39V/5k8F6UU39V.md +376 -0
  7. md/train/9YlaeLfuhJF/9YlaeLfuhJF.md +0 -0
  8. md/train/9l0K4OM-oXE/9l0K4OM-oXE.md +381 -0
  9. md/train/B1QRgziT-/B1QRgziT-.md +548 -0
  10. md/train/B1TTpYKgx/B1TTpYKgx.md +670 -0
  11. md/train/B1twdMCab/B1twdMCab.md +242 -0
  12. md/train/BJehNfW0-/BJehNfW0-.md +427 -0
  13. md/train/BJgqqsAct7/BJgqqsAct7.md +472 -0
  14. md/train/BJl6AjC5F7/BJl6AjC5F7.md +415 -0
  15. md/train/BkeOp6EKDH/BkeOp6EKDH.md +202 -0
  16. md/train/Bkeeca4Kvr/Bkeeca4Kvr.md +398 -0
  17. md/train/CaKvIT5UMfd/CaKvIT5UMfd.md +258 -0
  18. md/train/DILxQP08O3B/DILxQP08O3B.md +276 -0
  19. md/train/H1dh6Ax0Z/H1dh6Ax0Z.md +375 -0
  20. md/train/HJgpugrKPS/HJgpugrKPS.md +339 -0
  21. md/train/HJlzxgBtwH/HJlzxgBtwH.md +384 -0
  22. md/train/HJx7uJStPH/HJx7uJStPH.md +300 -0
  23. md/train/Hk99zCeAb/Hk99zCeAb.md +373 -0
  24. md/train/Hkf2_sC5FX/Hkf2_sC5FX.md +494 -0
  25. md/train/HkxlcnVFwB/HkxlcnVFwB.md +0 -0
  26. md/train/Hyepjh4FwB/Hyepjh4FwB.md +454 -0
  27. md/train/Hygm8jC9FQ/Hygm8jC9FQ.md +346 -0
  28. md/train/Hygxb2CqKm/Hygxb2CqKm.md +667 -0
  29. md/train/JzdYX8uzT4W/JzdYX8uzT4W.md +352 -0
  30. md/train/ODKwX19UjOj/ODKwX19UjOj.md +266 -0
  31. md/train/PiKUvDj5jyN/PiKUvDj5jyN.md +0 -0
  32. md/train/S19dR9x0b/S19dR9x0b.md +285 -0
  33. md/train/S1xiOjC9F7/S1xiOjC9F7.md +405 -0
  34. md/train/SJgdnAVKDH/SJgdnAVKDH.md +328 -0
  35. md/train/SJzvDjAcK7/SJzvDjAcK7.md +484 -0
  36. md/train/SkxW23NtPH/SkxW23NtPH.md +270 -0
  37. md/train/SyQq185lg/SyQq185lg.md +239 -0
  38. md/train/SyZI0GWCZ/SyZI0GWCZ.md +264 -0
  39. md/train/Syx7WyBtwB/Syx7WyBtwB.md +357 -0
  40. md/train/WEHSlH5mOk/WEHSlH5mOk.md +311 -0
  41. md/train/X7GEA3KiJiH/X7GEA3KiJiH.md +344 -0
  42. md/train/ZdJQ8KekIyd/ZdJQ8KekIyd.md +522 -0
  43. md/train/b83ibRX55T/b83ibRX55T.md +393 -0
  44. md/train/bajTv_cvkI/bajTv_cvkI.md +270 -0
  45. md/train/kR95DuwwXHZ/kR95DuwwXHZ.md +319 -0
  46. md/train/ki4eJ1fSJNq/ki4eJ1fSJNq.md +457 -0
  47. md/train/lH2ukHnGDdq/lH2ukHnGDdq.md +347 -0
  48. md/train/r1gl7hC5Km/r1gl7hC5Km.md +340 -0
  49. md/train/r1l73iRqKm/r1l73iRqKm.md +310 -0
  50. md/train/rJBiunlAW/rJBiunlAW.md +371 -0
md/train/3-GCM92yaB3/3-GCM92yaB3.md ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The Unbalanced Gromov Wasserstein Distance: Conic Formulation and Relaxation
2
+
3
+ Thibault Séjourné Ecole Normale Supérieure, DMA, PSL thibault.sejourne@ens.fr
4
+
5
+ François-Xavier Vialard Université Gustave Eiffel francois-xavier.vialard@u-pem.fr
6
+
7
+ Gabriel Peyré Ecole Normale Supérieure, DMA, CNRS, PSL gabriel.peyre@ens.fr
8
+
9
+ # Abstract
10
+
11
+ Comparing metric measure spaces (i.e. a metric space endowed with a probability distribution) is at the heart of many machine learning problems. The most popular distance between such metric measure spaces is the Gromov-Wasserstein (GW) distance, which is the solution of a quadratic assignment problem. The GW distance is however limited to the comparison of metric measure spaces endowed with a probability distribution. To alleviate this issue, we introduce two Unbalanced Gromov-Wasserstein formulations: a distance and a more tractable upper-bounding relaxation. They both allow the comparison of metric spaces equipped with arbitrary positive measures up to isometries. The first formulation is a positive and definite divergence based on a relaxation of the mass conservation constraint using a novel type of quadratically-homogeneous divergence. This divergence works hand in hand with the entropic regularization approach which is popular to solve large scale optimal transport problems. We show that the underlying non-convex optimization problem can be efficiently tackled using a highly parallelizable and GPU-friendly iterative scheme. The second formulation is a distance between mm-spaces up to isometries based on a conic lifting. Lastly, we provide numerical experiments on synthetic examples and domain adaptation data with a Positive-Unlabeled learning task to highlight the salient features of the unbalanced divergence and its potential applications in ML.
12
+
13
+ # 1 Introduction
14
+
15
+ Comparing data distributions on different metric spaces is a basic problem in machine learning. This class of problems is for instance at the heart of surfaces [Bronstein et al., 2006] or graph matching $\mathrm { [ X u }$ et al., 2019] (equipping the surface or graph with its associated geodesic distance), regression problems in quantum chemistry [Gilmer et al., 2017] (viewing the molecules as distributions of points in $\mathbb { R } ^ { 3 }$ ) and natural language processing [Grave et al., 2019, Alvarez-Melis and Jaakkola, 2018] (where texts in different languages are embedded as points distributions in different vector spaces).
16
+
17
+ Metric measure spaces. The mathematical way to formalize these problems is to model the data as metric measure spaces (mm-spaces). A mm-space is denoted as $\mathbf { \bar { \boldsymbol { X } } } = ( X , d , \mu )$ where $X$ is a complete separable set endowed with a distance $d$ and a positive Borel measure $\mu \in { \mathcal { M } } _ { + } ( X )$ . For instance, if $\bar { X } = ( x _ { i } ) _ { i }$ is a finite set of points, then $\mu = \bar { \Sigma _ { i } } m _ { i } \delta _ { x _ { i } }$ (here $\delta _ { x _ { i } }$ is the Dirac mass at $x _ { i }$ ) is simply a set of positive weights $m _ { i } = \dot { \mu } ( \{ x _ { i } \} ) \ge \dot { 0 }$ associated to each point $x _ { i }$ , which accounts for its mass or importance. For instance, setting some $m _ { i }$ to 0 is equivalent to removing the point $x _ { i }$ . We refer to Sturm [2012] for a mathematical account on the theory of mm-spaces. In all the applications highlighted above, it makes sense to perform the comparisons up to isometric transformations of the data. Two mm-spaces $\mathcal { X } = ( X , d _ { X } , \mu )$ and $\mathcal { V } = ( Y , d _ { Y } , \nu )$ are considered to be equal (denoted $\mathcal { X } \sim \mathcal { V }$ ) if they are isometric, meaning that there is a bijection $\psi : \mathrm { s p t } ( \mu ) \to \mathrm { s p t } ( \nu )$ (where $\operatorname { s p t } ( \mu )$ is the support of $\mu$ ) such that $d _ { X } ( x , y ) { \overset { \cdot } { = } } d _ { Y } ( \psi ( x ) , \psi ( y ) )$ and $\psi _ { \sharp } \mu = \nu$ . Here $\psi _ { \sharp }$ is the push-forward operator, so that $\psi _ { \sharp } \mu = \nu$ is equivalent to imposing $\nu ( A ) = \mu ( \psi ^ { - 1 } ( A ) )$ for any set $A \subset Y$ . For discrete spaces where $\begin{array} { r } { \mu = \sum _ { i } m _ { i } \delta _ { x _ { i } } } \end{array}$ , then one should have $\begin{array} { r } { \nu = \psi _ { \sharp } \mu = \sum _ { i } m _ { i } \delta _ { \psi ( x _ { i } ) } , } \end{array}$ . As highlighted by Mémoli [2011], considering mm-spaces up to isometry is a powerful way to formalize and analyze a wide variety of problems such as matching, regression and classification of distributions of points belonging to different spaces. Most often, the objects of interest come with a natural distance such as an intrinsic or extrinsic distance and the uniform measure is the usual choice to make mm-spaces widely applicable. The key to unlock all these problems is the computation of a distance between mm-spaces up to isometry. So far, existing distances (reviewed below) assume that $\mu$ is a probability distribution, i.e. $\mu ( X ) = 1$ . This constraint is not natural and sometimes problematic for most of the practical applications to machine learning. The goal of this paper is to alleviate this restriction. We define for the first time a class of distances between unbalanced metric measure spaces, these distances being upper-bounded by divergences which can be approximated by an efficient numerical scheme.
18
+
19
+ Csiszár divergences The simplest case is when $X = Y$ and one simply ignores the underlying metric. One can then use Csiszár divergences (or $\varphi$ -divergences), which perform a pointwise comparison (in contrast with optimal transport distances, which perform a displacement comparison). It is defined using an entropy function $\varphi : \mathbb { R } _ { + } \to [ 0 , + \infty ]$ , which is a convex, lower semi-continuous, positive function with $\varphi ( 1 ) = 0$ . The Csiszár $\varphi$ -divergence reads $\begin{array} { r } { \mathbf { D } _ { \varphi } ( \mu | \nu ) \triangleq \int _ { X } \varphi \big ( \frac { \mathrm { d } \mu } { \mathrm { d } \nu } \big ) \mathrm { d } \nu + } \end{array}$ $\varphi _ { \infty } ^ { \prime } \int _ { X } \mathrm { d } \mu ^ { \perp }$ , where $\begin{array} { r } { \mu = \frac { \mathrm { d } \mu } { \mathrm { d } \nu } \nu + \mu ^ { \perp } } \end{array}$ is called the Radon-Nikodym or the Lebesgue decomposition of $\mu$ with respect to $\nu$ and $\begin{array} { r } { \varphi _ { \infty } ^ { \prime } = \operatorname* { l i m } _ { r \to \infty } \varphi ( r ) / r \in \mathbb { R } \cup \{ + \infty \} } \end{array}$ is called the recession constant. This divergence $\mathrm { D } _ { \varphi }$ is convex, positive, 1-homogeneous and weak\* lower-semicontinuous, see Liero et al. [2015] for details. Particular instances of $\varphi$ -divergences are Kullback-Leibler (KL) for $\varphi ( r ) =$ $r \log ( r ) - r + 1$ (note that $\varphi _ { \infty } ^ { \prime } = \infty ,$ ) and Total Variation (TV) for $\varphi ( r ) = | r - 1 |$ .
20
+
21
+ Balanced and unbalanced optimal transport. If the common embedding space $X$ is equipped with a distance $d ( x , y )$ , one can use more elaborated methods such as optimal transport (OT) distances, which are computed by solving convex optimization problems. This type of methods has proven useful for ML problems as diverse as domain adaptation [Courty et al., 2014], supervised learning over histograms [Frogner et al., 2015] and unsupervised learning of generative models [Arjovsky et al., 2017]. In this case, the extension from probability distributions to arbitrary positive measures $( \mu , \nu ) \in$ $\mathcal { M } _ { + } ( X ) ^ { 2 }$ is now well understood and corresponds to the theory of unbalanced OT. Following Liero et al. [2015], Chizat et al. [2018a], a family of unbalanced Wasserstein distances is defined by solving
22
+
23
+ $$
24
+ \mathrm { U W } ( \mu , \nu ) ^ { q } \triangleq \operatorname* { i n f } _ { \pi \in \mathcal { M } ( X \times X ) } \int \lambda ( d ( x , y ) ) \mathrm { d } \pi ( x , y ) + { \mathbf { D } _ { \varphi } } ( \pi _ { 1 } | \mu ) + { \mathbf { D } _ { \varphi } } ( \pi _ { 2 } | \mu ) .
25
+ $$
26
+
27
+ Here $( \pi _ { 1 } , \pi _ { 2 } )$ are the two marginals of the joint distribution $\pi$ , defined by $\pi _ { 1 } ( A ) = \pi ( A \times Y )$ for $A \subset X$ . The mapping $\lambda : \mathbb { R } ^ { + } \mathbb { R }$ and exponent $q \geq 1$ should be chosen wisely to ensure for instance that UW defines a distance (see Section 2.2.1). It is frequent to take $\rho \mathrm { D } _ { \varphi }$ instead of $\mathrm { D } _ { \varphi }$ (i.e. take $\psi = \rho \varphi ,$ ) to adjust the strength of the marginals’ penalization. Balanced OT is retrieved with the convex indicator $\varphi = \iota _ { \{ 1 \} }$ (i.e. $\varphi ( 1 ) = 0$ and $\varphi ( x ) = + \infty$ otherwise) or by taking the limit $\rho + \infty$ , which enforces $\pi _ { 1 } = \mu$ and $\pi _ { 2 } = \nu$ . When $0 < \rho < + \infty$ , unbalanced OT operates a trade-off between transportation and creation of mass, which is crucial to be robust to outliers in the data and to cope with mass variations in the modes of the distributions. For supervised tasks, the value of $\rho$ should be cross-validated to obtain the best performances. Its use is gaining popularity in applications, such as medical imaging registration [Feydy et al., 2019a], videos [Lee et al., 2019], generative learning [Balaji et al., 2020] and gradient flow to train neural networks [Chizat and Bach, 2018, Rotskoff et al., 2019]. Furthermore, existing efficient algorithms for balanced OT extend to this unbalanced problem. In particular Sinkhorn’s iterations, introduced in ML for balanced OT by Cuturi [2013], extend to unbalanced OT [Chizat et al., 2018b, Séjourné et al., 2019], as detailed in Section 3.
28
+
29
+ The Gromov-Wasserstein distance and its applications. The Gromov-Wasserstein (GW) distance [Mémoli, 2011, Sturm, 2012] generalizes the notion of OT to the setting of mm-spaces up to isometries. It replaces the linear cost $\textstyle \int \lambda ( d ) \mathrm { d } \pi$ of OT by a quadratic function. It reads
30
+
31
+ $$
32
+ \mathbf { G W } ( \mathcal { X } , \mathcal { Y } ) ^ { q } \triangleq \operatorname* { m i n } _ { \pi \in \mathcal { M } _ { + } ( X \times Y ) } \left\{ \int \lambda \big ( | d _ { X } ( x , x ^ { \prime } ) - d _ { Y } ( y , y ^ { \prime } ) | \big ) \mathrm { d } \pi ( x , y ) \mathrm { d } \pi ( x ^ { \prime } , y ^ { \prime } ) : \operatorname { \Lambda } _ { \pi _ { 2 } = \nu } ^ { \pi _ { 1 } = \mu } \right\} .
33
+ $$
34
+
35
+ It is proved in Mémoli [2011], Sturm [2012] that GW defines with $\lambda ( t ) = t ^ { q }$ a distance up to isometries on balanced mm-spaces (i.e. the measures are probability distributions). The GW distance is applied successfully in natural language processing for unsupervised translation learning [Grave et al., 2019, Alvarez-Melis and Jaakkola, 2018], in generative learning for objects lying in spaces of different dimensions [Bunne et al., 2019] and to build VAE for graphs [Xu et al., 2020]. It has been adapted for domain adaptation over different spaces [Redko et al., 2020]. It is also a relevant distance to compute barycenters between graphs or shapes [Vayer et al., 2018, Chowdhury and Needham, 2020]. When $( \mathcal { X } , \mathcal { Y } )$ are Euclidean spaces, this distance compares distributions up to rigid isometry, and is closely related (but not equal) to metrics defined by procrustes analysis [Grave et al., 2019, Alvarez-Melis et al., 2019]. The problem (2) is non convex because the quadratic form $\begin{array} { r } { \int \lambda ( | d _ { X } - d _ { Y } | ) \mathrm { d } \pi \otimes \pi } \end{array}$ is not positive in general. It is in fact closely related to quadratic assignment problems [Burkard et al., 1998], which are used for graph matching problems, and are known to be NP-hard in general. Nevertheless, non-convex optimization methods have been shown to be successful in practice to use GW distances for ML problems. This includes for instance alternating minimization [Mémoli, 2011, Redko et al., 2020] and entropic regularization [Peyré et al., 2016, Gold and Rangarajan, 1996].
36
+
37
+ Related works and contributions. The concomitant work of De Ponti and Mondino [2020] extends the $L ^ { p }$ transportation distance defined in Sturm et al. [2006] to unbalanced mm-spaces and studies its geometric properties. This distortion distance is not equivalent to the GW distance, and is more difficult to estimate numerically because it explicitly imposes a triangle inequality constraint in the optimization problem. The work of Chapel et al. [2020] relaxes the GW distance to the unbalanced setting by hybridizing GW with partial OT [Figalli, 2010] for unsupervised labeling. It ressembles one particular setting of our formulation, but with some important differences, detailed in Section 2. Our construction is also connected to partial matching methods, which find numerous applications in graphics and vision [Cosmo et al., 2016]. In particular, Rodola et al. [2012] introduces a mass conservation relaxation of the GW problem.
38
+
39
+ The two main contributions of this paper are the definition of two formulations relaxing the GW distance. The first one is called the Unbalanced Gromov-Wasserstein (UGW) divergence and can be computed efficiently on GPUs. The second one is called the Conic Gromov-Wasserstein distance (CGW). It is proved to be a distance between mm-spaces endowed with positive measures up to isometries, as stated in Theorem 1 which is the main theoretical result of this paper. We also prove in Theorem 1 that UGW can be used as a surrogate upper-bounding CGW. We present those concepts and their properties in Section 2. We also detail in Section 3 an efficient computational scheme for a particular setting of UGW. This method computes an approximate stationary point of a biconvex relaxation of our formulations. Even though it is a lower bound of the original problem, we provide in Theorem 3 conditions ensuring the tightness of this relaxation in many cases of interest. The algorithm leverages the strength of entropic regularization and the Sinkhorn algorithm, namely that it is GPU-friendly and defines smooth loss functions amenable to back-propagation for ML applications. Section 4 provides some numerical experiments to highlight the qualitative behavior of this algorithm and its ability to cope with outliers and mass variations in the modes of the distributions. We illustrate numerically the tightness of the relation between UGW and CGW, showing that UGW is a reasonnable proxy of a distance, at least locally. We provide an application of our divergence in the positive unlabeled learning setting, using domain adaptation data, and display results which are at par or outperform the computable competitor Chapel et al. [2020].
40
+
41
+ # 2 Unbalanced Gromov-Wasserstein formulations
42
+
43
+ We present in this section our two new formulations and their properties. The first one, called UGW, is exploited in Sections 3 and 4 to derive an efficient algorithm used in numerical experiments. The second one, called CGW, defines a distance between mm-spaces up to isometries. Those results build upon the work of Liero et al. [2015], and a summary of the construction of UOT is detailed in Appendix A. In all what follows, we consider complete separable mm-spaces endowed with a metric and a positive measure.
44
+
45
+ # 2.1 The unbalanced Gromov-Wasserstein divergence
46
+
47
+ This new formulation makes use of quadratic $\varphi$ -divergences, defined as $ { \mathbf { D } } _ { \varphi } ^ { \otimes } ( \rho | { \boldsymbol { \nu } } ) \triangleq { \mathbf { D } } _ { \varphi } ( \rho \otimes \rho | { \boldsymbol { \nu } } \otimes { \boldsymbol { \nu } } )$ , where $\rho \otimes \rho \in \mathcal { M } _ { + } ( X ^ { 2 } )$ is the tensor product measure defined by $\mathrm { d } ( \rho \otimes \rho ) ( x , y ) = \mathrm { d } \rho ( x ) \mathrm { d } \rho ( y )$ . Note that $\mathrm { D } _ { \varphi } ^ { \otimes }$ is not a convex function in general.
48
+
49
+ Definition 1 (Unbalanced GW). The Unbalanced Gromov-Wasserstein divergence is defined as $\begin{array} { r } { \mathrm { U G W } ( \mathcal { X } , \mathcal { Y } ) = \operatorname* { i n f } _ { \pi \in \mathcal { M } ^ { + } ( X \times Y ) } \mathcal { L } ( \pi ) \triangleq \mathcal { G } ( \pi ) + { \mathbf { D } } _ { \varphi } ^ { \otimes } ( \pi _ { 1 } | \mu ) + { \mathbf { D } } _ { \varphi } ^ { \otimes } ( \pi _ { 2 } | \nu ) . } \end{array}$ .
50
+
51
+ This definition can be understood as an hybridation between (1) and (2) but with a twist: one needs to use the quadratic divergence $\mathrm { D } _ { \varphi _ { \bullet } } ^ { \otimes }$ in place of $\mathrm { D } _ { \varphi }$ . To the best of our knowledge, it is the first time such quadratic divergences are being used and studied. In the TV case, this is the most important distinction between UGW and partial-GW [Chapel et al., 2020]. Note also that the balanced GW distance (2) is recovered as a particular case when using $\varphi = \iota _ { \{ 1 \} }$ or by letting $\rho + \infty$ for an entropy $\psi = \rho \varphi$ .
52
+
53
+ Using quadratic divergences results in UGW being 2-homogeneous: for $\theta \geq 0$ , writing $( \mathscr { X } _ { \theta } , \mathscr { y } _ { \theta } )$ equiped with $( \theta \mu , \theta \nu )$ , one has $\theta ^ { - 2 } \mathrm { U G W } ( \mathcal { X } _ { \theta } , \mathcal { Y } _ { \theta } ) \bar { \ } = \mathrm { U G W } ( \mathcal { X } , \mathcal { Y } )$ . When using non tensorized $\varphi$ -divergences, the resulting unbalanced Gromov-Wassertein functional between $\mathcal { X } _ { \theta }$ and $\mathcal { { D } } _ { \theta }$ have very different and inconsistent behaviors when $\theta 0$ and $\theta \to + \infty$ . Indeed, once normalized by $\theta ^ { - \bar { 2 } }$ and $\theta ^ { - 1 }$ , one obtains respectively balanced GW and a Hellinger-type distance. Using tensorized divergences ensures that the behavior does not depends on $\theta$ . It is also fundamental to connect UGW with our distance CGW, see Theorem 1 and Appendix B.
54
+
55
+ We first prove the existence of optimal plans $\pi$ minimizing $\mathcal { L }$ , which holds for the three key settings of Section 2.2.1, namely for KL, TV, and for compact metric spaces (such as finite pointclouds and graphs). All proofs are deferred in Appendix B.
56
+
57
+ Proposition 1 (Existence of minimizers). We assume that $( X , Y )$ are compact and that either $( i ) \varphi$ superlinear, i.e $\varphi _ { \infty } ^ { \prime } = \infty$ , or (ii) $\lambda$ has compact sublevel sets in $\mathbb { R } _ { + }$ and $2 \varphi _ { \infty } ^ { \prime } + \operatorname* { i n f } \lambda > 0$ . Then there exists $\pi \in { \mathcal { M } } _ { + } ( X \times Y )$ such that $\mathrm { U G } \mathrm { \bar { w } } ( \mathcal { X } , \mathcal { Y } ) = \mathcal { L } ( \pi )$ .
58
+
59
+ The following proposition ensures that the functional UGW can be used to compare mm-spaces.
60
+
61
+ Proposition 2 (Definiteness of UGW). Assume that $\varphi ^ { - 1 } ( \{ 0 \} ) = \{ 1 \}$ and $\lambda ^ { - 1 } ( \{ 0 \} ) = \{ 0 \}$ . Then $\mathrm { U G W } ( \mathcal { X } , \mathcal { Y } ) \ge 0$ and is 0 if and only if $\mathcal { X } \sim \mathcal { V }$ .
62
+
63
+ We end this section with a reformulation of UGW which is important to make the connection with the second formulation CGW of the following section. It splits UGW into two parts: the term $\varphi ( 0 ) ( | ( \mu \otimes \mu ) ^ { \perp } | + | ( \nu \otimes \nu ) ^ { \perp } | )$ accounts for the pure creation/destruction of mass and a new transport cost $L _ { c }$ accounts for the remaining part (partial/pure transport and partial creation/destruction of mass).
64
+
65
+ Lemma 1. Defining $L _ { c } ( a , b ) \triangleq c + a \varphi ( 1 / a ) + b \varphi ( 1 / b ) \operatorname { \mathrm { , } }$ , and writing $\begin{array} { r } { ( f \triangleq \frac { \mathrm { d } \mu } { \mathrm { d } \pi _ { 1 } } , g \triangleq \frac { \mathrm { d } \nu } { \mathrm { d } \pi _ { 2 } } ) } \end{array}$ the Lebesgue densities of $( \mu , \nu )$ w.r.t. $( \pi _ { 1 } , \pi _ { 2 } )$ such that $\mu = f \pi _ { 1 } + \mu ^ { \perp }$ and $\nu = g \pi _ { 2 } + \nu ^ { \perp }$ , one has
66
+
67
+ $$
68
+ \mathcal { L } ( \pi ) = \int _ { X ^ { 2 } \times Y ^ { 2 } } L _ { \lambda ( | d _ { X } - d _ { Y } | ) } ( f \otimes f , g \otimes g ) \mathrm { d } \pi \mathrm { d } \pi + \varphi ( 0 ) ( | ( \mu \otimes \mu ) ^ { \perp } | + | ( \nu \otimes \nu ) ^ { \perp } | ) .
69
+ $$
70
+
71
+ Proof. Write $\begin{array} { r } { f = \frac { \mathrm { d } \mu } { \mathrm { d } \pi _ { 1 } } } \end{array}$ and $\begin{array} { r } { g = \frac { \mathrm { d } \nu } { \mathrm { d } \pi _ { 2 } } } \end{array}$ The Lebesgue decompositions read $\mu \otimes \mu = ( f \otimes f ) \pi _ { 1 } \otimes$ $\pi _ { 1 } + ( \mu \otimes \mu ) ^ { \perp }$ and $\nu \otimes \nu = ( g \otimes g ) \pi _ { 2 } \otimes \pi _ { 2 } + ( \nu \otimes \nu ) ^ { \perp }$ , thanks to the tensorized structure of the decomposed plans. To prove Equation (3), we need to define the reverse entropy Liero et al. [2015] such that $\mathrm { D } _ { \varphi } ( \alpha | \mu ) = \mathrm { D } _ { \psi } ( \mu | \alpha )$ , where $\psi ( x ) \triangleq x \varphi ( { \frac { 1 } { x } } )$ is also an entropy function satisfying $\psi _ { \infty } ^ { \prime } = \varphi ( 0 )$ . One then has
72
+
73
+ $$
74
+ \begin{array} { r } { \mathcal { L } ( \pi ) = \displaystyle \int _ { X ^ { 2 } \times Y ^ { 2 } } \lambda ( \Gamma ) \mathrm { d } \pi \mathrm { d } \pi + \mathbf { D } _ { \varphi } ^ { \otimes } ( \pi _ { 1 } | \mu ) + \mathbf { D } _ { \varphi } ^ { \otimes } ( \pi _ { 2 } | \nu ) } \\ { = \displaystyle \int _ { X ^ { 2 } \times Y ^ { 2 } } \lambda ( \Gamma ) \mathrm { d } \pi \mathrm { d } \pi + \mathbf { D } _ { \psi } ^ { \otimes } ( \mu | \pi _ { 1 } ) + \mathbf { D } _ { \psi } ^ { \otimes } ( \nu | \pi _ { 2 } ) } \end{array}
75
+ $$
76
+
77
+ $$
78
+ \begin{array} { l } { \displaystyle \mathcal { L } ( \pi ) = \int _ { X ^ { 2 } \times Y ^ { 2 } } \lambda ( \Gamma ) \mathrm { d } \pi \mathrm { d } \pi + \int _ { X ^ { 2 } } \psi ( f \otimes f ) \mathrm { d } \pi _ { 1 } \mathrm { d } \pi _ { 1 } + \int _ { Y ^ { 2 } } \psi ( g \otimes g ) \mathrm { d } \pi _ { 2 } \mathrm { d } \pi _ { 2 } } \\ { \displaystyle \qquad + \varphi ( 0 ) ( | ( \mu \otimes \mu ) ^ { \perp } | + | ( \nu \otimes \nu ) ^ { \perp } | ) } \\ { \displaystyle = \int _ { X ^ { 2 } \times Y ^ { 2 } } L _ { \lambda ( \Gamma ) } ( f \otimes f , g \otimes g ) \mathrm { d } \pi \mathrm { d } \pi + \varphi ( 0 ) ( | ( \mu \otimes \mu ) ^ { \perp } | + | ( \nu \otimes \nu ) ^ { \perp } | ) . } \end{array}
79
+ $$
80
+
81
+ Using the definition of $\psi$ in $L _ { c }$ ends the proof.
82
+
83
+ # 2.2 The conic Gromov-Wasserstein distance
84
+
85
+ We introduce a second “conic” formulation of unbalanced GW, which is connected to UGW, and whose construction is inspired by the conic formulation of UOT (see Appendix A for an overview).
86
+
87
+ # 2.2.1 Background on cone sets and distances
88
+
89
+ The conic formulation lifts a point $x \in X$ to a couple $( x , r ) \in X \times \mathbb { R } ^ { + }$ where $r$ encodes some (power of a) mass. Then we seek optimal transport plans defined over ${ \mathfrak { C } } [ X ] \triangleq X \times \mathbb { R } _ { + } / ( X \times \{ 0 \} )$ , where coordinates $( x , r = 0 )$ ) with no mass are merged into a single point $\circ _ { X }$ called the apex of the cone. In the sequel, points of $X \times \mathbb { R } _ { + }$ are noted $( x , r )$ , while $[ x , r ]$ are quotiented points of ${ \mathfrak { C } } [ X ]$ .
90
+
91
+ While transport plans depend on variables $\left( [ x , r ] , [ y , s ] \right)$ and $( [ x ^ { \prime } , r ^ { \prime } ] , [ y ^ { \prime } , s ^ { \prime } ] )$ in ${ \mathfrak { C } } [ X ] \times { \mathfrak { C } } [ Y ]$ , the transportation cost involved in our conic formulation only makes use of the 2-D cone ${ \mathfrak { C } } [ \mathbb { R } _ { + } ]$ over $\mathbb { R } _ { + }$ endowed with the distance $\left| u - v \right|$ (note that any other distance on $\mathbb { R }$ could be used as well). More specifically, we consider coordinates of the form $( [ u , a ] , [ v , b ] ) = ( [ d _ { X } ( x , x ^ { \prime } ) , r r ^ { \prime } ] , [ d _ { Y } ( y , y ^ { \prime } ) , s s ^ { \bar { \prime } } ] ) \in$ ${ \mathfrak { C } } [ \mathbb { R } _ { + } ] \times { \mathfrak { C } } [ \mathbb { R } _ { + } ]$ . Thus we now describe conic discrepancies $\mathcal { D }$ on ${ \mathfrak { C } } [ \mathbb { R } _ { + } ]$ , which are defined for $( p , q ) \geq 1$ as ${ \mathcal { D } } ( [ u , a ] , [ v , b ] ) ^ { q } \triangleq H _ { \lambda ( \vert u - v \vert ) } ( a ^ { p } , b ^ { p } )$ , where $\begin{array} { r } { H _ { c } ( a ^ { p } , b ^ { p } ) \triangleq \operatorname* { i n f } _ { \theta \geq 0 } \theta L _ { c } ( \frac { a ^ { p } } { \theta } , \frac { b ^ { p } } { \theta } ) } \end{array}$ is the perspective transform of $L _ { c }$ introduced in Lemma 1. The intuition underpinning the definition of this cost is that the perspective transform accounts for the possibility to rescale a transport plan $\pi$ by a scalar $\theta$ but the scaling is performed pointwise instead of globally. In general $\mathcal { D }$ is not a distance, but it is always definite as stated by this result proved in Appendix A.
92
+
93
+ Proposition 3. Assume $\lambda ^ { - 1 } ( \{ 0 \} ) = \{ 0 \}$ , $\varphi ^ { - 1 } ( \{ 0 \} ) = \{ 1 \}$ and $\varphi$ is coercive. Then $\mathcal { D }$ is definite on $\mathfrak { C } [ \mathbb { R } ^ { + } ] \mathrm { . }$ , i.e. $\mathcal { D } ( [ u , a ] , [ v , b ] ) = \mathrm { \dot { 0 } }$ if and only if $\overset { \prime } { a } = b = 0$ ) or ${ a = b }$ and $u = v$ ).
94
+
95
+ Of particular interest are those $\varphi$ where $\mathcal { D }$ is a distance, which necessitates a careful choice of $\lambda , p$ and $q$ . We now detail three examples where this is the case.
96
+
97
+ Gaussian Hellinger distance (GH). When $\mathrm { D } _ { \varphi } = \mathrm { K L }$ , $\lambda ( t ) = t ^ { 2 }$ and $q = p = 2$ , then one has $\mathcal { D } ( [ u , a ] , [ v , b ] ) ^ { 2 } = a ^ { 2 } + b ^ { 2 } - 2 a b e ^ { - | u - v | / 2 }$ . This cone distance [Burago et al., 2001] is further generalized by De Ponti [2019] who shows that $\mathcal { D }$ is a distance for power entropies $\begin{array} { r } { \varphi ( s ) = \frac { s ^ { p } - p ( s - 1 ) - 1 } { p ( p - 1 ) } } \end{array}$ if $p \geq 1$ (the case $p = 1$ corresponding to $\mathrm { D } _ { \varphi } = \mathrm { K L }$ ).
98
+
99
+ Hellinger-Kantorovich (HK) $/$ Wasserstein-Fisher-Rao distance (WFR). When $\mathrm { D } _ { \varphi } ~ = ~ \mathrm { K L }$ , $\begin{array} { r } { \lambda ( t ) = - \log \cos ^ { 2 } ( t \wedge \frac { \pi } { 2 } ) } \end{array}$ and $q = p = 2$ , then one has $\begin{array} { r } { \mathcal { D } ( [ u , a ] , [ v , b ] ) ^ { 2 } = a ^ { 2 } + b ^ { 2 } - 2 a b \cos ( \frac { \pi } { 2 } \wedge | u - } \end{array}$ $v | ,$ . This construction, which might seem peculiar, corresponds to the one used to make unbalanced OT a geodesic distance, as detailed in [Liero et al., 2015, Chizat et al., 2018a].
100
+
101
+ Partial optimal transport distance (PT). When $\mathbf { D } _ { \varphi } = \mathrm { T V }$ , $\lambda ( t ) = t ^ { q }$ , $q \geq 1$ and $p = 1$ , then ${ \mathcal { D } } ( [ u , a ] , { \bar { [ } } v , b ] ) ^ { q } = a + { \bar { b } } - ( a \wedge b ) ( 2 - | u - v | ^ { q } ) _ { + }$ defines a cone distance [Chizat et al., 2018a].
102
+
103
+ # 2.2.2 Definitions and properties
104
+
105
+ The conic formulation consists in solving a GW problem on the cone, with the addition of two linear constraints. Informally speaking, $L _ { c }$ from Lemma 1 becomes $\mathcal { D }$ , the term $( | ( \mu \otimes \mu ) ^ { \perp } | + | ( \nu \otimes \nu ) ^ { \perp } | )$ is taken into account by the constraints (5) below, and the variables $( f , g )$ are replaced by $( r ^ { p } , s ^ { p } )$ . It reads $\begin{array} { r } { \mathrm { C G W } ( \mathcal { X } , \mathcal { Y } ) \triangleq \operatorname* { i n f } _ { \alpha \in \mathcal { U } _ { p } ( \mu , \nu ) } \mathcal { H } ( \alpha ) } \end{array}$ where
106
+
107
+ $$
108
+ \mathcal { H } ( \alpha ) \triangleq \int \mathcal { D } ( [ d _ { X } ( x , x ^ { \prime } ) , r r ^ { \prime } ] , [ d _ { Y } ( y , y ^ { \prime } ) , s s ^ { \prime } ] ) ^ { q } \mathrm { d } \alpha ( [ x , r ] , [ y , s ] ) \mathrm { d } \alpha ( [ x ^ { \prime } , r ^ { \prime } ] , [ y ^ { \prime } , s ^ { \prime } ] ) ,
109
+ $$
110
+
111
+ and $\mathcal { U } _ { p } ( \mu , \nu )$ is defined as the set
112
+
113
+ $$
114
+ \mathcal { U } _ { p } ( \mu , \nu ) \triangleq \left\{ \alpha \in \mathcal { M } _ { + } ( \mathfrak { C } [ X ] \times \mathfrak { C } [ Y ] ) , \ \int _ { \mathbb { R } _ { + } } r ^ { p } \mathrm { d } \alpha _ { 1 } ( \cdot , r ) = \mu , \ \int _ { \mathbb { R } _ { + } } s ^ { p } \mathrm { d } \alpha _ { 2 } ( \cdot , s ) = \nu \right\} .
115
+ $$
116
+
117
+ It is similar to the conic formulation of UW, see Appendix A. Note that similarly to the GW formulation (2) – and in sharp contrast with the conic formulation of UW – here the transport plans are defined on the cone ${ \mathfrak { C } } [ X ] ^ { - } \times { \mathfrak { C } } [ Y ]$ but the cost $\mathcal { D }$ is a distance on ${ \mathfrak { C } } [ \mathbb { R } _ { + } ]$ .
118
+
119
+ We present now the main contributions of this paper, proved in Appendix C. We state that CGW defines a distance under conditions that hold for the settings of Section 2.2.1, and that it is upperbounded by UGW. The divergence UGW can be approximated with efficient numerical schemes as detailed in Section 3.
120
+
121
+ Theorem 1. (i) The divergence CGW is symmetric, positive and definite up to isometries. (ii) If $\mathcal { D }$ is a distance on ${ \mathfrak { C } } [ \mathbb { R } _ { + } ]$ , then $\mathrm { C G W ^ { 1 / \boldsymbol { q } } }$ is a distance on the set of mm-spaces up to isometries. (iii) For any $( \mathbf { D } _ { \varphi } , \lambda , p , q )$ with associated cost $\mathcal { D }$ on the cone, one has $\mathrm { U G W } \geq \mathrm { C G W }$ .
122
+
123
+ # 3 Algorithms
124
+
125
+ We focus in this section on the numerical computation of the upper bound UGW using a bi-convex relaxation and derive an alternate minimization scheme coupled with entropic regularization. We also propose to approximate CGW by doing a similar alternate minimization, as detailed in Appendix E. We provide guarantees of tightness on the bi-convex relaxation for CGW (see Theorem 3). The computation of the distance CGW is heavy in practice because it requires an optimization over a lifted conic space, which needs to be discretized. Thus it does not scale to large problem for CGW, but allows to explore numerically how tight is the upper bound $\mathrm { U G W } \geq \mathrm { C G W }$ , see Section 4. The algorithm for UGW is presented on arbitrary measures, the special case of discrete measures being a particular case. The discretized formulas and algorithms are detailed in Appendix D, see also Chizat et al. [2018b], Peyré et al. [2016]. All implementations are available at https: //github.com/thibsej/unbalanced_gromov_wasserstein, and installable in Python with the command pip install unbalancedgw.
126
+
127
+ # 3.1 Bi-convex relaxation and tightness
128
+
129
+ In order to derive a simple numerical approximation scheme, following Mémoli [2011], we introduce a lower bound obtained by introducing two transportation plans. To further accelerate the method and enable GPU-friendly iterations, similarly to Gold et al. [1996], Solomon et al. [2016], we consider an entropic regularization. It reads, for any $\varepsilon \geq 0$ ,
130
+
131
+ $$
132
+ \begin{array} { r l r } { \mathrm { U G W } _ { \varepsilon } ( X , y ) \triangleq \underset { \pi } { \operatorname { i n f } } \mathscr { L } ( \pi ) + \varepsilon \mathrm { K L } ^ { \otimes } ( \pi | \mu \otimes \nu ) \geq \underset { \pi , \gamma } { \operatorname { i n f } } \mathscr { F } ( \pi , \gamma ) + \varepsilon \mathrm { K L } ( \pi \otimes \gamma | ( \mu \otimes \nu ) ^ { \otimes 2 } ) , } & { } & { ( 6 ) } \\ { \mathrm { a n d } } & { \mathscr { F } ( \pi , \gamma ) \triangleq \displaystyle \int _ { X ^ { 2 } \times Y ^ { 2 } } \lambda ( | d _ { X } - d _ { Y } | ) \mathrm { d } \pi \otimes \gamma + \mathrm { D } _ { \varphi } ( \pi _ { 1 } \otimes \gamma _ { 1 } | \mu \otimes \mu ) + \mathrm { D } _ { \varphi } ( \pi _ { 2 } \otimes \gamma _ { 2 } | \nu \otimes \nu ) , } & { } & \end{array}
133
+ $$
134
+
135
+ where $( \gamma _ { 1 } , \gamma _ { 2 } )$ denote the marginals of the plan $\gamma$ . In the sequel we write $\mathcal { F } _ { \varepsilon } = \mathcal { F } + \varepsilon \mathrm { K L } ^ { \otimes }$ . Note that in contrast to the entropic regularization of GW Peyré et al. [2016], here we use a tensorized entropy to maintain the overall homogeneity of the energy. A simple method to approximate this lower bound is to perform an alternate minimization on $\pi$ and $\gamma$ , which is known to converge for smooth $\varphi$ to a stationary point since the coupling term in the functional is smooth [Tseng, 2001]. Note that if $\pi \otimes \gamma$ is optimal then so is $\left( s \pi \right) \bar { \otimes } \left( { \textstyle { \frac { 1 } { s } } } \bar { \gamma } \right)$ with $s \geq 0$ . Thus without loss of generality we can optimize under the constraint $m ( \pi ) = m ( \gamma )$ by setting $s = \sqrt { m ( \gamma ) / m ( \pi ) }$ .
136
+
137
+ We now discuss the tightness of the bi-convex relaxation by generalizing a result of Konno. We first present a result which applies to general quadratic assignment problems, then state its application to our setting.
138
+
139
+ Theorem 2 (Tight relaxation). Let $B$ a Banach space, let $f : B \mapsto \mathbb { R } \cup \{ + \infty \}$ be a function and let $\mathcal { L } : C \subset B \mapsto \mathbb { R }$ the function defined on the convex set $C \subset B$ by $\begin{array} { r } { \mathcal { L } ( { \boldsymbol \pi } ) = \frac { 1 } { 2 } \langle { \boldsymbol \pi } , k ( { \boldsymbol \pi } ) \rangle + 2 f ( { \boldsymbol \pi } ) } \end{array}$ where $k$ is a symmetric bilinear map which is negative (not necessarily definite) on $\Delta C \triangleq { \mathrm { S p a n } } ( \{ \pi -$ $\gamma ; ( \pi , \overset { \cdot } { \gamma } ) \in C \}$ ), that is, for any $z \in \Delta C$ , $\langle z , k z \rangle \leq 0$ . Assume that there exists $\pi _ { 0 } \in C$ such that $\mathcal { L } ( \pi _ { 0 } ) < + \infty$ , and define $\mathcal { F } ( \pi , \gamma ) \triangleq \frac { _ 1 } { ^ 2 } \langle \pi , k ( \gamma ) \rangle + f ( \pi ) + f ( \gamma )$ . Then, for any $( \pi _ { * } , \gamma _ { * } ) \in$ arg min $\mathcal { F } ( \pi , \gamma )$ , we have $\mathcal { F } ( \pi _ { * } , \pi _ { * } ) = \mathcal { F } ( \bar { \gamma _ { * } } , \gamma _ { * } ) = \mathcal { F } ( \pi _ { * } , \gamma _ { * } )$ . Moreover, if one assumes either that $k$ is a definite kernel or $f$ is strictly convex, one gets $\pi _ { * } = \gamma _ { * }$ .
140
+
141
+ The above Theorem 2 is proved in Appendix D. As an application, we now state our tightness result for $\mathrm { G W } _ { \varepsilon }$ and CGW. In those settings the optimizers of the bi-convex relaxation are also optimal for the original problem.
142
+
143
+ Theorem 3. For $G W _ { \varepsilon }$ with $\varepsilon \geq 0$ or for CGW, assume that $\lambda ( t ) = t ^ { 2 }$ and that $( d _ { X } , d _ { Y } )$ are both conditionnally negative (or conditionally positive) kernels. Then the bi-convex relaxation of both problems is tight.
144
+
145
+ Proof. The proof for CGW is detailed in Appendix E, we prove the tightness for $\mathrm { G W } _ { \varepsilon }$ . When $\lambda ( t ) =$ $t ^ { 2 }$ the kernel $k = \lambda ( | d _ { X } - d _ { Y } | )$ is conditionally negative on the set $\{ ( \pi , \gamma ) , \ \pi _ { 1 } = \gamma _ { 1 }$ and $\pi _ { 2 } = \gamma _ { 2 } \}$ , i.e. we have $\langle ( \pi - \gamma ) \rangle$ , $k ( \pi - \gamma ) \rangle \leq 0$ (see Maron and Lipman [2018]). For $\mathrm { G W } _ { \varepsilon }$ one has $\pi _ { 1 } = \gamma _ { 1 } = \mu$ and $\pi _ { 2 } = \gamma _ { 2 } = \nu$ thanks to the constraints on marginals. Thus the kernel is negative semi-definite and the proof of Theorem 2 applies, hence the tightness of the relaxation. □
146
+
147
+ Konno’s result Konno [1976] applies for unregularized $\mathit { \Omega } ( \varepsilon = 0 ) ,$ ), Balanced-GW. The novelty of Theorem 3 is its extension to both $\mathrm { G W } _ { \varepsilon }$ and CGW. So far it is an open question whether the relaxation is tight or not for $\mathrm { U G W } _ { \varepsilon }$ , because the above proof no longer holds. Note that in all our numerical simulations, our solvers always found solutions of $\mathrm { U G W } _ { \varepsilon }$ such that $\pi = \gamma$ when $| d _ { X } - d _ { Y } | ^ { 2 }$ is conditonally negative. The property that the kernel $| d _ { X } - d _ { Y } | ^ { 2 }$ is negative does not hold in general (e.g. for graph geodesic distances) and the tightness of the relaxation remains open in this setting. We know from [Maron and Lipman, 2018, Theorem 1] that it is conditionally negative semi-definite when both $( d _ { X } , d _ { Y } )$ are conditionally negative kernels. Examples of distances which are negative kernels are tree metrics in the case of graphs, as well as Euclidean, spherical and hyperbolic distances over their respective manifolds Feragen et al. [2015]. In practice, when $\varepsilon$ is small, we observed in the indefinite setting that the relaxation outputs more frequently spurious minima than in the negative semi-definite setting.
148
+
149
+ # 3.2 Alternate Sinkhorn minimization
150
+
151
+ Minimizing the lower bound (6) with respect to either $\pi$ or $\gamma$ is non-trivial for an arbitrary $\varphi$ . We restrict our attention to the Kullback-Leibler case $\mathrm { D } _ { \varphi } = \rho \mathrm { K L }$ with $\rho > 0$ , which can be addressed by solving a regularized and convex unbalanced problem as studied in Chizat et al. [2018b], Séjourné et al. [2019]. It is explained in the following proposition.
152
+
153
+ Proposition 4. For a fixed $\gamma _ { i }$ , the optimal $\pi \in \arg \operatorname* { m i n } _ { \pi } \mathcal { F } ( \pi , \gamma ) + \varepsilon \mathrm { K L } ( \pi \otimes \gamma | ( \mu \otimes \nu ) ^ { \otimes 2 } )$ solves
154
+
155
+ $$
156
+ \operatorname* { m i n } _ { \pi } \int c _ { \gamma } ^ { \varepsilon } ( x , y ) \mathrm { d } \pi ( x , y ) + \rho m ( \gamma ) \mathrm { K L } ( \pi _ { 1 } | \mu ) + \rho m ( \gamma ) \mathrm { K L } ( \pi _ { 2 } | \nu ) + \varepsilon m ( \gamma ) \mathrm { K L } ( \pi | \mu \otimes \nu ) ,
157
+ $$
158
+
159
+ where $m ( \gamma ) \triangleq \gamma ( X \times Y )$ is the mass of $\gamma _ { i }$ , and where we define the cost associated to $\gamma$ as
160
+
161
+ $$
162
+ \varepsilon _ { \gamma } ^ { \varepsilon } ( x , y ) \triangleq \int \lambda ( | d x ( x , \cdot ) - d _ { Y } ( y , \cdot ) | ) \mathrm { d } \gamma + \rho \int \log ( \frac { \mathrm { d } \gamma _ { 1 } } { \mathrm { d } \mu } ) \mathrm { d } \gamma _ { 1 } + \rho \int \log ( \frac { \mathrm { d } \gamma _ { 2 } } { \mathrm { d } \nu } ) \mathrm { d } \gamma _ { 2 } + \varepsilon \int \log ( \frac { \mathrm { d } \gamma } { \mathrm { d } \mu \mathrm { d } \nu } ) \mathrm { d } \gamma .
163
+ $$
164
+
165
+ Computing the cost $c _ { \gamma } ^ { \varepsilon }$ for spaces $X$ and $Y$ of $n$ points has in general a cost ${ \dot { O } } ( n ^ { 4 } )$ in time and memory. However, as explained for instance in Peyré et al. [2016], for the special case $\lambda ( t ) = t ^ { 2 }$ , this cost is reduced to $O ( n ^ { 3 } )$ in time and ${ \dot { O } } ( n ^ { 2 } )$ in memory. This is the setting we consider in the numerical simulations. This makes the method applicable for scales of the order of $1 0 ^ { 4 }$ points. For larger datasets one should use approximation schemes such as hierarchical approaches [Xu et al., 2019] or Nyström compression of the kernel [Altschuler et al., 2018].
166
+
167
+ The resulting alternate minimization method is detailed in Algorithm 1, see Appendix D for a discretized version. It uses the unbalanced Sinkhorn algorithm of Chizat et al. [2018b], Séjourné et al. [2019] as subiterations and takes $\pi = \mu \otimes \nu / \sqrt { m ( \mu ) m ( \nu ) }$ to ini
168
+
169
+ $$
170
+ \overline { { \mathbf { A l g o r i t h m 1 - U G W } ( \mathcal { X } , \mathcal { V } , \rho , \varepsilon ) } }
171
+ $$
172
+
173
+ Input: mm-spaces $( \mathcal { X } , \mathcal { Y } )$ , relax. $\rho$ , regul. $\varepsilon$
174
+ Output: $\pi , \gamma$ solving (6) Init. $\pi = \gamma = \mu \otimes \nu / { \sqrt { m ( \mu ) m ( \nu ) } } , g =$ $g = 0$ . while $( \pi , \gamma )$ has not converged do Update $\pi \gamma$ , then $c \gets c _ { \pi } ^ { \varepsilon } , \tilde { \rho } \gets m ( \pi ) \rho , \tilde { \varepsilon } \gets m ( \pi ) \varepsilon$ while $( f , g )$ has not converged do $\begin{array} { r } { f \gets - \frac { \tilde { \varepsilon } \tilde { \rho } } { \tilde { \varepsilon } + \tilde { \rho } } \log { \int e ^ { ( g ( y ) - c ( \cdot , y ) ) / \tilde { \varepsilon } } \mathrm { d } \nu ( y ) } } \end{array}$ $\begin{array} { r } { g \gets - \frac { \tilde { \varepsilon } \tilde { \rho } } { \tilde { \varepsilon } + \tilde { \rho } } \log \int e ^ { ( f ( x ) - c ( x , \cdot ) ) / \tilde { \varepsilon } } \mathrm { d } \mu ( x ) } \end{array}$ end while Upd. $\begin{array} { l } { { \widehat { \gamma ( x , y ) } { } e ^ { \frac { f ( x ) + g ( y ) - c ( x , y ) } { \widehat { \varepsilon } } } \mu ( x ) \nu ( y ) } } \end{array}$ Rescale $\gamma \sqrt { m ( \pi ) / m ( \gamma ) } \gamma$ end while Return $( \pi , \gamma )$ .
175
+
176
+ tialize the updates. This Sinkhorn algorithm operates over a pair of continuous functions (so-called
177
+
178
+ Kantorovitch potentials) $f ( x )$ and $g ( y )$ . For discrete spaces $X$ and $Y$ of size $n$ , these functions are stored in vectors of size $n$ , and that integral involved in the updates becomes a sum. Each iteration of Sinkhorn thus has a cost $n ^ { 2 }$ , and all the involved operation can be efficiently mapped to parallelizable GPU routines as detailed in Chizat et al. [2018b], Séjourné et al. [2019]. Another advantage of using an unbalanced Sinkhorn algorithm is its complexity $O ( n ^ { 2 } / \varepsilon )$ to compute an $\varepsilon$ -approximation, as stated in Pham et al. [2020], which should be compared to ${ \cal O } ( n ^ { 2 } / \varepsilon ^ { 2 } )$ operations for balanced Sinkhorn.
179
+
180
+ Note also that balanced GW is recovered as a special case when setting $\rho \to + \infty$ , so that $\tilde { \rho } / ( \tilde { \varepsilon } +$ $\tilde { \rho } ) 1$ should be used in the iterations. In order to speed up Sinkhorn inner-loops, especially for small values of $\varepsilon$ , one can use linear extrapolation [Thibault et al., 2017] or non-linear Anderson acceleration [Anderson, 1965, Scieur et al., 2016].
181
+
182
+ There is an extra scaling step after computing $\gamma$ involving the mass $m ( \pi )$ . It corresponds to the scaling $s$ of $\pi \otimes \gamma$ such that $m ( \pi ) = m ( \gamma )$ , and we observe that this scaling is key not only to impose this mass equality but also to stabilize the algorithm. Otherwise we observed that $m ( \gamma ) < 1 < \bar { m } ( \pi )$ and underflows whenever $m ( \gamma ) \to 0$ and $\bar { m ( \pi ) } \to \infty$ .
183
+
184
+ # 4 Numerical experiments
185
+
186
+ This section presents simulations on synthetic examples to highlight the qualitative behavior of UGW and the tightness of the bound $\mathrm { U G W } \geq \mathrm { C G W }$ . Other illustrations on UGW are available in Appendix E. We end the section with a learning application of UGW in a positive-unlabeled setting, using domain adaptation data so as to compare with PGW Chapel et al. [2020]. In the synthetic experiments, $\mu$ and $\nu$ are probability distributions, which allows us to compare GW with UGW.
187
+
188
+ Robustness to imbalanced classes. In this first example, we take $X = \mathbb { R } ^ { 3 }$ , $Y = \mathbb { R } ^ { 2 }$ and consider $\mathcal { E } _ { 2 } , \mathcal { E } _ { 3 }$ , $\mathcal { C }$ and $s$ to be uniform distributions on a 2D and 3D ellipse, a square and a sphere. We consider mm-spaces of different dimensions to emphasize the ability of (U)GW to compare different spaces. Figure 1 contrasts the transportation plan obtained by GW and UGW for a fixed $\mu = 0 . 5 \mathcal { E } _ { 3 } + 0 . 5 \mathcal { S }$ and $\nu$ obtained using two different mixtures of ${ \mathcal { E } } _ { 2 }$ and $\mathcal { C }$ . The black segments show the largest entries of the transportation matrix $\pi$ , for a sub-sampled set of points (to ease visibility), thus effectively displaying the matching induced by the plan. Furthermore, the width of the dots are scaled according to the mass of the marginals $\pi _ { 1 } \approx \mu$ and $\pi _ { 2 } \approx \nu$ , i.e. the smaller the point, the smaller is the amount of transported mass. This figure shows that the exact conservation of mass imposed by GW leads to a poor geometrical matching of the shapes which have different global mass. As this should be expected, UGW recovers coherent matchings. We suspect the alternate minimization algorithm is able to find the global minimum in these cases.
189
+
190
+ ![](images/f47db5fb8f3450982a0a66e1916d139eb5e73fda2c541eaadd7d5cfe24ea392e.jpg)
191
+ Figure 1: GW vs. UGW transportation plan, using $\nu = 0 . 3 \mathcal { E } _ { 2 } { + } 0 . 7 \mathcal { C }$ on the left, and $\nu = 0 . 7 \mathcal { E } _ { 2 } \mathrm { + } 0 . 3 \mathcal { C }$ on the right. The 2D mm-spaces is lifted into $\mathbb { R } ^ { 3 }$ by padding the third coordinate to zero.
192
+
193
+ Tightness of the bound $\mathbf { C G W } { \leq } \mathbf { U G W }$ We propose to approximate CGW by doing a similar alternate minimization as for UGW, as detailed in Appendix E. This numerical scheme does not scale to large problems, but allows us to explore numerically how tight is the upper bound $\mathrm { U G W } \geq \mathrm { C G W }$ Figure 2 highlights the fact that in Euclidean space $\dot { X } = \dot { Y } = \mathbb { R } ^ { d }$ , this bound seems to be tight when the two measures are sufficiently close. We consider discrete measures $\begin{array} { r } { \mu = \frac { 1 } { n } \sum _ { i } \delta _ { x _ { i } } } \end{array}$ in $X = Y = \mathbb { R } ^ { d }$ and $\begin{array} { r } { \nu _ { t } = \frac { 1 } { n } \sum _ { i } \delta _ { y _ { i } } } \end{array}$ where $y _ { i } = x _ { i } + t \Delta _ { i }$ where $\Delta _ { i }$ are random perturbations and denote $( \mathcal { X } , \mathcal { Y } _ { t } )$ the two mm-spaces associated to the Euclidean distance. As $t 0$ , $\mu$ and $\nu _ { t }$ get closer, we observe numerically that $\mathrm { U G W } \approx \mathrm { C G W }$ . Figure 3 considers random points $( x _ { i } ) _ { i }$ and $( y _ { i } ) _ { i }$ and displays the histograms of the ratio CGW/UGW for $n = 3$ . This shows that while the bound $\mathrm { C G W } \leq \mathrm { U G W }$ seems not tight, the ratio appears to be bounded even for points not being close. This numerical experiment suggests that UGW and CGW are locally equivalent and that UGW is in practice an acceptable proxy of the distance CGW. We leave for future works a tighter analysis of the gap between UGW and CGW.
194
+
195
+ Positive unlabeled learning experiments Positive Unlabeled (PU) learning is a semi-supervised classification problem, where instead of learning from positive and negative samples $( x _ { i } , \ell _ { i } ) _ { i }$ with labels $\ell _ { i } \in \bar { \{ - 1 , 1 \} }$ we only learn from one class labeled with positives, i.e. only those $X \ \triangleq \ \{ x _ { i } : \ell _ { i } = 1 \}$ . The task is to leverage $X$ to predict the classes $\ell = \ell ( y ) \in$ $\{ - 1 , + 1 \}$ of unlabelled $y \in Y$ belong to a separate space. We consider here that $X , Y$ are embedded in Euclidean space, and denote $\mathcal { X } , \mathcal { y }$ the associated labelled and unlabelled mm-spaces, equipped with the uniform distribution. Our experiments are adapted from Partial-GW (PGW) Chapel et al. [2020], which used partial GW to solve PU-learning. The rationale of using unbalanced OT methods for PU learning stems from the fact that positive samples should be matched with positive due to their similar features, while negative samples would be ignored due to dissimilar features that induce a laziness to transport mass and match them.
196
+
197
+ ![](images/e4475ff8de7094efc40c50b639287430c08143782b69fb86b6cbf08cb3d44283.jpg)
198
+ Figure 2: Comparison of $\operatorname { U G W } ( \mathcal { X } , \mathcal { Y } _ { t } )$ and $\bar { \mathrm { C G W } } ( \mathcal { X } , \mathcal { Y } _ { t } )$ as the support gets shifted by a perturbation.
199
+
200
+ We consider PU learning over the Caltech office dataset used for domain adaptation tasks (with domains Caltech (C) Griffin et al. [2007], Amazon (A), Webcam (W) and DSLR (D) Saenko et al. [2010]). The Caltech datasets are represented with two embeddings based on Surf and Decaf features Saenko et al. [2010], Donahue et al. [2014]. On the latter datasets, we perform PU learning over similar features (e.g. surf- $C $ surf-\* or decaf-C decaf-\*) and from one feature format to the other (e.g. surf- $C $ decaf-\* or surf- $C $ decaf-\*). Those features are projected via PCA to subspaces of dimension 10 for surf features and 40 for decaf features. In the last task, one cannot use standard PU-method, and to the best of our knowledge, Unbalanced-GW methods are the only approaches for PU learning across different domains/features.
201
+
202
+ The procedure is the following. We solve the PU learning problem by computing the optimal plan $\pi$ for $\operatorname { U G W } ( \mathcal { X } , \mathcal { Y } )$ We compute its first marginal $\pi _ { 2 }$ on $\mathcal { V }$ , and predict the labels of some $y \in Y$ as $\ell ( y ) \triangleq \operatorname { s i g n } ( \pi _ { 2 } ( y ) - q )$ where $q$ is the quantile of $\pi _ { 2 }$ corresponding to the proportion $r$ of positives samples in $Y$ . Following Chapel et al. [2020] which is adapted from Kato et al. [2018], Hsieh et al. [2019], this proportion $r$ is assumed to be known. We report the accuracy of the prediction over the same 20 folds of the datasets, and use 20 other folds to validate the parameters of UGW. We consider 100 random samples for each fold of $( X , Y )$ , a ratio of positive samples $r = 0 . 1$ for domains (C,A,W,D), and a ratio $r = 0 . 2$ for domains (C,A,W).
203
+
204
+ ![](images/4a0dc32811e8a949315913b7b5c5a46c11a6ea0b91869c0999eefd388abd4f75.jpg)
205
+ Figure 3: Histograms of the ratio CGW/UGW for random spaces with $n \in \{ 2 , 3 , 5 \}$ samples. Ratios over 1 are due to local minima.
206
+
207
+ Since the GW objective is non-convex, the initialization of the minimization algorithms is key to obtain good performances. In Chapel et al. [2020] and our experiments, for tasks where $Y$ and $Y$ belong to the same Euclidean space, (e.g. surf- $\mathbf { \partial } \cdot \mathbf { C } \to \operatorname { s u r f } - ^ { * }$ ) we initialize $\pi$ with the Partial-Wasserstein (PW) solution with a squared Euclidean cost. For cross-domain prediction (e.g. surf- $C $ decaf-\*), following Chapel et al. [2020], PGW is initialized with a list of plans built using a coarsened representation of the data with $k$ -NN. While Chapel et al. [2020] makes use in an oracle manner of the plan providing the best accuracy, we modified their protocol and keep the plan which has the lowest PGW cost, which seems fairer, hence the difference in performance with Chapel et al. [2020]. To initialize UGW when $X$ and $Y$ do not belong to the same Euclidean space, we use a UOT solution of a matching between distance histograms called FLB Mémoli [2011]. We define FLB in our UGW setting as
208
+
209
+ Table 1: Accuracy for all tasks. The left block are domain adaptation experiments with similar features, where both PGW and UGW are initialised with PW. The right block are domain adaptation experiments with different features, and the reported init is FLB (see Appendix E) used for UGW.
210
+
211
+ <table><tr><td>Dataset</td><td>prior</td><td>Init (PW)</td><td>PGW</td><td>UGW</td><td>Dataset</td><td>prior</td><td>Init (FLB)</td><td>PGW</td><td>UGW</td></tr><tr><td>surf-C→surf-C</td><td>0.1</td><td>89.9</td><td>84.9</td><td>83.9</td><td>surf-C→decaf-C</td><td>0.1</td><td>85.0</td><td>85.1</td><td>85.6</td></tr><tr><td>surf-C →surf-A</td><td>0.1</td><td>81.8</td><td>82.2</td><td>83.5</td><td>surf-C→decaf-A</td><td>0.1</td><td>84.2</td><td>87.1</td><td>83.6</td></tr><tr><td>surf-C→ surf-W</td><td>0.1</td><td>81.9</td><td>81.3</td><td>80.3</td><td>surf-C→decaf-W</td><td>0.1</td><td>86.2</td><td>88.6</td><td>86.8</td></tr><tr><td>surf-C→surf-D</td><td>0.1</td><td>80.0</td><td>81.4</td><td>83.2</td><td>surf-C →decaf-D</td><td>0.1</td><td>84.7</td><td>91.1</td><td>90.7</td></tr><tr><td>surf-C→surf-C</td><td>0.2</td><td>79.7</td><td>75.7</td><td>75.4</td><td>surf-C→decaf-C</td><td>0.2</td><td>74.8</td><td>75.6</td><td>75.9</td></tr><tr><td>surf-C →surf-A</td><td>0.2</td><td>65.6</td><td>66.0</td><td>76.4</td><td>surf-C →decaf-A</td><td>0.2</td><td>76.2</td><td>87.9</td><td>82.4</td></tr><tr><td>surf-C→surf-W</td><td>0.2</td><td>65.1</td><td>64.3</td><td>67.3</td><td>surf-C→decaf-W</td><td>0.2</td><td>81.5</td><td>88.4</td><td>89.9</td></tr><tr><td>decaf-C→decaf-C</td><td>0.1</td><td>93.9</td><td>83.0</td><td>86.8</td><td>decaf-C→surf-C</td><td>0.1</td><td>81.7</td><td>81.0</td><td>81.1</td></tr><tr><td>decaf-C →decaf-A</td><td>0.1</td><td>80.1</td><td>81.4</td><td>85.6</td><td>decaf-C- →surf-A</td><td>0.1</td><td>80.9</td><td>81.2</td><td>82.4</td></tr><tr><td>decaf-C→decaf-W</td><td>0.1</td><td>80.1</td><td>82.7</td><td>86.1</td><td>decaf-C→ surf-W</td><td>0.1</td><td>82.0</td><td>81.3</td><td>83.5</td></tr><tr><td>decaf-C→decaf-D</td><td>0.1</td><td>80.6</td><td>83.8</td><td>83.4</td><td>decaf-C→surf-D</td><td>0.1</td><td>80.0</td><td>80.8</td><td>81.5</td></tr><tr><td>decaf-C→decaf-C</td><td>0.2</td><td>90.6</td><td>76.7</td><td>80.5</td><td>decaf-C →surf-C</td><td>0.2</td><td>66.6</td><td>63.7</td><td>65.2</td></tr><tr><td>decaf-C→decaf-A</td><td>0.2</td><td>62.5</td><td>68.7</td><td>74.7</td><td>decaf-C- →surf-A</td><td>0.2</td><td>62.9</td><td>62.4</td><td>69.3</td></tr><tr><td>decaf-C → decaf-W</td><td>0.2</td><td>65.7</td><td>75.9</td><td>79.2</td><td>decaf-C→surf-W</td><td>0.2</td><td>65.1</td><td>61.4</td><td>83.3</td></tr></table>
212
+
213
+ $$
214
+ \mathrm { F L B } ( \mathcal { X } , \mathcal { Y } ) \triangleq \operatorname* { m i n } \int _ { X \times \mathcal { Y } } | \bar { \mu } \star d _ { X } - \bar { \nu } \star d _ { Y } | ^ { 2 } \mathrm { d } \pi + \rho \mathrm { K L } ( \pi _ { 1 } | \mu ) + \rho \mathrm { K L } ( \pi _ { 2 } | \nu ) + \varepsilon \mathrm { K L } ( \pi | \mu \otimes \nu ) ,
215
+ $$
216
+
217
+ where $\begin{array} { r } { \mu \star d _ { X } ( x ) \triangleq \int d _ { X } ( x , x ^ { \prime } ) \mathrm { d } \mu ( x ^ { \prime } ) } \end{array}$ is the eccentricity, i.e. a histogram of aggregated distances, and $\bar { \mu } = \mu / m ( \mu )$ . Contrary to GW Mémoli [2011], there is a priori no link between FLB and UGW.
218
+
219
+ In the experiments we slightly generalize UGW and use two different marginal penalties $\rho _ { 1 } \mathrm { K L } ^ { \otimes } ( \pi _ { 1 } ^ { \cdot } | \mu ) + \rho _ { 2 } \mathrm { K L } ^ { \otimes } ( \pi _ { 2 } \overline { { { | } } } \nu )$ with two parameters $( \rho _ { 1 } , \rho _ { 2 } )$ to take into account shifts between domains/features. Note that PGW has a single parameter (which plays a role similar to $\left( \rho _ { 1 } , \rho _ { 2 } \right) )$ which controls the cost of mass creation/destruction. We set $\varepsilon = 2 ^ { - 9 }$ , which avoids introducing an extra parameter in the method. The value $( \rho _ { 1 } , \rho _ { 2 } ) \in \{ 2 ^ { - k }$ , $k \in [ [ 5 , 1 0 ] ] ^ { 2 }$ are cross validated for each J Ktask on the validation folds, and we report the average accuracy on the testing folds. We discuss in Appendix E the impact of reducing the number of parameters on the performance. Comparison with other methods – PU and PUSB Kato et al. [2018], Du Plessis et al. [2014] – are provided in Chapel et al. [2020] and we focus here on the comparison with PGW only.
220
+
221
+ The results are reported in Table 1. We display the performance of PGW, UGW and the initialization used for UGW to guarantee that using UGW does improve the performance. We observe that when the source and target dataset is the same $\mathrm { C } { } \mathrm { C }$ tasks), the PW initialization performs better and PGW/UGW degrade the performance, so that in this setting Optimal Transport should be preferred over GW, which is to be expected. However when the domains are different, applying UGW improves the performance over the initialization (which is FLB) in almost all tasks. Note that in that case the methods PU, PUSB or PW cannot be used. Overall, this shows that GW methods are able to solve to some extent the PU learning problem across different spaces, and that using a “softer” KL penalties in UGW is at least at par with Partial GW, and performs better in some settings.
222
+
223
+ # 5 Conclusion and perspectives
224
+
225
+ This paper defines two Unbalanced Gromov-Wasserstein formulations: CGW and UGW. We prove that they are both positive and definite. We provide a scalable, GPU-friendly algorithm to compute UGW illustrate its applicability in learning tasks, and show that CGW is a distance between mmspaces up to isometry. These divergences and distances allow for the first time to blend in a seamless way the transportation geometry of GW with creation and destruction of mass. This hybridization is the key to unlock both theoretical and practical issues. This work opens new questions for future works, for instance removing the bias introduced by the use of entropic regularization, which is important for applications to ML. Note that such a debiasing was successfully applied for BalancedGW in Bunne et al. [2019] and is shown to lead to a valid divergence for balanced OT in Feydy et al. [2019b] and UW in Séjourné et al. [2019]. The design of efficient numerical solvers for CGW is also an interesting avenue for future works, as well as the study of its induced topology.
226
+
227
+ # Acknowledgements
228
+
229
+ The works of Thibault Séjourné and Gabriel Peyré is supported by the ERC grant NORIA. The work of G. Peyré was supported in part by the French government under management of Agence Nationale de la Recherche as part of the "Investissements d’avenir" program, reference ANR19-P3IA-0001 (PRAIRIE 3IA Institute).
230
+
231
+ The authors thank Rémi Flamary for his remarks and advices, as well as Laetitia Chapel for her help to reproduce her experiments.
232
+
233
+ # References
234
+
235
+ Alexander M Bronstein, Michael M Bronstein, and Ron Kimmel. Generalized multidimensional scaling: a framework for isometry-invariant partial surface matching. Proceedings of the National Academy of Sciences, 103(5):1168–1172, 2006.
236
+
237
+ Hongteng Xu, Dixin Luo, and Lawrence Carin. Scalable gromov-wasserstein learning for graph partitioning and matching. In Advances in neural information processing systems, pages 3046– 3056, 2019.
238
+
239
+ Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 1263–1272. JMLR. org, 2017.
240
+
241
+ Edouard Grave, Armand Joulin, and Quentin Berthet. Unsupervised alignment of embeddings with wasserstein procrustes. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 1880–1890, 2019.
242
+
243
+ David Alvarez-Melis and Tommi S Jaakkola. Gromov-wasserstein alignment of word embedding spaces. arXiv preprint arXiv:1809.00013, 2018.
244
+
245
+ Karl-Theodor Sturm. The space of spaces: curvature bounds and gradient flows on the space of metric measure spaces. arXiv preprint arXiv:1208.0434, 2012.
246
+
247
+ Facundo Mémoli. Gromov–wasserstein distances and the metric approach to object matching. Foundations of computational mathematics, 11(4):417–487, 2011.
248
+
249
+ Matthias Liero, Alexander Mielke, and Giuseppe Savaré. Optimal entropy-transport problems and a new hellinger–kantorovich distance between positive measures. Inventiones mathematicae, pages 1–149, 2015.
250
+
251
+ Nicolas Courty, Rémi Flamary, and Devis Tuia. Domain adaptation with regularized optimal transport. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pages 274–289. Springer, 2014.
252
+
253
+ Charlie Frogner, Chiyuan Zhang, Hossein Mobahi, Mauricio Araya, and Tomaso A Poggio. Learning with a Wasserstein loss. In Advances in Neural Information Processing Systems, pages 2053–2061, 2015.
254
+
255
+ Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein GAN. arXiv preprint arXiv:1701.07875, 2017.
256
+
257
+ Lénaïc Chizat, Gabriel Peyré, Bernhard Schmitzer, and François-Xavier Vialard. Unbalanced optimal transport: Dynamic and kantorovich formulations. Journal of Functional Analysis, 274(11): 3090–3123, 2018a.
258
+
259
+ Jean Feydy, Pierre Roussillon, Alain Trouvé, and Pietro Gori. Fast and scalable optimal transport for brain tractograms. In International Conference on Medical Image Computing and ComputerAssisted Intervention, pages 636–644. Springer, 2019a.
260
+
261
+ John Lee, Nicholas P Bertrand, and Christopher J Rozell. Parallel unbalanced optimal transport regularization for large scale imaging problems. arXiv preprint arXiv:1909.00149, 2019.
262
+
263
+ Yogesh Balaji, Rama Chellappa, and Soheil Feizi. Robust optimal transport with applications in generative modeling and domain adaptation. Advances in Neural Information Processing Systems, 33, 2020.
264
+
265
+ Lenaic Chizat and Francis Bach. On the global convergence of gradient descent for over-parameterized models using optimal transport. In Advances in neural information processing systems, pages 3036–3046, 2018.
266
+
267
+ Grant Rotskoff, Samy Jelassi, Joan Bruna, and Eric Vanden-Eijnden. Global convergence of neuron birth-death dynamics. arXiv preprint arXiv:1902.01843, 2019.
268
+
269
+ Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In Adv. in Neural Information Processing Systems, pages 2292–2300, 2013.
270
+
271
+ Lenaic Chizat, Gabriel Peyré, Bernhard Schmitzer, and François-Xavier Vialard. Scaling algorithms for unbalanced transport problems. to appear in Mathematics of Computation, 2018b.
272
+
273
+ Thibault Séjourné, Jean Feydy, François-Xavier Vialard, Alain Trouvé, and Gabriel Peyré. Sinkhorn divergences for unbalanced optimal transport. arXiv preprint arXiv:1910.12958, 2019.
274
+
275
+ Charlotte Bunne, David Alvarez-Melis, Andreas Krause, and Stefanie Jegelka. Learning generative models across incomparable spaces. arXiv preprint arXiv:1905.05461, 2019.
276
+
277
+ Hongteng Xu, Dixin Luo, Ricardo Henao, Svati Shah, and Lawrence Carin. Learning autoencoders with relational regularization. arXiv preprint arXiv:2002.02913, 2020.
278
+
279
+ Ivegen Redko, Titouan Vayer, Rémi Flamary, and Nicolas Courty. Co-optimal transport. arXiv preprint arXiv:2002.03731, 2020.
280
+
281
+ Titouan Vayer, Laetita Chapel, Rémi Flamary, Romain Tavenard, and Nicolas Courty. Fused gromovwasserstein distance for structured objects: theoretical foundations and mathematical properties. arXiv preprint arXiv:1811.02834, 2018.
282
+
283
+ Samir Chowdhury and Tom Needham. Gromov-wasserstein averaging in a riemannian framework. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pages 842–843, 2020.
284
+
285
+ David Alvarez-Melis, Stefanie Jegelka, and Tommi S Jaakkola. Towards optimal transport with global invariances. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 1870–1879. PMLR, 2019.
286
+
287
+ Rainer E Burkard, Eranda Cela, Panos M Pardalos, and Leonidas S Pitsoulis. The quadratic assignment problem. In Handbook of combinatorial optimization, pages 1713–1809. Springer, 1998.
288
+
289
+ Gabriel Peyré, Marco Cuturi, and Justin Solomon. Gromov-wasserstein averaging of kernel and distance matrices. In International Conference on Machine Learning, pages 2664–2672, 2016.
290
+
291
+ Steven Gold and Anand Rangarajan. A graduated assignment algorithm for graph matching. IEEE Transactions on pattern analysis and machine intelligence, 18(4):377–388, 1996.
292
+
293
+ Nicoló De Ponti and Andrea Mondino. Entropy-transport distances between unbalanced metric measure spaces. arXiv preprint arXiv:2009.10636, 2020.
294
+
295
+ Karl-Theodor Sturm et al. On the geometry of metric measure spaces. Acta mathematica, 196(1): 65–131, 2006.
296
+
297
+ Laetitia Chapel, Mokhtar Z Alaya, and Gilles Gasso. Partial gromov-wasserstein with applications on positive-unlabeled learning. arXiv preprint arXiv:2002.08276, 2020.
298
+
299
+ Alessio Figalli. The optimal partial transport problem. Archive for rational mechanics and analysis, 195(2):533–560, 2010.
300
+
301
+ Luca Cosmo, Emanuele Rodolà, Michael M Bronstein, Andrea Torsello, Daniel Cremers, and Y Sahillioglu. Shrec’16: Partial matching of deformable shapes. Proc. 3DOR, 2(9):12, 2016.
302
+
303
+ Emanuele Rodola, Alex M Bronstein, Andrea Albarelli, Filippo Bergamasco, and Andrea Torsello. A game-theoretic approach to deformable shape matching. In 2012 IEEE Conference on Computer Vision and Pattern Recognition, pages 182–189. IEEE, 2012.
304
+ Dmitri Burago, Iu D Burago, Yuri Burago, Sergei A Ivanov, and Sergei Ivanov. A course in metric geometry, volume 33. American Mathematical Soc., 2001.
305
+ Nicolò De Ponti. Metric properties of homogeneous and spatially inhomogeneous $f$ -divergences. IEEE Transactions on Information Theory, 66(5):2872–2890, 2019.
306
+ Steven Gold, Anand Rangarajan, et al. Softmax to softassign: Neural network algorithms for combinatorial optimization. Journal of Artificial Neural Networks, 2(4):381–399, 1996.
307
+ J. Solomon, G. Peyré, V. Kim, and S. Sra. Entropic metric alignment for correspondence problems. ACM Transactions on Graphics (TOG), 35(4), 2016.
308
+ Paul Tseng. Convergence of a block coordinate descent method for nondifferentiable minimization. Journal of optimization theory and applications, 109(3):475–494, 2001.
309
+ Haggai Maron and Yaron Lipman. (probably) concave graph matching. arXiv preprint arXiv:1807.09722, 2018.
310
+ Hiroshi Konno. Maximization of a convex quadratic function under linear constraints. Mathematical programming, 11(1):117–127, 1976.
311
+ Aasa Feragen, Francois Lauze, and Soren Hauberg. Geodesic exponential kernels: When curvature and linearity conflict. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3032–3042, 2015.
312
+ Jason Altschuler, Francis Bach, Alessandro Rudi, and Jonathan Weed. Massively scalable Sinkhorn distances via the nystr\" om method. arXiv preprint arXiv:1812.05189, 2018.
313
+ Khiem Pham, Khang Le, Nhat Ho, Tung Pham, and Hung Bui. On unbalanced optimal transport: An analysis of sinkhorn algorithm. arXiv preprint arXiv:2002.03293, 2020.
314
+ Alexis Thibault, Lénaïc Chizat, Charles Dossal, and Nicolas Papadakis. Overrelaxed Sinkhorn-Knopp algorithm for regularized optimal transport. arXiv preprint arXiv:1711.01851, 2017.
315
+ Donald G Anderson. Iterative procedures for nonlinear integral equations. Journal of the ACM (JACM), 12(4):547–560, 1965.
316
+ Damien Scieur, Alexandre d’Aspremont, and Francis Bach. Regularized nonlinear acceleration. In Advances In Neural Information Processing Systems, pages 712–720, 2016.
317
+ Gregory Griffin, Alex Holub, and Pietro Perona. Caltech-256 object category dataset. 2007.
318
+ Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell. Adapting visual category models to new domains. In European conference on computer vision, pages 213–226. Springer, 2010.
319
+ Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In International conference on machine learning, pages 647–655. PMLR, 2014.
320
+ Masahiro Kato, Takeshi Teshima, and Junya Honda. Learning from positive and unlabeled data with a selection bias. In International Conference on Learning Representations, 2018.
321
+ Yu-Guan Hsieh, Gang Niu, and Masashi Sugiyama. Classification from positive, unlabeled and biased negative data. In International Conference on Machine Learning, pages 2820–2829. PMLR, 2019.
322
+ Marthinus C Du Plessis, Gang Niu, and Masashi Sugiyama. Analysis of learning from positive and unlabeled data. Advances in neural information processing systems, 27:703–711, 2014.
323
+ Jean Feydy, Thibault Séjourné, François-Xavier Vialard, Shun-ichi Amari, Alain Trouvé, and Gabriel Peyré. Interpolating between optimal transport and mmd using sinkhorn divergences. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 2681–2690, 2019b.
324
+
325
+ Matthias Liero, Alexander Mielke, and Giuseppe Savaré. Optimal transport in competition with reaction: The hellinger–kantorovich distance and geodesic curves. SIAM Journal on Mathematical Analysis, 48(4):2869–2911, 2016.
326
+
327
+ Lenaic Chizat, Gabriel Peyré, Bernhard Schmitzer, and François-Xavier Vialard. An interpolating distance between optimal transport and fisher–rao metrics. Foundations of Computational Mathematics, 18(1):1–44, 2018c.
328
+
329
+ Cedric Villani. Topics in C. Transportation. Graduate studies in Math. AMS, 2003.
330
+
331
+ Rémi Flamary and Nicolas Courty. Pot python optimal transport library. GitHub: https://github. com/rflamary/POT, 2017.
md/train/4AWko4A35ss/4AWko4A35ss.md ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SELF-SUPERVISED VIDEO REPRESENTATION LEARNING WITH CONSTRAINED SPATIOTEMPORAL JIGSAW
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ This paper proposes a novel pretext task for self-supervised video representation learning by exploiting spatiotemporal continuity in videos. It is motivated by the fact that videos are spatiotemporal by nature and a representation learned to detect spatiotemporal continuity/discontinuity is thus beneficial for downstream video content analysis tasks. A natural choice of such a pretext task is to construct spatiotemporal (3D) jigsaw puzzles and learn to solve them. However, this task turns out to be intractable. We thus propose Constrained Spatiotemporal Jigsaw (CSJ) whereby the 3D jigsaws are formed in a constrained manner to ensure that large continuous spatiotemporal cuboids exist in a shuffled clip to provide sufficient cues for the model to reason about the continuity. With the constrained jigsaw puzzles, instead of solving them directly, which could still be extremely hard, we carefully design four surrogate tasks that are more solvable but meanwhile still ensure that the learned representation is sensitive to spatiotemporal continuity at both the local and global levels. Extensive experiments show that our CSJ achieves state-of-the-art on two downstream tasks across various benchmarks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Self-supervised learning (SSL) has achieved tremendous successes recently for static images (He et al., 2020; Chen et al., 2020) and shown to be able to outperform supervised learning on a wide range of downstream image understanding tasks. However, such successes have not yet been reproduced for videos. Since different SSL models differ mostly on the pretext tasks employed on the unlabeled training data, designing pretext tasks more suitable for videos is the current focus for self-supervised video representation learning (Han et al., 2020; Wang et al., 2020).
12
+
13
+ Videos are spatiotemporal data and spatiotemporal analysis is the key to many video content understanding tasks. A good video representation learned from the self-supervised pretext task should therefore capture discriminative information jointly along both spatial and temporal dimensions. It is thus somewhat counter-intuitive to note that most existing SSL pretext tasks for videos do not explicitly require joint spatiotemporal video understanding. For example, some spatial pretext tasks have been borrowed from images without any modification (Jing et al., 2018), ignoring the temporal dimension. On the other hand, many recent video-specific pretext tasks typically involve speed or temporal order prediction (Lee et al., 2017; Wei et al., 2018; Benaim et al., 2020; Wang et al., 2020), i.e., operating predominately along the temporal axis.
14
+
15
+ A natural choice for a spatiotemporal pretext task is to solve 3D jigsaw puzzles, whose 2D counterpart has been successfully used for images (Noroozi & Favaro, 2016). Indeed, solving 3D puzzles requires the learned model to understand spatiotemporal continuity, a key step towards video content understanding. However, directly solving a 3D puzzle turns out to be intractable: a puzzle of $3 \times 3 \times 3$ pieces (the same size as a Rubik’s cube) can have 27! possible permutations. Video volume even in a short clip is much larger than that. Nevertheless, the latest neural sorting models (Paumard et al., 2020; Du et al., 2020) can only handle permutations a few orders of magnitude less, so offer no solution. This is hardly surprising because such a task is daunting even for humans: Most people would struggle with a standard Rubik’s cube, let alone a much larger one.
16
+
17
+ In this paper, we propose a novel Constrained Spatiotemporal Jigsaw (CSJ) pretext task for selfsupervised video representation learning. The key idea is to form 3D jigsaw puzzles in a constrained manner so that it becomes solvable. This is achieved by factorizing the permutations (shuffling)
18
+
19
+ ![](images/0e2765ac1fc37cb3ed7161a49676d6807733f039ef6007ddb1e38232e0101f70.jpg)
20
+ Figure 1: Illustration of our constrained jigsaw and the surrogate pretext tasks using an image example (only spatial for clarity). Our constrained jigsaw can be easily extended to the spatiotemporal domain as done in this work. (a): The raw image. (b),(c): Comparing an unconstrained puzzle (b) and our constrained one (c), it is clear that ours is much more continuous (hence interpretable) reflected by the size of the largest continuous cuboids (LCCs, rectangles in images here) shown in red. (d),(e): Illustration of the importance of the relative order of the top-2 LCCs for determining the global continuity level of the shuffled image. (d) and (e) have the same top-2 LCCs, but only (d) keeps the correct relative order between them. Locating these LCCs and predicting their relative order are thus the key objectives of our surrogate tasks.
21
+
22
+ into the three spatiotemporal dimensions and then applying them sequentially. This ensures that for a given video clip, large continuous spatiotemporal cuboids exist after the constrained shuffling to provide sufficient cues for the model to reason about spatiotemporal continuity (see Fig. 1(b)(c)). Such large continuous cuboids are also vital for human understanding of video as revealed in neuroscience and visual studies (Stringer et al., 2006; Chen et al., 2019). Even with the constrained puzzles, solving them directly could still be extremely hard. Consequently, instead of directly solving the puzzles (i.e., recovering the permutation matrix so that each piece can be put back), four surrogate tasks are carefully designed. They are more solvable but meanwhile still ensure that the learned representation is sensitive to spatiotemporal continuity at both the local and global levels. Concretely, given a video clip shuffled with our constrained permutations, we make sure that the top-2 largest continuous cuboids (LCCs) dominate the clip volume. The level of continuity in the shuffle clip as a whole is thus determined mainly by the volumes of these LCCs, and whether they are at the right order (see Fig. 1(d)(e)) both spatially and temporally. Our surrogate tasks are thus designed to locate these LCCs and predict their order so that the model learned with these tasks can be sensitive to spatiotemporal continuity both locally and globally.
23
+
24
+ Our main contributions are three-fold: (1) We introduce a new pretext task for self-supervised video representation learning called Constrained Spatiotemporal Jigsaw (CSJ). To our best knowledge, this is the first work on self-supervised video representation learning that leverages spatiotemporal jigsaw understanding. (2) We propose a novel constrained shuffling method to construct easy 3D jigsaws containing large LCCs. Four surrogate tasks are then formulated in place of the original jigsaw solving tasks. They are much more solvable yet remain effective in learning spatiotemporal discriminative representations. (3) Extensive experiments show that our approach achieves state-ofthe-art on two downstream tasks across various benchmarks.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Self-supervised Learning with Pretext Tasks Self-supervised learning (SSL) typically employs a pretext task to generate pseudo-labels for unlabeled data via some forms of data transformation. According to the transformations used by the pretext task, existing SSL methods for video presentation learning can be divided into three categories: (1) Spatial-Only Transformations: Derived from the original image domain (Gidaris et al., 2018), Jing et al. (2018) leveraged the spatial-only transformations for self-supervised video presentation learning. (2) Temporal-Only Transformations: Misra et al. (2016); Fernando et al. (2017); Lee et al. (2017); Wei et al. (2018) obtained shuffled video frames with the temporal-only transformations and then distinguished whether the shuffled frames are in chronological order. Xu et al. (2019) chose to shuffle video clips instead of frames. Benaim et al. (2020); Yao et al. (2020); Jenni et al. (2020) exploited the speed transformation via determining whether one video clip is accelerated. (3) Spatiotemporal Transformations: There are only a few recent approaches (Ahsan et al., 2019; Kim et al., 2019) that leveraged both spatial and temporal transformations by permuting 3D spatiotemporal cuboids. However, due to the aforementioned intractability of solving the spatiotemporal jigsaw puzzles, they only leveraged either temporal or spatial permutations as training signals, i.e., they exploited the two domains independently. Therefore, no true spatiotemporal permutations have been considered in Ahsan et al. (2019); Kim et al. (2019). In contrast, given that both spatial appearances and temporal relations are important cues for video representation learning, the focus of this work is on investigating how to exploit the spatial and temporal continuity jointly for self-supervised video presentation learning. To that end, our Constrained Spatiotemporal Jigsaw (CSJ) presents the first spatiotemporal continuity based pretext task for video SSL, thanks to a novel constrained 3D jigsaw and four surrogate tasks to reason about the continuity in the 3D jigsaw puzzles without solving them directly.
29
+
30
+ Self-supervised Learning with Contrastive Learning Contrastive learning is another selfsupervised learning approach that has become increasingly popular in the image domain (Misra & Maaten, 2020; He et al., 2020; Chen et al., 2020). Recently, it has been incorporated into video SSL as well. Contrastive learning and transformation based pretext tasks are orthogonal to each other and often combined in that different transformed versions of a data sample form the positive set used in contrastive learning. In El-Nouby et al. (2019); Knights et al. (2020); Qian et al. (2020); Wang et al. (2020); Yang et al. (2020), the positive/negative samples were generated based on temporal transformations only. In contrast, some recent works (Han et al., 2019; 2020; Zhuang et al., 2020) leveraged features from the future frame embeddings or with the memory bank (Wu et al., 2018). They modeled spatiotemporal representations using only contrastive learning without transformations. Contrastive learning is also exploited in one of our surrogate pretext tasks. Different from existing works, we explore the spatiotemporal transformations in the form of CSJ and employ contrastive learning to distinguish different levels of spatiotemporal continuity in shuffled jigsaws. This enables us to learn more discriminative spatiotemporal representations.
31
+
32
+ # 3 CONSTRAINED SPATIOTEMPORAL JIGSAW
33
+
34
+ # 3.1 PROBLEM DEFINITION
35
+
36
+ The main goal of self-supervised video representation learning is to learn a video feature representation function $f ( \cdot )$ without using any human annotations. A general approach to achieving this goal is to generate a supervisory signal $\textbf { { y } }$ from an unlabeled video clip $_ { \textbf { \em x } }$ and construct a pretext task $P$ to predict $\textbf { { y } }$ from $f ( { \pmb x } )$ . The process of solving the pretext task $P$ encourages $f ( \cdot )$ to learn discriminative spatiotemporal representations.
37
+
38
+ The pretext task $P$ is constructed typically by applying to a video clip a transformation function $t ( \cdot ; \pmb \theta )$ parameterized by $\pmb { \theta }$ and then automatically deriving $\textbf { { y } }$ from $\pmb \theta$ , e.g., $\textbf { { y } }$ can be the type of the transformation. Based on this premise, $P$ is defined as the prediction of $\textbf { { y } }$ using the feature map of the transformed video clip $f ( \widetilde { \pmb x } )$ , i.e., $P : f ( { \widetilde { \mathbf { x } } } ) \to { \pmb y }$ , where $\widetilde { \pmb { x } } = t ( \pmb { x } ; \pmb { \theta } )$ . For example, in Lee et al. (2017), $t ( \cdot ; \pmb \theta )$ e e e denotes a temporal transformation that permutes the four frames of video clip $_ { \textbf { \em x } }$ in a temporal order $\pmb \theta$ , $\widetilde { \pmb { x } } = t ( \pmb { x } ; \pmb { \theta } )$ is the shuffled clip, and the pseudo-label $\textbf { { y } }$ is defined as the permutation order $\pmb \theta$ e(e.g., 1324, 4312, etc.). The pretext task $P$ is then a classification problem of 24 categories because there are $4 ! = 2 4$ possible orders.
39
+
40
+ # 3.2 CONSTRAINED PERMUTATIONS
41
+
42
+ Solving spatiotemporal video jigsaw puzzles seems to be an ideal pretext task for learning discriminative representation as it requires an understanding of spatiotemporal continuity. After shuffling the pixels in a video clip using a 3D permutation matrix, the pretext task is to recover the permutation matrix. However, as explained earlier, this task is intractable given even moderate video clip sizes. Our solution is to introduce constraints on the permutations. As a result, a new pretext task $P _ { \mathrm { C S J } }$ based on Constrained Spatiotemporal Jigsaw (see Fig. 2(a)) is formulated, which is much easier to solve than a random/unconstrained jigsaw.
43
+
44
+ Specifically, our goal is to introduce constraints to the permutations so that the resultant shuffled video clip is guaranteed to have large continuous cuboids (see Fig. 2(a)). Similar to humans (Stringer et al., 2006), having large continuous cuboids is key for a model to understand a 3D jigsaw and therefore to have any chance to solve it. Formally, the volume of a shuffled video clip $\widetilde { \pmb x }$ are denoted as $\{ T , H , W \}$ e, measuring its sizes along the temporal, height, and width dimensions, respectively. A cuboid is defined as a crop of $\widetilde { \pmb x }$ : $\pmb { c } = \widetilde { \pmb { x } } _ { t _ { 1 } : t _ { 2 } , h _ { 1 } : h _ { 2 } , w _ { 1 } : w _ { 2 } }$ , where $t _ { 1 } , t _ { 2 } \in \{ 1 , 2 , \dots , T \} , h _ { 1 } , h _ { 2 } \in$ $\{ 1 , 2 , \ldots , H \} , w _ { 1 } , w _ { 2 } \in \{ 1 , 2 , \ldots , W \}$ . If all the jigsaw pieces (smallest video clip unit, e.g. a pixel or a 3D pixel block) in $^ c$ keep the same relative order as they were in $_ { \textbf { \em x } }$ (before being shuffled), we call the cuboid $^ c$ as a continuous cuboid $c ^ { \mathrm { c o n t } }$ . The cuboid’s volume equals $\left( t _ { 2 } - t _ { 1 } \right) \mathbf { \bar { \times } } \left( h _ { 2 } - h _ { 1 } \right) \times \mathbf { \bar { \Sigma } }$ $( w _ { 2 } - w _ { 1 } )$ , and the largest continuous cuboid (LCC) $c _ { \mathrm { m a x } } ^ { \mathrm { c o n t } }$ is the $c ^ { \mathrm { c o n t } }$ with the largest volume.
45
+
46
+ ![](images/1078e24fffb3ba13c20ebafabd92aee164ef40d676a91283df6ddb5e42457aac.jpg)
47
+ Figure 2: (a) Illustration of our Constrained Spatiotemporal Jigsaw (CSJ) (see Sec. 3.2). (b) The pipeline of our proposed framework for self-supervised video representation learning (see Sec. 3.3). A raw video clip is transformed into 8 shuffled clips with our Constrained Spatiotemporal Jigsaw (CSJ), and a 3D CNN sharing weights extracts the feature representations from them. The model is then trained by solving four self-supervised tasks jointly.
48
+
49
+ We introduce two permutation strategies to ensure that the volumes of LCCs are large in relation to the whole video clip volume after our shuffling transformation $t ( \cdot ; \theta _ { \mathrm { C S J } } )$ . First, instead of shuffling $_ { \textbf { \em x } }$ in three spatiotemporal dimensions simultaneously, $t ( \cdot ; \theta _ { \mathrm { C S J } } )$ factorizes the permutations into the three spatiotemporal dimensions and then utilizes them sequentially to generate shuffled clips, e.g., in the order of $T , W , H$ and only once. Note that the volume of the generated $\widetilde { \pmb x }$ stays the same with different permutation orders (e.g., $T W H$ and $H T W$ e). Second, we shuffle a group of jigsaw pieces together instead of each piece individually along each dimension. Taking spatial shuffling as an example, if there are 8 pieces per frame (along each of the two spatial dimensions), $\theta _ { \mathrm { C S J } }$ could be represented as the permutation from $\{ 1 2 3 4 5 6 7 8 \}$ to $\{ 8 4 5 6 7 1 2 3 \}$ . The longest and the secondlongest index ranges are: [2, 5] for coordinates $\{ 4 5 6 7 \}$ , and [6, 8] for coordinates $\lbrace 1 2 3 \rbrace$ . With these two permutation strategies, not only do we have large LCCs, but also they are guaranteed to have clearly separable boundaries (see Fig. 2(b)) with surrounding pieces due to the factorized and grouped permutation design. This means that they are easily detectable.
50
+
51
+ # 3.3 SURROGATE TASKS
52
+
53
+ Having permutation constraints preserves more spatiotemporal continuity in the shuffled clip and reduces the amount of possible permutations. But exploiting these constraints to make a neural sorting model tractable is still far from trivial. Instead of solving the jigsaw directly, our $P _ { \mathrm { C S J } }$ is thus formulated as four surrogate tasks: Largest Continuous Cuboid Detection (LCCD), Clip Shuffling Pattern Classification (CSPC), Contrastive Learning over Shuffled Clips (CLSC), and Clip Continuity Measure Regression (CCMR). As illustrated in Fig. 2(b), given an unlabeled clip $_ { \textbf { \em x } }$ , we first construct a mini-batch of 8 clips $\{ \widetilde { \pmb { x } } _ { 1 } , \widetilde { \pmb { x } } _ { 2 } , . . . , \widetilde { \pmb { x } } _ { 8 } \}$ by shuffling $_ { \textbf { \em x } }$ with different but related constrained permutae e etions (to be detailed later). These shuffled clips and the raw clip $_ { \textbf { \em x } }$ are then fed into a 3D CNN model $f ( \cdot )$ for spatiotemporal representation learning with a non-local operation (Wang et al., 2018):
54
+
55
+ $$
56
+ f _ { \mathrm { N L } } ( \widetilde { \mathbf { x } } _ { i } ) = \mathrm { N L } ( f ( \widetilde { \mathbf { x } } _ { i } ) , f ( \pmb { x } ) ) ,
57
+ $$
58
+
59
+ where $\operatorname { N L } ( \cdot , \cdot )$ denotes the non-local operator, and $f ( \widetilde { \pmb x } _ { i } )$ and $f ( { \pmb x } )$ denote the feature map of $\widetilde { \pmb { x } } _ { i }$ and $_ { \textbf { \em x } }$ from the last convolutional layer of $f ( \cdot )$ e, respectively. The resultant feature map $f _ { \mathrm { N L } } ( \widetilde { \pmb x } _ { i } )$ eis further passed through a spatial pooling layer followed by a separately fully-connected layer for each surrogate task. Note that the raw video feature map $f ( { \pmb x } )$ is used as guidance through the nonlocal based attention mechanism to help fulfill the tasks. This is similar to humans needing to see the completed jigsaw picture to help solve the puzzle.
60
+
61
+ Before we detail the four tasks, we first explain how the eight permutations from the same raw clip are generated. First, the factorized and grouped permutations are applied to $_ { \textbf { \em x } }$ to create one shuffled clip. By examining the largest and the second-largest continuous puzzle piece numbers of each dimension $( \{ T , H , \bar { W } \} )$ , we can easily identify the top-2 largest continuous cuboids (LCCs). Next, by varying the relative order of the top-2 LCCs either in the correct (original) order or the reverse order in each dimension, $2 \times 2 \times 2 { = } 8$ permutations are obtained. By controlling the group size in permutation, we can make sure that the top-2 LCCs account for a large proportion, saying $80 \%$ of the total clip volume. Our four tasks are thus centered around these two LCCs as they largely determine the overall spatiotemporal continuity of the shuffled clip.
62
+
63
+ The first task LCCD is to locate the top-2 LCCs $\{ c _ { \mathrm { m a x } } ^ { \mathrm { c o n t } } ( j ) : j = 1 , 2 \}$ and formulated as a regression problem. Given a ground-truth LCC $c _ { \mathrm { m a x } } ^ { \mathrm { c o n t } } ( j )$ , a Gaussian kernel is applied to its center to depict the possibility of each pixel in $\widetilde { \pmb x }$ belonging to the LCC. This leads to a soft mask $M _ { \mathrm { L C C D } } ^ { j }$ with the same size of $\widetilde { \pmb x }$ : $M _ { \mathrm { L C C D } } ^ { j }$ is all 0 outside the region of $c _ { \mathrm { m a x } } ^ { \mathrm { c o n t } } ( j )$ , and $\exp \bigl ( - \frac { | | \boldsymbol { a } - \boldsymbol { a } _ { \mathrm { c } } | | ^ { 2 } } { 2 \sigma _ { g } ^ { 2 } } \bigr )$ inside the region, where ${ \mathbf { } } a , a _ { \mathrm { { c } } }$ denote any pixel and the center point, respectively. $\sigma _ { g }$ is the hyper-parameter which is set as 1 empirically. In the training stage, FPN (Lin et al., 2017) is used for multi-level feature fusion. LCCD is optimized using the MSE loss in each point:
64
+
65
+ $$
66
+ { \cal L } _ { \mathrm { L C C D } } = \sum _ { j \in \{ 1 , 2 \} } \sum _ { { \bf { a } } \in \widetilde { { \pmb x } } } \mathrm { M S E } ( M _ { \mathrm { L C C D } } ^ { j } ( { \pmb a } ) , M _ { \mathrm { L C C D } } ^ { j } ( { \pmb a } ) ^ { ' } ) ,
67
+ $$
68
+
69
+ where $\mathrm { M S E } ( \cdot , \cdot )$ denotes the MSE loss function, and $M _ { \mathrm { L C C D } } ^ { j } ( \pmb { a } ) ^ { \prime }$ 0 is the prediction of each pixel $^ { a }$
70
+
71
+ CSPC is designed to recognize the shuffling pattern of a shuffled clip. As mentioned early, the eight shuffled clips in each mini-batch are created from the same raw clip and differ only in the relative order of the top-2 LCCs along each of the three dimensions. There are thus eight permutations depending on the order (correct or reverse) in each dimension. Based on this understanding, CSPC is formulated as a multi-class classification task to recognize each shuffled clip into one of these eight classes, which is optimized using the Cross-Entropy (CE) loss:
72
+
73
+ $$
74
+ L _ { \mathrm { C S P C } } = \sum _ { i \in \{ 0 , 1 , . . . , 7 \} } { \bf C E } ( l _ { \mathrm { C S P C } } [ i ] , l _ { \mathrm { C S P C } } ^ { ' } [ i ] ) ,
75
+ $$
76
+
77
+ where $\operatorname { C E } ( \cdot , \cdot )$ denotes the CE loss function and $l _ { \mathrm { C S P C } } ^ { ' } [ i ]$ is the predicted class label of $i$ -th sample (shuffled clip) in each mini-batch.
78
+
79
+ The two tasks above emphasize on local spatiotemporal continuity understanding. In contrast, CLSC leverages the contrastive loss to encourage global continuity understanding. In particular, since the top-2 LCCs dominate the volume of a clip, it is safe to assume that if their relative order is correct in all three dimensions, the shuffled clip largely preserve continuity compared to the original clip, while all other 7 permutations feature large discontinuity in at least one dimension. We thus form a contrastive learning task with the original video $_ { \textbf { \em x } }$ and the most continuous shuffled video $\widetilde { \pmb { x } } _ { i }$ as a positive pair, and $_ { \textbf { \em x } }$ and the rest $\widetilde { \pmb { x } } _ { j }$ $( j \neq i )$ ) as negative pairs. CLSC is optimized using the e eNoise Contrastive Estimation (NCE) (Tian et al., 2020) loss:
80
+
81
+ $$
82
+ \begin{array} { r } { L _ { \mathrm { C L S C } } = - \log \frac { \exp ( \sin ( f ( \pmb { x } ) , f ( \widetilde { \pmb { x } } _ { i } ) ) / \tau ) } { \exp ( \sin ( f ( \pmb { x } ) , f ( \widetilde { \pmb { x } } _ { i } ) ) / \tau ) + \sum _ { j } \exp ( \sin ( f ( \pmb { x } ) , f ( \widetilde { \pmb { x } } _ { j } ) ) / \tau ) } , } \end{array}
83
+ $$
84
+
85
+ where $\sin ( \cdot , \cdot )$ is defined by the dot product: $f ( \pmb { x } ) ^ { \top } f ( \widetilde { \pmb { x } } _ { i } )$ , and $\tau$ is the temperature hyper-parameter.
86
+ Note that the non-local operator is not used in CLSC.
87
+
88
+ CCMR is similar to CLSC in that it also enforces global continuity understanding, but differs in that it is a regression task aimed at predicting a global continuity measure. We consider two such measures. Since the total size of the top-2 LCCs $\{ c _ { \mathrm { m a x } } ^ { \mathrm { c o n t } } ( j ) : j = 1 , 2 \}$ is a good indicator of how continuous a shuffle video clip is, the first measure $l _ { l d }$ directly measures the relative total size of the top-2 LCCs: $l _ { l d } = \frac { \mathbf { v } ( { c } _ { \mathrm { m a x } } ^ { \mathrm { c o n t } } ( 1 ) ) + \mathbf { v } ( { c } _ { \mathrm { m a x } } ^ { \mathrm { c o n t } } ( 2 ) ) } { \mathbf { v } ( \widetilde { \pmb { x } } ) }$ , where $\mathbf { v } ( \cdot )$ represents the volume of a clip/cuboid.
89
+
90
+ The second measure $l _ { \mathrm { h d } } ^ { \mathrm { t / h / w } }$ examines the shuffling degree of $\widetilde { \pmb x }$ in each dimension, computed as the normalized hamming distance: $\frac { \mathrm { h a m m i n g } ( \widetilde { \pmb { x } } ) } { N _ { c } ( N _ { c } - 1 ) / 2 }$ where hamming $( \cdot )$ denotes the hamming distance in each dimension between the original piece sequence and the permuted one, and $N _ { c }$ represents the number of pieces in each dimension so that $N _ { c } ( \bar { N } _ { c } { - } 1 ) / 2$ indicates the maximum possible hamming distance in the dimension. CCMR is optimized using the Mean Squared Error (MSE) loss:
91
+
92
+ $$
93
+ \begin{array} { r } { L _ { \mathrm { C C M R } } = \mathbf { M S E } \big ( \big [ l _ { \mathrm { l d } } , l _ { \mathrm { h d } } ^ { \mathrm { t } } , l _ { \mathrm { h d } } ^ { \mathrm { h } } , l _ { \mathrm { h d } } ^ { \mathrm { w } } \big ] , \big [ l _ { \mathrm { l d } } ^ { ' } , l _ { \mathrm { h d } } ^ { \mathrm { t } ^ { \prime } } , l _ { \mathrm { h d } } ^ { \mathrm { h } ^ { \prime } } , l _ { \mathrm { h d } } ^ { \mathrm { w } ^ { \prime } } \big ] \big ) , } \end{array}
94
+ $$
95
+
96
+ where $l _ { \mathrm { l d } } ^ { ' } , l _ { \mathrm { h d } } ^ { \mathrm { t } ^ { \prime } } , l _ { \mathrm { h d } } ^ { \mathrm { h } ^ { \prime } } , l _ { \mathrm { h d } } ^ { \mathrm { w } ^ { \prime } }$ are the prediction of the model.
97
+
98
+ # 3.4 OVERALL LEARNING OBJECTIVE
99
+
100
+ Our entire CSJ framework is optimized end-to-end with the learning objective defined as:
101
+
102
+ $$
103
+ L = \sigma _ { 1 } L _ { \mathrm { L C C D } } + \sigma _ { 2 } L _ { \mathrm { C S P C } } + \sigma _ { 3 } L _ { \mathrm { C L S C } } + \sigma _ { 4 } L _ { \mathrm { C C M R } } ,
104
+ $$
105
+
106
+ where $\sigma _ { 1 } , \sigma _ { 2 } , \sigma _ { 3 } , \sigma _ { 4 }$ denote the weights for the four losses. We deploy the adaptive weighting mechanism (Kendall et al., 2018) to weight these tasks, and thus there is no free hyper-parameters to tune. We also adopt curriculum learning (Bengio et al., 2009; Korbar et al., 2018) to train our network by shuffling clips from easy to hard. More details are presented in Appendix. A.1 and A.2.
107
+
108
+ # 4 EXPERIMENTS
109
+
110
+ # 4.1 DATASETS AND SETTINGS
111
+
112
+ We select three benchmark datasets for performance evaluation: UCF101 (Soomro et al., 2012), HMDB51 (Kuehne et al., 2011), and Kinetics-400 (K400) (Kay et al., 2017), containing 13K/7K/306K video clips from 101/51/400 action classes, respectively. In the self-supervised pretraining stage, we utilize the first training split of UCF101/HMDB51 and the training split of K400 without using their labels. As in Han et al. (2020), we adopt R2D3D as the backbone network, which is modified from R3D (Hara et al., 2018) with fewer parameters. By fine-tuning the pre-trained model, we can evaluate the SSL performance on a downstream task (i.e., action classification). Following Han et al. (2019); He et al. (2020), two evaluation protocols are used: comparisons against state-of-the-arts follow the more popular fully fine-tuning evaluation protocol, but ablation analysis takes both the linear evaluation and fully fine-tuning protocols. For the experiments on supervised learning, we report top-1 accuracy on the first test split of UCF101/HMDB51 as the standard (Han et al., 2020). More details of the datasets are provided in Appendix B.
113
+
114
+ # 4.2 IMPLEMENTATION DETAILS
115
+
116
+ Raw videos in these datasets are decoded at a frame rate of 24-30 fps. From each raw video, we start from a randomly selected frame index and sample a consecutive 16-frame video clip with a temporal stride of 4. For data augmentation, we first resize the video frames to $1 2 8 \times 1 7 1$ pixels, from which we extract random crops of size $1 1 2 \times 1 1 2$ pixels. We also apply random horizontal flipping and random color jittering to the video frames during training. We exploit only the raw RGB video frames as input, and do not leverage optical flow or other auxiliary signals for self-supervised pretraining. We adopt the Adam optimizer with a weight decay of $1 0 ^ { - 3 }$ and a batch size of 8 per GPU (with a total of 32 GPUs). We deploy cosine annealing learning rate with an initial value of $\bar { 1 } 0 ^ { - 4 }$ and 100 epochs. The jigsaw puzzle piece sizes of $\{ T , H , { \bar { W } } \}$ dimensions are set as $1 , 4 , 4$ , respectively. A $1 6 \times 1 1 2 \times 1 1 2$ video clip thus contains $1 6 \times 2 8 \times 2 8$ pieces. We set the temperature hyper-parameter $\tau$ to 0.07. A dropout of 0.5 is applied to the final layer of each task. More implementation details of the fine-tuning and test evaluation stages can be found in Appendix B.
117
+
118
+ # 4.3 MAIN RESULTS
119
+
120
+ Comparison in Action Recognition A standard way to evaluate a self-supervised video representation learning model is to use it to initialize an action recognition model on a small dataset. Specifically, after self-supervised pre-training on UCF101/HMDB51/K400, we exploit the learned backbone for fully fine-tuning on UCF101 and HMDB51, following Han et al. (2020); Wang et al. (2020).
121
+
122
+ Table 1: Comparison to the state-of-the-art on UCF101(U) and HMDB51 $\mathrm { ( H ) }$ . All models are pretrained with the RGB modality only. $\dagger$ : Methods with temporal-only transformations. $^ \ddag$ : Methods with both spatial and temporal transformations. $* 1$ : Methods that leverage spatiotemporal representations. HT: HowTo100M. The underline represents the second-best result.
123
+
124
+ <table><tr><td>Methods</td><td>Backbone</td><td>Pre-trained Datasets</td><td>Input size (T*H)</td><td>UCF101</td><td>HMDB51</td></tr><tr><td>CMC (ECCV&#x27;20) (Tian et al.,2020)</td><td>C2D</td><td>U</td><td>1</td><td>55.3</td><td></td></tr><tr><td>Skip-Clip† (El-Nouby et al.,2019)</td><td>R3D-18</td><td>U/H</td><td>16*112</td><td>64.4</td><td>一</td></tr><tr><td>VCOPt (CVPR&#x27;19) (Xu et al.,2019)</td><td>R3D-18</td><td>U/H</td><td>16*112</td><td>64.9</td><td>29.5</td></tr><tr><td>VCP† (AAAI&#x27;20) (Luo et al.,2020b)</td><td>R3D-18</td><td>U/H</td><td>16*112</td><td>66.0</td><td>31.5</td></tr><tr><td>PRPt (CVPR&#x27;20)(Yao et al.,2020)</td><td>R3D-18</td><td>U/H</td><td>16*112</td><td>66.5</td><td>29.7</td></tr><tr><td>MemDPC* (ECCV&#x27;20) (Han et al.,2020) CSJ*(ours)</td><td>R2D3D-18</td><td>U/H</td><td>40*128</td><td>69.2</td><td>一</td></tr><tr><td>Video-Jigsaw* (WACV&#x27;19) (Ahsan et al.,2019)</td><td>R2D3D-18</td><td>U/H</td><td>16*112</td><td>70.4</td><td>36.0</td></tr><tr><td>Statisics*(CVPR&#x27;19) (Wang et al.,2019)</td><td>C2D C3D</td><td>K400</td><td>25*224</td><td>55.4</td><td>27.0</td></tr><tr><td>ST-Puzzle‡ (AAAI&#x27;19) (Kim et al.,2019)</td><td>R3D-18</td><td>K400</td><td>16*112</td><td>61.2</td><td>33.4</td></tr><tr><td>DPC*(ICCVW&#x27;19) (Han et al.,2019)</td><td>R2D3D-18</td><td>K400</td><td>16*112</td><td>63.9</td><td>33.7</td></tr><tr><td>SpeedNet (CVPR&#x27;20) (Benaim et al.,2020)</td><td></td><td>K400</td><td>40*128</td><td>68.2</td><td>34.5</td></tr><tr><td>VIE*(CVPR&#x27;20) (Zhuang et al.,2020)</td><td>I3D</td><td>K400</td><td>16*224</td><td>66.7</td><td>43.7</td></tr><tr><td>Pace† (ECCV&#x27;20) (Wang et al.,2020)</td><td>R3D-18</td><td>K400</td><td>16*112</td><td>75.5</td><td>44.6</td></tr><tr><td>CSJ* (ours)</td><td>R(2+1)D-18</td><td>K400</td><td>16*112</td><td>77.1</td><td>36.6</td></tr><tr><td></td><td>R2D3D-18</td><td>K400</td><td>16*112</td><td>76.2</td><td>46.7</td></tr><tr><td>MemDPC* (ECCV&#x27;20) (Han et al.,2020) CBT (Sun et al.,2019)</td><td>R2D3D-34</td><td>K400</td><td>40*224</td><td>78.1</td><td>41.2</td></tr><tr><td>CSJ* (ours)</td><td>S3D R2D3D-34</td><td>K600+HT K400</td><td>一 16*224</td><td>79.5</td><td>44.6</td></tr><tr><td></td><td></td><td></td><td></td><td>79.5</td><td>50.9</td></tr><tr><td>Upper Bound:Fully-Supervised</td><td>R3D-34</td><td>K400</td><td>16*224</td><td>87.7</td><td>59.1</td></tr></table>
125
+
126
+ Table 2: Comparison with state-of-the-art self-supervised learning methods for nearest neighbor video retrieval (top- $k$ recall) on UCF101. The underline represents the second-best result.
127
+
128
+ <table><tr><td>Methods</td><td>Backbone</td><td>Top1</td><td>Top5</td><td>Top10</td><td>Top20</td><td>Top50</td></tr><tr><td>VCOP (CVPR&#x27;19) (Xu et al., 2019)</td><td>R3D-18</td><td>14.1</td><td>30.3</td><td>40.0</td><td>51.1</td><td>66.5</td></tr><tr><td>VCP (AAAI&#x27;20) (Luo et al., 2020b)</td><td>R3D-18</td><td>18.6</td><td>33.6</td><td>42.5</td><td>53.5</td><td>68.1</td></tr><tr><td>SpeedNet (CVPR&#x27;20) (Benaim et al., 2020)</td><td>S3D-G</td><td>13.1</td><td>28.1</td><td>37.5</td><td>49.5</td><td>65.0</td></tr><tr><td>PRP (CVPR&#x27;2O) (Yao et al.,2020)</td><td>R3D-18</td><td>22.8</td><td>38.5</td><td>46.7</td><td>55.2</td><td>69.1</td></tr><tr><td>Pace (ECCV&#x27;2O) (Wang et al., 2020)</td><td>R3D-18</td><td>19.9</td><td>36.2</td><td>46.1</td><td>55.6</td><td>69.2</td></tr><tr><td>ERUV (Luo et al., 2020a)</td><td>R3D-18</td><td>21.4</td><td>35.2</td><td>43.8</td><td>53.1</td><td>68.3</td></tr><tr><td>MemDPC (ECCV&#x27;20) (Han et al., 2020)</td><td>R2D3D-18</td><td>20.2</td><td>40.4</td><td>52.4</td><td>64.7</td><td>1</td></tr><tr><td>CSJ (ours)</td><td>R2D3D-18</td><td>21.5</td><td>40.5</td><td>53.2</td><td>64.9</td><td>70.0</td></tr></table>
129
+
130
+ We consider one baseline: fully-supervised learning with pre-training on K400. Note that this baseline is commonly regarded as the upper bound of self-supervised representation learning (Alwassel et al., 2019). From Table 1, we have the following observations: (1) Our CSJ achieves state-of-theart performance on both UCF101 and HMDB51. Particularly, with the backbone R2D3D-18 that is weaker than $\mathrm { R } ( 2 + 1 ) \mathrm { D } { - } 1 8 $ , our CSJ performs comparably w.r.t. Pace on UCF101 but achieves a $10 \%$ improvement over Pace on HMDB51. (2) By exploiting spatiotemporal transformations for self-supervised representation learning, our CSJ beats either methods with only temporal transformations $( \dag )$ or methods with both spatial and temporal transformations $( \ddagger )$ , as well as those learning spatiotemporal representations $( \ast )$ via only contrastive learning (w./o. spatiotemporal transformations). (3) Our CSJ also outperforms CBT (Sun et al., 2019), which used ten-times more massive datasets (K600 (Carreira et al., 20 $ { \left| 8 \right. } + { \mathrm { H } }$ owto100M (Miech et al., 2019)) and multiple modalities (RGB $+ .$ Audio). (4) Our CSJ is the closest to the fully-supervised one (upper bound), validating its effectiveness in self-supervised video representation learning.
131
+
132
+ Comparison in Video Retrieval We evaluate our CSJ method in the video retrieval task. Following Xu et al. (2019), we extract each video clips’ embeddings with the pre-training model and use each clip in the test set to query the $k$ nearest clips in the training set. The comparative results in Table 2 show that our method outperforms all other self-supervised methods and achieves new state-of-the-art in video retrieval on UCF101. Particularly, our method beats the latest competitor
133
+
134
+ Table 3: Evaluation of pre-training tasks with the backbone R2D3D-18 under linear probe and fully fine-tuning protocols on UCF101. AW: Adaptive Weighting. CL: Curriculum Learning.
135
+
136
+ <table><tr><td>Tasks</td><td>Linear Probe</td><td>Fully Fine-tuning</td></tr><tr><td>Random Initialization</td><td>8.3</td><td>63.6</td></tr><tr><td>LCCD</td><td>21.8</td><td>67.8</td></tr><tr><td>CSPC</td><td>22.6</td><td>68.1</td></tr><tr><td>CLSC</td><td>18.9</td><td>68.1</td></tr><tr><td>CCMR</td><td>22.7</td><td>68.1</td></tr><tr><td>CCMR+CSPC</td><td>24.7</td><td>69.2</td></tr><tr><td>CCMR+CSPC+CLSC</td><td>25.5</td><td>69.3</td></tr><tr><td>CCMR+CSPC+CLSC+LCCD</td><td>27.9</td><td>69.5</td></tr><tr><td>CCMR+CSPC+CLSC+LCCD+AW</td><td>28.2</td><td>70.0</td></tr><tr><td>CCMR+CSPC+CLSC+LCCD+AW+CL</td><td>28.5</td><td>70.4</td></tr></table>
137
+
138
+ ![](images/05879f14857b6a2ef744f82417429a2c36c8fe64aa824955368e18b252cb5f3a.jpg)
139
+ Figure 3: Attention visualization of the last feature maps from the fine-tuned models on UCF101. The first row denotes the raw frames from videos, and the last two rows correspond to fine-tuning from random initialization and our self-supervised pre-trained model, respectively.
140
+
141
+ PRP (Yao et al., 2020) on four out of five metrics. This indicates that our proposed CSJ is also effective for video representation learning in video retrieval.
142
+
143
+ # 4.4 FURTHER EVALUATIONS
144
+
145
+ Ablation Study We conduct ablative experiments to validate the effectiveness of four CSJ surrogate tasks and two additional learning strategies. From Table 3, we can observe that: (1) Selfsupervised learning with each of the four tasks shows better generalization than fine-tuning the network from scratch (random initialization). (2) By training over all the four tasks jointly, we can achieve large performance gains (see ‘+LCCD’ vs. ‘CCMR’). (3) Each additional learning strategy (i.e., adaptive weighting or curriculum learning) leads to a small boost to the performance by 0.3- $0 . 5 \%$ . (4) Our full model achieves a remarkable classification accuracy of $7 0 . 4 \%$ , demonstrating the effectiveness of our proposed CSJ with only the RGB video stream (without additional optical flow, audio, or text modalities). More ablative analysis can be found in Appendix D.
146
+
147
+ Visualization of Attention Maps Fig. 3 visualizes the attention map of the last feature maps from two models fine-tuned on UCF101 with or without adopting our self-supervised pre-training. Since each frame’s attention map involves four adjacent frames, it actually contains spatiotemporal semantic features. We can see that our self-supervised pre-training with CSJ indeed helps to better capture meaningful spatiotemporal information and thus recognize the action categories more correctly.
148
+
149
+ ![](images/364822a46bd24076097579693c7a18c390267468a5a5de153032980e75a3b9f3.jpg)
150
+ Figure 4: Visualization of the LCCD predictions from the pre-trained models. Each row denotes the frames at time stamp $= ( 0 , 4 , 8 , 1 2 )$ from one video clip. (a) raw frames (with color jittering); (b) shuffled frames; (c) the ground truth of LCCD; (d) network’s prediction.
151
+
152
+ Visualization of LCCD Predictions We also demonstrate the visualization of the LCCD predictions from the pre-trained models in Fig. 4. We can observe that solving the LCCD task indeed enables the model to learn the locations of LCCs and understand spatiotemporal continuity, which is a key step towards video content understanding.
153
+
154
+ # 5 CONCLUSION
155
+
156
+ We have introduced a novel self-supervised video representation learning method named Constrained Spatiotemporal Jigsaw (CSJ). By introducing constrained permutations, our proposed CSJ is the first to leverage spatiotemporal jigsaw in self-supervised video representation learning. We also propose four surrogate tasks based on our constrained spatiotemporal jigsaws. They are designed to encourage a video representation model to understand the spatiotemporal continuity, a key building block towards video content analysis. Extensive experiments were carried out to validate the effectiveness of each of the four CSJ tasks and also show that our approach achieves the state-of-the-art on two downstream tasks across various benchmarks.
157
+
158
+ # REFERENCES
159
+
160
+ Yazan Abu Farha and Juergen Gall. Ms-tcn: Multi-stage temporal convolutional network for action segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3575–3584, 2019.
161
+
162
+ Unaiza Ahsan, Rishi Madhok, and Irfan Essa. Video jigsaw: Unsupervised learning of spatiotemporal context for video action recognition. In WACV, pp. 179–189, 2019.
163
+
164
+ Humam Alwassel, Dhruv Mahajan, Lorenzo Torresani, Bernard Ghanem, and Du Tran. Selfsupervised learning by cross-modal audio-video clustering. arXiv preprint arXiv:1911.12667, 2019.
165
+
166
+ Sagie Benaim, Ariel Ephrat, Oran Lang, Inbar Mosseri, William T. Freeman, Michael Rubinstein, Michal Irani, and Tali Dekel. Speednet: Learning the speediness in videos. In CVPR, pp. 9922– 9931, 2020.
167
+
168
+ Yoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ˆ ICMLE, pp. 41–48, 2009.
169
+
170
+ Joao Carreira, Eric Noland, Andras Banki-Horvath, Chloe Hillier, and Andrew Zisserman. A short ˜ note about kinetics-600. arXiv preprint arXiv:1808.01340, 2018.
171
+
172
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In ICML, pp. 10709–10719, 2020.
173
+
174
+ Yue Chen, Yalong Bai, Wei Zhang, and Tao Mei. Destruction and construction learning for finegrained image recognition. In CVPR, pp. 5157–5166, 2019.
175
+
176
+ Ruoyi Du, Dongliang Chang, Ayan Kumar Bhunia, Jiyang Xie, Yi-Zhe Song, Zhanyu Ma, and Jun Guo. Fine-grained visual classification via progressive multi-granularity training of jigsaw patches. arXiv preprint arXiv:2003.03836, 2020.
177
+
178
+ Alaaeldin El-Nouby, Shuangfei Zhai, Graham W. Taylor, and Joshua M. Susskind. Skip-clip: Selfsupervised spatiotemporal representation learning by future clip order ranking. arXiv preprint arXiv:1910.12770, 2019.
179
+
180
+ Basura Fernando, Hakan Bilen, Efstratios Gavves, and Stephen Gould. Self-supervised video representation learning with odd-one-out networks. In CVPR, pp. 3636–3645, 2017.
181
+
182
+ Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. ICLR, 2018.
183
+
184
+ Tengda Han, Weidi Xie, and Andrew Zisserman. Video representation learning by dense predictive coding. In ICCV Workshop, pp. 1483–1492, 2019.
185
+
186
+ Tengda Han, Weidi Xie, and Andrew Zisserman. Memory-augmented dense predictive coding for video representation learning. In ECCV, 2020.
187
+
188
+ Kensho Hara, Hirokatsu Kataoka, and Yutaka Satoh. Can spatiotemporal 3d cnns retrace the history of 2d cnns and imagenet? In CVPR, pp. 6546–6555, 2018.
189
+
190
+ Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In CVPR, pp. 9729–9738, 2020.
191
+
192
+ Simon Jenni, Givi Meishvili, and Paolo Favaro. Learning video representations by transforming time. In ECCV, 2020.
193
+
194
+ Longlong Jing, Xiaodong Yang, Jingen Liu, and Yingli Tian. Self-supervised spatiotemporal feature learning via video rotation prediction. arXiv preprint arXiv:1811.11387, 2018.
195
+
196
+ Will Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijaya- ˜ narasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, Mustafa Suleyman, and Andrew Zisserman. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950, 2017.
197
+
198
+ Alex Kendall, Yarin Gal, and Roberto Cipolla. Multi-task learning using uncertainty to weigh losses for scene geometry and semantics. In CVPR, pp. 7482–7491, 2018.
199
+
200
+ Dahun Kim, Donghyeon Cho, and In So Kweon. Self-supervised video representation learning with space-time cubic puzzles. In AAAI, pp. 8545–8552, 2019.
201
+
202
+ Joshua Knights, Anthony Vanderkop, Daniel Ward, Olivia Mackenzie-Ross, and Peyman Moghadam. Temporally coherent embeddings for self-supervised video representation learning. arXiv preprint arXiv:2004.02753, 2020.
203
+
204
+ Bruno Korbar, Du Tran, and Lorenzo Torresani. Cooperative learning of audio and video models from self-supervised synchronization. In NeurIPS, pp. 7763–7774, 2018.
205
+
206
+ Hilde Kuehne, Ali Arslan, and Thomas Serre. The language of actions: Recovering the syntax and semantics of goal-directed human activities. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 780–787, 2014.
207
+
208
+ Hildegard Kuehne, Hueihan Jhuang, Estibaliz Garrote, Tomaso Poggio, and Thomas Serre. Hmdb: A large video database for human motion recognition. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2556–2563, 2011.
209
+
210
+ Hsin-Ying Lee, Jia-Bin Huang, Maneesh Singh, and Ming-Hsuan Yang. Unsupervised representation learning by sorting sequences. In ICCV, pp. 667–676, 2017.
211
+
212
+ Tsung-Yi Lin, Piotr Dollar, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie.´ Feature pyramid networks for object detection. In CVPR, pp. 2117–2125, 2017.
213
+
214
+ Dezhao Luo, Bo Fang, Yu Zhou, Yucan Zhou, Dayan Wu, and Weiping Wang. Exploring relations in untrimmed videos for self-supervised learning. arXiv preprint arXiv:2008.02711, 2020a.
215
+
216
+ Dezhao Luo, Chang Liu, Yu Zhou, Dongbao Yang, Can Ma, Qixiang Ye, and Weiping Wang. Video cloze procedure for self-supervised spatio-temporal learning. In AAAI, 2020b.
217
+
218
+ Antoine Miech, Dimitri Zhukov, Jean-Baptiste Alayrac, Makarand Tapaswi, Ivan Laptev, and Josef Sivic. Howto100m: Learning a text-video embedding by watching hundred million narrated video clips. In ICCV, pp. 2630–2640, 2019.
219
+
220
+ Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. In CVPR, pp. 6707–6717, 2020.
221
+
222
+ Ishan Misra, C. Lawrence Zitnick, and Martial Hebert. Shuffle and learn: Unsupervised learning using temporal order verification. In ECCV, pp. 527–544, 2016.
223
+
224
+ Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In ECCV, pp. 69–84, 2016.
225
+
226
+ Marie-Morgane Paumard, David Picard, and Hedi Tabia. Deepzzle: Solving visual jigsaw puzzles with deep learning and shortest path optimization. TIP, 29:3569–3581, 2020.
227
+
228
+ Rui Qian, Tianjian Meng, Boqing Gong, Ming-Hsuan Yang, Huisheng Wang, Serge Belongie, and Yin Cui. Spatiotemporal contrastive video representation learning. arXiv preprint arXiv:2008.03800, 2020.
229
+
230
+ Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
231
+
232
+ Simon M. Stringer, Gavin Perry, Edmund T. Rolls, and J. H. Proske. Learning invariant object recognition in the visual system with continuous transformations. Biological Cybernetics, 94(2): 128–142, 2006.
233
+
234
+ Chen Sun, Fabien Baradel, Kevin Murphy, and Cordelia Schmid. Learning video representations using contrastive bidirectional transformer. arXiv preprint arXiv:1906.05743, 2019.
235
+
236
+ Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. In ECCV, 2020.
237
+
238
+ Jiangliu Wang, Jianbo Jiao, Linchao Bao, Shengfeng He, Yunhui Liu, and Wei Liu. Self-supervised spatio-temporal representation learning for videos by predicting motion and appearance statistics. In CVPR, pp. 4006–4015, 2019.
239
+
240
+ Jiangliu Wang, Jianbo Jiao, and Yun-Hui Liu. Self-supervised video representation learning by pace prediction. In ECCV, 2020.
241
+
242
+ Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In CVPR, pp. 7794–7803, 2018.
243
+ Donglai Wei, Joseph Lim, Andrew Zisserman, and William T. Freeman. Learning and using the arrow of time. In CVPR, pp. 8052–8060, 2018.
244
+ Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In CVPR, pp. 3733–3742, 2018.
245
+ Dejing Xu, Jun Xiao, Zhou Zhao, Jian Shao, Di Xie, and Yueting Zhuang. Self-supervised spatiotemporal learning via video clip order prediction. In CVPR, pp. 10334–10343, 2019.
246
+ Ceyuan Yang, Yinghao Xu, Bo Dai, and Bolei Zhou. Video representation learning with visual tempo consistency. arXiv preprint arXiv:2006.15489, 2020.
247
+ Yuan Yao, Chang Liu, Dezhao Luo, Yu Zhou, and Qixiang Ye. Video playback rate perception for self-supervised spatio-temporal representation learning. In CVPR, pp. 6548–6557, 2020.
248
+ Chengxu Zhuang, Tianwei She, Alex Andonian, Max Sobol Mark, and Daniel Yamins. Unsupervised learning from video with deep neural embeddings. In CVPR, pp. 9563–9572, 2020.
249
+
250
+ # A ADDITIONAL LEARNING STRATEGIES
251
+
252
+ # A.1 ADAPTIVE WEIGHT
253
+
254
+ Formally, our CSJ has two continuous outputs $\mathrm { y } _ { 1 } , \mathrm { y } _ { 4 }$ from LCCD and CCMR, and two discrete outputs $\mathrm { y } _ { 2 } , \mathrm { y } _ { 3 }$ from CSPC and CLSC, modeled with Gaussian likelihoods and softmax likelihoods, respectively. The joint loss for these four tasks $L ( \mathbf { W } , \sigma _ { 1 } , \sigma _ { 2 } , \sigma _ { 3 } , \sigma _ { 4 } )$ is:
255
+
256
+ $$
257
+ \begin{array} { r l } & { L ( \mathbf { W } , \sigma _ { 1 } , \sigma _ { 2 } , \sigma _ { 3 } , \sigma _ { 4 } ) } \\ & { = - \log \mathcal { N } ( \mathbf { y } _ { 1 } ; \mathbf { f } ^ { \mathbf { W } } ( \mathbf { x } ) , \sigma _ { 1 } ^ { 2 } ) \cdot - \log \mathcal { N } ( \mathbf { y } _ { 4 } ; \mathbf { f } ^ { \mathbf { W } } ( \mathbf { x } ) , \sigma _ { 4 } ^ { 2 } ) } \\ & { \quad \cdot \ \mathrm { s o f t m a x } ( \mathbf { y } _ { 2 } = \sigma ; \mathbf { f } ^ { \mathbf { W } } ( \mathbf { x } ) , \sigma _ { 2 } ) \cdot \mathrm { s o f t m a x } ( \mathbf { y } _ { 3 } = \sigma ; \mathbf { f } ^ { \mathbf { W } } ( \mathbf { x } ) , \sigma _ { 3 } ) } \\ & { = \frac { 1 } { 2 \sigma _ { 1 } ^ { 2 } } | | \mathbf { y } _ { 1 } - \mathbf { f } ^ { \mathbf { W } } ( \mathbf { x } ) | | ^ { 2 } + \log \sigma _ { 1 } - \frac { 1 } { 2 \sigma _ { 4 } ^ { 2 } } | | \mathbf { y } _ { 4 } - \mathbf { f } ^ { \mathbf { W } } ( \mathbf { x } ) | | ^ { 2 } + \log \sigma _ { 4 } } \\ & { \quad - \log p ( \mathbf { y } _ { 2 } | \mathbf { f } ^ { \mathbf { W } } ( \mathbf { x } ) , \sigma _ { 2 } ) - \log p ( \mathbf { y } _ { 3 } | \mathbf { f } ^ { \mathbf { W } } ( \mathbf { x } ) , \sigma _ { 3 } ) } \\ & { \approx \frac { 1 } { 2 \sigma _ { 1 } ^ { 2 } } L ( \mathbf { W } ) + \frac { 1 } { \sigma _ { 2 } ^ { 2 } } L _ { 2 } ( \mathbf { W } ) + \frac { 1 } { \sigma _ { 3 } ^ { 2 } } L _ { 3 } ( \mathbf { W } ) + \frac { 1 } { 2 \sigma _ { 4 } ^ { 2 } } L _ { 4 } ( \mathbf { W } ) } \\ & { \quad + \log \sigma _ { 1 } + \log \sigma _ { 2 } + \log \sigma _ { 3 } + \log \sigma _ { 4 } , } \end{array}
258
+ $$
259
+
260
+ where $\sigma$ is the weight factor that can be automatically learned from the network, and the log likelihood for the output y is defined as:
261
+
262
+ $$
263
+ \log p ( \mathrm { y } = c | \mathbf { f } ^ { \mathbf { W } } ( \mathbf { x } ) , \boldsymbol { \sigma } ) = \frac { 1 } { \sigma ^ { 2 } } f _ { c } ^ { \mathbf { W } } ( \mathbf { x } ) - \log \sum _ { c ^ { \prime } } \exp ( \frac { 1 } { \sigma ^ { 2 } } f _ { c ^ { \prime } } ^ { \mathbf { W } } ( \mathbf { x } ) ) .
264
+ $$
265
+
266
+ # A.2 CURRICULUM LEARNING
267
+
268
+ We adopt curriculum learning (Korbar et al., 2018) to train our network by shuffling clips from easy to hard. Let $d$ be the shuffle degree of a shuffled clip $\widetilde { \pmb x }$ , representing the number of continuous cuboids in each dimension. We gradually increase $d$ efrom 3 to 5 during the training phase to produce more permuted clips. Note that when the video content is ambiguous in one dimension, e.g., a static video clip inflated from an image, there is no temporal variance to learn the transformation. Kim et al. (2019); Noroozi & Favaro (2016) also mentioned this problem as similar-looking ambiguity. To solve this problem, we calculate the variance on each dimension and set a threshold. If the variance is lower than the threshold, we decrease $d$ from 3 to 1 so that the pieces are not shuffled in the corresponding dimension.
269
+
270
+ # B DATASETS AND IMPLEMENTATION
271
+
272
+ # B.1 DETAILS OF DATASETS
273
+
274
+ UCF101 (Soomro et al., 2012) is a widely-used dataset in the action recognition task, which contains 13,320 videos with 101 action classes. The dataset is divided into three training/testing splits. In this paper, following prior works (Wang et al., 2020; Han et al., 2020), we use the first training split as the pre-training dataset and the first testing split for evaluation.
275
+
276
+ HMDB51 (Kuehne et al., 2011) is a relatively small action recognition dataset, consisting of 6,766 videos with 51 categories. It is also divided into three training/testing splits. Following Wang et al. (2020); Han et al. (2020), we use the first training split as the pre-training dataset and the first testing split for evaluation.
277
+
278
+ Kinetics-400 (K400) (Kay et al., 2017) is a very large action recognition dataset consisting of 400 human action classes and around 306k videos. In this work, we use the training split of K400 as the pre-training dataset.
279
+
280
+ # B.2 IMPLEMENTATION DETAILS
281
+
282
+ In the fine-tuning stage, weights of convolutional layers are initialized with self-supervised pretraining, but weights of fully-connected layers are randomly initialized. The whole network is then trained with the cross-entropy loss. The pre-processing and training strategies are the same as in the
283
+
284
+ Table 4: The structure of the encoding function $f ( \cdot )$ . R2D3D-18 is used as an example.
285
+
286
+ <table><tr><td rowspan=1 colspan=1>stage</td><td rowspan=1 colspan=3>detail</td><td rowspan=1 colspan=1>output sizeT×HW×C</td></tr><tr><td rowspan=1 colspan=1> input data</td><td rowspan=1 colspan=3>1</td><td rowspan=1 colspan=1>16×112²×3</td></tr><tr><td rowspan=1 colspan=1>conV1</td><td rowspan=1 colspan=3>1 × 7²,64stride 1, 22</td><td rowspan=1 colspan=1>16 × 56² × 64</td></tr><tr><td rowspan=1 colspan=1>pool1</td><td rowspan=1 colspan=3>1 × 3²,64stride 1, 22</td><td rowspan=1 colspan=1>16 × 28² × 64</td></tr><tr><td rowspan=1 colspan=1>res2</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[1 ×3²,641 × 3²,64</td><td rowspan=1 colspan=1>×2</td><td rowspan=1 colspan=1>16 × 28² × 64</td></tr><tr><td rowspan=1 colspan=1>res3</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1 × 3²,1281× 3²,128</td><td rowspan=1 colspan=1>×2</td><td rowspan=1 colspan=1>16 × 14² × 128</td></tr><tr><td rowspan=1 colspan=1>res4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3× 3²,2563 × 32,256</td><td rowspan=1 colspan=1>×2</td><td rowspan=1 colspan=1>8×7² × 256</td></tr><tr><td rowspan=1 colspan=1>res5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3 × 3²,512[3 × 3²,512</td><td rowspan=1 colspan=1>×2</td><td rowspan=1 colspan=1>4 × 4² × 512</td></tr><tr><td rowspan=1 colspan=1>Avgpool</td><td rowspan=1 colspan=3>4 × 4²,512stride 1,12</td><td rowspan=1 colspan=1>1 ×1² × 512</td></tr></table>
287
+
288
+ self-supervised pre-training stage, except that the total epochs are 300 and the initial learning rate is $1 0 ^ { - 3 }$ . We use a batch size of 64 per GPU and a total of 8 GPUs for fine-tuning.
289
+
290
+ We follow the standard evaluation protocol (Han et al., 2020) during inference and use ten-crop to take the same sequence length as training from the video. The predicted label of each video is calculated by averaging the softmax probabilities of all clips in the video.
291
+
292
+ # C NETWORK ARCHITECTURE
293
+
294
+ We deploy the same network backbone R2D3D as Han et al. (2019; 2020), which is a 3D-ResNet (R3D) similar to Hara et al. (2018). The only difference between R2D3D and R3D lies in that: R2D3D keeps the first two residual blocks as 2D convolutional blocks while R3D uses 3D blocks. Therefore, the modified R2D3D has fewer parameters (only the last two blocks are 3D convolutions). We present the CNN structure of R2D3D in Table 4.
295
+
296
+ # D ADDITIONAL ABLATION STUDIES
297
+
298
+ Table 5: Evaluation of pre-training tasks under different designs of LCCD on UCF101.
299
+
300
+ <table><tr><td rowspan=1 colspan=1>Methods</td><td rowspan=1 colspan=1>LCCS</td><td rowspan=1 colspan=1>LCCD+MLccs</td><td rowspan=1 colspan=1>LCCD + L1</td><td rowspan=1 colspan=1>LCCD+MSE</td></tr><tr><td rowspan=1 colspan=1>Top-1 Acc</td><td rowspan=1 colspan=1>66.5</td><td rowspan=1 colspan=1>64.0</td><td rowspan=1 colspan=1>66.5</td><td rowspan=1 colspan=1>67.8</td></tr></table>
301
+
302
+ # D.1 LCCD
303
+
304
+ Instead of predicting center points using the detection method, we also design a segmentation method – largest continuous cuboid segmentation (LCCS) to predicts the location of top-2 LCCs $\{ c _ { \operatorname* { m a x } } ^ { \mathrm { c o n t } } ( j ) : j = 1 , 2 \}$ . The difference between LCCD and LCCS lies in that: LCCS is formulated as a segmentation task to discriminate whether a pixel is in the region of $c _ { \mathrm { m a x } } ^ { \mathrm { c o n t } } ( j )$ . Concretely, LCCS predicts a binary mask $M _ { \mathrm { L C C S } } ^ { j }$ where only points in the region of $\{ c _ { \mathrm { m a x } } ^ { \mathrm { c o n t } } ( j )$ are set to be 1, otherwise 0. As a result, LCCS is optimized using the Cross Entropy (CE) loss at each point:
305
+
306
+ $$
307
+ { \cal L } _ { \mathrm { L C C S } } = \sum _ { j \in \{ 1 , 2 \} } \sum _ { { \pmb { a } } \in { \pmb { \widetilde x } } } \mathrm { C E } ( M _ { \mathrm { L C C S } } ^ { j } ( { \pmb { a } } ) , M _ { \mathrm { L C C S } } ^ { j } ( { \pmb { a } } ) ^ { ' } ) ,
308
+ $$
309
+
310
+ where $\operatorname { C E } ( \cdot , \cdot )$ denotes the CE loss function, and $M _ { \mathrm { L C C S } } ^ { j } ( \pmb { a } ) ^ { \prime }$ is the predicted class of pixel $\textbf { \em a }$ .
311
+
312
+ We report the performance of four different designs of LCCD in Table 5: (1) LCCS: LCCS is used instead of LCCD. (2) $\mathrm { L C C D } { + } M _ { \mathrm { L C C S } }$ : The Gaussian mask $M _ { \mathrm { L C C D } }$ is substituted by the binary mask $M _ { \mathrm { L C C S } }$ , but the LCCD task is optimized using the MSE loss. (3) $\mathrm { L C C D + L 1 }$ : The LCCD task is optimized by the L1 loss. (4) $\mathrm { L C C D + M S E }$ : The LCCD task is optimized by the MSE loss. From Table 5, it can be seen that the segmentation task also helps self-supervised representation learning but doesn’t perform as well as LCCD. Also, under the three different settings of LCCD, the MSE loss with the Gaussian map performs the best.
313
+
314
+ Table 6: Evaluation of different temperature $\tau$ for CLSC on UCF101.
315
+
316
+ <table><tr><td rowspan=1 colspan=1>Methods</td><td rowspan=1 colspan=1>T=1</td><td rowspan=1 colspan=1>T =0.1</td><td rowspan=1 colspan=1>T = 0.07</td></tr><tr><td rowspan=1 colspan=1>Top-1 Acc</td><td rowspan=1 colspan=1>60.9</td><td rowspan=1 colspan=1>66.3</td><td rowspan=1 colspan=1>68.1</td></tr></table>
317
+
318
+ # D.2 CLSC
319
+
320
+ Table 6 above shows the accuracies obtained with different temperatures $\tau$ used in contrastive learning. We can observe that: (1) When $\tau$ is in the range $1 \sim 0 . 0 7$ , the accuracy increases with smaller $\tau$ . (2) When $\tau$ is large (e.g., 1), the accuracy drops considerably. In this work, $\tau$ is set to 0.0.
321
+
322
+ Table 7: Evaluation of different designs of CSPC on UCF101.
323
+
324
+ <table><tr><td rowspan=1 colspan=1>Methods</td><td rowspan=1 colspan=1>2 Categories</td><td rowspan=1 colspan=1>4 Categories</td><td rowspan=1 colspan=1>8 Categories</td></tr><tr><td rowspan=1 colspan=1>Top-1 Acc</td><td rowspan=1 colspan=1>67.0</td><td rowspan=1 colspan=1>68.0</td><td rowspan=1 colspan=1>68.1</td></tr></table>
325
+
326
+ # D.3 CSPC
327
+
328
+ In addition to our CSPC with 8 pattern categories (see Sec. 3.3), we consider another two designs: (1) 2 Categories: the shuffled clip is discriminated by whether it has the same relative order of the top-2 LCCs as the raw clip. It is almost the same as CLSC but is optimized by the CE loss. (2) 4 Categories: the shuffled clip is discriminated by how it differs from the raw clip: non-difference, spatial-only difference, temporal-only difference, spatiotemporal difference. From Table 7, we can see that CSPC with 8 categories outperforms the other two designs. These results support our motivation for leveraging spatiotemporal transformations.
329
+
330
+ Table 8: Evaluation of different designs of CCMR on UCF101.
331
+
332
+ <table><tr><td rowspan=1 colspan=1>Methods</td><td rowspan=1 colspan=1>ld</td><td rowspan=1 colspan=1>hd</td><td rowspan=1 colspan=1>ld+hd</td></tr><tr><td rowspan=1 colspan=1>Top-1 Acc</td><td rowspan=1 colspan=1>66.9</td><td rowspan=1 colspan=1>67.2</td><td rowspan=1 colspan=1>68.1</td></tr></table>
333
+
334
+ # D.4 CCMR
335
+
336
+ We report the performance of three different designs of CCMR: (1) ld: the learning degree $l _ { \mathrm { l d } }$ is used as supervision, which only contains volume information. (2) hdare used, which contain only the relative order information. (3) mming distances : both ld and hd $l _ { \mathrm { h d } } ^ { \mathrm { t } } , l _ { \mathrm { h d } } ^ { \mathrm { h } } , l _ { \mathrm { h d } } ^ { \mathrm { w } }$ $\mathrm { l d } + \mathrm { h d }$
337
+ supervision. From Table 8, we can see that: First, both ld and hd help the model to learn continuous characteristics during pre-training, and hd outperforms ld by a small margin. Second, our CCMR learns the best representation by combining ld and hd.
338
+
339
+ # D.5 RESULTS OF DIRECTLY SOLVING CSJ
340
+
341
+ We also demonstrate the results of solving the CSJ task directly in Table 9. We randomly shuffle video clips into $4 \times 4 \times 4$ jigsaw puzzles. To recognize the correct permutation, the model solve a $( 4 ! \times 4 ! \times 4 ! )$ -way classification task in the pre-training stage. We compare the CSJ task with the joint LCCD+CCMR task under the same setting for fair comparison. Linear evaluation is adopted to show the effectiveness of different tasks. We can observe from the table that solving LCCD $^ +$ CCMR jointly is more effective than solving CSJ directly.
342
+
343
+ # E TEMPORAL ACTION SEGMENTATION
344
+
345
+ To show the effectiveness of our CSJ for solving new downstream tasks, we apply the pretrained model obtained by our CSJ to temporal action segmentation, which is more challenging than the conventional action recognition and retrieval tasks. Specifically, we choose to compare our CSJ model with the latest competitor MemDPC (Han et al., 2020) on the Breakfast dataset (Kuehne et al., 2014). For fair comparison, our CSJ model and the MemDPC model adopt the same R2D3D34 backbone. Due the time constraint, from the original Breakfast dataset, we only use a small subset of 200 long videos as the training set for fine-tuning, and select a few long videos for the test. For temporal action segmentation, we follow the overall framework of MS-TCN (Abu Farha & Gall, 2019), but changes its backbone to R2D3D-34 pretrained by our CSJ or MemDPC.
346
+
347
+ ![](images/91d5f16e4c3031f297cf0187ff6396d46e14d07e9f8ebd39a1ff3cfc677d685f.jpg)
348
+ Figure 5: Qualitative results for the temporal action segmentation task on the Breakfast dataset. Note that the notation $\varnothing$ denotes an unannotated segment in the ground truth.
349
+
350
+ We present the qualitative results on two test videos in Fig. 5. We can clearly observe that our CSJ outperforms MemDPC on both test videos. Particularly, the predictions of our CSJ are much closer to the ground truth, but MemDPC tends to produce unwanted segments for temporal action segmentation: it wrongly recognizes the segment (color in yellow) in the middle part of the first video as ‘Pour Milk’, and the segment (color in black) in the last part of the second video as ‘Stir Coffee’. In conclusion, as compared to the latest SSVRL method MemDPC, our CSJ can learn more robust features for temporal action segmentation due to its ‘true’ spatiotemporal jigsaw understanding.
md/train/4JLiaohIk9/4JLiaohIk9.md ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MOTION FORECASTING WITH UNLIKELIHOOD TRAINING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Motion forecasting is essential for making safe and intelligent decisions in robotic applications such as autonomous driving. State-of-the-art methods formulate it as a sequence-to-sequence prediction problem, which is solved in an encoderdecoder framework with a maximum likelihood estimation objective. In this paper, we show that the likelihood objective itself results in a model assigning too much probability to trajectories that are unlikely given the contextual information such as maps and states of surrounding agents. This is despite the fact that many state-of-the-art models do take contextual information as part of their input. We propose a new objective, unlikelihood training, which forces generated trajectories that conflict with contextual information to be assigned a lower probability by our model. We demonstrate that our method can improve state-of-art models’ performance on challenging real-world trajectory forecasting datasets (nuScenes and Argoverse) by $8 \%$ and reduce the standard deviation by up to $50 \%$ . Code will be made available.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ For robotic applications deployed in the real world, the ability to foresee the future motions of agents in the surrounding environment plays an essential role for safe and intelligent decision making. This is a very challenging task. For example, in the autonomous driving domain, to predict nearby agents’ future trajectories, an agent needs to consider contextual information such as their past trajectories, potential interactions, and maps. State of the art prediction models (Salzmann et al., 2020; Tang & Salakhutdinov, 2019; Rhinehart et al., 2019) directly take contextual information as part of their input and use techniques such as graph neural networks to extract high-level features for prediction. They are typically trained with a maximum likelihood estimation (MLE) objective that maximizes the likelihood of ground truth trajectories in the predicted distribution. Although MLE loss encourages the prediction to be close to the ground truth geometrically, it does not focus on learning a good distribution that is plausible with respect to the contextual information. These models predict trajectories that violate the contextual information (e.g., go to opposite driving direction or out of the driving area) but still closes to ground truth. In contrast, humans can easily notice that these trajectories are unlikely in a specific context. This phenomenon suggests that simply applying MLE loss cannot fully exploit contextual information.
12
+
13
+ To address the problem, we propose a novel and simple method, unlikelihood training, that injects contextual information into the learning signal. Our loss penalizes the trajectories that violate the contextual information, called negative trajectories, by minimizing their likelihood in the predicted distribution. To generate negative trajectories, we first draw a number of candidate trajectories from our model’s predicted distribution. Then, a context checker is used to cut out the trajectories that violate contextual information as negative trajectories. This context checker does not need to be differentiable. By minimizing the likelihood of negative trajectories, the model is forced to use the contextual information to avoid predictions that violate context. Therefore, the prediction quality is improved.
14
+
15
+ Existing methods (Casas et al., 2020; Park et al., 2020) using contextual information as learning signals either introduce new learning parameters or using high-variance learning methods such as the REINFORCE algorithm (Casas et al., 2020). In contrast, our method injects rich contextual information into the training objective and keeps the training process simple.
16
+
17
+ Unlikelihood training (Welleck et al., 2019) has been applied to neural text generation. We are the first to propose unlikelihood training for continuous space of trajectories. For the discrete space of token sequences, repeating tokens or n-grams in the generated sequence are chosen as negative tokens. In contrast, we design a context checker to select negative trajectories sampled from the continuous distribution of model predictions.
18
+
19
+ Our method can be viewed as a simple add-on to any models that estimate the distribution of future trajectories. It improves their performance by encouraging models to focus more on contextual information without increasing the complexity of its original training process.
20
+
21
+ Our contributions are summarized as follows:
22
+
23
+ • We propose a novel and simple method, unlikelihood training for motion forecasting in autonomous driving that encourages models to use contextual information by minimizing the likelihood of trajectories that violate contextual information. Our method can be easily incorporated into state-of-the-art models.
24
+ • Our experimental results on challenging real-world trajectory forecasting datasets, nuScenes and Argoverse, shows that unlikelihood training can improve prediction performance by $8 \%$ and reduce the standard deviation by up to $50 \%$ .
25
+
26
+ # 2 RELATED WORK
27
+
28
+ In this section, we briefly review the two most related topics.
29
+
30
+ Trajectory Forecasting Trajectory forecasting of dynamic agents, a core problem for robotic applications such as autonomous driving and social robots, has been well studied in the literature. State-of-the-art models solves it as a sequence-to-sequence multi-modal prediction problem (Lee et al., 2017; Cui et al., 2018; Chai et al., 2019; Rhinehart et al., 2019; Kosaraju et al., 2019; Tang & Salakhutdinov, 2019; Ridel et al., 2020; Salzmann et al., 2020; Huang et al., 2019). (Cui et al., 2018; Chai et al., 2019; Ridel et al., 2020) predicts multiple future trajectories without learning low dimensional latent agent behaviors. (Lee et al., 2017; Kosaraju et al., 2019; Rhinehart et al., 2019; Huang et al., 2019) encodes agent behaviors in continuous low dimensional latent space while (Tang & Salakhutdinov, 2019; Salzmann et al., 2020) uses discrete latent variables. Discrete latent variables succinctly capture semantically meaningful modes such as turn left, turn right. (Tang & Salakhutdinov, 2019; Salzmann et al., 2020) learns discrete latent variables without explicit labels. All of them use a maximum likelihood estimation (MLE) objective or its approximations (e.g., VAE). In this paper, we show that MLE loss can ignore contextual information such as maps and states of surrounding agents. As a result, models with such a loss can assign too much probability to unlikely trajectories. We propose an unlikelihood training objective to avoid such cases. All models with the maximum likelihood estimation objective can potentially benefit from our methods.
31
+
32
+ Contrastive learning and unlikelihood training To date, several studies have investigated the possibilities to benefit from negative data. One of the popular direction is contrastive learning. Contrastive learning has achieved significant success in many fields (Oord et al., 2018; Kipf et al., 2019; Ma & Collins, 2018; Abid & Zou, 2019; Welleck et al., 2019). NCE (Ma & Collins, 2018) CPC (Oord et al., 2018) maximizes the mutual information between data and latent representation by a novel contrastive loss to extract useful representation from data. C-SWMs (Kipf et al., 2019) utilizes contrastive learning to learn a better world model for reinforcement learning tasks. Recently, unlikelihood training (Welleck et al., 2019) proposes a new method to utilize negative data. In addition, to maximize the likelihood of the ground truth token, it minimizes the likelihood of negative tokens for better text generation. Their method is on the discrete space of token sequences. Repeating tokens or n-grams in the generated sequence is chosen as negative tokens. In contrast, our proposed method works in the continuous space of trajectories. We design a novel method, context checker, to select negative trajectories.
33
+
34
+ # 3 METHOD
35
+
36
+ # 3.1 PROBLEM FORMULATION
37
+
38
+ We are targeting at better predicting the future trajectory $\mathbf { Y } _ { i }$ of a vehicle $i$ given input $\mathbf { X } _ { i }$ . $\mathbf { X } _ { i }$ can include any related information like rasterized maps or past positions of vehicle $i$ and surrounding agents, depends on the design of the method. Here we skip the detailed choice of input and denote it as $\mathbf { X } _ { i }$ for conciseness. Due to different driving strategies, driving intents, and the complex traffic environment, there are usually multiple possible future trajectories given an input $x _ { i }$ (although there is only one ground truth future trajectory $y _ { i , g t }$ in a dataset recorded in the real world). To handle this situation, most state of the art methods (Salzmann et al., 2020) model a distribution of possible future trajectories $p _ { \theta } ( \mathbf { Y } _ { i } \mid \mathbf { X } _ { i } )$ to cover all the possibilities given the input $\mathbf { X } _ { i }$ instead of predicting one trajectory. $\theta$ denotes the learning parameters of the model. To train such methods, most stateof-the-art models usually use maximum likelihood estimation (MLE) to maximize the likelihood of ground truth trajectory $\mathbf { Y } _ { i , g t }$ in the predicted distribution. For example, the loss of CVAE-based model Trajectron $^ { + + }$ (Salzmann et al., 2020) is Eq.1. This loss is used to maximize the lower bound of ground truth’s likelihood when the coefficient $k = 1$ .
39
+
40
+ $$
41
+ \begin{array} { r l } & { L _ { \mathrm { t r a j + + } } = - \mathbb { E } _ { \hat { z } \sim q _ { \theta 3 } ( z | X _ { i } , Y _ { i , g t } ) } \bigl [ \log p _ { \theta 2 } ( Y _ { i , g t } \mid X _ { i } , \hat { z } ) \bigr ] } \\ & { \qquad + k D _ { \mathrm { K L } } \bigl ( q _ { \theta 3 } ( z \mid X _ { i } , Y _ { i , g t } ) \bigr ) \bigl \| p _ { \theta 1 } ( z \mid X _ { i } ) \bigr ) - I _ { q } ( X _ { i } ; z ) } \\ & { \qquad \geq - \log p ( Y _ { i , g t } \mid X _ { i } , Y _ { i , g t } ) - I _ { q } ( X _ { i } ; z ) , \qquad \mathrm { w h e n ~ } k = 1 } \end{array}
42
+ $$
43
+
44
+ Limitation of MLE on Motion Forecasting MLE encourages the model to predict a distribution that allocates reasonable probability mass to the region where $\mathbf { Y _ { i } }$ is located by minimizing the KL-divergence of predicted distribution and ground truth distribution. Because the domain of trajectory distribution is over the geometric locations, MLE makes these two distributions ”close” to each other geometrically. However, we argue that maintaining the geometrical nearness only is not good enough for motion forecasting task in autonomous driving. In complex traffic scenarios, there can be many potential trajectories close enough to the ground truth geometrically but are very unlikely to happen. For example, if the ground truth trajectory $Y _ { i , g t }$ is on the outermost lane, a trajectory that is close to $Y _ { i , g t }$ but outside the drivable region is unlike to happen in the real world. However, MLE loss will not impose a significant enough penalty on such a case to avoid such a prediction. Fig.1 demonstrates a prediction example from Trajectron $^ { + + }$ (Salzmann et al., 2020) where part of the distribution is outside of the derivable region or on the lane with the wrong direction. The MLE-based loss
45
+
46
+ ![](images/1847de5db5a5b37e5aedcaf818bf8b15925a84c83024d377c47a7cf211c8cb7d.jpg)
47
+ Figure 1: Examples of predicted distribution from Trajectron $^ { + + }$ (Salzmann et al., 2020). White points denote the ground truth trajectory $\mathbf { Y } _ { i , g t }$ and the color region indicates the predicted distribution. Some of the prediction go outside of the drivable region or go to the lane in opposite direction.
48
+
49
+ only offers learning signals that contain the geometric location information of the ground truth trajectories. All the other contextual information, like the drivable region and the lane direction, are missing in the learning signals. While the inputs to a model contain rich contextual information, the model cannot use it to avoid the prediction that is geometrically close to ground truth but violates context. In contrast, this is quite a simple task for humans.
50
+
51
+ # 3.2 UNLIKELIHOOD LOSS
52
+
53
+ To mitigate this problem, we design a new loss term that encourages the model to consider the contextual information. Inspired by contrastive learning and unlikelihood training, we additionally train our model to minimize the likelihood of trajectories that violate the contextual information given input $X _ { i }$ . We denote them as negative trajectories ${ Y _ { i , n e g } }$ . Let’s first assume that we already have a distribution of negative trajectories $p _ { \mathrm { n e g } } ( \bar { \mathbf { Y } } _ { i } \mid X _ { i } )$ . One intuitive way is to directly minimize the log likelihood of ${ Y _ { i , n e g } }$ in our predicted distribution, similar to MLE but in an opposite manner
54
+
55
+ $$
56
+ L _ { \mathrm { u n l i k e } } = \mathbb { E } _ { X _ { i } , \sim \mathbb { D } , Y _ { i , n e g } \sim p _ { \mathrm { n e g } } ( Y _ { i } | X _ { i } ) } [ \log p _ { \theta } ( Y _ { i , n e g } \mid X _ { i } ) ]
57
+ $$
58
+
59
+ However, the gradient of log function tends to infinity when the input tends to 0, which leads to unstable training since the model are optimized to minimize $p _ { \theta } ( \bar { \mathbf { Y } _ { i , n e g } } \mid \mathbf { X } _ { i } )$ and $p _ { \theta } ( \mathbf { Y } _ { i , n e g } \mid$ $\mathbf { X } _ { i } ) \geq 0$ . To avoid the infinity gradient region of log function, we add a small constant $\epsilon$ to the likelihood. The final loss term we propose is
60
+
61
+ $$
62
+ L _ { \mathrm { u n l i k e } } = \mathbb { E } _ { X _ { i } , \sim \mathbb { D } , Y _ { i , n e g } \sim p _ { \mathrm { n e g } } ( \mathbf { Y } _ { i } \mid \mathbf { X } ) } [ \log ( p _ { \theta } ( { Y } _ { i , n e g } \mid X _ { i } ) + \epsilon ) ) ]
63
+ $$
64
+
65
+ We call it unlikelihood loss. We use a coefficient $\gamma$ to balance $L _ { \mathrm { u n l i k e } }$ . The final training objective in case we combine our method with Trajectron $^ { + + }$ is
66
+
67
+ $$
68
+ L = L _ { \mathrm { t r a j + + } } + \gamma L _ { \mathrm { u n l i k e } }
69
+ $$
70
+
71
+ Eq.4 is also easily adapted to combine with any other models that predict trajectory distribution as output. With the help of $L _ { \mathrm { u n l i k e } }$ , we inject the contextual information into the learning signal, force the model to better extract and use contextual information in $\mathbf { X } _ { i }$ , and generate more reasonable predicted distribution to avoid high $L _ { \mathrm { u n l i k e } }$ .
72
+
73
+ # 3.3 NEGATIVE TRAJECTORIES
74
+
75
+ Our proposed loss term is highly dependent on the negative samples ${ Y } _ { i , n e g }$ from the distribution $p _ { \mathrm { n e g } } ( Y _ { i } \mid X _ { i } )$ . However, these are not given in the dataset. To solve this issue, we approximate the samples by directly drawing a set of trajectories from the predicted distribution and select the trajectories that violate the contextual information out by a context checker. Note that this checker does not need to be differentiable and it can be as complex and advanced as necessary. The type of unlike predictions the model learns to avoid by our method depends on the type of unlike trajectories the checker can detect.
76
+
77
+ Design of Our Checker We implement a map-based checker to judge whether a given trajectory suits the context or not. In detail, the checker examines whether the trajectory goes into the lane in the opposite direction or out of the road. We create a map that stores the lane direction at every location of lanes and the drivable region. Two examples are shown in Fig.2. We first check whether all the locations of a given trajectory are in the drivable region. If so, we further calculate angles between velocity and the lane direction at each time step to see whether they are all inside a 90 degree. The velocities are approximated by differentiating the trajectory. The trajectories that fail to pass the exam are judged as negative trajectories ${ Y _ { i , n e g } }$ . Note that the lane direction information originally comes from the dataset and is usually incomplete or invalid like in the intersection. In this case, we only use the drivable region information. In addition, there are also a small part of ground truth trajectories in the dataset that violates the lane direction or drivable region. In this case, our checker skips the checking and we train it without $L _ { \mathrm { u n l i k e } }$ to allow similar prediction. Note that this checker is not perfect due to the incomplete information and simple checking mechanism. A trajectory that passes the exam of the checker doesn’t mean it is $100 \%$ compatible with the context. However, our method can still work properly, because our method only depends on the negative trajectories that do not pass the exam and has nothing to do with the passing ones. Our checker design offers reasonable negative trajectories to support our approach. But of course, a more advanced checker helps the model to avoid more complex unlikely prediction. We leave it open for future research.
78
+
79
+ # 3.4 ALGORITHM
80
+
81
+ The finial algorithm is shown in Alg.1. At each iteration, we first run the forward pass of the model to get the output distribution $p _ { \theta } ( \pmb { Y } _ { i } \mid \pmb { X } _ { i } )$ given the input $X _ { i }$ . Then, $K$ negative candidate trajectories are drawn from this distribution and we select the negative trajectories out ${ Y _ { i , n e g } }$ via our checker. After that, ground truth trajectory and negative trajectories are used to calculate the loss function, update the model, and go to next iteration. Note that if there are no ${ Y _ { i , n e g } }$ in the $K$ negative candidates judged by our checker for data $i$ , we don’t apply $L _ { \mathrm { u n l i k e } }$ on $i$ .
82
+
83
+ ![](images/3cc40cce52f70c1a0954a903aa911a5f9324ffbf776ff889b682efe3fa35338e.jpg)
84
+ Figure 2: Examples of maps used in the checker in nuScences (Caesar et al., 2019a). Green and blue region together denote the drivable region and the blue means that we have lane direction information here. Random locations are sampled and their lane directions are plotted as red arrows to show the concrete directions. Blue line denotes the trajectories to check and the velocity directions are represented as yellow arrows. (a) shows a negative trajectory that goes out of the road. (b) is a passing case.
85
+
86
+ # 3.5 GRADIENT ANALYSIS
87
+
88
+ Let’s assume a single-mode prediction case that the future position $_ { { \mathbf { \mathit { y } } } _ { i , g t , t } }$ at time step $t$ of agent $i$ is modeled by a simple Gaussian distribution $\mathcal { N } ( \boldsymbol { y } _ { i , t } ; \bar { \boldsymbol { \mu } } _ { i , t } , \hat { \sigma } _ { i , t } \bar { \boldsymbol { I } } )$ . $\hat { \pmb { \mu } }$ and $\hat { \sigma } _ { i , t }$ are calculated by the model. With a single negative position ${ \bf { \it { y } } } _ { i , n e g , t }$ we define a simple loss for step $t$ $L _ { t } = - \log \mathcal { N } ( y _ { g t , t } ; \hat { \mu } _ { t } , \hat { \sigma } _ { t } I ) + \log \bar { \mathcal { N } } ( y _ { n e g , t } ; \hat { \mu } _ { t } , \hat { \sigma } _ { t } I )$ and omit the subscript $i$ for brevity. The gradient of $L _ { t }$ with respect to $\hat { \pmb { \mu } } _ { t }$ and $\hat { \sigma } _ { t }$ in this case is (Derivation in Appx.A):
89
+
90
+ $$
91
+ \frac { \partial { { L } _ { t } } } { \partial { { \hat { \pmb { \mu } } } _ { t } } } = - \frac { 1 } { { { \hat { \sigma } } _ { t } ^ { 2 } } } ( ( \pmb { y } _ { g t , t } - { { \hat { \pmb { \mu } } } _ { t } } ) + ( \pmb { { \hat { \mu } } } _ { t } - \pmb { y } _ { n e g , t } ) )
92
+ $$
93
+
94
+ $$
95
+ \frac { \partial L } { \partial \hat { \sigma } _ { t } } = - \frac { 1 } { { \hat { \sigma } _ { t } } ^ { 3 } } ( | | y _ { g t , t } - \hat { \mu } _ { t } | | ^ { 2 } - | | y _ { n e g , t } - \hat { \mu } _ { t } | | ^ { 2 } )
96
+ $$
97
+
98
+ Eq.5 shows that the center of the predicted distribution $\hat { \pmb { \mu } } _ { t }$ is pushed towards ${ \bf \nabla } _ { { \bf { y } } _ { g t , t } }$ and pushed away from yneg,t by this learning objective. In Eq.6, when ygt,t is closer to the center than yneg,t, ∂L∂σˆt is positive and $\hat { \sigma } _ { t }$ is decreased. Note that ${ { y } _ { n e g , t } }$ is selected out from samples of $\mathcal { N } ( \hat { \mu } _ { t } , \hat { \sigma } _ { t } \pmb { I } ) )$ , this means when $\mathcal { N } ( \hat { \mu } _ { t } , \hat { \sigma } _ { t } \pmb { I } ) )$ ) covers context-violated region and this region is farther than ground truth region, $\mathcal { N } ( \hat { \mu } _ { t } , \hat { \sigma } _ { t } \pmb { I } ) )$ will shrink to exclude the negative region and become a better estimation to the true data distribution.
99
+
100
+ When the prediction is not so accurate (e.g. at the beginning of training), our ground truth $\scriptstyle { \boldsymbol { \mathbf { \mathit { y } } } } _ { \mathit { g t , t } }$ may be farther than the negative location ${ \bf { \mathscr { y } } } _ { n e g , t }$ . In this case, $\mathcal { N } ( \hat { \mu } _ { t } , \hat { \sigma } _ { t } \pmb { I } )$ will expand to better cover the ground truth and make the prediction more uncertain. A simple approach to alleviate this issue is turning off our unlikelihood loss $L _ { \mathrm { u n l i k e } }$ in the first few training epochs. We implement this by making $\gamma$ in Eq.4 as a sigmoid function centered at a specified epoch. By this way, we smoothly turn on $L _ { \mathrm { u n l i k e } }$ during training.
101
+
102
+ In this section, we present the experimental results of our method to demonstrate our performance. Our method is easily to applied on state of the art models that generate a future trajectory distribution and can further improve their performance. In our experiments, we select Trajectron $^ { + + }$ (Salzmann et al., 2020), one of the state-of-the-art methods on NuScenes dataset (Caesar et al., 2019b) with open-source implementation, as our base model. We extend the implementation to work on Argoverse dataset (Chang et al., 2019). We evaluate our approach on these two motion forecasting datasets.
103
+
104
+ <table><tr><td>Algorithm 1: Training process (Use Trajec- tron++ as base model)</td></tr><tr><td>Initialize the model parameters 0; Initialize learning rate α and coeifficient γ; while not converge do X,Yi,gt ~ D run forward pass to compute pe(Yi | Xi) draw K trajectotries Yi,k ~ pe(Yi |Xi) select Yi,neg via checker Compute Ltraj++ using Eq.1 Compute Lunlike using Eq.3 L = Ltraj++ + γLunlike 0=0-αVθ(L) end</td></tr></table>
105
+
106
+ Test Model Trajectron $^ { + + }$ (Salzmann et al.,
107
+ 2020) is a CVAE-based (Sohn et al., 2015) model. Its input $X _ { i }$ contains positions, velocities, heading of the predicted and surrounding vehicles, and a map patch. The output distribution $\begin{array} { r } { p _ { \theta } ( \boldsymbol { Y _ { i } } ~ \{ \textbf { { X } } _ { i } ) ~ = ~ \sum _ { z } p _ { \theta 1 } ( z ~ \lvert ~ \boldsymbol { X } _ { i } ) p _ { \theta 2 } ( \boldsymbol { Y _ { i } } ~ \{ \textbf { { X } } _ { i } , { z } \} | } \end{array}$ is a Gaussian mixture model with 25 components and modeled by an encoder net $p _ { \theta 1 } ( z \mid X _ { i } )$ and a decoder net $p _ { \theta 1 } ( Y _ { i } \mid X _ { i } , z )$ . In addition, it has another encoder net ${ q _ { \theta 3 } } ( z \mid X _ { i } , Y _ { i , g t } )$ used only in training. The original learning objective is shown in Eq.1. $I _ { q }$ denotes the mutual information.
108
+
109
+ Evaluation Metrics we use average $l _ { 2 }$ displacement error (ADE) and final $l _ { 2 }$ displacement error (FDE) to evaluate the prediction performance. Each of them contains some sub-versions. FDE-1 is the FDE calculated using only 1 predicted trajectory. In both original Trajectron $^ { + + }$ and our approach, this single trajectory is drawn from predicted distribution by greedy search step by step. ADE-Full/FDE-Full represents the quality of the whole output distribution. To compute ADEFull/FDE-Full, we randomly sample 200 trajectories and calculate the average performance as the reported scores. In addition, we use our context checker to measure the context-violation rate in these 200 trajectories as a metric to show the context-related performance.
110
+
111
+ # 4.1 NUSCENES DATASET
112
+
113
+ nuScenes dataset (Caesar et al., 2019b) contains 1000 city driving scenes from both left-hand (Singapore) and right-hand (Boston) traffic regions. Each scene is 20s long and recorded in $2 \mathrm { H z }$ . It is one of the biggest open-source motion forecasting datasets with detailed semantic maps.
114
+
115
+ Experiments The batch size is set to 1024. Models are trained for 35 epochs and we test the weights from the best epoch measured by average ADE on validation set. The coefficient $\gamma$ in Alg.1 increases gradually from 0 to 1 as a sigmoid function centered at 24th epoch. Initial learning rate is 3e-3 and it decays exponentially by 0.9995 per iteration. These hyperparameters except $\gamma$ are optimized for Trajectron $^ { + + }$ and lead to better performance than that in original paper. In addition, we rotate the scenes randomly from $1 5 ^ { \circ }$ to $3 4 5 ^ { \circ }$ in the training set for data augmentation following the setting of original Trajectron $^ { + + }$ . For each model, we run 5 experiments and report the mean and standard deviation of the measured metrics. The models are trained to predict 3 seconds into the future. To evaluate on generalization beyond the training horizon, we test on both 3 second and 4 second prediction horizons.
116
+
117
+ Tab.1 shows the quantitative results 3s and 4s prediction measured by the FDE/ADE-Full metrics and the context-violation rate. Our unlikelihood loss improves Trajectron $^ { + + }$ by about $8 \%$ for both metrics in both 3 and 4 second prediction horizons. Results indicate that our method helps improve the accuracy of the predicted distribution. This is also demonstrated in the qualitative comparison in Fig.3. The predicted distribution from our methods covers the not-drivable region less compared to original Trajectron $^ { + + }$ without our proposed loss. In contrast, original Trajectron $^ { + + }$ tends to violate the contextual information when prediction horizon is long. This shows that our method encourages the model to be more sensitive to the road boundary and the lane direction. In addition, we observe a reduction of the performance variance measured by standard deviation in Tab1, indicates that our
118
+
119
+ Table 1: nuScenes: Experiment results on nuScenes dataset (Caesar et al., 2019b) with Trajectron $^ { + + }$ (Salzmann et al., 2020). FDE and ADE are averaged over 200 trajectories drawn from the predicted distribution. Our proposed loss improves the performance of Trajectron $^ { + + }$ by about $8 \%$ , and avoid $16 \%$ context-violated prediction compared to Trajectron $^ { + + }$ , which indicates a better predicted distribution. Mean and standard deviation are calculated over 5 runs.
120
+
121
+ <table><tr><td>Model</td><td colspan="2">FDE-Full</td><td colspan="2">ADE-Full</td><td colspan="2">Context-Violation-Rate</td></tr><tr><td></td><td>3s</td><td>4s</td><td>3s</td><td>4s</td><td>3s</td><td>4s</td></tr><tr><td>Trajectron++</td><td>1.46±0.07</td><td>2.74±0.10</td><td>0.59±0.04</td><td>1.04±0.05</td><td>7.29%±0.22%</td><td>10.59%±0.54%</td></tr><tr><td>Ours</td><td>1.34±0.04</td><td>2.51±0.06</td><td>0.54±0.02</td><td>0.95±0.03</td><td>6.57 %±0.15%</td><td>8.85% ± 0.32%</td></tr></table>
122
+
123
+ Table 2: nuScenes: Experimental results on the nuScenes dataset for single prediction. FDE and ADE are computed by only one predicted trajectory. For both Trajectron $^ { + + }$ and our method, this trajectory is sampled by greedy search. Our method helps to improve the predicted accuracy. Mean and standard deviation are calculated over 5 runs.
124
+
125
+ <table><tr><td>Model</td><td colspan="4">FDE-1</td></tr><tr><td></td><td>1s</td><td>2s</td><td>3s</td><td>4s</td></tr><tr><td>Const. Velocity (Salzmann et al., 2020)</td><td>0.32</td><td>0.89</td><td>1.70</td><td>2.73</td></tr><tr><td>S-LSTM (Alahi et al., 2016)</td><td>0.47</td><td></td><td>1.61</td><td>-</td></tr><tr><td>CSP (Deo &amp; Trivedi,2018)</td><td>0.46</td><td>2.35</td><td>1.50</td><td></td></tr><tr><td>CAR-Net (Sadeghian et al., 2018)</td><td>0.38</td><td>-</td><td>1.35</td><td></td></tr><tr><td>SpAGNN (Casas et al., 2019)</td><td>0.36</td><td>=</td><td>1.23</td><td>-</td></tr><tr><td>Trajectron++ (Salzmann et al., 2020)</td><td>0.07</td><td>0.45</td><td>1.14</td><td>2.20</td></tr><tr><td>Trajectron++ (our hyperparameters)</td><td>0.06±0.01</td><td>0.43±0.01</td><td>1.08±0.04</td><td>2.05±0.08</td></tr><tr><td>Ours</td><td>0.05±0.00</td><td>0.42±0.01</td><td>1.05±0.02</td><td>1.99±0.05</td></tr></table>
126
+
127
+ method helps to stable the training process. Comparison with other methods is shown in Tab.2. The FDE for single predicted trajectory is also improved by our method.
128
+
129
+ # 4.2 ARGOVERSE DATASET
130
+
131
+ Argoverse dataset (Chang et al., 2019) contains 300,000 5-second tracked scenarios in 2 American cities Miami and Pittsburgh. The data is recorded in $1 0 \ \mathrm { H z }$ . The first 2 seconds are used as input to predict the next 3 seconds future. It is also one of the biggest open-source motion forecasting datasets that offer semantic maps.
132
+
133
+ Experiments We downsample the data from $1 0 \mathrm { H z }$ to $2 \mathrm { H z }$ to make the setting similar to nuScenes following the setting of (Park et al., 2020). Argoverse does not release the ground truth future trajectories for the test dataset. Therefore, we use the original validation set as our test set in this experiments and randomly split the original training set into our training set with $9 5 \%$ data and our validation set with $5 \%$ data. Batch size is 256. Initial learning rate is 3e-3 and it decays exponentially by 0.9995 per iteration. The model is trained for maximal 60 epochs and we select the weights from the best epoch measured by average ADE in validation set. The coeffient $\gamma$ in Alg.1 increases gradually from 0 to 1 as a sigmoid function centered at 18th epoch. Trajectron $^ { + + }$ is not designed for Argoverse. To make the experiments runnable, we made some small modifications that are explained in Appx.D. We execute 6 training instances for both original Trajectron $^ { + + }$ and our method, report the average performance and the standard deviation. The results are listed in Tab.3. Compared to Trajectron $^ { + + }$ without our method, our model improves the accuracy of the prediction by about $8 \%$ with our simple loss and reduces the performance variance by about $50 \%$ measured by standard deviation.
134
+
135
+ # 4.3 ABLATION STUDY
136
+
137
+ Prediction horizon for negative candidates Assume we have a predicted trajectory with a length six, and it is on the drivable region and obeys the lane direction. However, the trajectory tends to hit the road boundary in the near future (e.g., in 1 second). Such a trajectory can pass our checker’s exam, but it is still unlikely to happen in the real world. We can easily select out such a trajectory by extending the prediction horizon for the candidate trajectories and examining our checker’s extended version. To verify whether this helps us build a better checker, we extend the prediction horizon for negative candidates from 3 seconds to 4, 5, 6 seconds, respectively, and examine them by our original checker. The selected negative trajectories are truncated back to 3 seconds for computing $L _ { \mathrm { u n l i k e } }$ . We can see in table 4 that the model benefits from an adequately extended prediction horizon. The prediction horizon for ground truth trajectory is 3s. By extending the negative trajectories 1 second more, we improve the prediction accuracy. Numbers are averaged over two training instances.
138
+
139
+ ![](images/10373648cea99d219d79d7cb06ab1e5382c63c59f66797cc160ed58c20678d7d.jpg)
140
+ Figure 3: Qualitative results of our method and Trajectron $^ { + + }$ in a complex scenario. Some of the predicted distribution of Trajectron $^ { + + }$ are out of the road or cover the lane with wrong direction. Our method helps alleviate this issue. Predicted distribution is plotted as colored region and white points denotes the ground truth trajectories. More results are in Appx.F
141
+
142
+ Table 3: Argoverse: Experimental results on Argoverse dataset. Compared to our base model Trajectron $^ { + + }$ , our proposed method helps increase the accuracy and stable the performance.
143
+
144
+ <table><tr><td>Model</td><td>ADE-1</td><td>FDE-1</td><td>ADE-Full</td><td>FDE-Full</td></tr><tr><td>Trajectron++</td><td>1.15±0.14</td><td>2.73±0.24</td><td>1.43±0.15</td><td>3.40±0.20</td></tr><tr><td>Ours</td><td>1.06±0.08</td><td>2.58±0.14</td><td>1.34±0.06</td><td>3.25±0.10</td></tr></table>
145
+
146
+ Table 4: nuScenes: Ablation study on prediction horizon of negative candidates on nuScenes dataset.
147
+
148
+ <table><tr><td></td><td></td><td colspan="5">FDE Full</td><td colspan="3">FDE ML</td><td colspan="5">B.Violations 3s</td></tr><tr><td>Model</td><td>PHn</td><td>1s</td><td>2s</td><td>3s</td><td>4s</td><td>1s</td><td>2s</td><td>3s</td><td>4s</td><td>1s</td><td>2s</td><td></td><td></td><td>4s</td></tr><tr><td>Trajectron++</td><td>-</td><td>0.107</td><td>0.560</td><td>1.378</td><td>2.621</td><td>0.052</td><td>0.396</td><td>1.010</td><td></td><td>1.950</td><td>9.169%</td><td>9.710%</td><td>13.048%</td><td>21.369%</td></tr><tr><td>Ours</td><td>3s</td><td>0.105</td><td>0.538</td><td>1.320</td><td></td><td>2.494</td><td>0.054</td><td>0.414</td><td>1.029</td><td>1.960</td><td>9.188%</td><td>9.619%</td><td>11.818%</td><td>17.460%</td></tr><tr><td>Ours</td><td>4s</td><td>0.087</td><td>0.498</td><td>1.238</td><td>2.339</td><td></td><td>0.050</td><td>0.387</td><td>0.981</td><td>1.869</td><td>9.183%</td><td>9.620%</td><td>11.872%</td><td>17.551%</td></tr><tr><td>Ours</td><td>5s</td><td>0.087</td><td>0.497</td><td>1.259</td><td>2.406</td><td></td><td>0.056</td><td>0.397</td><td>1.002</td><td>1.889</td><td>9.174%</td><td>9.667%</td><td>12.106%</td><td>17.992%</td></tr><tr><td>Ours</td><td>6s</td><td>0.099</td><td>0.521</td><td>1.297</td><td>2.474</td><td></td><td>0.059</td><td>0.405</td><td>1.004</td><td>1.912</td><td>9.170%</td><td>9.636%</td><td>12.046%</td><td>17.761%</td></tr></table>
149
+
150
+ # 5 CONCLUSION
151
+
152
+ We present unlikelihood guided trajectory prediction method, that minimizes the probability of unlikely trajectories. During training, our context checker detects predicted unlikely trajectories and their probabilities are reduced through an unlikelihood loss. Our method can be incorporated into state-of-the-art models with a maximum likelihood estimation objective. Our experimental results demonstrate that our method significantly improves state-of-the-art trajectory prediction models.
153
+
154
+ We hope that our work may encourage future work on exploring better unlikelihood methods for trajectory prediction and improved context checker models.
155
+
156
+ # REFERENCES
157
+
158
+ Abubakar Abid and James Zou. Contrastive variational autoencoder enhances salient features. arXiv preprint arXiv:1902.04601, 2019.
159
+
160
+ Alexandre Alahi, Kratarth Goel, Vignesh Ramanathan, Alexandre Robicquet, Li Fei-Fei, and Silvio Savarese. Social lstm: Human trajectory prediction in crowded spaces. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 961–971, 2016.
161
+
162
+ Holger Caesar, Varun Bankiti, Alex H Lang, Sourabh Vora, Venice Erin Liong, Qiang Xu, Anush Krishnan, Yu Pan, Giancarlo Baldan, and Oscar Beijbom. nuscenes: A multimodal dataset for autonomous driving. arXiv preprint arXiv:1903.11027, 2019a.
163
+
164
+ Holger Caesar, Varun Bankiti, Alex H. Lang, Sourabh Vora, Venice Erin Liong, Qiang Xu, Anush Krishnan, Yu Pan, Giancarlo Baldan, and Oscar Beijbom. nuscenes: A multimodal dataset for autonomous driving. arXiv preprint arXiv:1903.11027, 2019b.
165
+
166
+ Sergio Casas, Cole Gulino, Renjie Liao, and Raquel Urtasun. Spatially-aware graph neural networks for relational behavior forecasting from sensor data. arXiv preprint arXiv:1910.08233, 2019.
167
+
168
+ Sergio Casas, Cole Gulino, Simon Suo, and Raquel Urtasun. The importance of prior knowledge in precise multimodal prediction. arXiv preprint arXiv:2006.02636, 2020.
169
+
170
+ Yuning Chai, Benjamin Sapp, Mayank Bansal, and Dragomir Anguelov. Multipath: Multiple probabilistic anchor trajectory hypotheses for behavior prediction. arXiv preprint arXiv:1910.05449, 2019.
171
+
172
+ Ming-Fang Chang, John Lambert, Patsorn Sangkloy, Jagjeet Singh, Slawomir Bak, Andrew Hartnett, De Wang, Peter Carr, Simon Lucey, Deva Ramanan, et al. Argoverse: 3d tracking and forecasting with rich maps. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8748–8757, 2019.
173
+
174
+ Henggang Cui, Vladan Radosavljevic, Fang-Chieh Chou, Tsung-Han Lin, Thi Nguyen, TzuKuo Huang, Jeff Schneider, and Nemanja Djuric. Multimodal trajectory predictions for autonomous driving using deep convolutional networks. CoRR, abs/1809.10732, 2018. URL http://arxiv.org/abs/1809.10732.
175
+
176
+ Nachiket Deo and Mohan M Trivedi. Multi-modal trajectory prediction of surrounding vehicles with maneuver based lstms. In 2018 IEEE Intelligent Vehicles Symposium (IV), pp. 1179–1184. IEEE, 2018.
177
+
178
+ Xin Huang, Stephen G. McGill, Jonathan A. DeCastro, Brian Charles Williams, Luke Fletcher, John J. Leonard, and Guy Rosman. Diversity-aware vehicle motion prediction via latent semantic sampling. ArXiv, abs/1911.12736, 2019.
179
+
180
+ Thomas Kipf, Elise van der Pol, and Max Welling. Contrastive learning of structured world models. arXiv preprint arXiv:1911.12247, 2019.
181
+
182
+ Vineet Kosaraju, Amir Sadeghian, Roberto Mart´ın-Mart´ın, Ian Reid, S Hamid Rezatofighi, and Silvio Savarese. Social-bigat: Multimodal trajectory forecasting using bicycle-gan and graph attention networks. arXiv preprint arXiv:1907.03395, 2019.
183
+
184
+ Namhoon Lee, Wongun Choi, Paul Vernaza, Christopher B. Choy, Philip H. S. Torr, and Manmohan Chandraker. DESIRE: distant future prediction in dynamic scenes with interacting agents. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pp. 2165–2174. IEEE Computer Society, 2017. doi: 10.1109/CVPR.2017.233. URL https://doi.org/10.1109/CVPR.2017.233.
185
+
186
+ Zhuang Ma and Michael Collins. Noise contrastive estimation and negative sampling for conditional models: Consistency and statistical efficiency. arXiv preprint arXiv:1809.01812, 2018.
187
+
188
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
189
+
190
+ Seong Hyeon Park, Gyubok Lee, Manoj Bhat, Jimin Seo, Minseok Kang, Jonathan Francis, Ashwin R Jadhav, Paul Pu Liang, and Louis-Philippe Morency. Diverse and admissible trajectory forecasting through multimodal context understanding. European Conference on Computer Vision, 2020.
191
+
192
+ Nicholas Rhinehart, Rowan McAllister, Kris Kitani, and Sergey Levine. Precog: Prediction conditioned on goals in visual multi-agent settings. In The IEEE International Conference on Computer Vision (ICCV), October 2019.
193
+
194
+ Daniela Ridel, Nachiket Deo, Denis Wolf, and Mohan Trivedi. Scene compliant trajectory forecast with agent-centric spatio-temporal grids. IEEE Robotics and Automation Letters, 5(2):2816– 2823, 2020.
195
+
196
+ Amir Sadeghian, Ferdinand Legros, Maxime Voisin, Ricky Vesel, Alexandre Alahi, and Silvio Savarese. Car-net: Clairvoyant attentive recurrent network. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 151–167, 2018.
197
+
198
+ Tim Salzmann, Boris Ivanovic, Punarjay Chakravarty, and Marco Pavone. Trajectron $^ { + + }$ : Multiagent generative trajectory forecasting with heterogeneous data for control. arXiv preprint arXiv:2001.03093, 2020.
199
+
200
+ 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.
201
+
202
+ Charlie Tang and Russ R Salakhutdinov. Multiple futures prediction. In Advances in Neural Information Processing Systems, pp. 15398–15408, 2019.
203
+
204
+ Sean Welleck, Ilia Kulikov, Stephen Roller, Emily Dinan, Kyunghyun Cho, and Jason Weston. Neural text generation with unlikelihood training. arXiv preprint arXiv:1908.04319, 2019.
205
+
206
+ Tianyang Zhao, Yifei Xu, Mathew Monfort, Wongun Choi, Chris Baker, Yibiao Zhao, Yizhou Wang, and Ying Nian Wu. Multi-agent tensor fusion for contextual trajectory prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 12126–12134, 2019.
207
+
208
+ # A DERIVATION OF GRADIENT
209
+
210
+ Here we show how to obtain Eq.5 and Eq.6
211
+
212
+ $$
213
+ \begin{array} { r l } & { L _ { t } = - \log \mathcal { N } ( y _ { g t , t } ; \hat { \mu } _ { t } , \hat { \sigma } _ { t } I ) + \log \mathcal { N } ( y _ { n e g , t } ; \hat { \mu } _ { t } , \hat { \sigma } _ { t } I ) } \\ & { \quad = \displaystyle \frac { 1 } { 2 } ( \log 2 \pi + \log \hat { \sigma } _ { t } ^ { 2 } + \frac { | | y _ { g t , t } - \hat { \mu } _ { t } | | ^ { 2 } } { \hat { \sigma } _ { t } ^ { 2 } } ) - \frac { 1 } { 2 } ( \log 2 \pi + \log \hat { \sigma } _ { t } ^ { 2 } + \frac { | | y _ { n e g , t } - \hat { \mu } _ { t } | | ^ { 2 } } { \hat { \sigma } _ { t } ^ { 2 } } ) } \\ & { \quad = \displaystyle \frac { 1 } { 2 \hat { \sigma } _ { t } ^ { 2 } } ( | | y _ { g t , t } - \hat { \mu } _ { t } | | ^ { 2 } - | | y _ { n e g , t } - \hat { \mu } _ { t } | | ^ { 2 } ) } \end{array}
214
+ $$
215
+
216
+ $$
217
+ \begin{array} { r l r } { { \frac { \partial L _ { t } } { \partial \hat { \pmb { \mu } } _ { t } } = \frac { \partial } { \partial \hat { \pmb { \mu } } _ { t } } \frac { 1 } { 2 \hat { \sigma } _ { t } ^ { 2 } } ( | | \pmb { y } _ { g t , t } - \hat { \pmb { \mu } } _ { t } | | ^ { 2 } - | | \pmb { y } _ { n e g , t } - \hat { \pmb { \mu } } _ { t } | | ^ { 2 } ) } } \\ & { } & { = - \frac { 1 } { \hat { \sigma } _ { t } ^ { 2 } } ( ( \pmb { y } _ { g t , t } - \hat { \pmb { \mu } } _ { t } ) + ( \hat { \pmb { \mu } } _ { t } - \pmb { y } _ { n e g , t } ) ) } \end{array}
218
+ $$
219
+
220
+ $$
221
+ \begin{array} { r l r } & { } & { \displaystyle \frac { \partial L } { \partial \hat { \sigma } _ { t } } = \frac { \partial } { \partial \hat { \sigma } _ { t } } \frac { 1 } { 2 \hat { \sigma } _ { t } ^ { 2 } } ( | | y _ { g t , t } - \hat { \pmb { \mu } } _ { t } | | ^ { 2 } - | | y _ { n e g , t } - \hat { \pmb { \mu } } _ { t } | | ^ { 2 } ) } \\ & { } & { \mathrm { ~ \ ~ \ } = - \frac { 1 } { \hat { \sigma } _ { t } ^ { 3 } } ( | | y _ { g t , t } - \hat { \pmb { \mu } } _ { t } | | ^ { 2 } - | | y _ { n e g , t } - \hat { \pmb { \mu } } _ { t } | | ^ { 2 } ) } \end{array}
222
+ $$
223
+
224
+ # B GRADIENT ANALYSIS IN GAUSSIAN MIXTURE MODEL
225
+
226
+ In case we model the output distribution as a Gaussian mixture model $\begin{array} { r l } { p _ { \mathrm { G M M } } ( \pmb { y } _ { t } ) } & { { } = } \end{array}$ $\begin{array} { r l } { \sum _ { i } \phi _ { i } \mathcal { N } ( \pmb { y } _ { t } ; \hat { \pmb { \mu } } _ { i , t } , \hat { \sigma } _ { i , t } \pmb { I } ) } & { { } } \end{array}$ , the gradient of $L _ { t }$ w.r.t. the mean of component $i$ is
227
+
228
+ $$
229
+ \begin{array} { r l } & { \frac { \partial L _ { t } } { \partial \hat { \mu } _ { i , t } } = \frac { \partial } { \partial \hat { \mu } _ { i , t } } ( - \log \frac { p _ { \mathrm { G M M } } ( y _ { g , t , t } ) } { p _ { \mathrm { G M M } } ( y _ { n e g , t } ) } ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \ \end{array}
230
+ $$
231
+
232
+ This gradient shows that the center $\hat { \mu } _ { i , t }$ of component $i$ will be pushed towards the ground truth location ${ \bf \nabla } _ { { \bf { y } } _ { g t , t } }$ and way from the negative location ${ \bf { \mathscr { y } } } _ { n e g , t }$ . For $\hat { \sigma } _ { i , t }$ we have
233
+
234
+ $$
235
+ \begin{array} { r l r } { { \frac { \partial L } { \partial \hat { \sigma } _ { i , t } } = - \phi _ { i } ( \frac { 1 } { p _ { \mathrm { G M M } } ( y _ { g t , t } ) } \frac { \partial \mathcal { N } ( y _ { g t , t } ; \hat { \mu } _ { i , t } , \hat { \sigma } _ { i , t } I ) } { \partial \hat { \sigma } _ { i , t } } - \frac { 1 } { p _ { \mathrm { G M M } } ( y _ { n e g , t } ) } \frac { \partial \mathcal { N } ( y _ { n e g , t } ; \hat { \mu } _ { i , t } , \hat { \sigma } _ { i , t } I ) } { \partial \hat { \sigma } _ { i , t } } ) } } \\ & { } & { = - \frac { \phi _ { i } } { \sigma _ { i , t } ^ { 3 } } ( \frac { \mathcal { N } ( y _ { g t , t } ; \hat { \mu } _ { i , t } , \hat { \sigma } _ { i , t } I ) } { p _ { \mathrm { G M M } } ( y _ { g t , t } ) } ( \vert \vert y _ { g t , t } - \hat { \mu } _ { i , t } \vert \vert ^ { 2 } - \sigma _ { i , t } ^ { 2 } ) } \\ & { } & { \quad - \frac { \mathcal { N } ( y _ { n e g , t } ; \hat { \mu } _ { i , t } , \hat { \sigma } _ { i , t } I ) } { p _ { \mathrm { G M M } } ( y _ { n e g , t } ) } ( \vert \vert y _ { n e g , t } - \hat { \mu } _ { i , t } \vert \vert ^ { 2 } - \sigma _ { i , t } ^ { 2 } ) ) } \end{array}
236
+ $$
237
+
238
+ # C THE INFLUENCE OF OUR LOSS WITHOUT MAP INPUT
239
+
240
+ In this experiment, we remove the map input to the model and demonstrate the influence of our unlikelihood loss in this case. Results are shown in Tab.5 Interestingly, our loss helps improve the performance from 1.52 to 1.42 measured by the FDE-Full in 3 seconds case although the model doesn’t see the context during inference. We think the reason is that compared to the Trajectron $^ { + + }$ without map input, our unlikelihood loss still offers context information to support the training since this loss is calculated using the context. Therefore, our model receives more information during training and performs better. Besides, our method without map input even achieves a comparable result (FDE-FUll 1.42) compared to Trajectron $^ { + + }$ with map input (FDE-Full 1.46). This experiment shows that our loss can inject context information into learning signals. In addition, map input improves FDE-Full of Trajectron $^ { + + }$ in 3s prediction from 1.52 to 1.46, which is about $6 \mathrm { c m }$ . However, when we further add our unlikelihood loss, performance improved from 1.46 to 1.34, which is 12 cm. Our loss triple the contribution of context information, which is significant.
241
+
242
+ Table 5: The influence of our loss without map input to the model on nuScenes. Compared to Trajectron $^ { + + }$ without map input, our loss performs better, which indicates that our loss can inject context information into learning signals
243
+
244
+ <table><tr><td>Model</td><td>FDE-Full 3s</td><td>ADE-Full 3s</td></tr><tr><td>Trajectron++ without map input</td><td>1.52±0.04</td><td>0.61±0.02</td></tr><tr><td>Trajectron++</td><td>1.46±0.07</td><td>0.59±0.04</td></tr><tr><td>Ours without map input</td><td>1.42±0.03</td><td>0.57±0.01</td></tr><tr><td>Ours</td><td>1.34±0.04</td><td>0.54±0.02</td></tr></table>
245
+
246
+ # D MODIFICATION ON TRAJECTRON $^ { + + }$ FOR ARGOVERSE EVALUATION
247
+
248
+ The original Trajectron+ $^ { - + }$ (Salzmann et al., 2020) is evaluated on nuScenes dataset (Caesar et al., 2019b) but not on Argoverse (Chang et al., 2019). To make it runnable on Argoverse, we make some modifications on Trajectron $^ { + + }$ . The input states of the full version of Trajectron $^ { + + }$ consist of the positions, velocities, accelerations, heading angles and heading angular velocities. However, Argoverse doesn’t offer the data for heading angles and heading angular velocities. Therefore, we remove them from the input states. In addition, Trajectron $^ { + + }$ has a unicycle physics model to convert the predicted velocity from neural networks to locations. The unicycle physics model requires also the angular velocities information. Therefore, we replace the unicycle model by the single integrator model that requires only velocities and initial positions. The maps offered by nuScens and Argoverse are different, too. We stack the drivable region and region of interest offered by Argoverse and upsample them to the same resolution as nuScenes as the input map. Please refer to Argoverse for the details. Lastly, Trajectron $^ { + + }$ use separate modules to process surrounding vehicles and surrounding pedestrians in nuScenes. However, Argoverse doesn’t offer the labels for the surrouding agents and just simply denote them as ”others”. Therefore, we remove the pedestrian modules in Trajectron $^ { + + }$ and use the vehicle modules to process both surrounding pedestrians and vehicles.
249
+
250
+ # E COMPARISON WITH OTHER METHODS ON ARGOVERSE
251
+
252
+ Our experiment setting on Argoverse follows AttGlobal-CAM-Nf (Park et al., 2020). Here we list the detailed comparison with their numbers using their evaluation metrics minADE-12 and minFDE12, which are the minimal ADE and FDE over 12 prediction candidates, in Tab.6. Both Trajectron++ and our method outperform their numbers. In addition, our unlikelihood loss helps improve the performance of Trajectron $^ { + + }$ . Our scores and the standard deviation are calculated over 4 training instances.
253
+
254
+ Table 6: Experimental results on Argoverse dataset
255
+
256
+ <table><tr><td>Model</td><td>minADE-12</td><td>minFDE-12</td></tr><tr><td>CSP (Deo &amp; Trivedi,2018; Park et al.,2020)</td><td>1.39</td><td>2.57</td></tr><tr><td>DESIRE (Lee et al.,2017; Park et al.,2020)</td><td>0.90</td><td>1.45</td></tr><tr><td>MATF-GAN (Zhao et al.,2019;Park et al., 2020)</td><td>1.26</td><td>2.31</td></tr><tr><td>R2P2-MA(Rhinehart et al.,2019;Park etal.,2020)</td><td>1.11</td><td>1.77</td></tr><tr><td>AttGlobal-CAM-Nf (Park et al., 2020)</td><td>0.73</td><td>1.12</td></tr><tr><td>Trajectron++ (Salzmann et al., 2020)</td><td>0.65±0.09</td><td>1.08±0.07</td></tr><tr><td>Ours</td><td>0.63±0.04</td><td>1.08±0.06</td></tr></table>
257
+
258
+ # F QUALITATIVE RESULTS
259
+
260
+ Here, we demonstrate our method’s qualitative results compared with Trajectron $^ { + + }$ for 3 seconds prediction. We randomly sample 50 trajectories from the predicted prediction, use kernel density estimation (KDE) to approximate the total output distribution from the samples, and print it out in Fig.4. White points represent the ground truth trajectories. Compared to Trajectron $^ { + + }$ , our method suits the contextual information more and therefore is more accurate and plausible.
261
+
262
+ ![](images/4a3f8749352651ddd592c8b50fb69586771e280e08d9c3215cbe03f98ac3c4c4.jpg)
263
+ Figure 4: Qualitative results of our method and Trajectron $^ { + + }$ .
md/train/4fLr7H5D_eT/4fLr7H5D_eT.md ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FjORD: Fair and Accurate Federated Learning under heterogeneous targets with Ordered Dropout
2
+
3
+ Samuel Horváth∗ KAUST† Thuwal, KSA samuel.horvath@kaust.edu.sa
4
+
5
+ Stefanos Laskaridis∗ Samsung AI Center Cambridge, UK mail@stefanos.cc
6
+
7
+ Mario Almeida∗
8
+ Samsung AI Center
9
+ Cambridge, UK
10
+ mario.a@samsung.com
11
+
12
+ Ilias Leontiadis Samsung AI Center Cambridge, UK i.leontiadis@samsung.com
13
+
14
+ Stylianos I. Venieris Samsung AI Center Cambridge, UK s.venieris@samsung.com
15
+
16
+ Nicholas D. Lane Samsung AI Center &
17
+ University of Cambridge Cambridge, UK
18
+ nic.lane@samsung.com
19
+
20
+ # Abstract
21
+
22
+ Federated Learning (FL) has been gaining significant traction across different ML tasks, ranging from vision to keyboard predictions. In large-scale deployments, client heterogeneity is a fact and constitutes a primary problem for fairness, training performance and accuracy. Although significant efforts have been made into tackling statistical data heterogeneity, the diversity in the processing capabilities and network bandwidth of clients, termed as system heterogeneity, has remained largely unexplored. Current solutions either disregard a large portion of available devices or set a uniform limit on the model’s capacity, restricted by the least capable participants. In this work, we introduce Ordered Dropout, a mechanism that achieves an ordered, nested representation of knowledge in deep neural networks (DNNs) and enables the extraction of lower footprint submodels without the need of retraining. We further show that for linear maps our Ordered Dropout is equivalent to SVD. We employ this technique, along with a self-distillation methodology, in the realm of FL in a framework called FjORD. FjORD alleviates the problem of client system heterogeneity by tailoring the model width to the client’s capabilities. Extensive evaluation on both CNNs and RNNs across diverse modalities shows that FjORD consistently leads to significant performance gains over state-of-the-art baselines, while maintaining its nested structure.
23
+
24
+ # 1 Introduction
25
+
26
+ Over the past few years, advances in deep learning have revolutionised the way we interact with everyday devices. Much of this success relies on the availability of large-scale training infrastructures and the collection of vast amounts of training data. However, users and providers are becoming increasingly aware of the privacy implications of this ever-increasing data collection, leading to the creation of various privacy-preserving initiatives by service providers [3] and government regulators [10].
27
+
28
+ Federated Learning (FL) [46] is a relatively new subfield of machine learning (ML) that allows the training of models without the data leaving the users’ devices; instead, FL allows users to collaboratively train a model by moving the computation to them. At each round, participating devices download the latest model and compute an updated model using their local data. These locally trained models are then sent from the participating devices back to a central server where updates are aggregated for next round’s global model. Until now, a lot of research effort has been invested with the sole goal of maximising the accuracy of the global model [46, 42, 39, 31, 63], while complementary mechanisms have been proposed to ensure privacy and robustness [6, 14, 47, 48, 27, 4].
29
+
30
+ ![](images/2e8b497a9c0ca5985656f9912ce45ced32adba2df264ad6a401b94f9458816d5.jpg)
31
+ Figure 1: FjORD employs OD to tailor the amount of computation to the capabilities of each participating device.
32
+
33
+ ![](images/b24e2607785994e09540f47c635a573b80e105dcd201e1a9e45ad3e10f6a629c.jpg)
34
+ Figure 2: Ordered vs. Random Dropout. In this example, the left-most features are used by more devices during training, creating a natural ordering to the importance of these features.
35
+
36
+ A key challenge of deploying FL in the wild is the vast heterogeneity of devices [38], ranging from low-end IoT to flagship mobile devices. Despite this fact, the widely accepted norm in FL is that the local models have to share the same architecture as the global model. Under this assumption, developers typically opt to either drop low-tier devices from training, hence introducing training bias due to unseen data [30], or limit the global model’s size to accommodate the slowest clients, leading to degraded accuracy due to the restricted model capacity [8]. In addition to these limitations, variability in sample sizes, computation load and data transmission speeds further contribute to a very unbalanced training environment. Finally, the resulting model might not be as efficient as models specifically tailored to the capabilities of each device tier to meet the minimum processingperformance requirements [34].
37
+
38
+ In this work, we introduce FjORD (Fig. 1), a novel adaptive training framework that enables heterogeneous devices to participate in FL by dynamically adapting model size – and thus computation, memory and data exchange sizes – to the available client resources. To this end, we introduce Ordered Dropout (OD), a mechanism for run-time ordered (importance-based) pruning, which enables us to extract and train submodels in a nested manner. As such, OD enables all devices to participate in the FL process independently of their capabilities by training a submodel of the original DNN, while still contributing knowledge to the global model. Alongside OD, we propose a self-distillation method from the maximal supported submodel on a device to enhance the feature extraction of smaller submodels. Finally, our framework has the additional benefit of producing models that can be dynamically scaled during inference, based on the hardware and load constraints of the device.
39
+
40
+ Our evaluation shows that FjORD enables significant accuracy benefits over the baselines across diverse datasets and networks, while allowing for the extraction of submodels of varying FLOPs and sizes without the need for retraining.
41
+
42
+ # 2 Motivation
43
+
44
+ Despite the progress on the accuracy front, the unique deployment challenges of FL still set a limit to the attainable performance. FL is typically deployed on either siloed setups, such as among hospitals, or on mobile devices in the wild [7]. In this work, we focus on the latter setting. Hence, while cloud-based distributed training uses powerful high-end clients [19], in FL these are commonly substituted by resource-constrained and heterogeneous embedded devices.
45
+
46
+ In this respect, FL deployment is currently hindered by the vast heterogeneity of client hardware [66, 28, 7]. On the one hand, different mobile hardware leads to significantly varying processing speed [1], in turn leading to longer waits upon aggregation of updates (i.e. stragglers). At the same time, devices of mid and low tiers might not even be able to support larger models, e.g. the model does not fit in memory or processing is slow, and, thus, are either excluded or dropped upon timeouts from the training process, together with their unique data. More interestingly, the resource allocation to participating devices may also reflect on demographic and socio-economic information of owners, that makes the exclusion of such clients unfair [30] in terms of participation. Analogous to the device load and heterogeneity, a similar trend can be traced in the downstream (model) and upstream (updates) network communication in FL, which can be an additional substantial bottleneck for the training procedure [55].
47
+
48
+ # 3 Ordered Dropout
49
+
50
+ In this paper, we firstly introduce the tools that act as enablers for heterogeneous federated training. Concretely, we have devised a mechanism of importance-based pruning for the easy extraction of subnetworks from the original, specially trained model, each with a different computational and memory footprint. We name this technique Ordered Dropout (OD), as it orders knowledge representation in nested submodels of the original network.
51
+
52
+ More specifically, our technique starts by sampling a value (denoted by $p$ ) from a distribution of candidate values. Each of these values corresponds to a specific submodel, which in turn gets translated to a specific computational and memory footprint (see Table 1b). Such sampled values and associations are depicted in Fig. 2. Contrary to conventional dropout (RD), our technique drops adjacent components of the model instead of random neurons, which translates to computational benefits3 in today’s linear algebra libraries and higher accuracy as shown later.
53
+
54
+ # 3.1 Ordered Dropout Mechanics
55
+
56
+ The proposed OD method is parametrised with respect to: i) the value of the dropout rate $p \in ( 0 , 1 ]$ per layer, ii) the set of candidate values $\mathcal { P }$ , such that $p \in \mathcal P$ and iii) the sampling method of $p$ over the set of candidate values, such that $p \sim D _ { \mathcal { P } }$ , where $D _ { \mathcal { P } }$ is the distribution over $\mathcal { P }$ .
57
+
58
+ A primary hyperparameter of OD is the dropout rate $p$ which defines how much of each layer is to be included, with the rest of the units dropped in a structured and ordered manner. The value of $p$ is selected by sampling from the dropout distribution $D _ { \mathcal { P } }$ which is represented by a set of discrete values $\mathcal { P } = \{ s _ { 1 } , s _ { 2 } , . . . , s _ { | \mathcal { P } | } \}$ such that $0 { < } s _ { 1 } { < } . . . { < } s _ { | } p _ { | } \leq 1$ and probabilities $\mathbf { P } ( { \dot { p } } = s _ { i } ) > 0$ , $\forall i \in [ | \mathcal { P } | ]$ such that $\begin{array} { r } { \sum _ { i = 1 } ^ { | \mathcal { P } | } \mathbf { P } ( p = s _ { i } ) = 1 } \end{array}$ . For instance, a uniform distribution over $\mathcal { P }$ is denoted by $p \sim \mathcal { U } _ { \mathcal { P } }$ (i.e. $D = \mathcal { U }$ ). In our experiments we use uniform distribution over the set $\mathcal { P } = \{ i / { k } \} _ { i = 1 } ^ { k }$ , which we refer to as $\mathcal { U } _ { k }$ (or uniform- $k$ ). The discrete nature of the distribution stems from the innately discrete number of neurons or filters to be selected. The selection of set $\mathcal { P }$ is discussed in the next subsection.
59
+
60
+ The dropout rate $p$ can be constant across all layers or configured individually per layer $l$ , leading to $p _ { l } \sim \dot { D } _ { \mathcal { P } } ^ { l }$ . As such an approach opens the search space dramatically, we refer the reader to NAS techniques [69] and continue with the same $p$ value across network layers for simplicity, without hurting the generality of our approach.
61
+
62
+ Given a $p$ value, a pruned $p$ -subnetwork can be directly obtained as follows. For each4 layer $l$ with width5 $K _ { l }$ , the submodel for a given $p$ has all neurons/filters with index $\{ 0 , 1 , \ldots , \lceil p \cdot K _ { l } \rceil - 1 \}$ included and $\{ \lceil p \cdot K _ { l } \rceil , \ldots , K _ { l } ^ { - } - 1 \}$ pruned. Moreover, the unnecessary connections between pruned neurons/filters are also removed6. We denote a pruned $p$ -subnetwork $\mathbf { F } _ { p }$ with its weights ${ \pmb w } _ { p }$ , where $\mathbf { F }$ and $\pmb { w }$ are the original network and weights, respectively. Importantly, contrary to existing pruning techniques [18, 35, 49], a $p$ -subnetwork from OD can be directly obtained post-training without the need to fine-tune, thus eliminating the requirement to access any labelled data.
63
+
64
+ # 3.2 Training OD Formulation
65
+
66
+ We propose two ways to train an OD-enabled network: i) plain $O D$ and ii) knowledge distillation $O D$ training (OD w/ KD). In the first approach, in each step we first sample $p \sim D _ { \mathcal { P } }$ ; then we perform the forward and backward pass using the $p$ -reduced network $\mathbf { F } _ { p }$ ; finally we update the submodel’s weights using the selected optimiser. Since sampling a $p$ -reduced network provides us significant computational savings on average, we can exploit this reduction to further boost accuracy. Therefore, in the second approach we exploit the nested structure of OD, i.e. $p _ { 1 } < p _ { 2 } \implies \mathbf { F } _ { p _ { 1 } } \subset \mathbf { F } _ { p _ { 2 } }$ and allow for the bigger capacity supermodel to teach the sampled $p$ -reduced network at each iteration via knowledge distillation (teacher $p _ { \operatorname* { m a x } } > p$ , $p _ { \operatorname* { m a x } } = \operatorname* { m a x } { \mathcal P }$ ). In particular, in each iteration, the loss function consists of two components as follows:
67
+
68
+ ![](images/89eb61d73c4481ca0ff08db1449e8b71e4f9769c77512ae027a9025ed7f69c13.jpg)
69
+ Figure 3: Full non-federated datasets. OD-Ordered Dropout with $D _ { \mathcal { P } } = \mathcal { U } _ { 5 }$ , SM-single independent models, KD-knowledge distillation.
70
+
71
+ where $\mathrm { S M } _ { p }$ is the softmax output of the sampled $p$ -submodel, $\pmb { y } _ { \mathrm { l a b e l } }$ is the ground-truth label, CE is the cross-entropy function, KL is the KL divergence, $T$ is the distillation temperature [21] and $\alpha$ is the relative weight of the two components. We observed in our experiments always backpropagating also the teacher network further boosts performance. Furthermore, the best performing values for distillation were $\alpha = T = 1$ , thus smaller models exactly mimic the teacher output. This means that new knowledge propagates in submodels by proxy, i.e. by backpropagating on the teacher, leading to the following loss function:
72
+
73
+ $$
74
+ \mathscr { L } _ { d } ( \mathbf { S } \mathbf { M } _ { p } , \mathbf { S } \mathbf { M } _ { p _ { \operatorname* { m a x } } } , \pmb { y } _ { \mathrm { l a b e l } } ) = \mathbf { K L } ( \mathbf { S } \mathbf { M } _ { p } , \mathbf { S } \mathbf { M } _ { p _ { \operatorname* { m a x } } } , T ) + \mathbf { C } \mathbf { E } ( \operatorname* { m a x } ( \mathbf { S } \mathbf { M } _ { p _ { \operatorname* { m a x } } } ) , \pmb { y } _ { \mathrm { l a b e l } } )
75
+ $$
76
+
77
+ # 3.3 Ordered Dropout exactly recovers SVD
78
+
79
+ We further show that our new OD formulation can recover the Singular Value Decomposition (SVD) in the case where there exists a linear mapping from features to responses. We formalise this claim in the following theorem.
80
+
81
+ Theorem 1. Let $\mathbf { F } : \mathbb { R } ^ { n } \mathbb { R } ^ { m }$ be a NN with two fully-connected linear layers with no activation or biases and $K = \operatorname* { m i n } \{ m , n \}$ hidden neurons. Moreover, let data $\mathcal { X }$ come from a uniform distribution on the $n$ -dimensional unit ball and $A$ be an $m \times n$ full rank matrix with $K$ distinct singular values. If response $y$ is linked to data $\mathcal { X }$ via a linear map: $x A x$ and distribution $D _ { \mathcal { P } }$ is such that for every $b \in [ K ]$ there exists $p \in \mathcal P$ for which $b = \lceil p \cdot K \rceil$ , then for the optimal solution of
82
+
83
+ $$
84
+ \operatorname* { m i n } _ { \mathbf { F } } \mathbb { E } _ { { x } \sim { \mathcal { X } } } \mathbb { E } _ { { p } \sim { D _ { \mathcal { P } } } } \| \mathbf { F } _ { p } ( { x } ) - { y } \| ^ { 2 }
85
+ $$
86
+
87
+ it holds $\mathbf { F } _ { p } ( x ) = A _ { b } x$ , where $A _ { b }$ is the best $b$ -rank approximation of $A$ and $b = \lceil p \cdot K \rceil$ .
88
+
89
+ Theorem 1 shows that our OD formulation exhibits not only intuitively, but also theoretically ordered importance representation. Proof of this claim is deferred to the Appendix.
90
+
91
+ # 3.4 Model-Device Association
92
+
93
+ Computational and Memory Implications. The primary objective of OD is to alleviate the excessive computational and memory demands of the training and inference deployments. When a layer is shrunk through OD, there is no need to perform the forward and backward passes or gradient updates on the pruned units. As a result, OD offers gains both in terms of FLOP count and model size. In particular, for every fully-connected and convolutional layer, the number of FLOPs and weight parameters is reduced by $K _ { 1 } { \cdot } K _ { 2 } \big / [ p { \cdot } K _ { 1 } ] { \cdot } [ p { \cdot } K _ { 2 } ] \sim 1 \big / p ^ { 2 }$ , where $K _ { 1 }$ and $K _ { 2 }$ correspond to the number of input and output neurons/channels, respectively. Accordingly, the bias terms are reduced by a factor of $K _ { 2 } / [ p \cdot K _ { 2 } ] \sim 1 / p$ . The normalisation, activation and pooling layers are compressed in terms of FLOPs and parameters similarly to the biases in fully-connected and convolutional layers. This is also evident in Table 1b. Finally, smaller model size also leads to reduced memory footprint for gradients and the optimiser’s state vectors such as momentum. However, how are these submodels related to devices in the wild and how is this getting modelled?
94
+
95
+ Ordered Dropout Rates Space. Our primary objective with OD is to tackle device heterogeneity. Inherently, each device has certain capabilities and can run a specific number of model operations within a given time budget. Since each $p$ value defines a submodel of a given width, we can indirectly associate a $p _ { \mathrm { m a x } } ^ { i }$ value with the $i$ -th device capabilities, such as memory, processing throughput or energy budget. As such, each participating client is given at most the $p _ { \mathrm { m a x } } ^ { i ^ { \ast } }$ -submodel it can handle.
96
+
97
+ Devices in the wild, however, can have dramatically different capabilities; a fact further exacerbated by the co-existence of previous-generation devices. Modelling discretely each device becomes quickly intractable at scale. Therefore, we cluster devices of similar capabilities together and subsequently associate a single $p _ { \mathrm { m a x } } ^ { i }$ value with each cluster. This clustering can be done heuristically (i.e. based on the specifications of the device) or via benchmarking of the model on the actual device and is considered a system-design decision for our paper. As smartphones nowadays run a multitude of simultaneous tasks [43], our framework can further support modelling of transient device load by reducing its associated $p _ { \mathrm { m a x } } ^ { i }$ , which essentially brings the capabilities of the device to a lower tier at run time, thus bringing real-time adaptability to FjORD.
98
+
99
+ Concretely, the discrete candidate values of $\mathcal { P }$ depend on i) the number of clusters and corresponding device tiers, ii) the different load levels being modelled and iii) the size of the network itself, as i.e. for each tier $i$ there exists $p _ { \mathrm { m a x } } ^ { i }$ beyond which the network cannot be resolved. In this paper, we treat the former two as invariants (assumed to be given by the service provider), but provide results across different number and distributions of clusters, models and datasets.
100
+
101
+ # 3.5 Preliminary Results
102
+
103
+ Here, we present some results to showcase the performance of OD in the centralised non-FL training setting (i.e. the server has access to all training data) across three tasks, explained in detail in $\ S 5$ Concretely, we run OD with distribution $D _ { \mathcal { P } } = \mathcal { U } _ { 5 }$ (uniform distribution over the set $\{ i / 5 \} _ { i = 1 } ^ { 5 } ,$ ) and compare it with end-to-end trained submodels (SM) trained in isolation for the given width of the model. Fig. 3 shows that across the three datasets, the best attained performance of OD along every width $p$ is very close to the performance of the baseline models. We extend this comparison against Random Dropout in the Appendix. We note at this point that the submodel baselines are trained from scratch, explicitly optimised to that given width with no possibility to jump across them, while our OD model was trained using a single training loop and offers the ability to switch between accuracy-computation points without the need to retrain.
104
+
105
+ #
106
+
107
+ Building upon the shoulders of OD, we introduce FjORD, a framework for federated training over heterogenous clients. We subsequently describe the FjORD’s workflow, further documented in Alg. 1.
108
+
109
+ As a starting point, the global model architecture, $\mathbf { F }$ , is initialised with weights $\pmb { w } ^ { 0 }$ , either randomly or via a pretrained network. The dropout rates space $\mathcal { P }$ is selected along with distribution $D _ { \mathcal { P } }$ with $| \mathcal { P } |$ discrete candidate values, with each $p$ corresponding to a subnetwork of the global model with varying FLOPs and parameters. Next, the devices to participate are clustered into $| \mathcal { C } _ { \mathrm { t i e r s } } |$ tiers and a $p _ { \mathrm { m a x } } ^ { c }$ value is associated with each cluster $c$ . The resulting $p _ { \mathrm { m a x } } ^ { c }$ represents the maximum capacity of the network that devices in this cluster can handle without violating a latency or memory constraint.
110
+
111
+ At the beginning of each communication round $t$ , the set of participating devices $S _ { t }$ is determined, which either consists of all available clients $\boldsymbol { A } _ { t }$ or contains only a random subset of $\boldsymbol { A } _ { t }$ based on the server’s capacity. Next, the server broadcasts the current model to the set of clients $S _ { t }$ and each client $i$ receives ${ w _ { p } } _ { \operatorname* { m a x } } ^ { i }$ . On the client side, each client runs $E$ local iterations and at each local iteration $k$ , the device $i$ samples $p _ { ( i , k ) }$ from conditional distribution $D _ { \mathcal { P } } | D _ { \mathcal { P } } \leq p _ { \operatorname* { m a x } } ^ { i }$ which accounts for its limited capability. Subsequently, each client updates the respective weights $( { w _ { p } } _ { \boldsymbol { \mathrm { ( } i } , \boldsymbol { k } \mathrm { ) } } )$ of the local submodel using the FedAvg [46] update rule. In this step, other strategies [39, 63, 31] can be interchangeably employed. At the end of the local iterations, each device sends its update back to the server.
112
+
113
+ Finally, the server aggregates these communicated changes and updates the global model, to be distributed in the next global federated round to a different subset of devices. Heterogeneity of devices leads to heterogeneity in the model updates and, hence, we need to account for that in the global aggregation step. To this end, we utilise the following aggregation rule
114
+
115
+ $$
116
+ \pmb { w } _ { s _ { j } } ^ { t + 1 } \backslash \pmb { w } _ { s _ { j - 1 } } ^ { t + 1 } = \mathrm { W A } \left( \left\{ \pmb { w } _ { i _ { s _ { j } } } ^ { ( i , t , E ) } \backslash \pmb { w } _ { s _ { j - 1 } } ^ { ( i , t , E ) } \right\} _ { i \in S _ { t } ^ { j } } \right)
117
+ $$
118
+
119
+ where ${ w _ { s } } _ { j . } \backslash w _ { s _ { j - 1 } }$ are the weights that belong to ${ \bf F } _ { s _ { j } }$ but not to $\mathbf { F } _ { { s } _ { j - 1 } }$ , ${ \pmb w } ^ { t + 1 }$ the global weights sj sj−1at communication round $t + 1$ , $\mathbf { \Sigma } _ { w } ^ { } ( i , t , E )$ sj the weights on client $i$ sj−1 at communication round $t$ after $E$ local iterations, $S _ { t } ^ { j } = \{ i \in { \mathcal { S } } _ { t } : p _ { \operatorname* { m a x } } ^ { i } \geq s _ { j } \}$ a set of clients that have the capacity to update ${ \pmb w } _ { s _ { j } }$ , and WA stands for weighted average, where weights are proportional to the amount of data on each client.
120
+
121
+ Communication Savings. In addition to the computational savings (§3.4), OD provides additional communication savings. First, for the server-to-client transfer, every device with $p _ { \mathrm { m a x } } ^ { i } < 1$ observes a reduction of approximately $^ 1 / ( p _ { \mathrm { m a x } } ^ { i } ) ^ { 2 }$ in the downstream transferred data due to the smaller model size $( \ S \ 3 . 4 )$ . Accordingly, the upstream client-to-server transfer is decreased by $^ 1 / ( p _ { \mathrm { m a x } } ^ { i } ) ^ { 2 }$ as only the gradient updates of the unpruned units are transmitted.
122
+
123
+ # Algorithm 1: FjORD (Proposed Framework)
124
+
125
+ Input: ${ \bf F } , { \pmb w } ^ { 0 } , D _ { \mathcal { P } } , T , E$
126
+ 1 for $t \gets 0$ to $T - 1$ do // Global rounds
127
+ 2 Server selects clients as a subset $S _ { t } \subset A _ { t }$
128
+ 3 Server broadcasts weights of $p _ { \mathrm { m a x } } ^ { i }$ -submodel to each client $i \in S _ { t }$
129
+ 4 for $k 0$ to $E - 1$ do // Local iterations
130
+ 5 $\forall i \in S _ { t }$ : Device $_ { i }$ samples $p _ { ( i , k ) } \sim D p \vert D _ { \mathcal { P } } \leq p _ { \mathrm { m a x } } ^ { i }$ and updates the weights of local model
131
+ 6 end
132
+ 7 $\forall i \in S _ { t }$ : device $_ { i }$ sends to the server the updated weights $\mathbf { \Delta } _ { w } ^ { ( i , t , E ) }$
133
+ 8 Server updates $\scriptstyle w ^ { t + 1 }$ as in Eq. (1)
134
+
135
+ Identifiability. A standard procedure in FL is to perform element-wise averaging to aggregate model updates from clients. However, coordinate-wise averaging of updates may have detrimental effects on the accuracy of the global model, due to the permutation invariance of the hidden layers. Recent techniques tackle this problem by matching clients’ neurons before averaging [68, 57, 62]. Unfortunately, doing so is computationally expensive and hurts scalability. FjORD mitigates this issue since it exhibits the natural importance of neurons/channels within each hidden layer by design; essentially OD acts in lieu of a neuron matching algorithm without the computational overhead.
136
+
137
+ Subnetwork Knowledge Transfer. In $\ S \ 3 . 2$ , we introduced knowledge distillation for our OD formulation. We extend this approach to FjORD, where instead of the full network, we employ width $\operatorname* { m a x } \{ p \in \mathcal { P } : p \leq p _ { \operatorname* { m a x } } ^ { i } \}$ as a teacher network in each local iteration on device $i$ . We provide the alternative of FjORD with knowledge distillation mainly as a solution for cases where the client bottleneck is memory- or network-related, rather than computational in nature [32]. However, in cases where client devices are computationally bound in terms of training latency, we propose FjORD without KD or decreasing $p _ { \mathrm { m a x } } ^ { i }$ to account for the overhead of KD.
138
+
139
+ 9 end
140
+
141
+ <table><tr><td>Dataset</td><td>Model</td><td># Clients # Samples Task</td></tr><tr><td>CIFAR10</td><td>ResNet18</td><td>10050,ooo Image classification</td></tr><tr><td>FEMNIST</td><td>CNN</td><td>3,400 671,585 Image classification</td></tr><tr><td>Shakespeare RNN</td><td></td><td>71538, OO1 Next character prediction</td></tr></table>
142
+
143
+ # 5 Evaluation of FjORD
144
+
145
+ In this section, we provide a thorough evaluation of FjORD and its components across different tasks, datasets, models and device cluster distributions to show its performance, elasticity and generality.
146
+
147
+ Datasets and Models. We evaluate FjORD on two vision and one text prediction task, shown in Table 1a. For CIFAR10 [33], we use the “CIFAR” version of ResNet18 [20]. We federate the dataset by randomly dividing it into equally-sized partitions, each allocated to a specific client, and thus remaining IID in nature. For FEMNIST, we use a CNN with two convolutional layers followed by a softmax layer. For Shakespeare, we employ a RNN with an embedding layer (without dropout) followed by two LSTM [22] layers and a softmax layer. We report the model’s performance of the last epoch on the test set which is constructed by combining the test data for each client. We report top-1 accuracy vision tasks and negative perplexity for text prediction. Further details, such as hyperparameters, description of datasets and models are available in the Appendix.
148
+
149
+ Table 1: Datasets and models
150
+
151
+ <table><tr><td colspan="2">p=0.2</td><td>0.4</td><td>0.6</td><td>0.8</td><td>1.0</td></tr><tr><td colspan="6">CIFAR10/ResNet18</td></tr><tr><td>MACs</td><td>23M</td><td>91M</td><td>203M</td><td>360M</td><td>555M</td></tr><tr><td>Params</td><td>456K</td><td>2M</td><td>4M</td><td>7M</td><td>11M</td></tr><tr><td colspan="6">FEMNIST/CNN</td></tr><tr><td>MACs</td><td>47K</td><td>120K</td><td>218K</td><td>342K</td><td>491K</td></tr><tr><td>Params</td><td>5K</td><td>10K</td><td>15K</td><td>20K</td><td>26K</td></tr><tr><td colspan="6">Shakespeare/RNN</td></tr><tr><td>MACs</td><td>12K</td><td>40K</td><td>83K</td><td>143K</td><td>216K</td></tr><tr><td>Params</td><td>12K</td><td>40K</td><td>82K</td><td>142K</td><td>214K</td></tr></table>
152
+
153
+ # 5.1 Experimental Setup
154
+
155
+ (b) MACs and parameters per $p$ -reduced network
156
+
157
+ Infrastructure. FjORD was implemented on top of the Flower (v0.14dev) [5] framework and PyTorch (v1.4.0) [51]. We run all our experiments on a private cloud cluster, consisting of Nvidia V100 GPUs. To scale to hundreds of clients on a single machine, we optimized Flower so that clients only allocate GPU resources when actively participating in a federated client round. We report average performance and the standard deviation across three runs for all experiments. To model client availability, we run up to 100 Flower clients in parallel and sample $10 \%$ at each global round, with the ability for clients to switch identity at the beginning of each round to overprovision for larger federated datasets. Furthermore, we model client heterogeneity by assigning each client to one of the device clusters. We provide the following setups:
158
+
159
+ ![](images/71d5837d4dc2562a1840258a05df4e1d53d37bcf5b7b8222ff9e74cb7c6826d0.jpg)
160
+ Figure 4: Ordered Dropout with KD vs eFD baselines. Performance vs dropout rate $p$ across different networks and datasets. $D _ { \mathcal { P } } = \mathcal { U } _ { 5 }$
161
+
162
+ Uniform-{5,10}: This refers to the distribution $D _ { \mathcal { P } }$ , i.e. $p \sim \mathcal { U } _ { k }$ , with $k = 5$ or 10.
163
+
164
+ Drop Scale $\in \ \{ 0 . 5 , 1 . 0 \}$ : This parameter affects a possible skew in the number of devices per uniform- cluster. It refers to the drop in clients per cluster of devices, as we go to higher $n$ and drop scale $d s$ , the high-end cluster $n$ contains $\scriptstyle 1 - \sum _ { i = 0 } ^ { n - 1 } d s / _ { n }$ of the devices and the $p$ ’s. Formally, for rest of the clusters contain $\left. d s \right/ n$ each. Hence, for $d s { = } 1 . 0$ of the uniform-5 case, all devices can run the $p = 0 . 2$ subnetwork, $80 \%$ can run the $p = 0 . 4$ and so on, leading to a device distribution of $( 0 . 2 , . . . , 0 . 2 )$ . This percentage drop is half for the case of $d s { = } 0 . 5$ , resulting in a larger high-end cluster, e.g. $( 0 . 1 , 0 . 1 , . . . , 0 . 6 )$ .
165
+
166
+ Baselines. To assess the performance against the state-of-the-art, we compare FjORD with the following baselines: i) Extended Federated Dropout (eFD), ii) FjORD with eFD (FjORD w/ eFD).
167
+
168
+ eFD builds on top of the technique of Federated Dropout (FD) [8], which adopts a Random Dropout (RD) at neuron/filter level for minimising the model’s footprint. However, FD does not support adaptability to heterogeneous client capabilities out of the box, as it inherits a single dropout rate across devices. For this reason, we propose an extension to FD, allowing to adapt the dropout rate to the device capabilities, defined by the respective cluster membership. It is clear that eFD dominates FD in performance and provides a tougher baseline, as the latter needs to impose the same dropout rate to fit the model at hand on all devices, leading to larger dropout rates (i.e. uniform dropout of $80 \%$ for full model to support the low-end devices). We provide empirical evidence for this in the Appendix. For investigative purposes, we also applied eFD on top of FjORD, as a means to update a larger part of the model from lower-tier devices, i.e. allow them to evaluate submodels beyond their $p _ { \mathrm { m a x } } ^ { i }$ during training.
169
+
170
+ # 5.2 Performance Evaluation
171
+
172
+ In order to evaluate the performance of FjORD, we compare it to the two baselines, eFD and $_ \mathrm { O D + e F D }$ . We consider the uniform-5 setup with drop scale of 1.0 (i.e. uniform clusters). For each baseline, we train one independent model $\mathbf { F } _ { p }$ , end-to-end, for each $p$ . For eFD, what this translates to is that the clusters of devices that cannot run model $\mathbf { F } _ { p }$ compensate by randomly dropping out neurons/filters. We point out that $p = 0 . 2$ is omitted from the eFD results as it is essentially not employing any dropout whatsoever. For the case of $\mathrm { F j O R D + e F D }$ , we control the RD by capping it to $d = 0 . 2 5$ . This allows for larger submodels to be updated more often – as device belonging to cluster $c$ can now have pcmax $p _ { \mathrm { m a x } } ^ { c } \to p _ { \mathrm { m a x } } ^ { c + 1 }$ during training where $c { + 1 }$ is the next more powerful cluster – while at the same time it prevents the destructive effect of too high dropout values shown in the eFD baseline.
173
+
174
+ Fig. 4 presents the achieved accuracy for varying values of $p$ across the three target datasets. FjORD (denoted by FjORD w/ KD) outperforms eFD across all datasets with improvements between 1.53- 34.87 percentage points (pp) (19.22 pp avg. across $p$ values) on CIFAR10, 1.57-6.27 pp (3.41 pp avg.) on FEMNIST and 0.01-0.82 points (p) (0.46 p avg.) on Shakespeare. Compared to FjORD $+ \mathrm { e F D }$ , FjORD achieves performance gains of $0 . 7 1 { \cdot } 2 . 6 6 \mathrm { p p }$ (1.79 avg.), up to 2.56 pp (1.35 pp avg.) on FEMNIST and $0 . 1 2 – 0 . 2 2 \mathfrak { p }$ $_ { 0 . 1 8 \mathrm { ~ p ~ } }$ avg.) on Shakespeare.
175
+
176
+ Across all tasks, we observe that FjORD is able to improve its performance with increasing $p$ due to the nested structure of its OD method. We also conclude that eFD on top of FjORD does not seem to lead to better results. More importantly though, given the heterogeneous pool of devices, to obtain the highest performing model for eFD, multiple models have to be trained (i.e. one per device cluster). For instance, the highest performing models for eFD are $\mathbf { F } _ { 0 . 4 }$ , $\mathbf { F } _ { 0 . 6 }$ and ${ \bf F } _ { 0 . 4 }$ for CIFAR10, FEMNIST and Shakespeare respectively, which can be obtained only a posteriori; after all model variants have been trained. Instead, despite the device heterogeneity, FjORD requires a single training process that leads to a global model that significantly outperforms the best model of eFD (by 2.98 and $2 . 7 3 \mathrm { p p }$ for CIFAR10 and FEMNIST, respectively, and $0 . 1 3 { \mathfrak { p } }$ for Shakespeare), while allowing the direct, seamless extraction of submodels due to the nested structure of OD. Empirical evidence of the convergence of FjORD and the corresponding baselines is provided in the Appendix.
177
+
178
+ ![](images/39ce337186f7a1e3fdbf78655ebd1ab5be1e5d5d0469d21595f13b76dea224cb.jpg)
179
+ Figure 5: Ablation analysis of FjORD with Knowledge Distillation. Ordered Dropout with $D _ { \mathcal { P } } = \mathcal { U } _ { 5 }$ , KD - Knowledge distillation.
180
+
181
+ # 5.3 Ablation Study of KD in FjORD
182
+
183
+ To evaluate the contribution of our knowledge distillation method to the attainable performance of FjORD, we conduct an ablative analysis on all three datasets. We adopt the same setup of uniform-5 and drop scale $= 1 . 0$ as in the previous section and compare FjORD with and without KD.
184
+
185
+ Fig. 5 shows the efficacy of FjORD’s KD in $\mathrm { F L }$ settings. FjORD’s KD consistently improves the performance across all three datasets when $p > 0 . 4$ , with average gains of 0.18, 0.68 and 0.87 pp for submodels of size 0.6, 0.8 and 1 on CIFAR-10, 1.96, 2.39 and 2.65 pp for FEMNIST and $0 . 1 0 \mathrm { p }$ for Shakespeare. For the cases of $p \leq 0 . 4$ , the impact of KD is fading. We believe this to be a side-effect of optimising for the average accuracy across submodels, which also yielded the $T = \alpha = 1$ strategy. We leave the exploration of alternative weighted KD strategies as future work. Overall, the use of KD significantly improves the performance of the global model, yielding gains of 0.71 and $2 . 6 3 \mathrm { p p }$ for CIFAR10 and FEMNIST and $0 . 1 0 \mathfrak { p }$ for Shakespeare.
186
+
187
+ # 5.4 FjORD’s Deployment Flexibility
188
+
189
+ # 5.4.1 Device Clusters Scalability
190
+
191
+ An important characteristic of FjORD is its ability to scale to a larger number of device clusters or, equivalently, perform well with higher granularity of $p$ values. To illustrate this, we test the performance of OD across two setups, uniform-5 and $- I O$ (defined in $\ S 5 . 1$ ).
192
+
193
+ As shown in Fig. 6, FjORD sustains its performance even under the higher granularity of $p$ values. This means that for applications where the modelling of clients needs to be more fine-grained, FjORD can still be of great value, without any significant degradation in achieved accuracy per submodel. This further supports the use-case where device-load needs to be modelled explicitly in device clusters (e.g. modelling device capabilities and load with deciles).
194
+
195
+ # 5.4.2 Adaptability to Device Distributions
196
+
197
+ In this section, we make a similar case about FjORD’s elasticity with respect to the allocation of available devices to each cluster. We adopt the setup of uniform-5 once again, but compare across drop scales 0.5 and 1.0 (defined in $\ S 5 . 1$ ). In both cases, clients that can support models of $p _ { \operatorname* { m a x } } ^ { i } \in \{ 0 . 2 , \dots , 0 . 8 \}$ are equisized, but the former halves the percentage of devices and allocates it to the last (high-end) cluster, now accounting for $60 \%$ of the devices. The rationale behind this is that the majority of participating devices are able to run the whole original model.
198
+
199
+ The results depicted in Fig. 7 show that the larger submodels are expectedly more accurate, being updated more often. However, the same graphs also indicate that FjORD does not significantly degrade the accuracy of the smaller submodels in the presence of more high-tier devices (i. $e . \ d s = 0 . 5$ ). This is a direct consequence of sampling $p$ values during local rounds, instead of tying each tier with only the maximal submodel it can handle. We should also note that we did not alter the uniform sampling in this case on the premise that high-end devices are seen more often, precisely to illustrate FjORD’s adaptability to latent user device distribution changes of which the server may not be aware.
200
+
201
+ # 6 Related Work
202
+
203
+ Dropout Techniques. Contrary to conventional Random Dropout [59], which stochastically drops a different, random set of a layer’s units in every batch and is typically applied for regularisation purposes, OD employs a structured ordered dropping scheme that aims primarily at tunably reducing the computational and memory cost of training and inference. However, OD can still have an implicit regularisation effect since we encourage learning towards the top-ranked units (e.g. the left-most units in the example of Fig. 2), as these units will be dropped less often during training. Respectively, at inference time, the load of a client can be dynamically adjusted by dropping the least important units, i.e. adjusting the width of the network.
204
+
205
+ ![](images/0ca029dc94449dd6e2efe5b02648f369ca9bc267fb10e2bd80acb94520dbb0df.jpg)
206
+ Figure 6: Demonstration of FjORD’s scalability with respect to the number of device clusters.
207
+
208
+ ![](images/c9c92134ee38481d7e91a359f09b44762be14bcf1363ed4a2add3195c45ef0b3.jpg)
209
+ (b) RNN - Shakespeare
210
+ Figure 7: Demonstration of the adaptability of FjORD across different device distributions.
211
+
212
+ To the best of our knowledge, the only similar technique to OD is Nested Dropout, where the authors proposed a similar construction, which is applied to the representation layer in autoencoders [54] in order to enforce identifiability of the learned representation or the last layer of the feature extractor [24] to learn an ordered set of features for transfer learning. In our case, we apply OD to every layer to elastically adapt the computation and memory requirements during training and inference.
213
+
214
+ Traditional Pruning. Conventional non-FL compression techniques can be applicable to reduce the network size and computation needs. The majority of pruning methods [18, 16, 37, 35, 49] aim to generate a single pruned model and require access to labelled data in order to perform a costly fine-tuning/calibration for each pruned variant. Instead, FjORD’s Ordered Dropout enables the deterministic extraction of multiple pruned models with varying resource budgets directly after training. In this manner, we remove both the excessive overhead of fine-tuning and the need for labelled data availability, which is crucial for real-world, privacy-aware applications [60, 56]. Finally, other model compression methods [13, 64, 9] remain orthogonal to FjORD.
215
+
216
+ System Heterogeneity. So far, although substantial effort has been devoted to alleviating the statistical heterogeneity [38] among clients [58, 36, 26, 12, 40], the system heterogeneity has largely remained unaddressed. Considering the diversity of client devices, techniques on client selection [50] and control of the per-round number of participating clients and local iterations [45, 65] have been developed. Nevertheless, as these schemes are restricted to allocate a uniform amount of work to each selected client, they either limit the model complexity to fit the lowest-end devices or exclude slow clients altogether. From an aggregation viewpoint, [39] allows for partial results to be integrated to the global model, thus enabling the allocation of different amounts of work across heterogeneous clients. Despite the fact that each client is allowed to perform a different number of local iterations based on its resources, large models still cannot be accommodated on the more constrained devices.
217
+
218
+ Communication Optimisation. The majority of existing work has focused on tackling the communication overhead in FL. [32] proposed using structured and sketched updates to reduce the transmitted data. ATOMO [61] introduced a generalised gradient decomposition and sparsification technique, aiming to reduce the gradient sizes communicated upstream. [17] adaptively select the gradients’ sparsification degree based on the available bandwidth and computational power. Building upon gradient quantisation methods [44, 23, 53, 25], [2] proposed using quantisation in the model sharing and aggregation steps. However, their scheme requires the same clients to participate across all rounds, and is, thus, unsuitable for realistic settings where clients’ availability cannot be guaranteed. Despite the bandwidth savings, these communication-optimising approaches do not offer computational gains nor do they address device heterogeneity. Nonetheless, they remain orthogonal to our work and can be complementarily combined to further alleviate the communication cost.
219
+
220
+ Computation-Communication Co-optimisation. A few works aim to co-optimise both the computational and bandwidth costs. PruneFL [29] proposes an unstructured pruning method. Despite the similarity to our work in terms of pruning, this method assumes a common pruned model across all clients at a given round, thus not allowing more powerful devices to update more weights. Hence, the pruned model needs to meet the constraints of the least capable devices, which severely limits the model capacity. Moreover, the adopted unstructured sparsity is difficult to translate to processing speed gains [67]. Federated Dropout [8] randomly sparsifies the global model, before sharing it to the clients. Similarly to PruneFL, Federated Dropout does not consider the system diversity and distributes the same model size to all clients. Thus, it is restricted by the low-end devices or excludes them altogether from the FL process. Additionally, Federated Dropout does not translate to computational benefits at inference time, since the whole model is deployed after federated training.
221
+
222
+ Contrary to the presented works, our framework embraces the client heterogeneity, instead of treating it as a limitation, and thus pushes the boundaries of FL deployment in terms of fairness, scalability and performance by tailoring the model size to the device at hand, both at training and inference time, in a “train-once-deploy-everywhere” manner.
223
+
224
+ # 7 Conclusions & Future Work
225
+
226
+ In this work, we have introduced FjORD, a federated learning method for heterogeneous device training. To this direction, FjORD builds on top of our Ordered Dropout technique as a means to extract submodels of smaller footprints from a main model in a way where training the part also participates in training the whole. We show that our Ordered Dropout is equivalent to SVD for linear mappings and demonstrate that FjORD’s performance in the local and federated setting exceeds that of competing techniques, while maintaining flexibility across different environment setups.
227
+
228
+ In the future, we plan to investigate how FjORD can be deployed and extended to future-gen devices and models in a life-long manner, the interplay between system and data heterogeneity for OD-based personalisation as well as alternative dynamic inference techniques for tackling system heterogeneity.
229
+
230
+ # Broader Impact
231
+
232
+ Our work has a dual broader societal impact: i) on privacy and fairness in participation and ii) on the environment. On the one hand, centralised DNN training [19] has been the norm for a long time, mainly facilitated by the advances in server-grade accelerator design and cheap storage. However, this paradigm comes with a set of disadvantages, both in terms of data privacy and energy consumption. With mobile and embedded devices becoming more capable and FL becoming a viable alternative [3, 7], one can leverage the free compute cycles of client devices to train models on-device, without data ever leaving the device premises. These devices, being typically battery-powered, operate under a more constrained power envelope compared to data-center accelerators [1]. Moreover, these devices are already deployed in the wild, but typically not used for training purposes. What FjORD contributes is the ability for even less capable devices to participate in the training process, thus increasing the representation of low-tier devices (and by extension the correlated demographic groups), as well as adding to the overall compute capabilities of the distributed system as a whole, potentially offsetting part of the carbon footprint of centralised training data centers [52].
233
+
234
+ However, moving the computation cost from the service provider to the user of the device is a non-negligible step and the user should be made aware what their device is used for, especially if they are contributing to the knowledge of a model they do not own. Moreover, while many large data centers [11, 15] are increasingly dependent on renewable resources for meeting their power demands, this might not be the case for household electricity, which may impede the sustainability of training on device, at least in the short run.
235
+
236
+ # Funding Disclosure
237
+
238
+ This work was entirely performed at and funded by Samsung AI.
239
+
240
+ # References
241
+
242
+ [1] Mario Almeida, Stefanos Laskaridis, Ilias Leontiadis, Stylianos I. Venieris, and Nicholas D. Lane. EmBench: Quantifying Performance Variations of Deep Neural Networks Across Modern Commodity Devices. In The 3rd International Workshop on Deep Learning for Mobile Systems and Applications (EMDL), 2019.
243
+
244
+ [2] Mohammad Mohammadi Amiri, Deniz Gunduz, Sanjeev R Kulkarni, and H Vincent Poor. Federated Learning with Quantized Global Model Updates. arXiv preprint arXiv:2006.10672, 2020.
245
+ [3] Apple. Learning with Privacy at Scale. In Differential Privacy Team Technical Report, 2017.
246
+ [4] Eugene Bagdasaryan, Andreas Veit, Yiqing Hua, Deborah Estrin, and Vitaly Shmatikov. How To Backdoor Federated Learning. In Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics (AISTATS), pages 2938–2948, 2020.
247
+ [5] Daniel J Beutel, Taner Topal, Akhil Mathur, Xinchi Qiu, Titouan Parcollet, and Nicholas D Lane. Flower: A Friendly Federated Learning Research Framework. arXiv preprint arXiv:2007.14390, 2020. [6] Keith Bonawitz et al. Practical Secure Aggregation for Privacy-Preserving Machine Learning. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security (CCS), 2017.
248
+ [7] Keith Bonawitz et al. Towards Federated Learning at Scale: System Design. In Proceedings of Machine Learning and Systems (MLSys), 2019.
249
+ [8] Sebastian Caldas, Jakub Konecný, Brendan McMahan, and Ameet Talwalkar. Expanding the ˇ Reach of Federated Learning by Reducing Client Resource Requirements. In NeurIPS Workshop on Federated Learning for Data Privacy and Confidentiality, 2018.
250
+ [9] Łukasz Dudziak, Mohamed S Abdelfattah, Ravichander Vipperla, Stefanos Laskaridis, and Nicholas D Lane. ShrinkML: End-to-End ASR Model Compression Using Reinforcement Learning. In INTERSPEECH, pages 2235–2239, 2019.
251
+ [10] European Commission. GDPR: 2018 Reform of EU Data Protection Rules.
252
+ [11] Facebook. Software, servers, systems, sensors, and science: Facebook’s recipe for hyperefficient data centers. https://tech.fb.com/hyperefficient-data-centers/, 2021. Accessed: January 10, 2022.
253
+ [12] Alireza Fallah, Aryan Mokhtari, and Asuman Ozdaglar. Personalized Federated Learning with Theoretical Guarantees: A Model-Agnostic Meta-Learning Approach. Advances in Neural Information Processing Systems (NeurIPS), 2020.
254
+ [13] Biyi Fang, Xiao Zeng, and Mi Zhang. NestDNN: Resource-Aware Multi-Tenant On-Device Deep Learning for Continuous Mobile Vision. In Proceedings of the 24th Annual International Conference on Mobile Computing and Networking (MobiCom), pages 115–127, 2018.
255
+ [14] Robin C. Geyer, Tassilo J. Klein, and Moin Nabi. Differentially Private Federated Learning: A Client Level Perspective. In NeurIPS Workshop on Machine Learning on the Phone and other Consumer Devices (MLPCD), 2017.
256
+ [15] Google. Google datacenters efficiency. https://www.google.co.uk/about/ datacenters/efficiency/, 2021. Accessed: January 10, 2022.
257
+ [16] Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic Network Surgery for Efficient DNNs. In Advances in Neural Information Processing Systems (NeuriPS), pages 1387–1395, 2016.
258
+ [17] Pengchao Han, Shiqiang Wang, and Kin K Leung. Adaptive Gradient Sparsification for Efficient Federated Learning: An Online Learning Approach. In IEEE International Conference on Distributed Computing Systems (ICDCS), 2020.
259
+ [18] 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 (NeurIPS), pages 1135–1143, 2015.
260
+ [19] K. Hazelwood et al. Applied Machine Learning at Facebook: A Datacenter Infrastructure Perspective. In IEEE International Symposium on High Performance Computer Architecture (HPCA), 2018.
261
+ [20] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
262
+ [21] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the Knowledge in a Neural Network. In NeurIPS Deep Learning Workshop, 2014.
263
+ [22] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
264
+ [23] Samuel Horváth, Chen-Yu Ho, L’udovít Horváth, Atal Narayan Sahu, Marco Canini, and Peter Richtárik. Natural Compression for Distributed Deep Learning. arXiv preprint arXiv:1905.10988, 2019.
265
+ [24] Samuel Horváth, Aaron Klein, Peter Richtárik, and Cédric Archambeau. Hyperparameter transfer learning with adaptive complexity. In International Conference on Artificial Intelligence and Statistics, pages 1378–1386. PMLR, 2021.
266
+ [25] Samuel Horváth and Peter Richtárik. A Better Alternative to Error Feedback for CommunicationEfficient Distributed Learning. In International Conference on Learning Representations, 2021.
267
+ [26] Kevin Hsieh, Amar Phanishayee, Onur Mutlu, and Phillip Gibbons. The Non-IID Data Quagmire of Decentralized Machine Learning. In International Conference on Machine Learning (ICML), 2020.
268
+ [27] R. Hu, Y. Guo, H. Li, Q. Pei, and Y. Gong. Personalized Federated Learning With Differential Privacy. IEEE Internet of Things Journal (JIOT), 7(10):9530–9539, 2020.
269
+ [28] Andrey Ignatov, Radu Timofte, Andrei Kulik, Seungsoo Yang, Ke Wang, Felix Baum, Max Wu, Lirong Xu, and Luc Van Gool. AI Benchmark: All About Deep Learning on Smartphones in 2019. In International Conference on Computer Vision Workshops (ICCVW), 2019.
270
+ [29] Yuang Jiang, Shiqiang Wang, Bong Jun Ko, Wei-Han Lee, and Leandros Tassiulas. Model Pruning Enables Efficient Federated Learning on Edge Devices. In Workshop on Scalability, Privacy, and Security in Federated Learning (SpicyFL), NeurIPS, 2020.
271
+ [30] Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurélien Bellet, Mehdi Bennis, Arjun Nitin Bhagoji, Keith Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Advances and open problems in federated learning. arXiv preprint arXiv:1912.04977, 2019.
272
+ [31] Sai Praneeth Karimireddy, Satyen Kale, Mehryar Mohri, Sashank Reddi, Sebastian Stich, and Ananda Theertha Suresh. SCAFFOLD: Stochastic Controlled Averaging for Federated Learning. In International Conference on Machine Learning (ICML), 2020.
273
+ [32] Jakub Konecný, H. Brendan McMahan, Felix X. Yu, Peter Richtarik, Ananda Theertha Suresh, ˇ and Dave Bacon. Federated Learning: Strategies for Improving Communication Efficiency. In NeurIPS Workshop on Private Multi-Party Machine Learning, 2016.
274
+ [33] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
275
+ [34] Stefanos Laskaridis, Stylianos I. Venieris, Hyeji Kim, and Nicholas D. Lane. HAPI: HardwareAware Progressive Inference. In International Conference on Computer-Aided Design (ICCAD), 2020.
276
+ [35] Namhoon Lee, Thalaiyasingam Ajanthan, and Philip Torr. SNIP: Single-Shot Network Pruning based on Connection Sensitivity. In International Conference on Learning Representations (ICLR), 2019.
277
+ [36] Daliang Li and Junpu Wang. FedMD: Heterogenous Federated Learning via Model Distillation. In NeurIPS 2019 Workshop on Federated Learning for Data Privacy and Confidentiality, 2019.
278
+ [37] Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning Filters for Efficient ConvNets. In International Conference on Learning Representations (ICLR), 2016.
279
+ [38] Tian Li, Anit Kumar Sahu, Ameet Talwalkar, and Virginia Smith. Federated Learning: Challenges, Methods, and Future Directions. IEEE Signal Processing Magazine, 2020.
280
+ [39] Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated Optimization in Heterogeneous Networks. In Proceedings of Machine Learning and Systems (MLSys), 2020.
281
+ [40] Tian Li, Maziar Sanjabi, Ahmad Beirami, and Virginia Smith. Fair Resource Allocation in Federated Learning. In International Conference on Learning Representations (ICLR), 2020.
282
+ [41] Xiaoxiao Li, Meirui JIANG, Xiaofei Zhang, Michael Kamp, and Qi Dou. Fed{BN}: Federated Learning on Non-{IID} Features via Local Batch Normalization. In International Conference on Learning Representations (ICLR), 2021.
283
+ [42] Paul Pu Liang, Terrance Liu, Liu Ziyin, Nicholas B Allen, Randy P Auerbach, David Brent, Ruslan Salakhutdinov, and Louis-Philippe Morency. Think Locally, Act Globally: Federated Learning with Local and Global Representations. In NeurIPS 2019 Workshop on Federated Learning, 2019.
284
+ [43] Robert LiKamWa and Lin Zhong. Starfish: Efficient Concurrency Support for Computer Vision Applications. In Proceedings of the 13th Annual International Conference on Mobile Systems, Applications, and Services (MobiSys), pages 213–226, 2015.
285
+ [44] Yujun Lin, Song Han, Huizi Mao, Yu Wang, and Bill Dally. Deep Gradient Compression: Reducing the Communication Bandwidth for Distributed Training. In International Conference on Learning Representations (ICLR), 2018.
286
+ [45] Bing Luo, Xiang Li, Shiqiang Wang, Jianwei Huang, and Leandros Tassiulas. Cost-Effective Federated Learning Design. In INFOCOM, 2021.
287
+ [46] Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-Efficient Learning of Deep Networks from Decentralized Data. In Proceedings of the 20th International Conference on Artificial Intelligence and Statistics (AISTATS), 2017.
288
+ [47] H. Brendan McMahan, Daniel Ramage, Kunal Talwar, and Li Zhang. Learning Differentially Private Recurrent Language Models. In International Conference on Learning Representations (ICLR), 2018.
289
+ [48] Luca Melis, Congzheng Song, Emiliano De Cristofaro, and Vitaly Shmatikov. Exploiting Unintended Feature Leakage in Collaborative Learning. In IEEE Symposium on Security and Privacy (SP), pages 691–706, 2019.
290
+ [49] Pavlo Molchanov, Arun Mallya, Stephen Tyree, Iuri Frosio, and Jan Kautz. Importance Estimation for Neural Network Pruning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 11264–11272, 2019.
291
+ [50] Takayuki Nishio and Ryo Yonetani. Client Selection for Federated Learning with Heterogeneous Resources in Mobile Edge. In IEEE International Conference on Communications (ICC), 2019.
292
+ [51] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. PyTorch: An Imperative Style, High-Performance Deep Learning Library. In Advances in Neural Information Processing Systems (NeurIPS), pages 8026–8037, 2019.
293
+ [52] Xinchi Qiu, Titouan Parcollet, Daniel J. Beutel, Taner Topal, Akhil Mathur, and Nicholas D. Lane. A first look into the carbon footprint of federated learning. CoRR, abs/2010.06537, 2020.
294
+ [53] Aditya Rajagopal, Diederik Vink, Stylianos Venieris, and Christos-Savvas Bouganis. MultiPrecision Policy Enforced Training (MuPPET) : A Precision-Switching Strategy for Quantised Fixed-Point Training of CNNs. In Proceedings of the 37th International Conference on Machine Learning (ICML), pages 7943–7952, 2020.
295
+ [54] Oren Rippel, Michael Gelbart, and Ryan Adams. Learning Ordered Representations with Nested Dropout. In International Conference on Machine Learning (ICML), pages 1746–1754, 2014.
296
+ [55] F. Sattler, S. Wiedemann, K. R. Müller, and W. Samek. Robust and Communication-Efficient Federated Learning From Non-i.i.d. Data. IEEE Transactions on Neural Networks and Learning Systems (TNNLS), 31(9):3400–3413, 2020.
297
+ [56] Reza Shokri and Vitaly Shmatikov. Privacy-Preserving Deep Learning. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security (CCS), pages 1310–1321, 2015.
298
+ [57] Sidak Pal Singh and Martin Jaggi. Model Fusion via Optimal Transport. Advances in Neural Information Processing Systems (NeurIPS), 33, 2020.
299
+ [58] Virginia Smith, Chao-Kai Chiang, Maziar Sanjabi, and Ameet S Talwalkar. Federated MultiTask Learning. In Advances in Neural Information Processing Systems (NeurIPS), 2017.
300
+ [59] Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A Simple Way to Prevent Neural Networks from Overfitting. Journal of Machine Learning Research (JMLR), 15(56):1929–1958, 2014.
301
+ [60] Martin J Wainwright, Michael Jordan, and John C Duchi. Privacy Aware Learning. In Advances in Neural Information Processing Systems (NeurIPS), 2012.
302
+ [61] Hongyi Wang, Scott Sievert, Shengchao Liu, Zachary Charles, Dimitris Papailiopoulos, and Stephen Wright. ATOMO: Communication-Efficient Learning via Atomic Sparsification. Advances in Neural Information Processing Systems (NeurIPS), 2018.
303
+ [62] Hongyi Wang, Mikhail Yurochkin, Yuekai Sun, Dimitris Papailiopoulos, and Yasaman Khazaeni. Federated Learning with Matched Averaging. In International Conference on Learning Representations (ICLR), 2020.
304
+ [63] Jianyu Wang, Qinghua Liu, Hao Liang, Gauri Joshi, and H Vincent Poor. Tackling the Objective Inconsistency Problem in Heterogeneous Federated Optimization. Advances in Neural Information Processing Systems (NeurIPS), 2020.
305
+ [64] Kuan Wang, Zhijian Liu, Yujun Lin, Ji Lin, and Song Han. HAQ: Hardware-Aware Automated Quantization with Mixed Precision. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition (CVPR), pages 8612–8620, 2019.
306
+ [65] Shiqiang Wang, Tiffany Tuor, Theodoros Salonidis, Kin K Leung, Christian Makaya, Ting He, and Kevin Chan. Adaptive Federated Learning in Resource Constrained Edge Computing Systems. IEEE Journal on Selected Areas in Communications (JSAC), 37(6), 2019.
307
+ [66] C. Wu et al. Machine Learning at Facebook: Understanding Inference at the Edge. In IEEE International Symposium on High Performance Computer Architecture (HPCA), 2019.
308
+ [67] Zhuliang Yao, Shijie Cao, Wencong Xiao, Chen Zhang, and Lanshun Nie. Balanced Sparsity for Efficient DNN Inference on GPU. In AAAI Conference on Artificial Intelligence (AAAI), volume 33, pages 5676–5683, 2019.
309
+ [68] Mikhail Yurochkin, Mayank Agarwal, Soumya Ghosh, Kristjan Greenewald, Nghia Hoang, and Yasaman Khazaeni. Bayesian Nonparametric Federated Learning of Neural Networks. In International Conference on Machine Learning (ICML), pages 7252–7261. PMLR, 2019.
310
+ [69] Barret Zoph and Quoc Le. Neural Architecture Search with Reinforcement Learning. In International Conference on Learning Representations (ICLR), 2017.
md/train/4i23Bjlh4Y9/4i23Bjlh4Y9.md ADDED
@@ -0,0 +1,561 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # On the Generalization of Neural Networks Trained with SGD: Information-Theoretical Bounds and Implications
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Understanding the generalization behaviour of deep neural networks is an important
11
+ 2 theme of modern research in machine learning. In this paper, we follow up on
12
+ 3 a recent work of Neu [49] and present new information-theoretic upper bounds
13
+ 4 for the generalization error of neural networks trained with SGD. Our bounds and
14
+ 5 experimental study provide new insights on the SGD training of neural networks.
15
+ 6 They also point to a new and simple regularization scheme which we show performs
16
+ 7 comparably to the current state of the art.
17
+
18
+ # 8 1 Introduction
19
+
20
+ 9 The outstanding performance of deep learning has brought to the surface some intriguing properties
21
+ 10 of deep neural networks, one of which is the observation that despite their high capacity, deep neural
22
+ 11 networks tend to generalize well [80]. This contradicts classical wisdom in statistical learning theory
23
+ 12 (e.g., [71] ) and has stimulated intense research interest in understanding the generalization behaviour
24
+ 13 of modern neural networks.
25
+ 14 One theme of research focuses on the study of over-parameterized neural networks, where generaliza
26
+ 15 tion bounds are obtained [22, 1, 6, 50, 52, 53, 2, 3] and a curious “double descent” phenomenon is
27
+ 16 observed and analyzed [9, 46, 78]. New bounding techniques for analyzing generalization have also
28
+ 17 been developed, utilizing information theoretic quantities [64, 65, 77, 5, 13, 69, 23, 7, 4, 30, 84]. The
29
+ 18 bounds provided by these techniques have the advantages of accounting for both the data structure
30
+ 19 and the learning algorithm.
31
+ 20 The generalization ability of neural networks trained with mini-batched stochastic gradient descent
32
+ 21 [61], simply referred to SGD in this paper, has also been widely studied. Specifically, built on a
33
+ 22 connection between stability and generalization [12], a stability-based bound is first presented in [32],
34
+ 23 followed by a surge of research effort exploiting similar approaches [44, 17, 26, 43, 8]. Information
35
+ 24 theoretic bounding techniques have also demonstrated great power in analyzing SGD-like algorithms.
36
+ 25 For example, [55] is the first to utilize information-theoretical bound in analyzing the generalization
37
+ 26 ability of SGLD [28, 74]. The bound was subsquently improved by [47, 31, 62, 72]. Inspired by the
38
+ 27 work of [55], [49] presents an information- theoretic analysis of the models trained with SGD. The
39
+ 28 analysis of [49] constructs an auxiliary weight process parallel to SGD training and upper-bounds the
40
+ 29 generalization error through this auxiliary process.
41
+ 30 Another line of research connects the generalization of neural networks with the flatness of loss
42
+ 31 minima [35] found by SGD or its variant [40, 20, 24, 51, 16, 37, 38, 83, 27]. This understanding
43
+ 32 has led to the discovery of new SGD-based training algorithms for improved generalization. For
44
+ 33 example, in a concurrent development by [83] and [27], a local “max-pooling” operation is applied to
45
+ 34 the loss landscape prior to the SGD updates. This approach, referred to as AMP[83] or SAM[27], is
46
+ 35 shown to make SGD favor flatter minima and achieve the state-of-the-art performance among various
47
+ 36 competitive regularization schemes [83].
48
+ 37 In this paper, we focus on investigating the generalization of neural networks trained with SGD.
49
+ 38 We build upon the work of [49]. Following the same construction of the auxiliary weight process
50
+ 39 in [49], we present upper bounds of generalization error that improve upon [49] in two ways. The
51
+ 40 first improvement is via removing an unnecessary term in the bounds of [49] by invoking the HWI
52
+ 41 inequality [60]. The second improvement is via replacing a sample-level mutual information term in
53
+ 42 [49] with an instance-level mutual information term, exploiting a recent result of [13]. The bounds we
54
+ 43 obtain decompose into two terms, one measuring the impact of training trajectories (“the trajectory
55
+ 44 term”) and the other measuring the impact of the flatness of the found solution (“the flatness term”).
56
+ 45 We empirically validate the derived bounds. Various insights are also obtained experimentally
57
+ 46 concerning the generalization of neural networks under SGD training. For example, the batch size of
58
+ 47 SGD appears to impact the trajectory term and the flatness term in opposite ways, which complicates
59
+ 48 the overall dependency of generalization error on batch sizes. A particular interesting observation
60
+ 49 from our experiments is that a key quantity arising in the trajectory term of the bounds, which we
61
+ 50 refer to as gradient dispersion1, reveals a double descent phenomenon with respect to training epochs.
62
+ 51 Most intriguingly, the valley in the double descent curve appears to mark the great divide between the
63
+ 52 “generalization regime” and the “memorization regime” of training. Furthering from this observation,
64
+ 53 we also show that it is possible to reduce the memorization effect by dynamically clipping the gradient
65
+ 54 and reducing its dispersion.
66
+ 55 Our bounds also inspire a natural and simple solution to alleviate generalization error. Specifically,
67
+ 56 we propose a new training scheme, referred to as Gaussian model perturbation (GMP), aiming at
68
+ 57 reducing the flatness term of the bounds. This scheme effectively applies a local “average pooling” to
69
+ 58 the empirical risk surface prior to SGD, greatly resembling the “max-pooling” approach adopted in
70
+ 59 AMP[83]. We demonstrate experimentally that GMP achieves a competitive performance with the
71
+ 60 current art of regularization schemes.
72
+
73
+ Length constraints precludes elaboration at places. The reader is referred to supplementary materials for proofs and additional information.
74
+
75
+ 63 Other Related Literature Gradient dispersion is mostly studied from optimization perspectives[11,
76
+ 64 63, 39, 75, 25]. Prior to this work, only a few works relate gradient dispersion with the generalization
77
+ 65 behaviour of the networks. In [49, 72], gradient dispersion also appears in the generalization bounds.
78
+ 66 In [38], gradient dispersion is argued to capture a notion of “flatness” of the local minima of the loss
79
+ 67 landscape, thereby correlating with generalization.
80
+ 68 Injecting noise in the training process has been proposed in various regularization schemes, for
81
+ 69 example, [10, 14, 15, 68, 73]. But unlike the Gaussian model perturbation scheme derived in this
82
+ 70 paper, where noise is injected to the model parameters, noise in those schemes is injected either to
83
+ 71 the training data or to the network activation.
84
+ 72 Gradient clipping is a common technique for preventing gradient exploding (see, e.g., [45, 56]).
85
+ 73 This technique is also used in [82] to accelerate training. In this paper, gradient clipping is used to
86
+ 74 investigate and control the impact of gradient dispersion on generalization error.
87
+
88
+ # 75 2 Preliminaries
89
+
90
+ Population Risk, Empirical Risk and Generalization Error Unless otherwise noted, a random variable will be denoted by a capitalized letter (e.g., $Z$ ), and its realization denoted by the corresponding lower-case letter (e.g. $z$ ). Let $\mathcal { Z }$ be the instance space of interest and $\mu$ be an unknown distribution on $\mathcal { Z }$ , specifying random variable $Z$ . Let $\mathcal { W } \subseteq \bar { \mathbb { R } } ^ { d }$ be the space of hypotheses. Suppose that a training sample ${ \bar { S } } = ( Z _ { 1 } , Z _ { 2 } , \ldots , Z _ { n } )$ is drawn i.i.d. from $\mu$ and that a stochastic learning algorithm $\mathcal { A }$ takes $S$ as its input and outputs a hypothesis $W \in { \mathcal { W } }$ according to some conditional distribution $P _ { W | S }$ mapping ${ \mathcal { Z } } ^ { n }$ to $\mathcal { W }$ . Let $\ell : \mathcal { W } \times \mathcal { Z } \to \mathbb { R } ^ { + }$ be a loss function, where $\ell ( w , z )$ measures the “unfitness” or “error” of any $z \in { \mathcal { Z } }$ with respect to a hypothesis $w \in \mathcal W$ . The population risk, for any
91
+
92
+ $$
93
+ L _ { \mu } ( w ) \triangleq \mathbb { E } _ { Z \sim \mu } [ \ell ( w , Z ) ] .
94
+ $$
95
+
96
+ 85 The goal of learning is to find a hypothesis $w$ that minimizes the population risk. But since $\mu$ is only
97
+ 6 partially accessible via the sample $S$ , in practice, we instead turn to the empirical risk, defined as
98
+
99
+ $$
100
+ L _ { S } ( w ) \triangleq { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } \ell ( w , Z _ { i } ) .
101
+ $$
102
+
103
+ 87 The expected generalization error of the learning algorithm $\mathcal { A }$ is then defined as
104
+
105
+ $$
106
+ \mathrm { g e n } ( \mu , P _ { W | S } ) \triangleq \mathbb { E } _ { W , S } [ L _ { \mu } ( W ) - L _ { S } ( W ) ] ,
107
+ $$
108
+
109
+ where the expectation is taken over the joint distribution of 88 $( S , W )$ (i.e., $\mu ^ { n } \otimes P _ { W | S } )$ .
110
+
111
+ 89 Throughout this paper, we take $\ell$ as a continuous function (adopting the usual notion “surrogate loss”
112
+ 90 [66].). Additionally, we assume that $\ell$ is differentiable almost everywhere with respect to both $w$ and
113
+ 91 $z$ . Furthermore we assume that $\ell ( w , Z )$ is $R$ -subgaussian2 for any $w \in \mathcal { W }$ . Note that a bounded loss
114
+ 92 is guaranteed to be subgaussian for all $\mu$ and all $w \in \mathcal { W }$ . Let $I ( X ; Y )$ denote the mutual information
115
+ 93 [18] between any pair of random variables $( X , Y )$ . The following results are known.
116
+
117
+ 94 Lemma 1 ([77, Theorem 1.]). The expected generalization error of algorithm $\mathcal { A }$ is bounded by
118
+
119
+ $$
120
+ | \mathrm { g e n } ( \mu , P _ { W | S } ) | \leq \sqrt { \frac { 2 R ^ { 2 } } { n } I ( W ; S ) } ,
121
+ $$
122
+
123
+ 95
124
+
125
+ 96 Lemma 2 ([13, Proposition 1.]). The expected generalization error of algorithm $\mathcal { A }$ is bounded by
126
+
127
+ $$
128
+ | \mathrm { g e n } ( \mu , P _ { W | S } ) | \leq \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \sqrt { 2 R ^ { 2 } I ( W ; Z _ { i } ) } ,
129
+ $$
130
+
131
+ 97
132
+
133
+ 98 Stochastic Gradient Descent We now restrict the learning algorithm $\mathcal { A }$ to be the mini-batched
134
+ 99 stochastic gradient descent (SGD) algorithm for empirical risk minimization. For each training epoch,
135
+ 100 the dataset $S$ is randomly split into $m$ disjoint mini-batches, each having size $b$ , namely, $n = m b$ .
136
+ 101 Based on each batch, one parameter update is performed. Specifically, let $B _ { t }$ denote the batch used
137
+ 102 for the $t ^ { \mathrm { t h } }$ update. Define
138
+
139
+ $$
140
+ g ( w , B _ { t } ) \triangleq \frac { 1 } { b } \sum _ { z \in B _ { t } } \nabla _ { w } \ell ( w , z ) ,
141
+ $$
142
+
143
+ 103 namely, $g ( w , B _ { t } )$ is the average gradient computed for the batch $B _ { t }$ with respect to parameter $w$ . The rule for the 104 $t ^ { \mathrm { t h } }$ parameter update is then
144
+
145
+ $$
146
+ W _ { t } \triangleq W _ { t - 1 } - \lambda _ { t } g ( W _ { t - 1 } , B _ { t } ) ,
147
+ $$
148
+
149
+ 105 where $\lambda _ { t }$ is the learning rate at the step $t$ . The initial parameter setting $W _ { 0 }$ is assumed to be drawn
150
+ 106 from the zero-mean spherical Gaussian $\mathcal { N } ( 0 , \sigma _ { 0 } ^ { 2 } \mathbf { I } _ { d } )$ with variance $\sigma _ { 0 } ^ { 2 }$ in each dimension. We will
151
+ 107 assume that the SGD algorithm stops after $T$ updates and outputs $W _ { T }$ as the learned model parameter.
152
+ 108 Given the training sample $S$ , let $\xi$ govern the randomness in the sequence $( B _ { 1 } , B _ { 2 } , \ldots , B _ { T } )$ of
153
+ 109 batches. For the simplicity of notion, we will fix the configuration of $\xi$ . That is, we will assume a
154
+ 110 fixed “batching trajectory”, or a fixed way to shuffle the example indices $\{ 1 , \ldots , n \}$ and divide them
155
+ 111 into $m$ batches in each epoch. The presented generalization bounds of this paper can be extended
156
+ 112 to the case where the batching trajectory is uniformly random (as we set up above). This merely
157
+ 113 involves averaging over all batching trajectories or taking expectation over $\xi$ .
158
+ 114 Auxiliary Weight Process We now associate with the SGD algorithm an auxiliary weight process
159
+ 115 $\{ \widetilde { W _ { t } } \}$ . Let $\sigma ^ { 2 }$ be given, and let $\sigma _ { 1 } , \sigma _ { 2 } , \ldots , \sigma _ { T }$ be a sequence of positive real numbers. Define
160
+
161
+ $$
162
+ \widetilde { W } _ { 0 } \triangleq W _ { 0 } , \quad \mathrm { a n d } \widetilde { W } _ { t } \triangleq \widetilde { W } _ { t - 1 } - \lambda _ { t } g ( W _ { t - 1 } , B _ { t } ) + N _ { t } , \mathrm { f o r } t > 0 ,
163
+ $$
164
+
165
+ where 116 $N _ { t } \sim \mathcal N ( 0 , \sigma _ { t } ^ { 2 } \mathbf I _ { d } )$ is a Gaussian noise. The relationship between this auxiliary weight process 117 $\{ \widetilde { W _ { t } } \}$ and the weight process $\{ W _ { t } \}$ in SGD is shown in the Bayesian network below.
166
+
167
+ 118
168
+
169
+ $$
170
+ \begin{array} { r l r l r l r l r l r l r l r } & { } & & { N _ { 1 } } & & { N _ { 2 } } & & { \cdots } & & { N _ { T - 1 } } & & { N _ { T } } \\ & { } & & { \downarrow } & & { \downarrow } & & { } & & { \downarrow } & & { \downarrow } & & { \downarrow } \\ { \widetilde { W } _ { 0 } } & { } & { \widetilde { W } _ { 1 } } & { } & { \widetilde { W } _ { 2 } } & { } & { \cdots } & { } & { \widetilde { W } _ { T - 1 } } & { } & { \widetilde { W } _ { T } } \\ { \parallel } & { \nearrow } & { } & { \chi } & { \chi } & { \nearrow } & { \dots } & { } & { \dots } & { } & { W _ { T } } \\ { W _ { 0 } } & { } & { W _ { 1 } } & { } & { W _ { 2 } } & { } & { \cdots } & { } & { W _ { T - 1 } } & { } & { W _ { T } } \end{array}
171
+ $$
172
+
173
+ 119 Let $\begin{array} { r } { \Delta _ { t } = \sum _ { \tau = 1 } ^ { t } N _ { \tau } } \end{array}$ . Noting that the weight updates in $\{ \widetilde { W } _ { t } \}$ uses the same gradient signal as that
174
+ 120 used in $\{ W _ { t } \}$ (which depends on $W _ { t - 1 }$ not $\widetilde { W } _ { t - 1 } )$ ), it is immediate that $\widetilde { W } _ { t } = W _ { t } + \Delta _ { t }$ . Note that this
175
+ 121 auxiliary process follows the same construction as [49], which we will use to study the generalization
176
+ 122 error of SGD.
177
+
178
+ 123 To that end, define gradient dispersion at parameter $w$ by
179
+
180
+ $$
181
+ \mathbb { V } ( w ) \triangleq \mathbb { E } \left[ | | \nabla _ { w } \ell ( w , Z ) - \mathbb { E } \left[ \nabla _ { w } \ell ( w , Z ) \right] | | _ { 2 } ^ { 2 } \right] ,
182
+ $$
183
+
184
+ 124 where the expectation is taken over $Z \sim \mu$ .
185
+
186
+ For a given sample 125 $s \in \mathcal { Z } ^ { n }$ , define
187
+
188
+ $$
189
+ \gamma ( w , s ) \triangleq \mathbb { E } \left[ L _ { s } ( w + \Delta _ { T } ) - L _ { s } ( w ) \right] ,
190
+ $$
191
+
192
+ 26 where the expectation is taken over $\Delta _ { T }$ and $L _ { s } ( w )$ is the empirical risk of $s$ at parameter $w$ .
193
+
194
+ In the remainder of the paper, let 127 $S ^ { \prime }$ denote another sample drawn from $\mu ^ { n }$ , independent of all other 128 random variables. The main generalization bound in [49] is re-stated below.
195
+
196
+ 129 Lemma 3 ([49, Theorem 1.]). The generalization error of SGD is upper bounded by
197
+
198
+ $$
199
+ \left| \mathrm { g e n } ( \mu , P _ { W _ { T } | S } ) \right| \leq \sqrt { \frac { 2 R ^ { 2 } } { n } \sum _ { t = 1 } ^ { T } \frac { \lambda _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \mathbb { E } \left[ \Psi ( W _ { t - 1 } ) + \frac { \Psi ( W _ { t - 1 } ) } { b } \right] } + \left| \mathbb { E } \left[ \gamma ( W _ { T } , S ) - \gamma ( W _ { T } , S ^ { \prime } ) \right] \right| ,
200
+ $$
201
+
202
+ $$
203
+ \begin{array} { r } { \Psi ( w _ { t - 1 } ) \triangleq \mathbb { E } \left[ | | \nabla _ { w } \ell ( w _ { t - 1 } , Z ) - \nabla _ { w } \ell ( w _ { t - 1 } + \zeta , Z ) | | _ { 2 } ^ { 2 } \right] a n d \zeta \sim \mathcal { N } ( 0 , 2 \sum _ { i = 1 } ^ { t - 1 } \sigma _ { i } ^ { 2 } \mathrm { I } _ { d } ) . } \end{array}
204
+ $$
205
+
206
+ The term $\Psi ( w _ { t - 1 } )$ in the bound is referred to as “local gradient sensitivity” in [49].
207
+
208
+ # 3 New Generalization Bounds for SGD
209
+
210
+ 133 We first prove that the generalization bound in Lemma 3 can be tightened by removing the local
211
+ 134 gradient sensitivity term $\Psi ( w _ { t - 1 } )$ . The key observation is that an independence condition used for
212
+ 135 establishing Lemma 3 in [49] is unnecessary (see Lemma 4 in [49]). This requires invoking a vector
213
+ 136 version of the HWI inequality [60, Lemma 3.4.2], which we prove in this paper.
214
+
215
+ Lemma 4. Let37 $X$ and $Y$ be two random vectors in $\mathbb { R } ^ { d }$ , and let $\boldsymbol { N } \sim \mathcal { N } ( 0 , \mathbf { I } _ { d } )$ be independent of 38 $( X , Y )$ . Then, for every $t > 0$ , $\begin{array} { r } { \mathrm { D } _ { \mathrm { K L } } \big ( P _ { X + \sqrt { t } N } | | P _ { Y + \sqrt { t } N } \big ) \leq \frac { 1 } { 2 t } \mathbb { E } \left[ | | X - Y | | ^ { 2 } \right] } \end{array}$ .
216
+
217
+ 39 Here $\mathrm { D } _ { \mathrm { K L } }$ is the KL divergence. Note that the bound in Lemma 3 relies on a similar result which
218
+ 40 however requires the independence of $X$ and $Y$ . Using Lemma 4, we obtain the following theorem.
219
+
220
+ 141 Theorem 1. The generalization error of SGD is upper bounded by
221
+
222
+ $$
223
+ \left| \mathrm { g e n } ( \mu , P _ { W _ { T } | S } ) \right| \le \sqrt { \frac { 2 R ^ { 2 } } { n b } \sum _ { t = 1 } ^ { T } \frac { \lambda _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \mathbb { E } \left[ \mathbb { V } ( W _ { t - 1 } ) \right] } + \left| \mathbb { E } \left[ \gamma ( W _ { T } , S ) - \gamma ( W _ { T } , S ^ { \prime } ) \right] \right| .
224
+ $$
225
+
226
+ 143 The proof of this theorem, as the bounds in [49], relies on Lemma 1 and the sample-level mutual
227
+ 144 information bound therein. This theorem can be further tightened by exploiting the fact that the
228
+ 145 instance-level mutual information bound in Lemma 2 is in fact tighter than the sample-level mutual
229
+ 146 information bound in Lemma 1, as shown in [13]. The main ingredient to proceed in this direction is
230
+ 147 the following lemma.
231
+ Lemma 5. Le148 $\begin{array} { r } { \ d _ { t } G _ { t } = - \lambda _ { t } g ( W _ { t - 1 } , B _ { t } ) . \ d H _ { t } Z _ { i } \in B _ { t } , t h e n I ( G _ { t } + N _ { t } ; Z _ { i } | \widetilde W _ { t - 1 } ) \le \frac { \lambda _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } b ^ { 2 } } \mathbb { E } \left[ \mathbb { V } ( W _ { t - 1 } ) \right] . } \end{array}$
232
+ 49
233
+ 150 In this lemma, the mutual information $I ( G _ { t } + N _ { t } ; Z _ { i } | \widetilde { W } _ { t - 1 } )$ roughly indicates the degree by which
234
+ 151 the SGD’s updating signal $G _ { t }$ (smoothed with noise) depends on an individual training instance
235
+ 152 $Z _ { i }$ , when $Z _ { i }$ is used for computing the gradient. When this dependency is strong (giving rise to a
236
+ 153 high value of the mutual information), the model conceivably tends to overfit the individual training
237
+ 154 instances. This lemma suggests that the strength of this dependency can be upper-bounded by the
238
+ 155 expected gradient dispersion at the current weight configuration. In our experiments, we will estimate
239
+ 156 the expected gradient dispersion and validate this intuition.
240
+ 157 It is remarkable that the noise $\{ N _ { t } \}$ plays an important role for the bound to hold. To see this,
241
+ 158 consider $b = 1$ and $\mathcal { Z }$ is countable and large. Then $\bar { I } ( G _ { t } ; Z _ { t } | W _ { t - 1 } )$ is merely the conditional entropy
242
+ 159 $H ( Z _ { i } | W _ { t - 1 } )$ , which would grow with sample size $n$ at least as $\log n$ . Upper-bounding it with a
243
+ 160 quantity independent of $n$ would be impossible – This justifies the construction of the auxiliary
244
+ 161 weight process.
245
+ 162 We now state our main theorem. Unlike Theorem 1, which considers a random batching trajectory,
246
+ 163 this theorem considers a fixed batching trajectory to keep the expression less cluttered. For that
247
+ 164 batching trajectory, we will use $\mathcal { T } _ { i }$ to denote the set of indices of batches $B _ { t }$ containing instance $Z _ { i }$ .
248
+
249
+ 165 Theorem 2. The expected generalization error of SGD is bounded by
250
+
251
+ $$
252
+ \left| \mathrm { g e n } ( \mu , P _ { W _ { T } | S } ) \right| \leq \frac { R } { n b } \sum _ { i = 1 } ^ { n } \sqrt { \sum _ { t \in { \mathcal T } _ { i } } \frac { 2 \lambda _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \mathbb { E } \left[ \mathbb { V } ( W _ { t - 1 } ) \right] } + \left| \mathbb { E } \left[ \gamma ( W _ { T } , S ) - \gamma ( W _ { T } , S ^ { \prime } ) \right] \right| .
253
+ $$
254
+
255
+ 167 With an additional assumption, the second term in the bound can be re-expressed, as shown in the
256
+ 168 following corollary.
257
+
258
+ 169 Corollary 1. Assume $L _ { \mu } ( w _ { T } ) \leq \mathbb { E } _ { \Delta } \left[ L _ { \mu } ( w _ { T } + \Delta _ { T } ) \right]$ , then the following holds,
259
+
260
+ $$
261
+ \mathrm { g e n } ( \mu , P _ { W r | S } ) \leq \frac { R } { n b } \sum _ { i = 1 } ^ { n } \sqrt { \sum _ { t \in \mathcal { T } _ { i } } \frac { 2 \lambda _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \mathbb { E } \left[ \mathbb { V } ( W _ { t - 1 } ) \right] } + \frac { \sum _ { t = 1 } ^ { T } \sigma _ { t } ^ { 2 } } { 2 } \mathrm { T r } \left( \mathbb { E } \left[ \mathrm { H } _ { W _ { T } } ( Z ) \right] \right) ,
262
+ $$
263
+
264
+ where 170 $\mathrm { H } _ { W _ { T } }$ is the Hessian matrix of the loss with respect to $W _ { T }$ and $\operatorname { T r } ( \cdot )$ denotes trace.
265
+
266
+ 171 Corollary 1 follows directly from the second order Taylor expansion of the second term in the bound
267
+ 172 of Theorem 2. The condition $L _ { \mu } ( w _ { T } ) \leq \mathbb { E } _ { \Delta } \left[ L _ { \mu } ( \hat { w _ { T } } + \bar { \Delta _ { T } } ) \right]$ indicates that the perturbation does
268
+ 173 not decrease the population risk. This is also assumed in [27] in the derivation of a PAC-Bayesian
269
+ 174 generalization bound.
270
+ 175 Notably, in the bound of Theorem 2, the first term captures the impact of the training trajectory
271
+ 176 (“trajectory term”), and the second term captures the impact of the final solution. As seen in Corollary
272
+ 177 1, this term in fact measures the flatness for the loss landscape at the found solution (“flatness term”).
273
+ 178 The previous bound of [49] (Lemma 3) and its tightened version in Theorem 1 also similarly contain a
274
+ 179 trajectory term and a flatness term. Despite that the flatness term there are identical to that in Theorem
275
+ 180 2, we now show the trajectory term in Theorem 2 does improve on its counter-part in Theorem 1.
276
+ 181 Lemma 6. Assume the instances are sampled without replacement in every epoch. Then the trajectory
277
+ 182 term in Theorem 2 is upper-bounded by
278
+
279
+ $$
280
+ \operatorname* { m i n } \left\{ \frac { R } { n } \sum _ { t = 1 } ^ { T } \sqrt { \frac { 2 \lambda _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \mathbb { E } \left[ \mathbb { V } ( W _ { t - 1 } ) \right] } , \sqrt { \frac { 2 R ^ { 2 } } { n b } \sum _ { t = 1 } ^ { T } \frac { \lambda _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \mathbb { E } \left[ \mathbb { V } ( W _ { t - 1 } ) \right] } \right\} .
281
+ $$
282
+
283
+ 184 The condition in Lemma 6 is usually satisfied in practice. This lemma then immediately implies that
284
+ 185 the trajectory term in Theorem 2 is no worse than that in Theorem 1. Incorporating this result, if we
285
+ 186 restrict the smoothness of the loss function $\ell$ , we may obtain another version of the generalization
286
+ 187 bound (although the flatness term therein is expected to be looser than that in Corollary 1).
287
+ 188 Corollary 2. If the loss function is differentiable and $\beta$ -smooth with respect to $w$ , then under the
288
+ 189 condition of Lemma ${ \it 6 }$ ,
289
+
290
+ $$
291
+ \mathrm { g e n } ( \mu , P _ { W _ { T } | S } ) | \leq \operatorname* { m i n } \left\{ \frac { R } { n } \sum _ { t = 1 } ^ { T } \sqrt { \frac { 2 \lambda _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \mathbb { E } \left[ \mathbb { V } ( W _ { t - 1 } ) \right] } , \sqrt { \frac { 2 R ^ { 2 } } { n b } \sum _ { t = 1 } ^ { T } \frac { \lambda _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \mathbb { E } \left[ \mathbb { V } ( W _ { t - 1 } ) \right] } \right\} + \beta d \sum _ { t = 1 } ^ { T } \sigma _ { t } ^ { 2 } .
292
+ $$
293
+
294
+ 191 To conclude, we remark that these bounds suggest that in order for the model to generalize well, both
295
+ 192 the trajectory term and the flatness term need to be small — the former involves the interaction of the
296
+ 193 learning rate and batch size with the gradient dispersion along the training trajectory, whereas the
297
+ 194 latter depends on the flatness of the empirical risk surface at the found solution.
298
+
299
+ # 195 4 Experimental Study
300
+
301
+ 196 Bound Verification We first verify our bound in Corollary 1 by training an MLP (with one hidden
302
+ 197 layer) and an AlexNet [42] on MNIST and CIFAR10 [41], respectively. To simplify estimation, we
303
+ 198 fix the weight initialization and set $\sigma _ { t }$ and $\lambda _ { t }$ to be constants $\sigma$ and $\lambda$ , respectively. To compute
304
+ 199 $\textstyle \sum _ { i = 1 } ^ { n } { \sqrt { \sum _ { t \in { \mathcal { T } } _ { i } } \mathbb { E } \left[ \mathbb { V } ( W _ { t - 1 } ) \right] } }$ , we compute the gradient dispersion as its empirical estimate from a
305
+ 200 batch, utilizing a PyTorch [54] library BackPack [19]. To compute $\mathrm { T r } \left( \mathbb { E } \left[ \mathrm { H } _ { W _ { T } } ( Z ) \right] \right)$ , we randomly
306
+ 201 sample $10 \%$ of the training data and use the PyHessian library [79] to compute the Hessian. Since
307
+ 202 every choice of $\sigma$ gives a valid generalization bound in Corollary 1, we need to find the optimal
308
+ 203 $\sigma$ , which gives the tightest bound. This can be done by simply utilizing the fact $A / \sigma + \bar { \sigma ^ { 2 } } B \geq$
309
+ 204 $3 ( A / 2 ) ^ { 2 / 3 } B ^ { 1 / 3 }$ for any positive $A$ and $B$ , where the equality is achieved by the optimal $\sigma$ . We set
310
+ 205 the sub-gaussian parameter $R = 0 . 1$ . The implementation in this paper is on PyTorch, and all the
311
+ 206 experiments are carried out on NVIDIA Tesla V100 GPUs (32 GB).
312
+ 207 We perform experiments with varying network width and varying levels of label noise. Specifically,
313
+ 208 label noise level $\epsilon$ refers to the setting where we replace the labels of $\epsilon$ fraction of the training and
314
+ 209 testing instances with random labels. The estimated bound is compared against the true generalization
315
+ 210 gap, namely, the difference between the training loss and testing loss, and is shown in Figure 1.
316
+ 211 In Figure 1, we see that in all cases the estimated bound follows closely the trend of the true
317
+ 212 generalization gap. The fact that the bound curve consistently tracks the gap curve under various
318
+ 213 label noise levels indicates that our bound very well captures the changes of the data distribution.
319
+ 214 Note that in Figure 1 (a) and (b), our bound decays with the increase of the model size, showing a
320
+ 215 trend as opposite to the bounds obtained in classical learning theory. But such a trend clearly better
321
+ 216 explains the generalization behaviour of modern neural networks.
322
+ 217 Learning Rate and Batch Size. The learning rate and batch size in SGD have explicitly appeared
323
+ 218 in the trajectory term of the bound in Theorem 2. From the way they appear in the bound, one may be
324
+ 219 tempted to assert that a small learning rate or large batch size will improve generalization. This would
325
+ 220 then contradict some previous observations [37, 76, 33], in which increasing the ratio of learning rate
326
+ 221 to batch size will benefit generalization. We now investigate this by performing experiments with
327
+ 222 varying learning rates and batch sizes. In our experiments, the model is continuously updated until
328
+ 223 the average training loss drops below 0.0001. We separate trajectory and flatness terms of the bound
329
+ 224 and plot them in Figure 2.
330
+ 225 A key observation in Figure 2 is that the learning rate impacts the trajectory term and the flatness term
331
+ 226 in opposite ways, as seen, for example, in (a) and (b), where the two set of curves swap their orders in
332
+ 227 the two figures. On the other hand, the batch size also impacts the two terms in opposite ways, as seen
333
+ 228 in (a) and (b) where curves decrease in (a) but increase in (b). This makes the generalization bound,
334
+ 229 i.e., the sum of the two terms, have a rather complex relationship with the settings of learning rate
335
+ 230 and batch size. This relationship is further complicated by the fact that a small learning rate requires
336
+ 231 a longer training time, or a larger number $T$ of training iterations, which increases the number that
337
+ 232 are summed over in the trajectory term. Nonetheless, we do observe that a smaller batch size gives a
338
+ 233 lower value of the flatness term ((b) and (d)), confirming the previous wisdom that small batch sizes
339
+ 234 enable the neural network to find a flat minima [40].
340
+ 235 Double Descent of Gradient Dispersion We experimentally investigate the impact of gradient
341
+ 236 dispersion on the training of the neural networks by fixing the learning rate, batch size and weight
342
+ 237 initialization for the each model (MLP for MNIST, AlexNet for CIFAR10). For each model and
343
+ 238 various label noise levels, we plot in Figure 3 the evolution of the (empirical) gradient dispersion
344
+ 239 $\widehat { \mathbb { V } } ( \boldsymbol { w } _ { t } )$ , training accuracy and testing accuracy across training epochs.
345
+
346
+ ![](images/e2845eede1a36c96ff767cc3b2a3b3b932b49c4abdcf63f4d16e3823ae0705ae.jpg)
347
+ Figure 1: Estimated bound and empirical generalization gap (“gap”) as functions of network width ((a) and (b)) and label noise level ((c) and (d)). Left Y-axis: gap value; right Y-axis: bound value.
348
+
349
+ ![](images/d7ecfa641ada864e8b7f67d14386df264cd5899c6554078a3f5f55e475c4a3a6.jpg)
350
+ Figure 2: The impact of learning rate and batch size on the trajectory term and the flatness term.
351
+
352
+ ![](images/0a762b53a3615ccaa00fe726062e74cdfffe11afbda1cbd432bd3e98a7ce576c.jpg)
353
+ Figure 3: Epoch-wise double descent of gradient dispersion, in relation to training/testing accuracies.
354
+
355
+ An intriguing epoch-wise “double descent” phenomenon is observed, particularly when the labels are noisy. According to the double descent curve, the training may be split into three phases (e.g., Figure 3 (h)). In the first phase, the gradient dispersion rapidly descends and maintains a very low level. In this phase, both training and test accuracies increase while maintaining a very small generalization gap. This suggests that the network in this phase is extracting useful patterns and generalizes well. In the second phase, the gradient dispersion starts increasing until it reaches a peak value. In this phase, the training and testing accuracies gradually diverge, marking the model entering an overfitting or “memorization” regime – when the data contains the noisy labels, the network mostly tries to memorize the labels in the training set. In the third phase, the gradient dispersion descends again, reaching a low value. In this phase, the model continuously overfits the training data, until the training and testing curves reach their respective maximum and minimum. It appears that the timing of the three phases depends on the dataset and the label noise level. For simpler data (e.g. MNIST) and cleaner datasets (e.g. CIFAR10 with low label noise), the first phase may be shorter. This is arguably because in these datasets, extracting useful patterns is relatively easier. Nonetheless, the valley in the double-descent curve appears to mark a “great divide” between generalization and memorization.
356
+
357
+ 255 Dynamic Gradient Clipping Inspired by our generalization bounds and above observations, one
358
+ 256 way to reduce the generalization error is to control the trajectory term of the bounds by reducing the
359
+ 257 gradient dispersion in each training step. Here we investigate a simple scheme that dynamically clips
360
+ 258 the gradient norm so as to reduce the gradient dispersion. Specifically, whenever the current gradient
361
+ 259 norm is larger than the gradient norm $K$ steps earlier, or $| | g ( W _ { t } , B _ { t } ) | | _ { 2 } > | | g ( W _ { t - K } , B _ { t - K } ) | | _ { 2 }$ (i.e.,
362
+ 260 the model is expected to have entered the “memorization” regime), we reduce the norm of the current
363
+ 261 gradient $g ( W _ { t } , B _ { t } )$ to $\alpha$ fraction of $| | g ( W _ { t - K } , B _ { t - K } ) | | _ { 2 }$ , for some prescribed value $\alpha < 1$ . The
364
+ 262 effectiveness of this scheme is best demonstrated when the labels contain noise. As shown in Figure
365
+ 263 4, dynamic gradient clipping significantly closes the gap between the training accuracy and the testing
366
+ 264 accuracy. The models trained with this scheme maintain a near-optimal testing accuracy (e.g., about
367
+ 265 $80 \%$ when the label noise level of MNIST is 0.2), without suffering from the severe memorization
368
+ 266 effect as seen in models trained without this scheme. Further understanding of the double-descent
369
+ 267 phenomenon of the gradient dispersion may enable more delicate design of such a dynamic clipping
370
+ 268 scheme and potentially lead to novel and powerful regularization techniques.
371
+
372
+ ![](images/3f2a6039b469e6c40083c61a8febb3a68d18c39f1c50dc01325222b7551f9afc.jpg)
373
+ Figure 4: Dynamic Gradient Clipping.
374
+
375
+ # 269 5 A Practical Implication: Gaussian Model Perturbation
376
+
377
+ 270 The appearance of the flatness term in our generalization bounds suggests that for an empirical
378
+ 271 risk minimizer $w ^ { * }$ to generalize well, it is necessary that the empirical risk surface at $w ^ { * }$ is flat,
379
+ 272 or insensitive to a small perturbation of $w ^ { * }$ . This naturally motivates a training scheme using the
380
+ 273 following regularized loss:
381
+
382
+ $$
383
+ \operatorname* { m i n } _ { w } L _ { s } ( w ) + \rho \operatorname* { l g } _ { \Delta \sim \mathcal { N } ( 0 , \sigma ^ { 2 } \mathbf { I } _ { d } ) } [ L _ { s } ( w + \Delta ) - L _ { s } ( w ) ] ,
384
+ $$
385
+
386
+ 274 where $\rho$ is a hyper-parameter. Replacing the expectation above with its stochastic approximation
387
+ 275 using $k$ realizations of $\Delta$ gives rise to the following optimization problem.
388
+
389
+ $$
390
+ \operatorname* { m i n } _ { w } \frac { 1 } { b } \sum _ { z \in B } \left( ( 1 - \rho ) \ell ( w , z ) + \rho \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \left( \ell ( w + \delta _ { i } , z ) \right) \right) .
391
+ $$
392
+
393
+ 276 We refer to the SGD training scheme using this loss as Gaussian model perturbation or GMP. Notably,
394
+ 277 GMP requires $k + 1$ forward passes for every parameter update. Empirical evidence shows that a
395
+ 278 small $k$ , for example, $k = 3$ , already gives competitive performance. Implementing the $k + 1$ forward
396
+ 279 passes on parallel processors further reduces the computation load.
397
+ 280 We experimentally compare GMP with several major regularization schemes in the current art, includ
398
+ 281 ing Dropout [68], label smoothing [70], Flooding [36], MixUp [81], adversarial training [29], and
399
+ 282 AMP [83]. The compared schemes are evaluated on three popular benchmark image classification
400
+ 283 datasets SVHN [48], CIFAR-10 and CIFAR-100 [41]. Two representative deep architectures PreAc
401
+ 284 tResNet18 [34] and VGG16 [67] are taken as the underlying model. We train the models for 200
402
+ 285 epochs by SGD. The learning rate is initialized as 0.1 and divided by 10 after 100 and 150 epochs.
403
+ 286 For all compared models, the batch size is set to 50 and weight decay is set to $1 0 ^ { - 4 }$ . For GMP, we
404
+ 287 choose $\rho = 0 . 5$ and set the standard deviation of the Gaussian noise $\Delta$ to 0.03. The value of $k$ is
405
+ 288 chosen as 3 and 10 respectively (referred to as $\mathrm { G M P ^ { 3 } }$ and $\mathrm { G M P ^ { 1 0 } }$ ).
406
+ 289 The performances of all compared schemes are given in Table 1. For the compared regularization
407
+ 290 schemes except GMP, we directly report their performances as given in [83]. Performances of vanilla
408
+ 291 ERM without regularization are also included as a reference.
409
+ 292 Table 1 demonstrates the effectiveness of GMP. Overall GMP performs comparably to the current
410
+ 293 art of regularization schemes, although appearing slighly inferior to the most recent record given by
411
+ 294 AMP [83]. Noting that the key ingredient of AMP, “max-pooling” in the parameter space, greatly
412
+ 295 resembles regularization term in GMP, which may be seen as “average-pooling” in the same space.
413
+
414
+ Table 1: Top-1 classification accuracy on (a) SVHN, (b) CIFAR-10 and (c) CIFAR-100. We run experiments 10 times and report the mean and the standard deviation of the testing accuracy.
415
+
416
+ <table><tr><td>PreActResNet18</td><td>Top-1 Acc. (%)</td><td>PreActResNet18</td><td>Top-1 Acc. (%)</td><td>PreActResNet18</td><td>Top-1 Acc. (%)</td></tr><tr><td>ERM</td><td>97.05±0.063</td><td>ERM</td><td>94.98±0.212</td><td>ERM</td><td>75.69±0.303</td></tr><tr><td>Dropout</td><td>97.20±0.065</td><td>Dropout</td><td>95.14±0.148</td><td>Dropout</td><td>75.52±0.351</td></tr><tr><td>Label Smoothing</td><td>97.22±0.087</td><td>Label Smoothing</td><td>95.15±0.115</td><td>Label Smoothing</td><td>77.93±0.256</td></tr><tr><td>Flooding</td><td>97.16±0.047</td><td>Flooding</td><td>95.03±0.082</td><td>Flooding</td><td>75.50±0.234</td></tr><tr><td>MixUp</td><td>97.26±0.044</td><td>MixUp</td><td>95.91±0.117</td><td>MixUp</td><td>78.22±0.210</td></tr><tr><td>Adv.Training</td><td>97.23±0.080</td><td>Adv. Training</td><td>95.01±0.085</td><td>Adv. Training</td><td>74.77±0.229</td></tr><tr><td>AMP</td><td>97.70±0.025</td><td>AMP</td><td>96.03±0.091</td><td>AMP</td><td>78.49±0.308</td></tr><tr><td>GMP3</td><td>97.43±0.037</td><td>GMP3</td><td>95.64±0.053</td><td>GMP3</td><td>78.05±0.208</td></tr><tr><td>GMP10</td><td>97.34±0.058</td><td>GMP10</td><td>95.71±0.073</td><td>GMP10</td><td>78.07±0.170</td></tr><tr><td>VGG16</td><td>Top-1 Acc. (%)</td><td>VGG16</td><td>Top-1 Acc. (%)</td><td>VGG16</td><td>Top-1 Acc. (%)</td></tr><tr><td>ERM</td><td>96.86±0.060</td><td>ERM</td><td>93.68±0.193</td><td>ERM</td><td>72.16±0.297</td></tr><tr><td>Dropout</td><td>97.04±0.049</td><td>Dropout</td><td>93.78±0.147</td><td>Dropout</td><td>72.28±0.337</td></tr><tr><td>Label Smoothing</td><td>96.93±0.070</td><td>Label Smoothing</td><td>93.71±0.158</td><td>Label Smoothing</td><td>72.51±0.179</td></tr><tr><td>Flooding</td><td>96.85±0.085</td><td>Flooding</td><td>93.74±0.145</td><td>Flooding</td><td>72.07±0.271</td></tr><tr><td>MixUp</td><td>96.91±0.057</td><td>MixUp</td><td>94.52±0.112</td><td>MixUp</td><td>73.19±0.254</td></tr><tr><td>Adv.Training</td><td>97.06±0.091</td><td>Adv. Training</td><td>93.51±0.130</td><td>Adv.Training</td><td>70.88±0.145</td></tr><tr><td>AMP</td><td>97.27±0.015</td><td>AMP</td><td>94.35±0.147</td><td>AMP</td><td>74.40±0.168</td></tr><tr><td>GMP3</td><td>97.18±0.057</td><td>GMP3</td><td>94.33±0.094</td><td>GMP3</td><td>74.45±0.256</td></tr><tr><td>GMP10</td><td>97.09±0.068</td><td>GMP10</td><td>94.45±0.158</td><td>GMP10</td><td>75.09±0.285</td></tr></table>
417
+
418
+ (a) SVHN (b) CIFAR-10 (c) CIFAR-100
419
+
420
+ # 296 6 Conclusion and Outlook
421
+
422
+ This paper presents new generalization bounds for neural networks trained with SGD, improving upon the results of [49]. Our bounds naturally point to new and effective regularization schemes. At the same time, they reveal interesting phenomena in the SGD training of neural networks. While these phenomena deserve further investigation in their own right, we here suggest another direction for improving the bounds, namely, via the use of strong data-processing inequalities (DPI) [57–59] (noting that the standard DPI is in fact needed for establishing Theorem 2).
423
+
424
+ 303 For any Markov chain $U \to X \to Y$ , we will denote by $u , x$ , and $\mathcal { V }$ the spaces in which $U$ ,
425
+ 304 $X$ , $Y$ take values, respectively. For any distribution $P$ on $\mathcal { X }$ , we will use $P _ { Y \mid X } \circ P$ to denote the
426
+ 305 distribution on $\mathcal { V }$ induced by the push-forward of the distribution $P$ by $P _ { Y \mid X }$ , namely, for any $y \in \mathcal { V }$ ,
427
+ 306 $\begin{array} { r } { \left( P _ { Y | X } \circ P \right) ( y ) \triangleq \int P _ { Y | X } ( y | x ) P ( x ) d x } \end{array}$ . Let ${ \cal { S } } ( U )$ be the support of $P _ { U }$ and ${ \mathcal { H } } ( U , P _ { X | U } )$ be the
428
+ 307 convex hull of $\{ P _ { X | U = u } : u \in { \mathcal { S } } ( U ) \}$ . Define
429
+
430
+ $$
431
+ \eta ( U \to X \to Y ) \triangleq \operatorname* { s u p } _ { P , Q \in \mathcal { H } ( U , P _ { X | U } ) } \frac { \mathrm { D } _ { \mathrm { K L } } ( P _ { Y | X } \circ P | | P _ { Y | X } \circ Q ) } { \mathrm { D } _ { \mathrm { K L } } ( P | | Q ) }
432
+ $$
433
+
434
+ 08 Lemma 7. For any Markov chain $U X Y$ , $I ( U ; Y ) \leq \eta ( U X Y ) I ( U ; X ) .$
435
+
436
+ 309 Here $\eta ( U \to X \to Y )$ serves as the “contraction coefficient” for the stochastic kernel $P _ { Y \mid X }$ ,
437
+ 310 characterizing the greatest extent by which the kernel may bring closer any two distributions on $S ( U )$
438
+ 311 in its output space. It is easy to see that $\eta ( U \to X \to Y ) \leq 1$ , giving rise to a stronger DPI.
439
+ 12 Denote $V _ { t } \triangleq \widetilde { W } _ { t - 1 } + G _ { t }$ . It can be verified that $Z _ { i } V _ { t } \widetilde { W } _ { t }$ form a Markov chain. Denote
440
+ 13 $\eta _ { i , t } \triangleq \eta ( Z _ { i } V _ { t } \widetilde { W } _ { t } )$ , and $\Gamma _ { i } ^ { t } = \{ t + 1 , t + 2 , \ldots , T \} \setminus \mathcal { T } _ { i }$ . Theorem 2 can be improved to:
441
+
442
+ 314 Theorem 3. The expected generalization error of SGD is bounded by
443
+
444
+ $$
445
+ \left| \mathrm { g e n } ( \mu , P _ { W _ { T } | S } ) \right| \le \frac { 2 R } { n b } \sum _ { i = 1 } ^ { n } \sqrt { \sum _ { t \in { \mathcal T } _ { i } } \frac { \lambda _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \mathbb { E } \left[ \mathbb { V } ( W _ { t - 1 } ) \right] \cdot \prod _ { \tau \in \Gamma _ { i } ^ { t } } \eta _ { i , \tau } } + \left| \mathbb { E } \left[ \gamma ( W _ { T } , S ) - \gamma ( W _ { T } , S ^ { \prime } ) \right] \right| .
446
+ $$
447
+
448
+ 316 It remains to characterize the contraction coefficient $\eta _ { i , \tau }$ in a computable form. Simply bounding it
449
+ 317 via the Dobrushin’s coefficient [21], as suggested in [72] for analyzing SGLD, is unlikely to make
450
+ 318 the bound in this theorem significantly tighter than that in Theorem 2.
451
+
452
+ 19 References [1] Z. Allen-Zhu, Y. Li, and Z. Song. A convergence theory for deep learning via overparameterization. In International Conference on Machine Learning, pages 242–252. PMLR, 2019. [2] S. Arora, R. Ge, B. Neyshabur, and Y. Zhang. Stronger generalization bounds for deep nets via a compression approach. In International Conference on Machine Learning, pages 254–263. PMLR, 2018. [3] S. Arora, S. Du, W. Hu, Z. Li, and R. Wang. Fine-grained analysis of optimization and generalization for overparameterized two-layer neural networks. In International Conference on Machine Learning, pages 322–332. PMLR, 2019. [4] A. R. Asadi and E. Abbe. Chaining meets chain rule: Multilevel entropic regularization and training of neural networks. Journal of Machine Learning Research, 21(139):1–32, 2020. [5] A. R. Asadi, E. Abbe, and S. Verdú. Chaining mutual information and tightening generalization bounds. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pages 7245–7254, 2018. [6] P. L. Bartlett, D. J. Foster, and M. Telgarsky. Spectrally-normalized margin bounds for neural networks. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 6241–6250, 2017. [7] R. Bassily, S. Moran, I. Nachum, J. Shafer, and A. Yehudayoff. Learners that use little information. In Algorithmic Learning Theory, pages 25–55. PMLR, 2018. [8] R. Bassily, V. Feldman, C. Guzmán, and K. Talwar. Stability of stochastic gradient descent on nonsmooth convex losses. Advances in Neural Information Processing Systems, 33, 2020. [9] M. Belkin, D. Hsu, S. Ma, and S. Mandal. Reconciling modern machine-learning practice and the classical bias–variance trade-off. Proceedings of the National Academy of Sciences, 116 (32):15849–15854, 2019. [10] C. M. Bishop. Training with noise is equivalent to tikhonov regularization. Neural computation, 7(1):108–116, 1995.
453
+ 46 [11] L. Bottou, F. E. Curtis, and J. Nocedal. Optimization methods for large-scale machine learning. Siam Review, 60(2):223–311, 2018.
454
+ 348 [12] O. Bousquet and A. Elisseeff. Stability and generalization. The Journal of Machine Learning Research, 2:499–526, 2002.
455
+ 50 [13] Y. Bu, S. Zou, and V. V. Veeravalli. Tightening mutual information-based bounds on generalization error. IEEE Journal on Selected Areas in Information Theory, 1(1):121–130, 2020.
456
+ [14] A. Camuto, M. Willetts, U. Simsekli, S. J. Roberts, and C. C. Holmes. Explicit regularisation in gaussian noise injections. In Advances in Neural Information Processing Systems, 2020. [15] A. Camuto, X. Wang, L. Zhu, C. Holmes, M. Gürbüzbalaban, and U. ¸Sim¸sekli. Asymmetric heavy tails and implicit bias in gaussian noise injections. arXiv preprint arXiv:2102.07006, 2021. [16] P. Chaudhari, A. Choromanska, S. Soatto, Y. LeCun, C. Baldassi, C. Borgs, J. T. Chayes, L. Sagun, and R. Zecchina. Entropy-sgd: Biasing gradient descent into wide valleys. In 5th International Conference on Learning Representations. OpenReview.net, 2017.
457
+ 60 [17] Y. Chen, C. Jin, and B. Yu. Stability and convergence trade-off of iterative optimization algorithms. arXiv preprint arXiv:1804.01619, 2018.
458
+ 362 [18] T. M. Cover and J. A. Thomas. Elements of Information Theory. John Wiley & Sons, 2012.
459
+ 363 [19] F. Dangel, F. Kunstner, and P. Hennig. Backpack: Packing more into backprop. In 8th International Conference on Learning Representations. OpenReview.net, 2020.
460
+ [20] L. Dinh, R. Pascanu, S. Bengio, and Y. Bengio. Sharp minima can generalize for deep nets. In International Conference on Machine Learning, pages 1019–1028. PMLR, 2017.
461
+ [21] R. L. Dobrushin. Central limit theorem for nonstationary markov chains. i. Theory of Probability & Its Applications, 1(1):65–80, 1956.
462
+ [22] S. S. Du, X. Zhai, B. Poczos, and A. Singh. Gradient descent provably optimizes overparameterized neural networks. In International Conference on Learning Representations, 2018.
463
+ [23] C. Dwork, V. Feldman, M. Hardt, T. Pitassi, O. Reingold, and A. Roth. Generalization in adaptive data analysis and holdout reuse. In Proceedings of the 28th International Conference on Neural Information Processing Systems-Volume 2, pages 2350–2358, 2015.
464
+ [24] G. K. Dziugaite and D. M. Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. In Proceedings of the 33rd Annual Conference on Uncertainty in Artificial Intelligence (UAI), 2017.
465
+ [25] F. Faghri, D. Duvenaud, D. J. Fleet, and J. Ba. A study of gradient variance in deep learning. arXiv preprint arXiv:2007.04532, 2020.
466
+ [26] V. Feldman and J. Vondrak. High probability generalization bounds for uniformly stable algorithms with nearly optimal rate. In Conference on Learning Theory, pages 1270–1279. PMLR, 2019.
467
+ [27] P. Foret, A. Kleiner, H. Mobahi, and B. Neyshabur. Sharpness-aware minimization for efficiently improving generalization. arXiv preprint arXiv:2010.01412, 2020.
468
+ [28] S. B. Gelfand and S. K. Mitter. Recursive stochastic algorithms for global optimization in rˆd. SIAM Journal on Control and Optimization, 29(5):999–1018, 1991.
469
+ [29] I. J. Goodfellow, J. Shlens, and C. Szegedy. Explaining and harnessing adversarial examples. In 3rd International Conference on Learning Representations, ICLR, 2015.
470
+ [30] H. Hafez-Kolahi, Z. Golgooni, S. Kasaei, and M. Soleymani. Conditioning and processing: Techniques to improve information-theoretic generalization bounds. Advances in Neural Information Processing Systems, 33, 2020.
471
+ [31] M. Haghifam, J. Negrea, A. Khisti, D. M. Roy, and G. K. Dziugaite. Sharpened generalization bounds based on conditional mutual information and an application to noisy, iterative algorithms. arXiv preprint arXiv:2004.12983, 2020.
472
+ [32] M. Hardt, B. Recht, and Y. Singer. Train faster, generalize better: Stability of stochastic gradient descent. In International Conference on Machine Learning, pages 1225–1234. PMLR, 2016.
473
+ [33] F. He, T. Liu, and D. Tao. Control batch size and learning rate to generalize well: Theoretical and empirical evidence. In Advances in Neural Information Processing Systems 32, pages 1141–1150, 2019.
474
+ [34] K. He, X. Zhang, S. Ren, and J. Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision, pages 630–645, 2016.
475
+ [35] S. Hochreiter and J. Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997.
476
+ [36] T. Ishida, I. Yamane, T. Sakai, G. Niu, and M. Sugiyama. Do we need zero training loss after achieving zero training error? In Proceedings of the 37th International Conference on Machine Learning, ICML, 2020.
477
+ [37] S. Jastrz˛ebski, Z. Kenton, D. Arpit, N. Ballas, A. Fischer, Y. Bengio, and A. Storkey. Three factors influencing minima in sgd. arXiv preprint arXiv:1711.04623, 2017.
478
+ [38] Y. Jiang, B. Neyshabur, H. Mobahi, D. Krishnan, and S. Bengio. Fantastic generalization measures and where to find them. In International Conference on Learning Representations, 2019.
479
+ [39] R. Johnson and T. Zhang. Accelerating stochastic gradient descent using predictive variance reduction. Advances in neural information processing systems, 26:315–323, 2013.
480
+ [40] N. S. Keskar, D. Mudigere, J. Nocedal, M. Smelyanskiy, and P. T. P. Tang. On large-batch training for deep learning: Generalization gap and sharp minima. In 5th International Conference on Learning Representations. OpenReview.net, 2017.
481
+ [41] A. Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
482
+ [42] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25:1097–1105, 2012.
483
+ [43] Y. Lei and Y. Ying. Fine-grained analysis of stability and generalization for stochastic gradient descent. In International Conference on Machine Learning, pages 5809–5819. PMLR, 2020.
484
+ [44] B. London. A pac-bayesian analysis of randomized learning with application to stochastic gradient descent. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 2935–2944, 2017.
485
+ [45] S. Merity, N. S. Keskar, and R. Socher. Regularizing and optimizing lstm language models. In International Conference on Learning Representations, 2018.
486
+ [46] P. Nakkiran, G. Kaplun, Y. Bansal, T. Yang, B. Barak, and I. Sutskever. Deep double descent: Where bigger models and more data hurt. In International Conference on Learning Representations, 2019.
487
+ [47] J. Negrea, M. Haghifam, G. K. Dziugaite, A. Khisti, and D. M. Roy. Information-theoretic generalization bounds for sgld via data-dependent estimates. In Advances in Neural Information Processing Systems, pages 11013–11023, 2019.
488
+ [48] Y. Netzer, T. Wang, A. Coates, A. Bissacco, B. Wu, and A. Y. Ng. Reading digits in natural images with unsupervised feature learning. In NeurIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2011.
489
+ [49] G. Neu. Information-theoretic generalization bounds for stochastic gradient descent. arXiv preprint arXiv:2102.00931, 2021.
490
+ [50] B. Neyshabur, R. Tomioka, and N. Srebro. Norm-based capacity control in neural networks. In Conference on Learning Theory, pages 1376–1401. PMLR, 2015.
491
+ [51] B. Neyshabur, S. Bhojanapalli, D. McAllester, and N. Srebro. Exploring generalization in deep learning. In Advances in Neural Information Processing Systems, pages 5947–5956, 2017.
492
+ [52] B. Neyshabur, S. Bhojanapalli, and N. Srebro. A pac-bayesian approach to spectrally-normalized margin bounds for neural networks. In International Conference on Learning Representations, 2018.
493
+ [53] B. Neyshabur, Z. Li, S. Bhojanapalli, Y. LeCun, and N. Srebro. The role of over-parametrization in generalization of neural networks. In International Conference on Learning Representations, 2018.
494
+ [54] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in Neural Information Processing Systems, 32:8026–8037, 2019.
495
+ [55] A. Pensia, V. Jog, and P.-L. Loh. Generalization error bounds for noisy, iterative algorithms. In 2018 IEEE International Symposium on Information Theory (ISIT), pages 546–550. IEEE, 2018.
496
+ [56] M. Peters, M. Neumann, M. Iyyer, M. Gardner, C. Clark, K. Lee, and L. Zettlemoyer. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 2227–2237, 2018.
497
+ 458 [57] Y. Polyanskiy and Y. Wu. Dissipation of information in channels with input constraints. IEEE Transactions on Information Theory, 62(1):35–55, 2015.
498
+ 460 [58] Y. Polyanskiy and Y. Wu. Strong data-processing inequalities for channels and bayesian networks. In Convexity and Concentration, pages 211–249. Springer, 2017.
499
+ 462 [59] M. Raginsky. Strong data processing inequalities and $\phi$ -sobolev inequalities for discrete channels. IEEE Transactions on Information Theory, 62(6):3355–3389, 2016.
500
+ 464 [60] M. Raginsky and I. Sason. Concentration of measure inequalities in information theory, communications and coding. Foundations and Trends in Communications and Information Theory; NOW Publishers: Boston, MA, USA, 2018. [61] H. Robbins and S. Monro. A stochastic approximation method. The annals of mathematical statistics, pages 400–407, 1951. [62] B. Rodríguez-Gálvez, G. Bassi, R. Thobaben, and M. Skoglund. On random subset generalization error bounds and the stochastic gradient langevin dynamics algorithm. arXiv preprint arXiv:2010.10994, 2020. [63] N. L. Roux, M. Schmidt, and F. Bach. A stochastic gradient method with an exponential convergence rate for finite training sets. In Proceedings of the 25th International Conference on Neural Information Processing Systems-Volume 2, pages 2663–2671, 2012. [64] D. Russo and J. Zou. Controlling bias in adaptive data analysis using information theory. In Artificial Intelligence and Statistics, pages 1232–1240, 2016. [65] D. Russo and J. Zou. How much does your data exploration overfit? controlling bias via information usage. IEEE Transactions on Information Theory, 66(1):302–323, 2019.
501
+ 479 [66] S. Shalev-Shwartz and S. Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014. [67] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In 3rd International Conference on Learning Representations, ICLR, 2015. [68] N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014. [69] T. Steinke and L. Zakynthinou. Reasoning about generalization via conditional mutual information. In Conference on Learning Theory, volume 125 of Proceedings of Machine Learning Research, pages 3437–3452. PMLR, 2020. [70] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, CVPR, pages 2818–2826, 2016.
502
+ [71] V. Vapnik. Statistical learning theory. Wiley, 1998. ISBN 978-0-471-03003-4. [72] H. Wang, Y. Huang, R. Gao, and F. P. Calmon. Learning while dissipating information: Understanding the generalization capability of sgld. arXiv preprint arXiv:2102.02976, 2021.
503
+ 495 [73] C. Wei, S. Kakade, and T. Ma. The implicit and explicit regularization effects of dropout. In International Conference on Machine Learning, pages 10181–10192. PMLR, 2020. [74] M. Welling and Y. W. Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th international conference on machine learning (ICML-11), pages 681–688. Citeseer, 2011.
504
+ 500 [75] Y. Wen, K. Luk, M. Gazeau, G. Zhang, H. Chan, and J. Ba. An empirical study of stochastic gradient descent with structured covariance noise. In International Conference on Artificial Intelligence and Statistics, pages 3621–3631. PMLR, 2020.
505
+
506
+ 503 [76] L. Wu, C. Ma, and E. Weinan. How sgd selects the global minima in over-parameterized
507
+ 504 learning: A dynamical stability perspective. Advances in Neural Information Processing
508
+ 505 Systems, 2018:8279–8288, 2018.
509
+ 506 [77] A. Xu and M. Raginsky. Information-theoretic analysis of generalization capability of learning
510
+ 507 algorithms. Advances in Neural Information Processing Systems, 2017:2525–2534, 2017.
511
+ 508 [78] Z. Yang, Y. Yu, C. You, J. Steinhardt, and Y. Ma. Rethinking bias-variance trade-off for
512
+ 509 generalization of neural networks. In International Conference on Machine Learning, pages
513
+ 510 10767–10777. PMLR, 2020.
514
+ 511 [79] Z. Yao, A. Gholami, K. Keutzer, and M. W. Mahoney. Pyhessian: Neural networks through
515
+ 512 the lens of the hessian. In 2020 IEEE International Conference on Big Data (Big Data), pages
516
+ 513 581–590. IEEE, 2020.
517
+ 514 [80] C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning
518
+ 515 requires rethinking generalization. In 5th International Conference on Learning Representations.
519
+ 516 OpenReview.net, 2017.
520
+ 517 [81] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz. mixup: Beyond empirical risk mini
521
+ 518 mization. In 6th International Conference on Learning Representations, ICLR, 2018.
522
+ 519 [82] J. Zhang, T. He, S. Sra, and A. Jadbabaie. Why gradient clipping accelerates training: A
523
+ 520 theoretical justification for adaptivity. In International Conference on Learning Representations,
524
+ 521 2019.
525
+ 522 [83] Y. Zheng, R. Zhang, and Y. Mao. Regularizing neural networks via adversarial model perturba
526
+ 523 tion. In CVPR, 2021.
527
+ 524 [84] R. Zhou, C. Tian, and T. Liu. Individually conditional individual mutual information bound on
528
+ 525 generalization error. arXiv preprint arXiv:2012.09922, 2020.
529
+
530
+ 1. For all authors...
531
+
532
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
533
+ (b) Did you describe the limitations of your work? [Yes] See Section 4, Section 5 and supplementary materials.
534
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] See supplementary materials.
535
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
536
+
537
+ 2. If you are including theoretical results...
538
+
539
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 2 and Section 3.
540
+ (b) Did you include complete proofs of all theoretical results? [Yes] See supplementary materials.
541
+
542
+ 3. If you ran experiments...
543
+
544
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See supplementary materials.
545
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 5 and supplementary materials.
546
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Section 4 and Section 5.
547
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 4.
548
+
549
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
550
+
551
+ (a) If your work uses existing assets, did you cite the creators? [Yes] See Section 4 and Section 5.
552
+ (b) Did you mention the license of the assets? [Yes] See supplementary materials.
553
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
554
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
555
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
556
+
557
+ 5. If you used crowdsourcing or conducted research with human subjects...
558
+
559
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
560
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
561
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/5k8F6UU39V/5k8F6UU39V.md ADDED
@@ -0,0 +1,376 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOREGRESSIVE ENTITY RETRIEVAL
2
+
3
+ Nicola De $\mathbf { C a o ^ { 1 , 2 * } }$ , Gautier Izacard $^ { 2 , 3 , 4 }$ , Sebastian Riedel2,5, Fabio Petroni2
4
+
5
+ 1University of Amsterdam, 2Facebook AI Research
6
+ 3ENS, PSL University, 4Inria, 5University College London
7
+ nicola.decao@gmail.com, {gizacard, sriedel, fabiopetroni}@fb.com
8
+
9
+ # ABSTRACT
10
+
11
+ Entities are at the center of how we represent and aggregate knowledge. For instance, Encyclopedias such as Wikipedia are structured by entities (e.g., one per Wikipedia article). The ability to retrieve such entities given a query is fundamental for knowledge-intensive tasks such as entity linking and open-domain question answering. One way to understand current approaches is as classifiers among atomic labels, one for each entity. Their weight vectors are dense entity representations produced by encoding entity meta information such as their descriptions. This approach leads to several shortcomings: (i) context and entity affinity is mainly captured through a vector dot product, potentially missing fine-grained interactions between the two; (ii) a large memory footprint is needed to store dense representations when considering large entity sets; (iii) an appropriately hard set of negative data has to be subsampled at training time. In this work, we propose GENRE, the first system that retrieves entities by generating their unique names, left to right, token-by-token in an autoregressive fashion and conditioned on the context. This enables us to mitigate the aforementioned technical issues since: (i) the autoregressive formulation allows us to directly capture relations between context and entity name, effectively cross encoding both; (ii) the memory footprint is greatly reduced because the parameters of our encoder-decoder architecture scale with vocabulary size, not entity count; (iii) the exact softmax loss can be efficiently computed without the need to subsample negative data. We show the efficacy of the approach, experimenting with more than 20 datasets on entity disambiguation, end-to-end entity linking and document retrieval tasks, achieving new state-of-the-art or very competitive results while using a tiny fraction of the memory footprint of competing systems. Finally, we demonstrate that new entities can be added by simply specifying their unambiguous name. Code and pre-trained models at https://github.com/facebookresearch/GENRE.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ The ability to retrieve the correct entity from large Knowledge Bases (KBs) given a textual input is a fundamental building block for several applications (Ferrucci, 2012; Slawski, 2015; Yang et al., 2018a). Most commercial recommendation systems, for instance, include in their pipelines components to detect and disambiguate entity mentions in open text, in order to isolate relevant concepts from non-meaningful data (Slawski, 2015; Yang et al., 2018a). Another example are chat-bots and question answering systems, that are often equipped with retrieval components to surface specific KB entries (e.g., Wikipedia articles) to find knowledge for sustaining a conversation or answering a question (Ferrucci, 2012; Chen et al., 2017; Lewis et al., 2020b; Roller et al., 2020).
16
+
17
+ Although there has been extensive previous work on entity retrieval (e.g. Hoffart et al., 2011; Piccinno & Ferragina, 2014; Huang et al., 2015; Le & Titov, 2018; Logeswaran et al., 2019; Broscheit, 2019; Wu et al., 2020, to name just a few) there is a common design choice to most current solutions: entities are associated with a unique atomic label and the retrieval problem can be interpreted as multi-class classification across these labels. The match between input and label is calculated through a bi-encoder (Wu et al., 2020; Karpukhin et al., 2020): a dot product between dense vector encodings of the input and the entity’s meta information (such as title and description).
18
+
19
+ ![](images/afb95d39a564faccda97aa93096798fa9caab47325ae274eef5e4e11ed69ead7.jpg)
20
+ Figure 1: Examples of entities correctly retrieved from GENRE (we show only the top-3 rank). On the top three entity disambiguation instances and on the bottom three document retrieval instances, two for open-domain question answering and one for fact checking. All of them are cast as sequenceto-sequence problems while inference is done using constrained beam search. Gold entities in bold. Sub-captions indicate the type of interaction between the input context and the entity names required.
21
+
22
+ Critically, this formulation enables sub-linear search using modern maximum-inner-product-search libraries (Johnson et al., 2019) and hence supports retrieving from large entity databases.
23
+
24
+ Unfortunately, the classifier approach to entity retrieval also has several shortcomings. First, unless a costly cross-encoder is used for re-ranking (Wu et al., 2020), the dot-product can miss fine-grained interactions between input and entity meta information (Humeau et al., 2020). Second, storing dense vectors for the whole KB requires a large memory footprint, especially in real-world scenarios (i.e., ${ \sim } 2 4 \mathrm { G B }$ to store 1024-dimensional vectors for all of the ${ \sim } 6 \mathbf { M }$ Wikipedia pages), and the size linearly grows with the addition of new entities. Third, computing an exact softmax over all entities is very expensive, hence current solutions need to subsample negative data (Logeswaran et al., 2019; Karpukhin et al., 2020) at training time. Tuning an appropriately hard set of negative instances can be challenging and time-consuming. Finally, existing systems can suffer from a cold-start problem since they cannot represent entities about which they have not yet gathered sufficient information, in the form, for instance, of a textual description or a set of relations with the existing entities.
25
+
26
+ The treatment of entity identifiers as atomic labels in a classifier ignores the fact that we often have unambiguous, highly structured and compositional entity names. Wikipedia, for instance, associates unique titles to articles,1 that may be the name of the subject or a description of its topic, as well as potential distinctive information to disambiguate 2 (see Figure 1 for some examples). These entity names often interact with mention contexts in a predictable and regular fashion. For example, often entity names are identical with the mention strings that refer to them (e.g., Fig. 1f). When this is not possible, they might be composed of tokens in the context (e.g., Fig. 1b), include a type specification that can inferred (e.g., Fig. 1a), be the translation of the string mention (e.g., Fig. 1c), require ‘normalization’ such as referring to the correct alias of a mention (e.g., Fig. 1d), or require factual knowledge that might be stored in the parameters of a model (e.g., Fig. 1e). These observations suggest that inputs could be translated into unique entity names, word by word, instead of being classified among a huge set of options.
27
+
28
+ In this paper, we propose GENRE (for Generative ENtity REtrieval), the first entity retriever that exploits a sequence-to-sequence architecture to generate entity names in an autoregressive fashion conditioned on the context. Concretely, GENRE uses a transformer-based architecture, pre-trained with a language modeling objective (i.e., we use BART weights from Lewis et al. (2020a)) and fine-tuned to generate entity names. This architecture has been shown to retain factual knowledge to some extent (Petroni et al., 2019) and language translation skills (Radford et al., 2019) among other things, both desirable properties for an entity retriever. Naturally, the generated output might not always be a valid entity name. To solve this problem, GENRE employs a constrained decoding strategy that forces each generated name to be in a predefined candidate set.
29
+
30
+ The autoregressive formulation allows us to directly capture the aforementioned relations between context and entity name, effectively cross encoding both. Also, the memory footprint required is orders of magnitude smaller than current systems, since the parameters of a sequence-to-sequence model scale linearly with the vocabulary size, not entity count. Moreover, the exact softmax can be computed efficiently for each output token (i.e., all non-gold tokens are considered negative), thereby eliminating the need for negative data downsampling. Finally, our model never accesses any explicit meta-information about the entity beyond their title, hence new entities can be added by simply appending their unambiguous name to the candidate set (e.g., Fig. 1b refers to an entity added after training).
31
+
32
+ We empirically evaluate the performance of GENRE on more than 20 datasets, spanning three families of tasks: (i) entity disambiguation, using popular datasets and settings (both in and out-of– domain); (ii) end-to-end entity linking, with the GERBIL benchmarking tool (Roder et al., 2018), by ¨ using a novel dynamically markup-constrained decoding strategy; (iii) document retrieval, with the recently proposed KILT benchmark (Petroni et al., 2020b) which spans 5 different sub-tasks. Our models achieve state-of-the-art or very competitive results on nearly all datasets, often with substantial improvement $( + 1 3 . 7$ precision points on KILT for retrieval on average). Further, we show that compared with recent models, GENRE requires substantially less memory ${ \sim } 2 0$ times smaller footprint on average). Finally, we demonstrate that our model can be applied in scenarios where the only entity information available is its name.
33
+
34
+ We organize the paper as follows: in Section 2 we describe our problem formulation. Then, in Section 3 we present GENRE and eventually in Section 4 we extensively evaluate our method on the aforementioned settings. We will release code and pre-processed data to reproduce our experiments.
35
+
36
+ # 2 ENTITY RETRIEVAL
37
+
38
+ We assume to have a collection of entities $\mathcal { E }$ (e.g., Wikipedia articles) where each entity is an entry in a Knowledge Base (KB) such as Wikipedia. We want to approach the following retrieval problem: given a textual input source $x$ (e.g., question), a model has to return the most relevant entities from $\mathcal { E }$ with respect to $x$ . We assume that each $e \in { \mathcal { E } }$ is uniquely assigned to a textual representation (i.e., its name): a sequence of tokens $y$ (e.g., Wikipedia pages are identified by their titles).
39
+
40
+ A particular instance of this problem is Entity Disambiguation (ED) (see Figure 1 for an example) where an input $x$ is annotated with a mention and a system has to select either its corresponding entity from $\mathcal { E }$ , or to predict that there is no corresponding entry in the KB. Another instance is pagelevel Document Retrieval (DR) where the input $x$ is intended as a query and $\mathcal { E }$ as a collection of documents identified by their unique titles (e.g., Wikipedia articles).
41
+
42
+ # 3 METHOD
43
+
44
+ We address the retrieval problem with an sequence-to-sequence model that generates textual entity identifiers (i.e., entity names). Concretely, GENRE ranks each $e \in { \mathcal { E } }$ by computing a score with an autoregressive formulation: $\begin{array} { r } { \mathrm { s c o r e } ( e | x ) = p _ { \theta } ( y | x ) = \prod _ { i = 1 } ^ { N } p _ { \theta } ( y _ { i } | y _ { < i } , x ) } \end{array}$ where $y$ is the set of $N$ tokens in the identifier of $e$ , and $\theta$ the parameters of the model. We take advantage of fine-tuning the BART (Lewis et al., 2020a) pre-trained language model. We train GENRE using a standard seq2seq objective, i.e., maximizing the output sequence likelihood with teacher forcing (Sutskever et al., 2011; 2014) and regularized with dropout (Srivastava et al., 2014) and label smoothing (Szegedy et al., 2016). Concretely, we use the objective that is typically used for neural machine translation (NMT, Wu et al., 2016), that is maximizing $\log p \theta ( y | x )$ with respect to model’s parameters $\theta$ which, due to the factorized formulation, can be calculated exactly. We do not need negative sampling to approximate the loss normalizer.
45
+
46
+ ![](images/a276253b4e90bdecbab89682f15bf698407030d633624853b2cfcf3474f42883.jpg)
47
+
48
+ In 1503, [Leonardo_
49
+
50
+ ![](images/926f6ddadda3670b8a72c5e09335699a108d0229b58fab5b7e0915f68f934483.jpg)
51
+
52
+ In 1503, [Leonardo](Leonardo_ (a) Outside: we can either continue to generate the input or start a new mention.
53
+
54
+ ![](images/ddbc51f005c4a29a1a69f2e29e36fc9da7a0858fff6d58723c847f4bc6b818e6.jpg)
55
+
56
+ (b) Inside a mention: we can either continue to generate the input or end the current mention.
57
+
58
+ (c) Inside an entity link: we can either generate from the entities prefix trie or close if the generated prefix is a valid entity.
59
+
60
+ Figure 2: Example of dynamically constrained Markup decoding for entity linking using “In 1503, Leonardo began painting the Mona Lisa.” as input. There are 3 cases: when we are outside a mention/entity (a), inside a mention generation step (b), and inside an entity link generation step (c). The model is supposed to output the input source annotating mentions and pointing them to the respective entities: “In 1503, [Leonardo](Leonardo da Vinci) began painting the [Mona Lisa](Mona Lisa)”.
61
+
62
+ # 3.1 INFERENCE WITH CONSTRAINED BEAM SEARCH
63
+
64
+ Naturally, at test time, we could compute a score for every element in $\mathcal { E }$ and then sort them. Unfortunately, this might be prohibitively expensive when $\mathcal { E }$ is very large (e.g., Wikipedia has ${ \sim } 6 \mathbf { M }$ entities). Hence, we exploit Beam Search (BS, Sutskever et al., 2014), an established approximate decoding strategies to efficiently navigate the search space. Instead of explicitly scoring all entities in $\mathcal { E }$ , we search for the top- $k$ entities in $\mathcal { E }$ decoding from our model using BS with $k$ beams. Note that using BS implies that the time cost of our retriever does not depend on the size of $\mathcal { E }$ , but only on the size of the beams and the average length of entity representations as we do autoregressive generation. The average length of entity representations is tractable (e.g., Wikipedia titles have 6 BPE tokens on average) and we follow standard NMT settings where $k$ is small (e.g., 10).
65
+
66
+ Since we want to output only entities from $\mathcal { E }$ we cannot use traditional BS while decoding. Indeed, allowing to generate any token from the vocabulary at every decoding step might lead the model to generate output strings that are not valid identifiers. Hence, we resort to Constrained BS, forcing to only decode valid entity identifiers. BS only considers one step ahead during decoding so we can only constrain the generation of a single next token conditioned on the previous ones. Thus, we define our constrain in terms of a prefix tree $\tau$ (aka trie) (Cormen et al., 2009) where nodes are annotated with tokens from the vocabulary. For each node $t \in \tau$ , its children indicate all the allowed continuations from the prefix defined traversing the trie from the root to $t$ .
67
+
68
+ See Figure 9 in Appendix C for an exampled of a trie. When the number of allowed outputs is tractable (e.g., generating a Wikipedia title among ${ \sim } 6 \mathbf { M } )$ ) the trie is relatively small it can be precomputed and stored into memory (e.g., constraining on Wikipedia titles using the BART tokenizer produces a trie with ${ \sim } 6 \mathbf { M }$ leaves, ${ \sim } 1 7 \mathbf { M }$ internal nodes that occupied ${ \sim } 6 0 0 \mathrm { M B }$ of disk space). We employed the constraints masking the log-probabilities of the invalid tokens and not their logits (i.e., we do not re-normalize the probability over the vocabulary).3
69
+
70
+ # 3.2 AUTOREGRESSIVE END-TO-END ENTITY LINKING
71
+
72
+ We additionally extend our autoregressive framework to address end-to-end Entity Linking (EL) where, given a document, a system has to both detect entity mentions and link those mentions to their respective KB entities. In this setting, we train the model to predict the source input again but with annotated spans. We use a Markup annotation where spans boundaries are flagged with special tokens and accompanied by their corresponding entity identifiers.
73
+
74
+ Differently from a setting where the output space is relatively small (e.g., a pre-defined set $\mathcal { E }$ ), the space of annotated outputs is exponentially large. Hence, it is intractable to pre-compute a trie for decoding, and we compute it dynamically instead. In Figure 2 we show an example. At each generation step, the decoder is either generating a mention span, generating a link to a mention, or continuing from the input source. When outside a mention/entity step the decoder has only two options: (i) to continue by copying the next token from the input source, or (ii) to generate the start of mention token (i.e., ‘[’) which makes the decoder enter the mention generating phase. While generating a mention, the decoder has either to continue with the next token in the input source or to generate the end of mention token (i.e., ‘]’) which makes the decoder enter the entity generating phase. Finally, when generating an entity, the decoder employs the entities trie such that it can only output a valid entity identifier as in Constrained Beam Search explained above.
75
+
76
+ # 4 EXPERIMENTS
77
+
78
+ We extensively evaluate GENRE on more than 20 datasets across 3 tasks: Entity Disambiguation, end-to-end Entity Linking (EL), and page-level Document Retrieval. We describe the experimental settings in Section 4.1 where we discuss results in Section 4.2. All experiments are in English.
79
+
80
+ # 4.1 SETTINGS
81
+
82
+ Entity Disambiguation (ED) We reproduce the setting of Le & Titov (2018) using the same candidate sets, in-domain and out-of-domain datasets, and evaluating using the InKB micro- $F _ { 1 }$ . We train GENRE feeding each document where a single mention is flagged with two special start and end tokens and the target output is the textual representation of the corresponding entity. At test time, we decode using constrained beam search with a trie obtained using the provided candidate set (i.e., a subset of $\mathcal { E }$ ). As large generative models benefit from large amount of data, we first pre-train GENRE on the BLINK data (Wu et al., 2020), i.e., 9M unique triples document-mention-entity from Wikipedia. Then, for the in-domain scenario, we fine-tune using the AIDA-CoNLL dataset (Hoffart et al., 2011). For the out-of-domain scenario, we evaluate on five test sets: MSNBC, AQUAINT, ACE2004, WNED-CWEB (CWEB) and WNED-WIKI (WIKI) (Gabrilovich et al., 2013; Guo & Barbosa, 2018). More task details and hyperparameters setting are reported in Appendix A.1.
83
+
84
+ End-to-End Entity Linking (EL) For EL, we reproduce the setting of Kolitsas et al. (2018) using the same in-domain and out-of-domain datasets as well as evaluating the InKB micro- $F _ { 1 }$ on the GERBIL benchmark platform (Roder et al., 2018). Similarly to the ED setting, we first pre-traine ¨ our model on all abstract sections from Wikipedia4 enriched by a string matching heuristic to solve co-references (i.e., if there is a string that matches exactly with another hyperlink we also add it to the dataset as a mention/entity pairs). Then, for the in-domain scenario, we fine-tune using the AIDACoNLL dataset. We evaluate on seven out-of-domain test sets: MSNBC, Derczynski (Der) (Derczynski et al., 2015), KORE 50 (K50) (Hoffart et al., 2012), N3-Reuters-128 (R128), N3-RSS-500 (R500) (Roder et al., 2014), and OKE challenge 2015 and 2016 (OKE15 and OKE16) (Nuzzolese ¨ et al., 2015). More task details and hyperparameters setting are reported in Appendix A.2.
85
+
86
+ Page-level Document Retrieval (DR) For this setting, we test GENRE on all the KILT benchmark tasks (Petroni et al., 2020b). Here, whole Wikipedia is used as the candidate set and we evaluate using R-precision (Beitzel et al., 2009). KILT consists of five tasks that use the same Wikipedia dump as a knowledge source: fact checking with FEVER (Thorne et al., 2018); open domain question answering using Natural Questions (Kwiatkowski et al., 2019), HotpotQA (Yang et al., 2018b), TriviaQA (Joshi et al., 2017), ELI5 (Fan et al., 2019); slot filling with T-REx (Elsahar et al., 2018), Zero Shot RE (Levy et al., 2017); entity disambiguation on AIDA CoNLL-YAGO, WNED-WIKI and WNED-CWEB; dialogue with Wizard of Wikipedia (Dinan et al., 2019). We train GENRE on BLINK and all KILT data simultaneously with a single model.5 More details on the hyperparameter setting are reported in Appendix A.3.
87
+
88
+ # 4.2 RESULTS
89
+
90
+ Overall, GENRE achieves very competitive results in all of the three settings being the best performing system on average across all of them. See Appendix C for examples of inputs, ground truth and model predictions for all of the three tasks. In the following, we discuss how GENRE compares to SOTA systems as well as showing some quantitative analysis on its memory footprint, how it exploits the structured of the entity name space, and how it behaves on a cold-start scenario where new unseen entities are added to the KB (descriptions of those entities are unobserved).
91
+
92
+ Table 1: Micro $F _ { 1 }$ (InKB) on the in-domain test set and five out-of-domain test sets for the named entity disambiguation task. Bold indicates best model and underline indicates second best (not for ablations). \*WIKI is usually considered out-of-domain but note that all methods use a part of Wikipedia to train. \*\*results taken from https://github.com/facebookresearch/ BLINK and normalized to accommodate entities not in KB.
93
+
94
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">In-domain AIDA</td><td colspan="6">Out-of-domain</td></tr><tr><td>MSNBC</td><td>AQUAINT</td><td>ACE2004</td><td>CWEB</td><td>WIKI*</td><td>Avg.</td></tr><tr><td>Ganea &amp; Hofmann (2017)</td><td>92.2</td><td>93.7</td><td>88.5</td><td>88.5</td><td>77.9</td><td>77.5</td><td>86.4</td></tr><tr><td>Guo &amp; Barbosa (2018)</td><td>89</td><td>92</td><td>87</td><td>88</td><td>77</td><td>84.5</td><td>86.2</td></tr><tr><td>Yang et al. (2018a)</td><td>95.9</td><td>92.6</td><td>89.9</td><td>88.5</td><td>81.8</td><td>79.2</td><td>88.0</td></tr><tr><td>Shahbazi et al. (2019)</td><td>93.5</td><td>92.3</td><td>90.1</td><td>88.7</td><td>78.4</td><td>79.8</td><td>87.1</td></tr><tr><td>Yang et al. (2019)</td><td>93.7</td><td>93.8</td><td>88.2</td><td>90.1</td><td>75.6</td><td>78.8</td><td>86.7</td></tr><tr><td>Le &amp; Titov (2019)</td><td>89.6</td><td>92.2</td><td>90.7</td><td>88.1</td><td>78.2</td><td>81.7</td><td>86.8</td></tr><tr><td>Fang et al. (2019)</td><td>94.3</td><td>92.8</td><td>87.5</td><td>91.2</td><td>78.5</td><td>82.8</td><td>87.9</td></tr><tr><td>BLINK w/o candidate set**</td><td>79.6</td><td>80.0</td><td>80.3</td><td>82.5</td><td>64.2</td><td>75.5</td><td>77.0</td></tr><tr><td>GENRE</td><td>93.3</td><td>94.3</td><td>89.9</td><td>90.1</td><td>77.3</td><td>87.4</td><td>88.8</td></tr><tr><td colspan="8">Ablations</td></tr><tr><td>GENRE only AIDA data</td><td>88.6</td><td>88.1</td><td>77.1</td><td>82.3</td><td>71.9</td><td>71.7</td><td>80.0</td></tr><tr><td>GENRE only BLINK data</td><td>89.3</td><td>93.3</td><td>90.9</td><td>91.1</td><td>76.0</td><td>87.9</td><td>88.1</td></tr><tr><td>GENRE w/o candidate set</td><td>91.2</td><td>86.9</td><td>87.2</td><td>87.5</td><td>71.1</td><td>86.4</td><td>85.1</td></tr><tr><td>GENRE w/o constraints</td><td>86.4</td><td>80.0</td><td>81.7</td><td>82.1</td><td>66.0</td><td>81.1</td><td>79.6</td></tr></table>
95
+
96
+ Comparing GENRE to SOTA systems In ED the difference in average $F _ { 1 }$ score between GENRE and the second best performing system is small (i.e., $+ 0 . 8 )$ however, ED is an established task with more than a decade of research that benchmarked on those datasets. Indeed all systems reported in Table 1 achieved high and similar results even if they were taken from three years back.
97
+
98
+ The improvements on EL are instead more evident. GENRE is the best in-domain system for AIDA while performing remarkably well also on the out-of-domain setting (e.g., $+ 1 3$ $F _ { 1 }$ points on Derczynski, and $+ 4 . 7$ on KORE50). Noticeably, in two datasets (OKE15 and OKE16) our model performs poorly. However, these datasets are annotated with coreference (pronouns and common nouns are linked to entities) while our model was not specifically trained for that. Conversely, most of the other systems, have a mention detection component in their pipelines that can be trained or biased to also solve these cases. We considered out of the aim of this work to additional train and evaluate on coreference and we leave it for future work.
99
+
100
+ On page-level DR, the superiority of GENRE is remarkable. Our model is the best performing system across all 5 KILT tasks and all datasets except on Natural Questions where it is the second best. We achieve $+ 1 3 . 7$ R-precision points on average with respect to the best performing baseline. In Table 3 we compare GENRE against all methods reported in the public leaderboard: DPR (Karpukhin et al., 2020), DPR $+$ BERT (Devlin et al., 2019), DPR $+$ BART, tf-idf (Leskovec et al., 2014), RAG (Lewis et al., 2020b), and BLINK $^ +$ flair (Wu et al., 2020; Akbik et al., 2019). No model except ours was trained on the entire KILT dataset at the same time. A RAG model was trained for every single task as well as for DPR $+$ BERT. Note that this gives and advantage to RAG and DPR $+$ BERT to specialize on single tasks where we have only a single model to solve all of them which still performs better. We speculate that multi-task training could have helped since the all tasks share a common objective to retrieve entities. Both DPR and BLINK $^ +$ flair were not trained specifically on KILT. However, DPR was trained using several QA datasets which include Natural Question and TriviaQA. In Appendix B we report additional results where we do not pre-train or fine-tune our models for both the ED and retrieval setting in Table 1 and 8 respectively. When we train GENRE only in the DPR or BLINK data, our model still outperforms them.
101
+
102
+ <table><tr><td></td><td colspan="9">In-domain</td></tr><tr><td>Method</td><td>AIDA</td><td>MSNBC</td><td>Der</td><td>K50</td><td>R128</td><td>Out-of-domain R500</td><td>OKE15*</td><td>OKE16*</td><td>Avg.</td></tr><tr><td>Hoffart et al. (2011)</td><td>72.8</td><td>65.1</td><td>32.6</td><td>55.4</td><td>46.4</td><td>42.4</td><td>63.1</td><td>0.0</td><td>47.2</td></tr><tr><td>Steinmetz &amp; Sack (2013)</td><td>42.3</td><td>30.9</td><td>26.5</td><td>46.8</td><td>18.1</td><td>20.5</td><td>46.2</td><td>46.4</td><td>34.7</td></tr><tr><td>Moro et al. (2014)</td><td>48.5</td><td>39.7</td><td>29.8</td><td>55.9</td><td>23.0</td><td>29.1</td><td>41.9</td><td>37.7</td><td>38.2</td></tr><tr><td>Kolitsas et al. (2018)</td><td>82.4</td><td>72.4</td><td>34.1</td><td>35.2</td><td>50.3</td><td>38.2</td><td>61.9</td><td>52.7</td><td>53.4</td></tr><tr><td>Broscheit (2019)</td><td>79.3</td><td>1</td><td>1</td><td>-</td><td>1</td><td>1</td><td>-</td><td>1</td><td></td></tr><tr><td>Martins et al. (2019)</td><td>81.9</td><td>-</td><td>-</td><td>-</td><td>1</td><td>1</td><td>1</td><td>1</td><td></td></tr><tr><td>van Hulst et al. (2020)†</td><td>80.5</td><td>72.4</td><td>41.1</td><td>50.7</td><td>49.9</td><td>35.0</td><td>63.1</td><td>58.3</td><td>56.4</td></tr><tr><td>GENRE</td><td>83.7</td><td>73.7</td><td>54.1</td><td>60.7</td><td>46.7</td><td>40.3</td><td>56.1</td><td>50.0</td><td>58.2</td></tr></table>
103
+
104
+ Table 2: Micro $F _ { 1 }$ (InKB) on the in-domain test set and four out-of-domain test sets for the entity linking task. Bold indicates best model and underline indicates second best. \*annotated with coreference (note that we do not train/evaluate our model to link pronouns and common nouns). †results from the Wikipedia 2019 setting as opposed to the 2014 setting (older dump and fewer entities).
105
+
106
+ Memory Footprint GENRE is not only performing better than other SOTA models on DR but it has a significant reduction of memory footprint (disk space). In Figure 4 we compare the number of model/index parameter against DPR, RAG, and BLINK. GENRE uses an order of magnitude less parameters (millions instead of billions) to store the entity index because it just has to use a prefix tree of the entity names as opposed to a dense vector for each entity. Concretely, GENRE occupied 14 times less memory than BLINK and 34 times less memory than DPR.
107
+
108
+ Exploiting the Structured Name Space We investigated some properties of GENRE, comparing two variants of our model to BLINK on the ED task (using WNED-KILT validation set): one trained to generate entity names and another to generate numerical identifiers (IDs). All models are trained on the same data and we report results in Figure 5. When there is an exact match between a mention and its entity name, both BLINK and GENRE almost always make an accurate prediction. Different is the case of partial and no match: GENRE performance is much higher suggesting that our model uses the context more effectively, as the autoregressive formulation allows to cross-encode mention context and entity candidates directly capturing fine-grained interactions between the two. Moreover, when we switch to predicting IDs, the performance drops drastically (-20.3 points on average) indicating that it is important that entity names are meaningful, structured and compositional (as they are in Wikipedia) conversely to atomic IDs. Surprisingly, when there is no overlap between a mention-entity pair, performance are still relatively high by using IDs. This suggests that the model is good at memorizing and recalling identifiers even if numeric.
109
+
110
+ Ablation study We here discuss an ablation study on the entity disambiguation task (see Table 1). Due to space limitation, we discuss an ablation study on document retrieval in Appendix B.2. In Table 1, GENRE only AIDA or BLINK data indicates the ablation for which we only train on one of the two datasets (i.e., only fine-tuning). GENRE (full) is also used with constrained decoding (see Section 3) and in combination with a candidate set (as provided by Le & Titov, 2018). GENRE without candidate set denotes ablating the provided (and small) candidate set and therefore using all the entities in the KB (in our case Wikipedia) as candidates. GENRE without constraints indicates ablating constrained decoding which implies no use of the provided candidates set but also unconstrained generation (i.e., the model may generate entity names that are not in the KB). Eventually, using constrained generation and exploiting the candidate sets proved useful. Training only on AIDA data is insufficient to get high $F _ { 1 }$ (but AIDA is quite small compared to the 9M datapoints of BLINK data).
111
+
112
+ Entity frequency The performance of a model naturally depends on how many times entities appear in the training data. We show the data distribution of the mention-entity frequency in Figure 3. Most of the pairs appears in Wikipedia $( 1 0 9 3 1 / 1 3 3 5 4 )$ where 2423 do not (first bin). The average accuracy is $8 2 . 5 \%$ but noticeable it is higher for mention-entity pairs that are more frequent (right side of the plot). The accuracy for pairs that do not appear in Wikipedia is substantially lower than the average suggesting that those are harder cases (the very end tail of the distribution). The degradation in performance is minimal indicating that our model is good at predicting rare entities.
113
+
114
+ Table 3: R-Precision for page-level retrieval on KILT test data. Bold indicates the best model and underline indicates the second best. For our model, we indicated what datasets we used for training.
115
+
116
+ <table><tr><td>Model</td><td rowspan="2">Fact Check. FEV</td><td colspan="3">Entity Disambiguation</td><td colspan="2">Slot Filling</td><td colspan="3">Open Domain QA</td><td colspan="3">Dial.</td></tr><tr><td></td><td>AY2</td><td>WnWi</td><td>WnCw</td><td>T-REx</td><td>zsRE</td><td>NQ</td><td>HoPo</td><td>TQA</td><td>ELI5</td><td>WoW</td><td>Avg.</td></tr><tr><td>DPR+BERT</td><td>72.9</td><td>-</td><td>-</td><td>-</td><td>1</td><td>40.1</td><td>60.7</td><td>25.0</td><td>43.4</td><td>-</td><td>-</td><td>-</td></tr><tr><td>DPR</td><td>55.3</td><td>1.8</td><td>0.3</td><td>0.5</td><td>13.3</td><td>28.9</td><td>54.3</td><td>25.0</td><td>44.5</td><td>10.7</td><td>25.5</td><td>23.6</td></tr><tr><td>tf-idf</td><td>50.9</td><td>3.7</td><td>0.24</td><td>2.1</td><td>44.7</td><td>60.8</td><td>28.1</td><td>34.1</td><td>46.4</td><td>13.7</td><td>49.0</td><td>30.5</td></tr><tr><td>DPR +BART</td><td>55.3</td><td>75.5</td><td>45.2</td><td>46.9</td><td>13.3</td><td>28.9</td><td>54.3</td><td>25.0</td><td>44.4</td><td>10.7</td><td>25.4</td><td>38.6</td></tr><tr><td>RAG</td><td>61.9</td><td>72.6</td><td>48.1</td><td>47.6</td><td>28.7</td><td>53.7</td><td>59.5</td><td>30.6</td><td>48.7</td><td>11.0</td><td>57.8</td><td>47.3</td></tr><tr><td>BLINK + fair</td><td>63.7</td><td>81.5</td><td>80.2</td><td>68.8</td><td>59.6</td><td>78.8</td><td>24.5</td><td>46.1</td><td>65.6</td><td>9.3</td><td>38.2</td><td>56.0</td></tr><tr><td>GENRE</td><td>83.6</td><td>89.9</td><td>87.4</td><td>71.2</td><td>79.4</td><td>95.8</td><td>60.3</td><td>51.3</td><td>69.2</td><td>15.8</td><td>62.9</td><td>69.7</td></tr></table>
117
+
118
+ Table 4: Comparison between retrieval models on memory (disk space) footprint and number of model/index parameters.
119
+
120
+ <table><tr><td>Model</td><td>Memory</td><td>Param.</td><td>Index</td></tr><tr><td>DPR</td><td>70.9GB</td><td>220M</td><td>15B</td></tr><tr><td>RAG</td><td>40.4GB</td><td>626M</td><td>15B</td></tr><tr><td>BLINK</td><td>30.1GB</td><td>680M</td><td>6B</td></tr><tr><td>GENRE</td><td>2.1GB</td><td>406M</td><td>17M</td></tr></table>
121
+
122
+ Table 5: Different types of matches between mentions and their entity names on the WNED-KILT. \*indicates GENRE trained on numerical identifiers.
123
+
124
+ <table><tr><td>Type (support)</td><td>BLINK</td><td>GENRE</td><td>IDs*</td></tr><tr><td>Exact match (1543)</td><td>97.8</td><td>96.6</td><td>76.0</td></tr><tr><td>Partial match (1531)</td><td>70.7</td><td>86.9</td><td>63.8</td></tr><tr><td>No match (322)</td><td>49.4</td><td>59.9</td><td>55.0</td></tr><tr><td>Total (3396)</td><td>81.0</td><td>88.8</td><td>68.5</td></tr></table>
125
+
126
+ Cold-start We manually collect 50 Wikipedia articles that were created in $2 0 2 0 ^ { 6 }$ to simulate a cold-start setting where new entities are added to the KB and the only entity information available is their names. To create ED instances we resort to hyperlinks pointing to those entities in other Wikipedia articles. 19 out of 50 mentions have an exact match with their respective entity names and all of them were correctly classified by GENRE. In combination with the results from Table 5 we can conclude that GENRE has a bias on exactly copying the mention, and this helps on unseen data. GENRE also correctly classified 14/31 of the remaining mentions $( 4 5 . 2 \% )$ . This demonstrates the ability of our solution to be applied in scenarios where entity metadata is unavailable (apart his name), a setting where, to the best of our knowledge, no existing system is capable to operate.
127
+
128
+ We additionally test how GENRE performs on unseen mention-entity pairs on WikilinksNED Unseen-Mentions data (Onoe & Durrett, 2020) and we report all results in Table 6 in Appendix B.1. Surprisingly, GENRE performs almost the same for seen and unseen entity pairs (64.4 vs 63.2 accuracy) However, in the Onoe & Durrett (2020) setting we cannot guarantee entity descriptions have not been seen by BART during pre-training (given his training data contains Wikipedia).
129
+
130
+ # 5 RELATED WORKS
131
+
132
+ Casting NLP tasks with a structured input or output into sequence-to-sequence problems has been explored for different problems, including semantic parsing (Rongali et al., 2020), semantic role labelling (Daza & Frank, 2018), discourse representation structure parsing (Liu et al., 2018), generation of fluent natural language responses from structured semantic representations (Balakrishnan et al., 2019), generation and parsing of abstract meaning representation (Konstas et al., 2017). In these works a structured representation, a tree or a graph for instance, is linearized into a sequence of symbols compatible with a seq2seq architecture. To the best of our knowledge, we are the first to cast entity retrieval as a sequence-to-sequence problem while decoding with an autoregressive formulation during inference.
133
+
134
+ Related to our constrained generation mechanism, Daza & Frank (2018); Rongali et al. (2020) use a copying mechanism in order to limit lexical deviations between the input and output strings. In these tasks, as well as for our problem, it is natural to promote a copying mechanism due to the input and the output proximity. A different type of constraint, a structural constraint, is used in Balakrishnan et al. (2019) to maintain a valid tree structure. Our constrained beam search encompasses both aspects, a copying mechanism that restrains the vocabulary and a structural constraint to obtain a well-formed annotated output. In addition to these tasks with close input and output, the integration of a mechanism to guide the output of neural networks has been explored in various settings. Lexically constrained decoding has been used to force the inclusion of pre-specified words for machine translation (Hokamp & Liu, 2017; Post & Vilar, 2018), and image captioning (Anderson et al., 2017). To the best of our knowledge, we are the first to exploit constrained generation for entity disambiguation, end-to-end entity linking, and query-based entity retrieval.
135
+
136
+ ![](images/0066823b752c9e840cd614f20e83617c9ee824858c21c15a0cbccc2584a48ad1.jpg)
137
+ Figure 3: Accuracy per mention-entity pair frequency (in Wikipedia) on the validation sets of all Entity Disambiguation tasks in KILT.
138
+
139
+ Nogueira et al. (2020) propose to use a sequence-to-sequence model to re-rank document. Given a query and a document the model is trained to output the words ”true” or ”false” depending on whether the document is relevant or not. Differently from our approach for entity retrieval, it requires a limited list of candidates documents, obtained with BM25 for instance, in order to be computationally possible. Massarelli et al. (2019); Petroni et al. (2020a) explore the idea of using an autoregressive language model as neural retriever, by exploiting the implicit knowledge stored in their parameters to generate relevant sentences given a query. While intriguing, such solutions still lag behind retrievers with an explicit knowledge access (e.g., an explicit Wikipedia index). The idea of using a generative model for entity disambiguation was proposed in Petroni et al. (2020b) as they trained both BART and T5 in a seq2seq fashion on all KILT tasks (including ED). We expanded that intuition generalizing on multiple tasks (end-to-end EL and page-level retrieval) as well as introducing constrained decoding for an efficient and effective search.
140
+
141
+ # 6 CONCLUSIONS
142
+
143
+ In this work, we propose GENRE, a novel paradigm to addresses entity retrieval: generate entity names autoregressively. Entity names have several properties that might help (even humans) retrieving them, including a compositional structure and a predictable interaction with the context. The autoregressive formulation allows us to directly capture some of these properties, leading to several advantages with respect to current solutions, including an efficient way to cross encode mention context and entity candidates, a much smaller memory footprint, and the ability to compute an exact softmax without the need to subsample negative data. We empirically show that these characteristics, combined with constrained decoding strategies, led to state-of-the-art performance on a plethora of entity retrieval datasets, spanning entity disambiguation, end-to-end entity linking, and page-level document retrieval, while resulting in systems with a remarkably contained memory footprint, a space reduction by a factor of twenty on average. We additionally demonstrate that new entities can be effectively considered in our system by simply appending their unambiguous name to the candidate set.
144
+
145
+ # ACKNOWLEDGMENTS
146
+
147
+ Authors thank Patrick Lewis, Aleksandra Piktus, Michael Schlichtkrull, Ivan Titov, Jean Maillard, Edouard Grave, Sergio De Cao, Luisa Quarta for helpful discussions and technical support.
148
+
149
+ # REFERENCES
150
+
151
+ Alan Akbik, Tanja Bergmann, Duncan Blythe, Kashif Rasul, Stefan Schweter, and Roland Vollgraf. FLAIR: An easy-to-use framework for state-of-the-art NLP. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pp. 54–59, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-4010. URL https://www.aclweb.org/anthology/ N19-4010.
152
+
153
+ Peter Anderson, Basura Fernando, Mark Johnson, and Stephen Gould. Guided open vocabulary image captioning with constrained beam search. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 936–945, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/D17-1098. URL https://www.aclweb.org/anthology/D17-1098.
154
+
155
+ Anusha Balakrishnan, Jinfeng Rao, Kartikeya Upasani, Michael White, and Rajen Subba. Constrained decoding for neural NLG from compositional representations in task-oriented dialogue. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 831–844, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1080. URL https://www.aclweb.org/anthology/P19-1080.
156
+
157
+ Steven M. Beitzel, Eric C. Jensen, and Ophir Frieder. Average R-Precision, pp. 195–195. Springer US, Boston, MA, 2009. ISBN 978-0-387-39940-9. doi: 10.1007/978-0-387-39940-9 491. URL https://doi.org/10.1007/978-0-387-39940-9_491.
158
+
159
+ Samuel Broscheit. Investigating entity knowledge in BERT with simple neural end-to-end entity linking. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pp. 677–685, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/K19-1063. URL https://www.aclweb.org/anthology/ K19-1063.
160
+
161
+ Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading Wikipedia to answer open-domain questions. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1870–1879, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1171. URL https: //www.aclweb.org/anthology/P17-1171.
162
+
163
+ Shuang Chen, Jinpeng Wang, Feng Jiang, and Chin-Yew Lin. Improving entity linking by modeling latent entity type information. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 7529–7537, 2020.
164
+
165
+ Thomas H Cormen, Charles E Leiserson, Ronald L Rivest, and Clifford Stein. Introduction to algorithms. MIT press, 2009.
166
+
167
+ Angel Daza and Anette Frank. A sequence-to-sequence model for semantic role labeling. In Proceedings of The Third Workshop on Representation Learning for NLP, pp. 207–216, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/W18-3027. URL https://www.aclweb.org/anthology/W18-3027.
168
+
169
+ Leon Derczynski, Diana Maynard, Giuseppe Rizzo, Marieke Van Erp, Genevieve Gorrell, Raphael¨ Troncy, Johann Petrak, and Kalina Bontcheva. Analysis of named entity recognition and linking for tweets. Information Processing & Management, 51(2):32–49, 2015.
170
+
171
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //www.aclweb.org/anthology/N19-1423.
172
+
173
+ Emily Dinan, Stephen Roller, Kurt Shuster, Angela Fan, Michael Auli, and Jason Weston. Wizard of wikipedia: Knowledge-powered conversational agents. Proceedings of the International Conference on Learning Representations (ICLR), 2019.
174
+
175
+ Hady Elsahar, Pavlos Vougiouklis, Arslen Remaci, Christophe Gravier, Jonathon Hare, Elena Simperl, and Frederique Laforest. T-rex: A large scale alignment of natural language with knowledge base triples. LREC, 2018.
176
+
177
+ Angela Fan, Yacine Jernite, Ethan Perez, David Grangier, Jason Weston, and Michael Auli. ELI5: long form question answering. In Anna Korhonen, David R. Traum, and Lluis Marquez (eds.), Proceedings of the 57th Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28- August 2, 2019, Volume 1: Long Papers, pp. 3558–3567. Association for Computational Linguistics, 2019. doi: 10.18653/v1/p19-1346. URL https://doi.org/ 10.18653/v1/p19-1346.
178
+
179
+ Zheng Fang, Yanan Cao, Qian Li, Dongjie Zhang, Zhenyu Zhang, and Yanbing Liu. Joint entity linking with deep reinforcement learning. In The World Wide Web Conference, pp. 438–447. ACM, 2019.
180
+
181
+ David A Ferrucci. Introduction to “this is watson”. IBM Journal of Research and Development, 56 (3.4):1–1, 2012.
182
+
183
+ Evgeniy Gabrilovich, Michael Ringgaard, and Amarnag Subramanya. Facc1: Freebase annotation of clueweb corpora, version 1 (release date 2013-06-26, format version 1, correction level 0). Note: http://lemurproject. org/clueweb09/FACC1/Cited by, 5:140, 2013.
184
+
185
+ Octavian-Eugen Ganea and Thomas Hofmann. Deep joint entity disambiguation with local neural attention. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2619–2629, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/D17-1277. URL https://www.aclweb.org/anthology/ D17-1277.
186
+
187
+ Zhaochen Guo and Denilson Barbosa. Robust named entity disambiguation with random walks. Semantic Web, 9(4):459–479, 2018.
188
+
189
+ Johannes Hoffart, Mohamed Amir Yosef, Ilaria Bordino, Hagen Furstenau, Manfred Pinkal, Marc ¨ Spaniol, Bilyana Taneva, Stefan Thater, and Gerhard Weikum. Robust disambiguation of named entities in text. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing, pp. 782–792, Edinburgh, Scotland, UK., July 2011. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/D11-1072.
190
+
191
+ Johannes Hoffart, Stephan Seufert, Dat Ba Nguyen, Martin Theobald, and Gerhard Weikum. KORE: Keyphrase Overlap Relatedness for Entity Disambiguation. In Proceedings of the 21st ACM International Conference on Information and Knowledge Management, CIKM ’12, pp. 545–554, New York, NY, USA, 2012. Association for Computing Machinery. ISBN 9781450311564. doi: 10.1145/2396761.2396832. URL https://doi.org/10.1145/2396761.2396832.
192
+
193
+ Chris Hokamp and Qun Liu. Lexically constrained decoding for sequence generation using grid beam search. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1535–1546, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1141. URL https://www.aclweb. org/anthology/P17-1141.
194
+
195
+ Hongzhao Huang, Larry Heck, and Heng Ji. Leveraging deep neural networks and knowledge graphs for entity disambiguation. arXiv preprint arXiv:1504.07678, 2015.
196
+
197
+ Samuel Humeau, Kurt Shuster, Marie-Anne Lachaux, and Jason Weston. Poly-encoders: Architectures and pre-training strategies for fast and accurate multi-sentence scoring. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum? id $=$ SkxgnnNFvH.
198
+
199
+ Jeff Johnson, Matthijs Douze, and Herve J ´ egou. Billion-scale similarity search with gpus. ´ IEEE Transactions on Big Data, 2019.
200
+
201
+ Mandar Joshi, Eunsol Choi, Daniel Weld, and Luke Zettlemoyer. TriviaQA: A large scale distantly supervised challenge dataset for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp.
202
+
203
+ 1601–1611, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi:
204
+ 10.18653/v1/P17-1147. URL https://www.aclweb.org/anthology/P17-1147.
205
+
206
+ Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6769–6781, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.550. URL https://www.aclweb.org/anthology/ 2020.emnlp-main.550.
207
+
208
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. Proceedings of the 3rd International Conference on Learning Representations (ICLR), 2014.
209
+
210
+ Nikolaos Kolitsas, Octavian-Eugen Ganea, and Thomas Hofmann. End-to-end neural entity linking. In Proceedings of the 22nd Conference on Computational Natural Language Learning, pp. 519– 529, Brussels, Belgium, October 2018. Association for Computational Linguistics. doi: 10.18653/ v1/K18-1050. URL https://www.aclweb.org/anthology/K18-1050.
211
+
212
+ Ioannis Konstas, Srinivasan Iyer, Mark Yatskar, Yejin Choi, and Luke Zettlemoyer. Neural AMR: Sequence-to-sequence models for parsing and generation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 146–157, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/ P17-1014. URL https://www.aclweb.org/anthology/P17-1014.
213
+
214
+ Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. Natural questions: A benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:452–466, March 2019. doi: 10.1162/tacl a 00276. URL https://www.aclweb.org/anthology/Q19-1026.
215
+
216
+ Phong Le and Ivan Titov. Improving entity linking by modeling latent relations between mentions. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1595–1604, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1148. URL https://www.aclweb.org/anthology/ P18-1148.
217
+
218
+ Phong Le and Ivan Titov. Boosting entity linking performance by leveraging unlabeled documents. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 1935–1945, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/ v1/P19-1187. URL https://www.aclweb.org/anthology/P19-1187.
219
+
220
+ Jure Leskovec, Anand Rajaraman, and Jeffrey David Ullman. Mining of Massive Datasets. Cambridge University Press, USA, 2nd edition, 2014. ISBN 1107077230.
221
+
222
+ Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer. Zero-shot relation extraction via reading comprehension. In Proceedings of the 21st Conference on Computational Natural Language Learning (CoNLL 2017), pp. 333–342, Vancouver, Canada, August 2017. Association for Computational Linguistics. doi: 10.18653/v1/K17-1034. URL https://www.aclweb. org/anthology/K17-1034.
223
+
224
+ Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7871–7880, Online, July 2020a. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.703. URL https://www.aclweb.org/anthology/2020.acl-main.703.
225
+
226
+ Patrick Lewis, Ethan Perez, Aleksandara Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rockt ¨ aschel, et al. Retrieval-augmented gener- ¨ ation for knowledge-intensive NLP tasks. arXiv preprint arXiv:2005.11401, 2020b.
227
+
228
+ Jiangming Liu, Shay B. Cohen, and Mirella Lapata. Discourse representation structure parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 429–439, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1040. URL https://www.aclweb.org/anthology/ P18-1040.
229
+
230
+ Lajanugen Logeswaran, Ming-Wei Chang, Kenton Lee, Kristina Toutanova, Jacob Devlin, and Honglak Lee. Zero-shot entity linking by reading entity descriptions. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 3449–3460, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1335. URL https://www.aclweb.org/anthology/P19-1335.
231
+
232
+ Pedro Henrique Martins, Zita Marinho, and Andre F. T. Martins. Joint learning of named entity ´ recognition and entity linking. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: Student Research Workshop, pp. 190–196, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-2026. URL https: //www.aclweb.org/anthology/P19-2026.
233
+
234
+ Luca Massarelli, Fabio Petroni, Aleksandra Piktus, Myle Ott, Tim Rocktaschel, Vassilis Plachouras, ¨ Fabrizio Silvestri, and Sebastian Riedel. How decoding strategies affect the verifiability of generated text. arXiv preprint arXiv:1911.03587, 2019.
235
+
236
+ Andrea Moro, Alessandro Raganato, and Roberto Navigli. Entity linking meets word sense disambiguation: a unified approach. Transactions of the Association for Computational Linguistics, 2:231–244, 2014. doi: 10.1162/tacl a 00179. URL https://www.aclweb.org/ anthology/Q14-1019.
237
+
238
+ Isaiah Onando Mulang’, Kuldeep Singh, Chaitali Prabhu, Abhishek Nadgeri, Johannes Hoffart, and Jens Lehmann. Evaluating the impact of knowledge graph context on entity disambiguation models. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management, pp. 2157–2160, 2020.
239
+
240
+ Rodrigo Nogueira, Zhiying Jiang, Ronak Pradeep, and Jimmy Lin. Document ranking with a pretrained sequence-to-sequence model. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 708–718, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.findings-emnlp.63. URL https://www.aclweb.org/ anthology/2020.findings-emnlp.63.
241
+
242
+ Andrea Giovanni Nuzzolese, Anna Lisa Gentile, Valentina Presutti, Aldo Gangemi, Dar´ıo Garigliotti, and Roberto Navigli. Open knowledge extraction challenge. In Semantic Web Evaluation Challenges, pp. 3–15. Springer, 2015.
243
+
244
+ Yasumasa Onoe and Greg Durrett. Fine-grained entity typing for domain independent entity linking. In AAAI, pp. 8576–8583, 2020.
245
+
246
+ Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan $\mathrm { N g }$ , David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pp. 48–53, 2019.
247
+
248
+ Fabio Petroni, Tim Rocktaschel, Sebastian Riedel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, and ¨ Alexander Miller. Language models as knowledge bases? In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 2463–2473, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1250. URL https://www.aclweb.org/anthology/D19-1250.
249
+
250
+ Fabio Petroni, Patrick Lewis, Aleksandra Piktus, Tim Rocktaschel, Yuxiang Wu, Alexander H.¨ Miller, and Sebastian Riedel. How context affects language models’ factual predictions. In Automated Knowledge Base Construction, 2020a. URL https://openreview.net/forum? id=025X0zPfn.
251
+
252
+ Fabio Petroni, Aleksandra Piktus, Angela Fan, Patrick Lewis, Majid Yazdani, Nicola De Cao, James Thorne, Yacine Jernite, Vassilis Plachouras, Tim Rocktaschel, et al. KILT: a Benchmark for ¨ Knowledge Intensive Language Tasks. arXiv preprint arXiv:2009.02252, 2020b.
253
+
254
+ Francesco Piccinno and Paolo Ferragina. From tagme to wat: A new entity annotator. In Proceedings of the First International Workshop on Entity Recognition and Disambiguation, ERD ’14, pp. 55–62, New York, NY, USA, 2014. Association for Computing Machinery. ISBN 9781450330237. doi: 10.1145/2633211.2634350. URL https://doi.org/10.1145/ 2633211.2634350.
255
+
256
+ Matt Post and David Vilar. Fast lexically constrained decoding with dynamic beam allocation for neural machine translation. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 1314–1324, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1119. URL https://www.aclweb.org/ anthology/N18-1119.
257
+
258
+ A. Radford, Jeffrey Wu, R. Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. In Technical report, OpenAI, 2019.
259
+
260
+ Jonathan Raiman and Olivier Raiman. Deeptype: multilingual entity linking by neural type system evolution. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
261
+
262
+ Michael Roder, Ricardo Usbeck, Sebastian Hellmann, Daniel Gerber, and Andreas Both.¨ $\mathbf { N } ^ { 3 }$ -a collection of datasets for named entity recognition and disambiguation in the nlp interchange format. In LREC, pp. 3529–3533, 2014.
263
+
264
+ Michael Roder, Ricardo Usbeck, and Axel-Cyrille Ngonga Ngomo. Gerbil–benchmarking named ¨ entity recognition and linking consistently. Semantic Web, 9(5):605–625, 2018.
265
+
266
+ Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M Smith, et al. Recipes for building an open-domain chatbot. arXiv preprint arXiv:2004.13637, 2020.
267
+
268
+ Subendhu Rongali, Luca Soldaini, Emilio Monti, and Wael Hamza. Don’t parse, generate! a sequence to sequence architecture for task-oriented semantic parsing. In Proceedings of The Web Conference 2020, WWW ’20, pp. 2962–2968. Association for Computing Machinery, 2020.
269
+
270
+ Hamed Shahbazi, Xiaoli Z Fern, Reza Ghaeini, Rasha Obeidat, and Prasad Tadepalli. Entity-aware ELMo: Learning Contextual Entity Representation for Entity Disambiguation. arXiv preprint arXiv:1908.05762, 2019.
271
+
272
+ Bill Slawski, Sep 2015. URL https://www.seobythesea.com/2015/09/ disambiguate-entities-in-queries-and-pages/.
273
+
274
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(56):1929–1958, 2014. URL http://jmlr.org/papers/v15/ srivastava14a.html.
275
+
276
+ Nadine Steinmetz and Harald Sack. Semantic multimedia information retrieval based on contextual descriptions. In Philipp Cimiano, Oscar Corcho, Valentina Presutti, Laura Hollink, and Sebastian Rudolph (eds.), The Semantic Web: Semantics and Big Data, pp. 382–396, Berlin, Heidelberg, 2013. Springer Berlin Heidelberg. ISBN 978-3-642-38288-8.
277
+
278
+ Ilya Sutskever, James Martens, and Geoffrey E Hinton. Generating text with recurrent neural networks. In Proceedings of the 28th International Conference on Machine Learning (ICML),, pp. 1017—-1024., 2011.
279
+
280
+ 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.
281
+
282
+ 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.
283
+
284
+ James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. FEVER: a large-scale dataset for fact extraction and VERification. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 809–819, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1074. URL https://www.aclweb.org/anthology/N18-1074.
285
+
286
+ Johannes M. van Hulst, Faegheh Hasibi, Koen Dercksen, Krisztian Balog, and Arjen P. de Vries. Rel: An entity linker standing on the shoulders of giants. In Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, SIGIR ’20, pp. 2197–2200, New York, NY, USA, 2020. Association for Computing Machinery. ISBN 9781450380164. doi: 10.1145/3397271.3401416. URL https://doi.org/10.1145/ 3397271.3401416.
287
+
288
+ Ledell Wu, Fabio Petroni, Martin Josifoski, Sebastian Riedel, and Luke Zettlemoyer. Scalable zero-shot entity linking with dense entity retrieval. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6397–6407, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.519. URL https://www.aclweb.org/anthology/2020.emnlp-main.519.
289
+
290
+ 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.
291
+
292
+ Ikuya Yamada, Hiroyuki Shindo, Hideaki Takeda, and Yoshiyasu Takefuji. Joint learning of the embedding of words and entities for named entity disambiguation. In Proceedings of The 20th SIGNLL Conference on Computational Natural Language Learning, pp. 250–259, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/K16-1025. URL https://www.aclweb.org/anthology/K16-1025.
293
+
294
+ Xiyuan Yang, Xiaotao Gu, Sheng Lin, Siliang Tang, Yueting Zhuang, Fei Wu, Zhigang Chen, Guoping Hu, and Xiang Ren. Learning dynamic context augmentation for global entity linking. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 271–281, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1026. URL https://www.aclweb.org/anthology/D19-1026.
295
+
296
+ Yi Yang, Ozan Irsoy, and Kazi Shefaet Rahman. Collective entity disambiguation with structured gradient tree boosting. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 777–786, New Orleans, Louisiana, June 2018a. Association for Computational Linguistics. doi: 10.18653/v1/N18-1071. URL https://www.aclweb.org/anthology/ N18-1071.
297
+
298
+ Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. HotpotQA: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2369–2380, Brussels, Belgium, October-November 2018b. Association for Computational Linguistics. doi: 10.18653/v1/D18-1259. URL https://www.aclweb.org/ anthology/D18-1259.
299
+
300
+ # A EXPERIMENTAL DETAILS
301
+
302
+ We implemented, trained, and evaluate our model using the fariseq library (Ott et al., 2019). We trained GENRE for every task using Adam (Kingma & Ba, 2014) with a learning rate $3 \cdot 1 0 ^ { - 5 }$ with a linear warm-up for 500 steps and then liner decay. The objective is sequence-to-sequence categorical cross-entropy loss with 0.1 of label smoothing.
303
+
304
+ # A.1 NAMED ENTITY DISAMBIGUATION
305
+
306
+ Setting Given a document $d _ { j }$ (e.g., a sentence) containing a set of entity mentions $\displaystyle m _ { 1 } , \ldots , m _ { N }$ , a system either has to assign, to each mention $m _ { i }$ , either a KB entity (i.e., $e _ { i } \in \mathcal { E } _ { i }$ ), or predicts that there is no corresponding entry in the KB (i.e., $e _ { i } = \mathrm { N L L } )$ . Moreover, a restricted candidates set $C _ { i } = \{ \hat { e } _ { i 1 } , \dots , \hat { e } _ { i K } \} \subseteq \bar { \mathcal { E } } \cup \{ \hat { \mathrm { N I L } } \}$ for each mention $m _ { i }$ is provided.
307
+
308
+ Training We pre-trained GENRE on BLINK data for $2 0 0 \mathrm { k }$ steps and then we do model selection on the validation set. Afterward, we fine-tuned on AIDA without resetting the learning rate nor the optimizer statistics for $1 0 \mathrm { k }$ steps and we do model selection on the validation set. Following previous works (Yamada et al., 2016; Ganea & Hofmann, 2017; Le & Titov, 2018), we considered only mentions that have entities in the KB (i.e., Wikipedia). Training was done on 32 GPUs (with 32GB of memory) and it completed in ${ \sim } 2 4 \mathrm { h }$ for a total of ${ \sim } 3 2$ GPU/day.
309
+
310
+ Inference At test time, we use Constrained Beam Search with 10 beams, and maximum decoding steps of 15. We restrict the input sequence to be at most 384 tokens cutting the left, right, or both parts of the context around a mention. We normalize the log-probabilities by sequence length.
311
+
312
+ # A.2 ENTITY LINKING
313
+
314
+ Setting Given a document $d _ { j }$ (e.g., a sentence) a system has to return a set of tuples $\langle m _ { i } , e _ { i } \rangle$ where $m _ { i }$ is a entity mentions (a span contained in $d _ { j }$ ) and $e _ { i } \in \mathcal { E }$ its corresponding entity in the KB. Following Kolitsas et al. (2018), we considered only mentions that have entities in the KB (i.e., Wikipedia) and we used their candidate sets with the additions of the table computed by Hoffart et al. (2011).
315
+
316
+ Training We pre-trained GENRE on all abstract sections from Wikipedia7 enriched by a string matching heuristic to solve co-references (i.e., if there is a string that matches exactly with another hyperlink we also add it to the dataset as a mention/entity pairs) data for $2 0 0 \mathrm { k }$ steps. Then we do model selection on the validation set. Afterward, we fine-tuned on AIDA resetting the learning rate and the optimizer statistics for $1 0 \mathrm { k }$ steps and we do model selection on the validation set. Again, following previous works (Kolitsas et al., 2018), we considered only mentions that have entities in Wikipedia. Training was done on 64 GPUs (with 32GB of memory) and it completed in ${ \sim } 3 0 \mathrm { h }$ for a total of ${ \sim } 8 0$ GPU/day.
317
+
318
+ Inference At test time, we use Constrained Beam Search with 6 beams, and a maximum decoding step of 384. When the input sequence is too long, we split the input into multiple chunks of equal size. We normalize the log-probabilities by sequence length.
319
+
320
+ # A.3 PAGE-LEVEL DOCUMENT RETRIEVAL
321
+
322
+ Setting Given a query $q$ (e.g., a question) and a collection of documents $\mathcal { D }$ (in KILT are Wikipedia pages), a system has to rank documents in $\mathcal { D }$ based on their relevance to $q$ .
323
+
324
+ Training We trained GENRE on all KILT data simultaneously for $2 0 0 \mathrm { k }$ steps and we do model selection on the validation set averaging the score across tasks. Training was done on 128 GPUs (with 32GB of memory) and it completed in ${ \sim } 3 3 \mathrm { h }$ for a total of ${ \sim } 1 7 6$ GPU/day.
325
+
326
+ Inference At test time, we use Constrained Beam Search with 10 beams. For the ED sub-task, we restrict the input sequence to be at most 384 tokens cutting the left, right, or both parts of the context around a mention. We normalize the log-probabilities by sequence length.
327
+
328
+ # B ADDITIONAL RESULTS
329
+
330
+ # B.1 NAMED ENTITY DISAMBIGUATION
331
+
332
+ Table 6 reports evaluation of GENRE on on WikilinksNED Unseen-Mentions data (Onoe & Durrett, 2020). We also report additional results on AIDA from the literature in Table 7.
333
+
334
+ <table><tr><td></td><td>Seen</td><td>Unseen</td><td>Total</td></tr><tr><td>Exact match</td><td>87.48 (751)</td><td>70.36 (2227)</td><td>74.68 (2978)</td></tr><tr><td>Partial match</td><td>56.39 (1566)</td><td>61.47 (4838)</td><td>60.23 (6404)</td></tr><tr><td>No match</td><td>41.46 (205)</td><td>45.04 (413)</td><td>43.85 (618)</td></tr><tr><td>Total</td><td>64.43 (2522)</td><td>63.21 (7478)</td><td>63.52 (10k)</td></tr></table>
335
+
336
+ Table 6: Evaluation of GENRE on WikilinksNED Unseen-Mentions data (Onoe & Durrett, 2020). We train on the provided train set and we report accuracy scores (i.e., precision at 1) alongside with the number of supporting datapoints. We report scores splitting the test set in seen and unseen entities as well as in three different matchings between a mention and its gold entity.
337
+ Table 7: Additional results on AIDA. We report Micro InKB $F _ { 1 }$ on test sets.
338
+
339
+ <table><tr><td>Methods</td><td>micro-F1</td></tr><tr><td>Guo &amp; Barbosa (2018)</td><td>89</td></tr><tr><td>Le &amp; Titov (2019)</td><td>89.6</td></tr><tr><td>Yamada et al. (2016)</td><td>91.5</td></tr><tr><td>Ganea &amp; Hofmann (2017)</td><td>92.2</td></tr><tr><td>Shahbazi et al. (2019)</td><td>93.5</td></tr><tr><td>Chen et al. (2020)</td><td>93.5</td></tr><tr><td>Yang et al. (2019)</td><td>93.7</td></tr><tr><td>Fang et al. (2019) Raiman &amp; Raiman (2018)</td><td>94.3</td></tr><tr><td>Mulang&#x27; et al. (2020)</td><td>94.9</td></tr><tr><td></td><td>94.9</td></tr><tr><td>Yang et al. (2018a)</td><td>95.9</td></tr><tr><td>GENRE</td><td>93.3</td></tr></table>
340
+
341
+ # B.2 DOCUMENT RETRIEVAL
342
+
343
+ Table 8 extends Table 3 with additional results (i.e., training GENRE on the numerical identifiers) and an ablation study on the document retrieval task. The purpose of the experiment is to see whether GENRE benefits from the entity names to be meaningful as well as compositional. Numerical IDs do not have that property. In both cases, the model uses its memorizing capabilities but when using IDs the performance is significantly low. Indeed, with IDs the model has no way to generalize nor to use “implicit knowledge” acquired during the unsupervised pre-training. We also ablate the training data. DPR data corresponds to training only on Natural Questions (NQ) and TriviaQA (TQA) as DPR was trained only for QA tasks on those datasets and two extra ones. Note that training on BLINK data corresponds to only training for entity disambiguation. However, every other task share similarities with entity disambiguation and thus the model is also capable to address the other tasks with non-zero performance. For the ablations, underlined cells indicate what are the results on the respective task on which a model was trained for (i.e., GENRE only BLINK data was trained only for ED where GENRE only DPR data was trained only for QA). The ablation on data suggests that it is beneficial to train on all tasks simultaneously. GENRE without constraints indicates ablating constrained decoding which implies unconstrained generation (i.e., the model may generate entity names that are not in the KB).
344
+
345
+ <table><tr><td></td><td rowspan="2">Fact Check. FEV</td><td colspan="3">Entity Disambiguation</td><td colspan="3">Slot Filling</td><td colspan="3">Open Domain QA</td><td colspan="3">Dial.</td></tr><tr><td>Model</td><td></td><td>AY2</td><td>WnWi</td><td>WnCw</td><td>T-REx</td><td>zsRE</td><td>NQ</td><td>HoPo</td><td>TQA</td><td>ELI5</td><td>WoW</td><td>|Avg.</td></tr><tr><td>DPR + BERT</td><td>72.9</td><td>1</td><td>1</td><td>1</td><td>1</td><td>40.1</td><td>60.7</td><td>25.0</td><td>43.4</td><td></td><td>1</td><td></td><td>1</td></tr><tr><td>DPR</td><td>55.3</td><td>1.8</td><td>0.3</td><td>0.5</td><td>13.3</td><td>28.9</td><td></td><td>54.3</td><td>25.0</td><td>44.5</td><td>10.7</td><td>25.5</td><td>23.6</td></tr><tr><td>tf-idf</td><td>50.9</td><td>3.7</td><td>0.24</td><td>2.1</td><td>44.7</td><td>60.8</td><td>28.1</td><td></td><td>34.1</td><td>46.4</td><td>13.7</td><td>49.0</td><td>30.5</td></tr><tr><td>DPR + BART</td><td>55.3</td><td>75.5</td><td>45.2</td><td>46.9</td><td>13.3</td><td>28.9</td><td>54.3</td><td></td><td>25.0</td><td>44.4</td><td>10.7</td><td>25.4</td><td>38.6</td></tr><tr><td>RAG</td><td>61.9</td><td>72.6</td><td>48.1</td><td>47.6</td><td>28.7</td><td>53.7</td><td></td><td>59.5</td><td>30.6</td><td>48.7</td><td>11.0</td><td>57.8</td><td>47.3</td></tr><tr><td>BLINK + flair</td><td>63.7</td><td>81.5</td><td>80.2</td><td>68.8</td><td>59.6</td><td>78.8</td><td>24.5</td><td></td><td>46.1</td><td>65.6</td><td>9.3</td><td>38.2</td><td>56.0</td></tr><tr><td>GENRE only BLINK IDs</td><td>1.8</td><td>65.0</td><td>63.5</td><td>58.6</td><td>0.1</td><td>0.2</td><td>0.4</td><td></td><td>0.3</td><td>5.4</td><td>0.3</td><td>13.3</td><td>19.0</td></tr><tr><td>GENRE only DPR data</td><td>70.8</td><td>9.7</td><td>1.9</td><td>7.3</td><td>60.0</td><td>79.7</td><td>58.3</td><td></td><td>40.3</td><td>69.6</td><td>13.2</td><td>52.6</td><td>42.1</td></tr><tr><td>GENRE only BLINK data</td><td>28.1</td><td>82.5</td><td>88.1</td><td>69.9</td><td>44.8</td><td>66.1</td><td>15.0</td><td></td><td>16.4</td><td>25.6</td><td>6.8</td><td>38.7</td><td>43.8</td></tr><tr><td>GENRE w/o constraints</td><td>78.9</td><td>87.2</td><td>83.2</td><td>36.5</td><td>74.4</td><td>93.6</td><td></td><td>53.3</td><td>45.2</td><td>63.7</td><td>14.3</td><td>62.7</td><td>63.0</td></tr><tr><td>GENRE full</td><td>83.6</td><td>89.9</td><td>87.4</td><td>71.2</td><td>79.4</td><td></td><td>95.8</td><td>60.3</td><td>51.3</td><td>69.2</td><td>15.8</td><td>62.9</td><td>69.7</td></tr></table>
346
+
347
+ Table 8: Ablation study on KILT retrieval. We report R-Precision. GENRE only BLINK IDs denotes training on BLINK (Wu et al., 2020) data where instead of using the textual entity representation as target we used a numerical ID.
348
+
349
+ ![](images/9ab3e75d2df00730453e67b6ddf05d2ae034fdf27788fb5f49e7d1aa59bbcdd5.jpg)
350
+ Figure 4: Accuracy per number of BPE tokens of the Wikipedia title to generate on the validation sets of all KILT datasets except ELI5 (as it is fundamentally different from the others). We also show the data distribution of token lengths. Most of the titles have less than 15 BPE tokens while the mode of the distribution is 5. Here GENRE has an average accuracy of $7 8 . 6 \%$ but it is higher for short titles (e.g., ${ < } 1 0 _ { \circ }$ ) and it is lower for long titles (e.g., ${ \geq } 1 0 _ { \cdot }$ ). Degradation in performance does not directly follow the data distribution of the token lengths. Indeed, even if long titles are rare performance is not heavily affected (e.g., for length ${ > } 1 5$ ).
351
+
352
+ ![](images/236f52df4bd2f6823c5c6b139a3c444d90284492b7e06ad60694700cb1d27c7d.jpg)
353
+ Figure 5: Accuracy per number of incoming links in Wikipedia on the validation sets of all KILT datasets except ELI5 (as it is fundamentally different from the others). We also show the data distribution of the number of incoming links. Intuitively, a page/entity with few incoming links has been observed less than highly connected pages/entities. Indeed, for pages/entities never linked (first bin on the left) the average accuracy is $20 \%$ lower than the global average $( 7 8 . 6 \% )$ . However, for pages/entities linked at least once it is above the global average. This indicates that GENRE seems effective on linking rare entities.
354
+
355
+ # C EXAMPLES
356
+
357
+ 1 ID : ’ 87d95287−707e−4bd9−9633−ca0c611a4a3a World Without Superma : 8 ’
358
+ 2 i n p u t s : ’ [ . . ] When Superman l e a v e s E a r t h f o r New K r y p t o n , he a p p o i n t s , n e w l y f r e e d f r o m & the Phantom Zone , t o ta ke h i s pla ce as gua rdian of [ START ENT ] M e t r o p o l i s [ END ENT& Mon−E l assumes t h e s e c r e t i d e n t i t y o f J o h n a t h a n Kent as a t r i b u t e t o C l a r k \ ’ s & a d o p t i v e f a t h e r , p o s i n g as C l a r k \ ’ s c o u s i n . [ . . ]
359
+ 3 g o l d o u t p u t : ’ M e t r o p o l i s ( c o m i c s ) ’
360
+ 4 p r e d i c t e d o u t p u t s :
361
+ 5 ( ’ M e t r o p o l i s ( c o m i c s ) ’ , −0.09) ,
362
+ 6 ( ’ T h e m y s c i r a ( DC Comics ) ’ , −1.09) ,
363
+ 7 ( ’ M e t r o p o l i s ( d i s a m b i g u a t i o n ) ’ −1.27) ,
364
+ 8 ’ Superman ( comic book ) , −1.51) ,
365
+ 9 ( ’ Superman ( E a r t h−Two ) ’ , −1.52)
366
+ 10 ]
367
+
368
+ ![](images/319f43317fe610338f1634c083374b1944e125f86103f7f64b378d3b57ec75e0.jpg)
369
+ Figure 6: Example of a GENRE prediction for named entity disambiguation on KILT WNED. The input is plain text where a mention is flagged with two special start and end tokens [START ENT] and [END ENT]. The output is a ranked list of entity (where we report the log-likelihood as well).
370
+ Figure 7: Example of GENRE predictions for the retrieval task on KILT. The input is a query and the output is a ranked list of Wikipedia article titles (we also report the log-likelihood of the solutions).
371
+
372
+ ![](images/70f7bd3e4d3c2e209d178e29e65ee7fd4eec572294849bb44de8e62645c1a7f6.jpg)
373
+ Figure 8: Example of a GENRE prediction for end-to-end entity linking on AIDA. The input is plain text and the output is a Markup string where the links are Wikipedia titles. Spans are in the format $\left. s _ { i } , l _ { i } , t _ { i } \right.$ : start of the mention, length of the mention, and title respectively.
374
+
375
+ ![](images/184990c507b796d30aeba4523f2a47444d1e1046993c59271add350605b41ea0.jpg)
376
+ Figure 9: Example of prefix tree (trie) structure where the allowed entities identifiers are ‘English language’, ‘English literature’ and ‘France’. Note that at the root there is the start-of-sequence token SOS and all leaves are end-of-sequence tokens EOS. Since more that one sequence has the same prefix (i.e., ‘English’), this end up being an internal node where branches are the possible continuations.
md/train/9YlaeLfuhJF/9YlaeLfuhJF.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/9l0K4OM-oXE/9l0K4OM-oXE.md ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL ATTENTION DISTILLATION: ERASING BACKDOOR TRIGGERS FROM DEEP NEURAL NETWORKS
2
+
3
+ Yige $\mathbf { L i } ^ { 1 }$ Xixiang Lyu1† Nodens Koren2 Lingjuan Lyu3 Bo Li4 Xingjun $\mathbf { M } \mathbf { a } ^ { \mathsf { \pm } }$ 1Xidian University 2The University of Melbourne 3Ant Group 4University of Illinois at Urbana–Champaign 5Deakin University, Geelong
4
+
5
+ # ABSTRACT
6
+
7
+ Deep neural networks (DNNs) are known vulnerable to backdoor attacks, a training time attack that injects a trigger pattern into a small proportion of training data so as to control the model’s prediction at the test time. Backdoor attacks are notably dangerous since they do not affect the model’s performance on clean examples, yet can fool the model to make incorrect prediction whenever the trigger pattern appears during testing. In this paper, we propose a novel defense framework Neural Attention Distillation (NAD) to erase backdoor triggers from backdoored DNNs. NAD utilizes a teacher network to guide the finetuning of the backdoored student network on a small clean subset of data such that the intermediate-layer attention of the student network aligns with that of the teacher network. The teacher network can be obtained by an independent finetuning process on the same clean subset. We empirically show, against 6 state-of-the-art backdoor attacks, NAD can effectively erase the backdoor triggers using only $5 \%$ clean training data without causing obvious performance degradation on clean examples. Our code is available at https://github.com/bboylyg/NAD.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In recent years, deep neural networks (DNNs) have been widely adopted into many important realworld and safety-related applications. Nonetheless, it has been demonstrated that DNNs are prone to potential threats in multiple phases of their life cycles. A type of well-studied adversary is called the adversarial attack (Szegedy et al., 2013; Goodfellow et al., 2014; Ma et al., 2018; Jiang et al., 2019; Wang et al., 2019b; 2020; Duan et al., 2020; Ma et al., 2020). At test time, state-of-the-art DNN models can be fooled into making incorrect predictions with small adversarial perturbations (Madry et al., 2018; Carlini & Wagner, 2017; Wu et al., 2020; Jiang et al., 2020). DNNs are also known to be vulnerable to another type of adversary known as the backdoor attack. Recently, backdoor attacks have gained more attention due to the fact it could be easily executed in real scenarios (Gu et al., 2019; Chen et al., 2017). Intuitively, backdoor attack aims to trick a model into learning a strong correlation between a trigger pattern and a target label by poisoning a small proportion of the training data. Even trigger patterns as simple as a single pixel (Tran et al., 2018) or a black-white checkerboard (Gu et al., 2019) can grant attackers full authority to control the model’s behavior.
12
+
13
+ Backdoor attacks can be notoriously perilous for several reasons. First, backdoor data could infiltrate the model on numerous occasions including training models on data collected from unreliable sources or downloading pre-trained models from untrusted parties. Additionally, with the invention of more complex triggers such as natural reflections (Liu et al., 2020b) or invisible noises (Liao et al., 2020; Li et al., 2019; Chen et al., 2019c), it is much harder to catch backdoor examples at test time. On top of that, once the backdoor triggers have been embedded into the target model, it is hard to completely eradicate their malicious effects by standard finetuning or neural pruning (Yao et al., 2019; Li et al., 2020b; Liu et al., 2020b). A recent work also proposed the mode connectivity repair (MCR) to remove backdoor related neural paths from the network (Zhao et al., 2020a). On the other hand, even though detection-based approaches have been performing fairly well on identifying backdoored models (Chen et al., 2019a; Tran et al., 2018; Chen et al., 2019b; Kolouri et al., 2020), the identified backdoored models still need to be purified by backdoor erasing techniques.
14
+
15
+ In this work, we propose a novel backdoor erasing approach, Neural Attention Distillation (NAD), for the backdoor defense of DNNs. NAD is a distillation-guided finetuning process motivated by the ideas of knowledge distillation (Bucilua et al., 2006; Hinton et al., 2014) and neural attention transfer (Zagoruyko & Komodakis, 2017; Huang & Wang, 2017; Heo et al., 2019). Specifically, NAD utilizes a teacher network to guide the finetuning of a backdoored student network on a small subset of clean training data so that the intermediate-layer attention of the student network is wellaligned with that of the teacher network. The teacher network can be obtained from the backdoored student network via standard finetuning using the same clean subset of data. We empirically show that such an attention distillation step is far more effective in removing the network’s attention on the trigger pattern in comparison to the standard finetuning or the neural pruning methods.
16
+
17
+ Our main contributions can be summarized as follows:
18
+
19
+ • We propose a simple yet powerful backdoor defense approach called Neural Attention Distillation (NAD). NAD is by far the most comprehensive and effective defense against a wide range of backdoor attacks.
20
+ • We suggest that attention maps can be used as an intuitive way to evaluate the performance of backdoor defense mechanisms due to their ability to highlight backdoored regions in a network’s topology.
21
+
22
+ # 2 RELATED WORK
23
+
24
+ Backdoor Attack. Backdoor attack is a type of attack emerging in the training pipeline of DNNs. Oftentimes, a backdoor attack is accomplished by designing a trigger pattern with (poisoned-label attack) (Gu et al., 2019; Chen et al., 2017; Liu et al., 2018b) or without (clean-label attack) (Shafahi et al., 2018; Turner et al., 2019; Liu et al., 2020b) a target label injected into a subset of training data. These trigger patterns can appear in forms as simple as a single pixel (Tran et al., 2018) or a tiny patch (Chen et al., 2017), or in more complex forms such as sinusoidal strips (Barni et al., 2019) and dynamic patterns (Li et al., 2020c; Nguyen & Tran, 2020). Trigger patterns may also appear in the form of natural reflection (Liu et al., 2020b) or human imperceptible noise (Liao et al., 2020; Li et al., 2019; Chen et al., 2019c), making them more stealthy and hard to be detected even by human inspection. Recent studies have shown that a backdoor attack can be conducted even without access to the training data (Liu et al., 2018b) or in federated learning (Xie et al., 2019; Bagdasaryan et al., 2020; Lyu et al., 2020). Surveys on backdoor attacks can be found in (Li et al., 2020a; Lyu et al., 2020).
25
+
26
+ Backdoor Defense. Existing works primarily focused on two types of strategies to defend against backdoor attacks. Depending on the methodologies, a backdoor defense can be either backdoor detection or trigger erasing.
27
+
28
+ Detection-based methods aim at identifying the existence of backdoor adversaries in the underlying model (Wang et al., 2019a; Kolouri et al., 2020) or filtering the suspicious samples from input data for re-training (Tran et al., 2018; Gao et al., 2019; Chen et al., 2019b). Although these methods have been performing fairly well on distinguishing whether a model has been poisoned, the backdoor effects still remain in the backdoored model. On the other hand, Erasing-based methods aim to directly purify the backdoored model by removing the malicious impacts caused by the backdoor triggers, while simultaneously maintain the model’s overall performance on clean data. A straightforward approach is to directly finetune the backdoored model on a small subset of clean data, which is typically available to the defender (Liu et al., 2018b). Nonetheless, training on only a small clean subset can lead to catastrophic forgetting (Kirkpatrick et al., 2017), where the model overfits to the subset and consequently causes substantial performance degradation. Fine-pruning (Liu et al., 2018a) alleviates this issue by pruning less informative neurons prior to finetuning the model. In such a way, the standard finetuning process can effectively erase the impact of backdoor triggers without significantly deteriorating the model’s overall performance. WILD (Liu et al., 2020a) proposed to utilize data augmentation techniques alongside distribution alignment between clean samples and their occluded versions to remove backdoor triggers from DNNs. Other techniques such as regularization (Truong et al., 2020) and mode connectivity repair (Zhao et al., 2020a) have also been explored to mitigate backdoor attacks. While promising, existing backdoor erasing methods still suffer from a number of drawbacks. Efficient methods can be evaded by the latest attacks (Liu et al., 2018a; 2020b), whereas effective methods are typically computationally expensive (Zhao et al., 2020a). In this work, we propose a novel finetuning-based backdoor erasing approach that is not only effective but efficient against a wide range of backdoor attacks.
29
+
30
+ ![](images/15de6974418f3039ae470101ea8522c535bc746b064eca57edca0fd971d9e84d.jpg)
31
+ Figure 1: The pipeline of backdoor erasing techniques. (a) The standard finetuning process, (b) our proposed NAD approach, and (c) our NAD framework using ResNet (He et al., 2016) as an example. NAD erases backdoor trigger following a two-step procedure: 1) obtain a teacher network by finetuning the backdoored network with a subset of clean training data, then 2) combine the teacher and the student through the neural attention distillation process. The attention representations are computed after each residual group, and the NAD distillation loss is defined in terms of the attention representations of the teacher and the student networks.
32
+
33
+ Knowledge Distillation (KD). KD was first proposed to compress a bigger or an ensemble of welltrained network(s) into a compact smaller network (Bucilua et al., 2006; Hinton et al., 2014). In this process, the more knowledgeable network is referred to as the teacher network, and the smaller network is the student network. Feature maps and attention mechanisms have been demonstrated to be very useful in KD to supervise the training of student networks (Romero et al., 2015; Zagoruyko & Komodakis, 2017; Huang & Wang, 2017; Song et al., 2018; Ahn et al., 2019; Heo et al., 2019). They can help the student network to learn more high-quality intermediate representations, leading to an improved distillation effect and better student network performance (Romero et al., 2015; Zagoruyko & Komodakis, 2017). KD has also shown its potential in other fields such as adversarial robustness (Papernot et al., 2016), multi-granularity lip reading (Zhao et al., 2020b), and data augmentation (Bagherinezhad et al., 2018). In this work, we propose a new backdoor defense technique based on the combination of knowledge distillation and neural attention transfer.
34
+
35
+ # 3 PROPOSED APPROACH
36
+
37
+ In this section, we first describe the defense setting, then introduce the proposed NAD approach.
38
+
39
+ Defense Setting. We adopt a typical defense setting where the defender outsourced a backdoored model from an untrusted party and is assumed to have a small subset of clean training data to finetune the model. The goals of backdoor erasing are to erase the backdoor trigger from the model while retaining the performance of the model on clean samples.
40
+
41
+ # 3.1 NEURAL ATTENTION DISTILLATION
42
+
43
+ Overview. We illustrate the differences between NAD and the traditional finetuning approach in Figure 1. Instead of using the finetuned network directly as our final model, we employ it as a teacher network and use it in conjunction with the original backdoored network (i.e. student network) through an attention distillation process. The job of NAD is to align neurons that are more responsive to the trigger pattern with benign neurons that only responsible for meaningful representations. The main challenge for NAD is thus to find the proper attention representations to distill. Over the next few subsections, we will define the attention representation used throughout our work formally and introduce the loss functions used in the process of attention distillation.
44
+
45
+ Attention Representation. Given a DNN model $F$ , we denote the activation output at the $l$ -th layer as $F ^ { l } \in \mathbb { R } ^ { C \times \hat { H } \times W }$ with $C$ , $H$ and $W$ being the dimensions of the channel, the height, and the width of the activation map respectively. We define $\mathcal { A } : \mathbb { R } ^ { C \times H \times W } \mathbb { R } ^ { H \times W }$ to be an attention operator that maps an activation map to an attention representation. Specifically, $\mathcal { A }$ takes a 3D activation map $F$ as input and outputs a flattened 2D tensor along the channel dimension. We explore three possible formulations of the attention operator $\mathcal { A }$ as suggested in (Zagoruyko & Komodakis, 2017):
46
+
47
+ $$
48
+ \mathcal { A } _ { \mathrm { s u m } } ( F ^ { l } ) = \sum _ { i = 1 } ^ { C } \left| F _ { i } ^ { l } \right| ; \mathcal { A } _ { \mathrm { s u m } } ^ { p } ( F ^ { l } ) = \sum _ { i = 1 } ^ { C } \left| F _ { i } ^ { l } \right| ^ { p } ; \mathcal { A } _ { \mathrm { m e a n } } ^ { p } ( F ^ { l } ) = \frac { 1 } { C } \sum _ { i = 1 } ^ { C } \left| F _ { i } ^ { l } \right| ^ { p } ,
49
+ $$
50
+
51
+ where $F _ { i } ^ { l }$ is the activation map of the $i$ -th channel, $| \cdot |$ is the absolute value function and $p > 1$ . Intuitively, $\mathcal { A } _ { \mathrm { s u m } }$ reflects all activation regions including both the benign and the backdoored neurons. $\mathcal { A } _ { s u m } ^ { p }$ is a generalized version of $\mathcal { A } _ { \mathrm { s u m } }$ that amplifies the disparities between the backdoored neurons and the benign neurons by an order of $p$ . In other words, the larger the $p$ is, the more weight is placed on the parts with highest neuron activations. $A _ { \mathrm { m e a n } }$ aligns the activation center of the backdoored neurons with that of the benign neurons by taking the mean over all activation regions. An empirical understanding of the three attention representations is provided in the experiments.
52
+
53
+ Attention Distillation Loss. A detailed structure of our NAD framework is illustrated in Figure 1(c). For ResNets (He et al., 2016), we compute attention representations using one of the proposed attention functions after each group of residual blocks. The teacher network is kept fixed throughout the distillation process. The distillation loss at the $l$ -th layer of the network is defined in terms of the teacher’s and the student’s attention maps:
54
+
55
+ $$
56
+ \mathcal { L } _ { \mathrm { N A D } } \left( F _ { T } ^ { l } , F _ { S } ^ { l } \right) = \left. \frac { \mathcal { A } ( F _ { T } ^ { l } ) } { \left. \mathcal { A } ( F _ { T } ^ { l } ) \right. _ { 2 } } - \frac { \mathcal { A } ( F _ { S } ^ { l } ) } { \left. \mathcal { A } ( F _ { S } ^ { l } ) \right. _ { 2 } } \right. _ { 2 } ,
57
+ $$
58
+
59
+ where $\| \cdot \| _ { 2 }$ is the $L _ { 2 }$ norm and $\mathcal { A } ( F _ { T } ^ { l } ) / \mathcal { A } ( F _ { S } ^ { l } )$ is the computed attention maps of the teacher/student network. It is worth mentioning that the normalization of the attention map is crucial to a successful distillation (Zagoruyko & Komodakis, 2017).
60
+
61
+ Overall Training Loss. The overall training loss is a combination of the cross entropy (CE) loss and the sum of the Neural Attention Distillation (NAD) loss over all $K$ residual groups:
62
+
63
+ $$
64
+ \mathcal { L } _ { t o t a l } = \mathbb { E } _ { ( \pmb { x } , \pmb { y } ) \sim \mathcal { D } } [ \mathcal { L } _ { \mathrm { C E } } ( F _ { S } ( \pmb { x } ) , \pmb { y } ) + \beta \cdot \sum _ { l = 1 } ^ { K } \mathcal { L } _ { \mathrm { N A D } } ( F _ { T } ^ { l } ( \pmb { x } ) , F _ { S } ^ { l } ( \pmb { x } ) ) ] ,
65
+ $$
66
+
67
+ where $\mathcal { L } _ { \mathrm { C E } } ( \cdot )$ measures the classification error of the student network, $\mathcal { D }$ is a subset of clean data used in finetuning, $l$ is the index of the residual group, and $\beta$ is a hyperparameter controlling the strength of the attention distillation.
68
+
69
+ Before the attention distillation, a teacher network should be in place. We finetune the backdoored student network on the same clean subset $\mathcal { D }$ to obtain the teacher network. We will investigate how the choice of the teacher network affects the performance of NAD in Section 4.4. We only distill the student network once as our NAD approach is effective enough to remove the backdoor by only a few epochs of distillation. A comprehensive analysis of iteratively applied NAD is also provided in the Appendix G.
70
+
71
+ # 4 EXPERIMENTS
72
+
73
+ In this section, we first introduce the experimental setting. We then evaluate and compare the effectiveness of NAD with 3 existing backdoor erasing methods on 6 state-of-the-art backdoor attacks. Finally, we provide a comprehensive understanding of NAD.
74
+
75
+ # 4.1 EXPERIMENTAL SETTING
76
+
77
+ Backdoor Attacks and Configurations. We consider 6 state-of-the-art backdoor attacks: 1) BadNets (Gu et al., 2019), 2) Trojan attack (Liu et al., 2018b), 3) Blend attack (Chen et al., 2017), 4) Clean-label attack(CL) (Turner et al., 2019) , 5) Sinusoidal signal attack(SIG) (Barni et al., 2019), and 6) Reflection attack(Refool) (Liu et al., 2020b). For a fair evaluation, we follow the configuration, including the trigger patterns, the trigger sizes and the target labels, of these attacks in their original papers. We test the performance of all attacks and erasing methods on two benchmark datasets, CIFAR-10 and GTSRB, with WideResNet (WRN-16- $1 ^ { * }$ ) being the base model throughout the experiments. More details on attack configurations are summarized in Appendix A.
78
+
79
+ Table 1: Performance of 4 backdoor defense methods against 6 backdoor attacks evaluated using the attack success rate (ASR) and the classification accuracy (ACC). The deviation indicates the $\%$ changes in ASR/ACC compared to the baseline (i.e. no defense). The experiments for Refool were done on GTSRB, while all other experiments were done on CIFAR-10. The best results are in bold.
80
+
81
+ <table><tr><td rowspan="2">Backdoor Attack</td><td colspan="2">Before</td><td colspan="2">Finetuning</td><td colspan="2">Fine-pruning</td><td colspan="2">MCR (t = 0.3)</td><td colspan="2">NAD (Ours)</td></tr><tr><td>ASR</td><td>ACC</td><td>ASR</td><td>ACC</td><td>ASR</td><td>ACC</td><td>ASR</td><td>ACC</td><td>ASR ACC</td></tr><tr><td>BadNets</td><td>100</td><td>85.65</td><td>17.18</td><td>81.22</td><td>99.73</td><td>81.14</td><td>4.65</td><td>80.94</td><td>4.77 81.17</td></tr><tr><td>Trojan</td><td>100</td><td>81.24</td><td>71.76</td><td>77.88</td><td>41.00</td><td>78.17</td><td>41.25 78.76</td><td>19.63</td><td>79.16</td></tr><tr><td>Blend</td><td>99.97</td><td>84.95</td><td>36.60</td><td>81.22</td><td>93.62</td><td>81.13</td><td>64.33 80.34</td><td>4.04</td><td>81.68</td></tr><tr><td>CL</td><td>99.21</td><td>82.43</td><td>75.08</td><td>81.73</td><td>29.88</td><td>79.32</td><td>32.95 79.04</td><td>9.18</td><td>80.34</td></tr><tr><td>SIG</td><td>99.91</td><td>84.36</td><td>9.18</td><td>81.28</td><td>74.26</td><td>81.60</td><td>1.62 80.94</td><td>2.52</td><td>81.95</td></tr><tr><td>Refool</td><td>95.16</td><td>82.38</td><td>14.38</td><td>80.34</td><td>63.49</td><td>80.64</td><td>8.76</td><td>78.84 3.18</td><td>80.73</td></tr><tr><td>Average</td><td>99.04</td><td>83.50</td><td>37.36</td><td>80.61</td><td>67.00</td><td>80.50</td><td>25.59 79.81</td><td>7.22</td><td>80.83</td></tr><tr><td>Deviation</td><td>1</td><td>-</td><td>↓61.68</td><td>↓2.89</td><td>↓32.04</td><td>↓3</td><td>↓73.44 ↓3.69</td><td>91.82</td><td>↓2.66</td></tr></table>
82
+
83
+ Defense Configuration. We compare our NAD approach with 3 existing backdoor erasing methods: 1) the standard finetuning, 2) Fine-pruning (Liu et al., 2018a), and 3) mode connectivity repair (MCR) (Zhao et al., 2020a). We assume all defense methods have access to the same $5 \%$ of the clean training data.
84
+
85
+ For NAD, we finetune the backdoored model (i.e. the student network) on the $5 \%$ accessible clean data for 10 epochs (results for 20 epochs can be found in Appendix J) using the Stochastic Gradient Descent (SGD) optimizer with a momentum of 0.9, an initial learning rate of 0.1, and a weight decay factor of $1 0 ^ { - 4 }$ . The learning rate is divided by 10 after every 2 epochs. We use a batch size of 64, and apply typical data augmentation techniques including random crop (padding $= 4$ ), horizontal flipping, and Cutout (n hole $\mathrm { { \ s } } = 1$ and length $^ { = 9 }$ ) (DeVries & Taylor, 2017). The data augmentations are applied to each batch of training images at each training iteration, following a typical DNN training process. The same data augmentations are also applied to other fintuning-based baseline methods. Additionally, we have a comparison of our NAD method to just using data augmentations Cutout and Mixup in Appendix B. For the distillation loss, we compute the attention maps using the A2sum attention operator after the three groups of residual blocks of WRN-16-1 (see Figure 1(c)) . An extensive study on four attention functions is given in Section 4.3. For the hyperparameter $\beta$ , we adaptively set it to different values for each backdoor attack. We provide more details on defense settings in Table 3 (see Appendix A).
86
+
87
+ Evaluation Metrics. We evaluate the performance of defense mechanisms with two metrics: attack success rate (ASR), which is the ratio of backdoored examples that are misclassified as the target label, and model’s accuracy on clean samples (ACC). The more the ASR drops and the less the ACC drops, the stronger the defense mechanism is.
88
+
89
+ # 4.2 EFFECTIVENESS OF OUR NAD DEFENSE
90
+
91
+ In order to assess the effectiveness of our proposed NAD defense, we evaluate its performance against 6 backdoor attacks using two metrics (i.e. ASR and ACC). We then compare the performance of NAD with the other 3 existing backdoor defense methods in Table 1. Our experiment shows that our NAD defense remarkably brought the average ASR from nearly $100 \%$ down to $7 . 2 2 \%$ . In comparison, Finetuning, Fine-pruning, and MCR are only able to reduce the average ASR to $3 7 . 3 6 \%$ , $6 7 . 0 0 \%$ , and $2 5 . 5 9 \%$ respectively.
92
+
93
+ MCR has an erasing effect stronger than that of the NAD’s by $0 . 1 2 \%$ on BadNets and by $0 . 9 \%$ on SIG, but its performance against the 4 other attacks are much poorer. Specifically, MCR failed to defend $6 0 . 2 9 \%$ more attack on Blend, $2 3 . 7 7 \%$ more attack on CL, and $1 8 . 7 7 \%$ more attack on Trojan in comparison to NAD. Our hypothesis on this is that backdoor triggers with much complicated adversarial noises (e.g. random or PGD perturbations) would hinder the training of connect path and consequently gives MCR a hard time at finding robust models against these backdoor attacks. Interestingly, finetuning did moderately well in erasing all kinds of attacks. A reasonable explanation to this is that the data augmentation techniques used in the early stage might have recovered some trigger-related images leading the backdoor model to unlearn the original trigger. For instance, the black edges in the zero-padding of images may have effects similar to the black-white trigger in BadNets. On the other hand, Fine-pruning gives a poor performance on mitigating all backdoor attacks under our experiment settings. We speculate that a potential reason behind this is due to the low number of neurons in the last convolutional layer of WRN-16-1, indicating a high mixing of benign neurons and backdoored neurons. This may cause a significant reduction in the classification accuracy and in consequence makes the pruning ineffective.
94
+
95
+ ![](images/6c09c45a2b6922d59c7c1efd10d1f100907de28b46b2905f64d769abebef35b7.jpg)
96
+ Figure 2: Performance of 4 backdoor erasing methods under different $\%$ of available clean data. The plots show the average ASR (left) and ACC (right) over all 6 attacks. NAD significantly reduces the ASR to nearly $0 \%$ with $20 \%$ clean data.
97
+
98
+ In summary, all erasing methods have some negative effects on the ACC, but the drops by utilizing NAD is the least prominent (merely $2 . 6 6 \%$ ). More comparisons to data augmentation techniques and the effectiveness in erasing all-target and adaptive backdoor attacks can be found in Appendix B, H and Appendix K respectively.
99
+
100
+ Effectiveness under Different Percentages of Clean Data. We are also interested in studying the correlation between the performance of NAD and the amount of available pristine data. Intuitively, we anticipate NAD to be stronger when we have more clean training data, and vice versa. The performance of NAD and 3 other defense mechanisms with various sizes of “purifying dataset” is recorded in Figure 2.
101
+
102
+ It is within our expectation that both MCR and our proposed NAD approach are capable of defending against all 6 backdoor attacks almost $100 \%$ of the time when $20 \%$ of clean training data are available to us. Nonetheless, NAD still beats MCR in terms of the convergence rate. We will show in Appendix C that our proposed NAD approach converges much faster than MCR. Additionally, we find that finetuning becomes much more effective when the backdoor model is retrained on $20 \%$ o f the clean data. Despite the improvement, the standard finetuning method is still considerably worse than MCR and NAD by ${ \sim } 1 0 \%$ in terms of the ASR. Surprisingly, Fine-pruning gains almost no benefits from clean data additional to the $5 \%$ used in the first experiment. This is because the benign neurons and the backdoored neurons are highly blended in the last layer of the backdoored network, leading to excessive pruning of the backdoored neurons. Retraining becomes pointless when too many backdoored neurons have been removed.
103
+
104
+ In short, even with just $1 \%$ of clean training data available, our NAD can still effectively bring the average ASR from $9 9 . 0 4 \%$ down to $3 5 . 9 3 \%$ , while only sacrifices $4 . 6 9 \%$ of ACC.
105
+
106
+ Comparison to Trigger Recovering. Some existing works proposed defense methods that predict the distributions of backdoor triggers through generative modeling or neuron reverse engineering. The predicted distributions can subsequently be sampled to craft backdoored data with correct labels. These “remedy data” can subsequently be used in retraining to alleviate the impact of backdoor triggers (Wang et al., 2019a; Qiao et al., 2019).
107
+
108
+ In this subsection, we compare the performance of our NAD defense to one such approach, MESA (Qiao et al., 2019), which is the current state-of-the-art trigger recovering method. Specifically, we are interested in comparing our method to the retraining-based method in general. To do this, we first retrain the backdoored model separately using the trigger generated by MESA (Rec-T) and the original trigger (Org-T). We then evaluate the performance of these retrained models and compare their performances to that of the NAD’s. The results are presented in Table 6 (see Appendix D).
109
+
110
+ The retraining-based approach is strong at defending against the BadNets attack. It is able to reduce the ASR from $100 \%$ to under $5 \%$ without significantly sacrificing the ACC. Nonetheless, its performance is nowhere close to our NAD defense when facing the CL attack. This is a good indication that the backdoored neurons can be fixed by retraining with the remedy data when the backdoor behavior is induced by only a few backdoored neurons. On the other hand, it is too much for these remedy data to handle backdoors obtained through the combination of complex adversarial noises and stronger trigger patterns.
111
+
112
+ ![](images/bdefe227d14ab7ef919d5aac0fe1462360321521eff83b705299aa254a9ec375.jpg)
113
+ Figure 3: Visualization of the attention maps learned at each residual group of the WRN-16-1 by different defense methods for a BadNets (left) or CL (right) backdoored image (see Appendix A). Our NAD method demonstrates a more effective erasing effect at the deeper layers (e.g. Group 3).
114
+
115
+ # 4.3 A COMPREHENSIVE UNDERSTANDING AND ANALYSIS OF NAD
116
+
117
+ In this section, we first provide intuition behind what an attention map is from the visual perspective, we then compare the efficacy of various choices of attention representation as promised in Section 3.1. Finally, we explore the adjustment border of the hyperparameter $\beta$ .
118
+
119
+ Understanding Attention Maps. The activation information of all neurons in a layer of a neural network can be referred from the attention map of that layer. The conjunct of all attention maps hence reflects the most discriminative regions in the network’s topology (Lopez et al., 2019). To give intuition on how attention maps help NAD with erasing backdoor triggers, we visualize and compare the attention maps before and after backdoor erasing in Figure 3. We use the attention function $\mathcal { A } _ { s u m } ^ { 2 }$ to derive the attention maps. For the backdoored models, all attention maps are completely (i.e. group1, group2, and group3) biased towards the backdoor trigger region, implying that the backdoor trigger can easily mislead the network to misbehave. The objective of backdoor erasing methods is consequently to relax the tension in this region. We show the results for two attacks, BadNets (left) and CL (right), to validate our hypothesis.
120
+
121
+ Attention maps can also be used as an indicator to deduce the performance of backdoor erasing methods. In Figure 3, we show the attention maps of a backdoored WRN-16-1 after purified by four different mechanisms: Fine-pruning, the standard finetuning, MCR, and our NAD approach. As expected, BadNets can easily be erased by the most defenses. To see why, refer to the attention maps of group 3; the network purified by the standard finetuning, MCR, and NAD pay almost no attention to the bottom right corner where the trigger is injected. For CL, only MCR and NAD are able to distract the backdoored model’s from focusing on the triggered regions, which is also foreseeable as CL is a stronger attack. In addition, the activation intensity of NAD in the benign area (i.e. non-trigger area) is correspondingly greater than that of MCR, which also justifies our conclusion that NAD is better than MCR in erasing CL attacks from another perspective.
122
+
123
+ Next, we compare the performance of NAD under scenarios where 4 different attention functions, $A _ { m e a n }$ , $\mathcal { A } _ { m e a n } ^ { 2 }$ , $\mathcal { A } _ { s u m }$ , and $\mathcal { A } _ { s u m } ^ { 2 }$ are in place. We use the BadNets attack as our benchmark attack. Again, we evaluate the performance of NAD using two metrics, the ASR and the ACC, and the results are summarized in Appendix F. Despite all choices of attention function are able to help NAD erase backdoors quite efficiently, $\mathcal { A } _ { s u m } ^ { 2 }$ achieved the best overall results. A comparison to using the raw activation map for distillation can be found in Appendix I.
124
+
125
+ Attention Distillation VS. Feature Distillation. We outline two advantages of attention distillation over feature distillation: 1) Integration. The attention operators calculate the sum (or the mean) of the activation map over different channels (see Equation 1). It can thus provide an integrated measure of the overall trigger effect. On the contrary, the trigger effect may be scattered into different channels if we use the raw activation values directly. Such a difference between the attention and the feature maps is visualized in Figure 11 and 12 in Appendix I. Therefore, aligning the attention maps between the teacher and the student networks is more effective in weakening the overall trigger effect than directly aligning the raw feature maps. 2) Regularization. Due to its integration effect, an attention map contains the activation information of both backdoor-fired neurons and the benign neurons. This is important as the backdoor neurons can receive extra gradient information from the attention map even when they are not activated by the clean data. Moreover, attention maps have lower dimensions than feature maps. This makes the attention map based regularization (alignment) more easily to be optimized than feature map based regularization.
126
+
127
+ ![](images/b4f8214e51fdb9fabab4161d80fd9128dcac31a819d038f9fdc1878e8f0b228e.jpg)
128
+ Figure 4: Comparison of 4 distillation combinations on CIFAR-10. The B, B-F, and C represent backdoored model, finetuned backdoored model, and model trained on the clean subset, respectively.
129
+
130
+ ![](images/6f2240c7bce31e8293303da10bcabe228c634b4269faf0fbc993cff66714b6fa.jpg)
131
+ Figure 5: Performance of NAD with teachers trained on various $\%$ of clean CIFAR-10 data.
132
+
133
+ Effect of Parameter $\beta$ . The selection of the distillation parameter $\beta$ is also a key factor for NAD to erase backdoor triggers successfully. We show the results of the coarse tuning $\beta$ for all the backdoor attacks in Appendix E, and it reveals that $\beta$ can certainly be tuned more to improve the performance of NAD. In short, the process of finding the right scaling factor $\beta$ is to find a balance between the ASR and the ACC. Even though bigger $\beta$ is more effective against backdoor attacks, Figure 8(right) in Appendix E shows that arbitrarily increasing $\beta$ may cause a degradation in the ACC. For instance, the purified network lost more than $50 \%$ of ACC when $\beta$ is set to 50,000. A practical strategy to select $\beta$ is to increase $\beta$ until the clean accuracy (right subfigure in Figure 8) drops below an acceptable threshold. This can reliably find an optimal $\beta$ , as increasing $\beta$ can always improve the robustness (left subfigure in Figure 8).
134
+
135
+ # 4.4 FURTHER EXPLORATION OF NAD
136
+
137
+ Here, we explore how the combinations of teachers and students and the choice of the teacher affect the defense performance of NAD. For simplicity, we define $\mathbf { B }$ to be the backdoored network, B-F to be the finetuned backdoored network, and C to be the model trained from scratch using $5 \%$ of clean training data. Here we consider 4 combinations of networks: 1) $\mathbf { B }$ teacher and B-F student, 2) B-F teacher and $\mathbf { B }$ student, 3) B-F teacher and B-F student, and 4) C teacher and $\mathbf { B }$ student.
138
+
139
+ Effect of Teacher-Student Combinations. The ASR and ACC of NAD-purified networks using different teacher-students combinations are presented in Figure 4. We find that the ASR slightly diminished with the combination of $\mathbf { B }$ teacher and B-F student. On the contrary, when using a B$\mathbf { F }$ teacher and a $\mathbf { B } { \cdot } \mathbf { F }$ student in the NAD framework, the ASR is drastically lowered (significantly improved defense). Interestingly, compared with the standard setting used throughout the previous experiments (i.e. Teacher: B-F, Student: B), using a trained-from-scratch model as the teacher can also reduce the average ASR by more than $80 \%$ . Furthermore, this combination works even better in tackling the Trojan attack. Nonetheless, the combination of $\mathbf { C }$ teacher and $\mathbf { B }$ student significantly deteriorates the ACC of the purified model, which is also predictable because the amount of clean data available to train a model from scratch has a direct effect on the model’s accuracy. It is hence not a surprise that an incompetent teacher misleads the student network into learning flawed features.
140
+
141
+ Table 2: Effectiveness of our NAD with different teacher architectures against BadNets on CIFAR10. ASR: attack success rate; ACC: clean accuracy. The first column highlights the architectural difference between the teacher and the student network. The best results are boldfaced.
142
+
143
+ <table><tr><td rowspan="2">Difference</td><td rowspan="2">Teacher</td><td rowspan="2">Student</td><td colspan="2">Before</td><td colspan="2">NAD (Ours)</td><td>Teacher</td></tr><tr><td>ASR</td><td>ACC</td><td>ASR</td><td>ACC</td><td>ACC</td></tr><tr><td>Depth&amp;Channel</td><td>WRN-10-2</td><td>WRN-16-1</td><td>100%</td><td>85.65%</td><td>4.68%</td><td>78.36%</td><td>63.78%</td></tr><tr><td>Same</td><td>WRN-16-1</td><td>WRN-16-1</td><td>100%</td><td>85.65%</td><td>4.55%</td><td>74.53%</td><td>61.21%</td></tr><tr><td>Channel</td><td>WRN-16-2</td><td>WRN-16-1</td><td>100%</td><td>85.65%</td><td>3.04%</td><td>78.68%</td><td>64.25%</td></tr><tr><td>Depth</td><td>WRN-40-1</td><td>WRN-16-1</td><td>100%</td><td>85.65%</td><td>2.95%</td><td>78.87%</td><td>63.35%</td></tr><tr><td>Depth&amp;Channel</td><td>WRN-40-2</td><td>WRN-16-1</td><td>100%</td><td>85.65%</td><td>3.74%</td><td>79.07%</td><td>64.53%</td></tr></table>
144
+
145
+ Effect of the Choice of a Teacher. Due to the competitive performance offered by the C teacher and $\mathbf { B }$ student combination in the last section, we are interested in exploring one question: is the standard setting (i.e. B-F teacher and $\pmb { B }$ student) we used throughout previous experiments still the best option when more clean data are available to us? To answer this question, we compare the performance of both B-F teacher and C teacher to erase $\mathbf { B }$ student under various percentages of available clean data on CIFAR-10. We use the same training configurations described in Section 4.1. The results are shown in Figure 5. Compared with the finetuning option of B-F teacher, the C teacher trained on a subset of clean data also offers competitive performance. Specifically, in the case where we have $20 \%$ of clean data available to us, the training option reduces the ASR by $0 . 1 5 \%$ in comparison to the finetuning option; nonetheless, it reduces the ACC by a greater amount of $2 . 5 \%$ . This makes finetuning still a better option even when we have $20 \%$ clean data at hands.
146
+
147
+ Effectiveness of Different Teacher Architectures. This experiment is conducted on CIFAR-10 against BadNets attack. We consider 5 teacher architectures: WRN-10-2, WRN-16-1, WRN-16-2, WRN-40-1 and WRN-40-2. We fix the student network to WRN-16-1. Since the teachers are of different (except one) architectures as the student, we train the teacher networks from scratch using only $5 \%$ clean training data. Our NAD is applied following the same configurations in Section 4.1. The results are reported in Table 2. We can see that all 5 teacher networks are able to purify the backdoored student effectively under our NAD framework. NAD can reduce the ASR from $100 \%$ to $4 . 6 8 \%$ even when a small teacher WRN-10-2 is used. This confirms that our NAD defense generalizes well across different network architectures. Note that the clean accuracy of NAD decreases more than in the same architecture setting (see Table 1). This is because the teachers have lower clean accuracy when trained from scratch on only $5 \%$ clean data, as we have analyzed in Figure 4.
148
+
149
+ Why a finetuned teacher can purify a backdoored student? During the NAD process, the backdoored neurons in the finetuned teacher network are less likely to be activated by the clean finetuning data. Moreover, as shown in Figure 12 (Appendix I), finetuning can suppress the trigger effect, and at the same time, boost the benign neurons (more visible light green regions in Figure 12 (b)). By using the squared sum attention map $\mathcal { A } _ { s u m } ^ { 2 }$ (analyzed in Section 4.3 and Appendix I), this trigger erasing effect can accumulate from the already finetuned teacher network, leading to more robust and cleaner student network. Note that the student can still overfit to the partially purified teacher if it is overly finetuned.
150
+
151
+ # 5 CONCLUSION
152
+
153
+ In this work, we proposed a novel knowledge distillation based backdoor defense framework Neural Attention Distillation (NAD). We demonstrated empirically that our proposed approach is able to achieve a superior performance against 6 state-of-the-art backdoor attacks in comparison to 3 other backdoor defense methods. Additionally, we propose the use of attention maps as an intuitive way to evaluate the performance of backdoor defense mechanisms due to their capability of displaying backdoored regions in a network’s topology visually. On top of that, we explored how different experimental settings might affect our proposed method. Empirical results demonstrate that our results are fairly resilient to the changes in experimental settings and thus can be conveniently employed without exhaustive hyperparameter tuning. Overall, our proposed NAD backdoor defense framework provides a strong baseline in mitigating the backdoor threat in model deployment.
154
+
155
+ # ACKNOWLEDGEMENT
156
+
157
+ This work is supported by China National Science Foundation under grant number 62072356 and Amazon research award.
158
+
159
+ # REFERENCES
160
+
161
+ Sungsoo Ahn, Shell Xu Hu, Andreas Damianou, Neil D Lawrence, and Zhenwen Dai. Variational information distillation for knowledge transfer. In CVPR, 2019.
162
+
163
+ Eugene Bagdasaryan, Andreas Veit, Yiqing Hua, Deborah Estrin, and Vitaly Shmatikov. How to backdoor federated learning. In AISTATS, 2020.
164
+
165
+ Hessam Bagherinezhad, Maxwell Horton, Mohammad Rastegari, and Ali Farhadi. Label refinery: Improving imagenet classification through label progression. In ICCV, 2018.
166
+
167
+ Mauro Barni, Kassem Kallas, and Benedetta Tondi. A new backdoor attack in cnns by training set corruption without label poisoning. In ICIP, 2019.
168
+
169
+ Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In SIGKDD, 2006.
170
+
171
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In $S P$ 2017.
172
+
173
+ Bryant Chen, Wilka Carvalho, Nathalie Baracaldo, Heiko Ludwig, Benjamin Edwards, Taesung Lee, Ian Molloy, and Biplav Srivastava. Detecting backdoor attacks on deep neural networks by activation clustering. In AAAI Workshop, 2019a.
174
+
175
+ Huili Chen, Cheng Fu, Jishen Zhao, and Farinaz Koushanfar. Deepinspect: A black-box trojan detection and mitigation framework for deep neural networks. In IJCAI, 2019b.
176
+
177
+ Jinyin Chen, Haibin Zheng, Mengmeng Su, Tianyu Du, Changting Lin, and Shouling Ji. Invisible poisoning: Highly stealthy targeted poisoning attack. In ICISC, 2019c.
178
+
179
+ 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.
180
+
181
+ Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
182
+
183
+ Ranjie Duan, Xingjun Ma, Yisen Wang, James Bailey, A Kai Qin, and Yun Yang. Adversarial camouflage: Hiding physical-world attacks with natural styles. In CVPR, 2020.
184
+
185
+ Yansong Gao, Change Xu, Derui Wang, Shiping Chen, Damith C Ranasinghe, and Surya Nepal. Strip: A defence against trojan attacks on deep neural networks. In ACSAC, 2019.
186
+
187
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2014.
188
+
189
+ Tianyu Gu, Brendan Dolan-Gavitt, and Siddharth Garg. Badnets: Identifying vulnerabilities in the machine learning model supply chain. IEEE Access, 7:47230–47244, 2019.
190
+
191
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
192
+
193
+ Byeongho Heo, Minsik Lee, Sangdoo Yun, and Jin Young Choi. Knowledge transfer via distillation of activation boundaries formed by hidden neurons. In AAAI, 2019.
194
+
195
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. In NeurIPS, 2014.
196
+
197
+ Zehao Huang and Naiyan Wang. Like what you like: Knowledge distill via neuron selectivity transfer. arXiv preprint arXiv:1707.01219, 2017.
198
+
199
+ Linxi Jiang, Xingjun Ma, Shaoxiang Chen, James Bailey, and Yu-Gang Jiang. Black-box adversarial attacks on video recognition models. In ACMMM, pp. 864–872, 2019.
200
+
201
+ Linxi Jiang, Xingjun Ma, Zejia Weng, James Bailey, and Yu-Gang Jiang. Imbalanced gradients: A new cause of overestimated adversarial robustness. arXiv preprint arXiv:2006.13726, 2020.
202
+
203
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. PNAS, 114(13):3521–3526, 2017.
204
+
205
+ Soheil Kolouri, Aniruddha Saha, Hamed Pirsiavash, and Heiko Hoffmann. Universal litmus patterns: Revealing backdoor attacks in cnns. In CVPR, 2020.
206
+
207
+ Shaofeng Li, Minhui Xue, Benjamin Zi Hao Zhao, Haojin Zhu, and Xinpeng Zhang. Invisible backdoor attacks on deep neural networks via steganography and regularization. arXiv preprint arXiv:1909.02742, 2019.
208
+
209
+ Yiming Li, Baoyuan Wu, Yong Jiang, Zhifeng Li, and Shu-Tao Xia. Backdoor learning: A survey. arXiv preprint arXiv:2007.08745, 2020a.
210
+
211
+ Yiming Li, Tongqing Zhai, Baoyuan Wu, Yong Jiang, Zhifeng Li, and Shutao Xia. Rethinking the trigger of backdoor attack. arXiv preprint arXiv:2004.04692, 2020b.
212
+
213
+ Yuezun Li, Yiming Li, Baoyuan Wu, Longkang Li, Ran He, and Siwei Lyu. Backdoor attack with sample-specific triggers. arXiv preprint arXiv:2012.03816, 2020c.
214
+
215
+ Cong Liao, Haoti Zhong, Anna Squicciarini, Sencun Zhu, and David Miller. Backdoor embedding in convolutional neural network models via invisible perturbation. CODASPY, 2020.
216
+
217
+ Kang Liu, Brendan Dolan-Gavitt, and Siddharth Garg. Fine-pruning: Defending against backdooring attacks on deep neural networks. In RAID, 2018a.
218
+
219
+ Xuankai Liu, Fengting Li, Bihan Wen, and Qi Li. Removing backdoor-based watermarks in neural networks with limited data. arXiv preprint arXiv:2008.00407, 2020a.
220
+
221
+ Yingqi Liu, Shiqing Ma, Yousra Aafer, Wen-Chuan Lee, Juan Zhai, Weihang Wang, and Xiangyu Zhang. Trojaning attack on neural networks. In NDSS, 2018b.
222
+
223
+ Yunfei Liu, Xingjun Ma, James Bailey, and Feng Lu. Reflection backdoor: A natural backdoor attack on deep neural networks. In ECCV, 2020b.
224
+
225
+ Pau Rodriguez Lopez, Diego Velazquez Dorta, Guillem Cucurull Preixens, Josep M Gonfaus Sitjes, Francesc Xavier Roca Marva, and Jordi Gonzalez. Pay attention to the activations: a modular attention mechanism for fine-grained image recognition. IEEE Transactions on Multimedia, 2019.
226
+
227
+ Lingjuan Lyu, Han Yu, Xingjun Ma, Lichao Sun, Jun Zhao, Qiang Yang, and Philip S Yu. Privacy and robustness in federated learning: Attacks and defenses. arXiv preprint arXiv:2012.06337, 2020.
228
+
229
+ Xingjun Ma, Bo Li, Yisen Wang, Sarah M Erfani, Sudanthi Wijewickrema, Grant Schoenebeck, Dawn Song, Michael E Houle, and James Bailey. Characterizing adversarial subspaces using local intrinsic dimensionality. In ICLR, 2018.
230
+
231
+ Xingjun Ma, Yuhao Niu, Lin Gu, Yisen Wang, Yitian Zhao, James Bailey, and Feng Lu. Understanding adversarial attacks on deep learning based medical image analysis systems. Pattern Recognition, pp. 107332, 2020.
232
+
233
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In ICLR, 2018.
234
+
235
+ Anh Nguyen and Anh Tran. Input-aware dynamic backdoor attack. In NeurIPS, 2020.
236
+
237
+ Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In S&P. IEEE, 2016.
238
+
239
+ Ximing Qiao, Yukun Yang, and Hai Li. Defending neural backdoors via generative distribution modeling. In NeurIPS, 2019.
240
+
241
+ Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. Fitnets: Hints for thin deep nets. In ICLR, 2015.
242
+
243
+ Ali Shafahi, W Ronny Huang, Mahyar Najibi, Octavian Suciu, Christoph Studer, Tudor Dumitras, and Tom Goldstein. Poison frogs! targeted clean-label poisoning attacks on neural networks. In NeurIPS, 2018.
244
+
245
+ Xuemeng Song, Fuli Feng, Xianjing Han, Xin Yang, Wei Liu, and Liqiang Nie. Neural compatibility modeling with attentive knowledge distillation. In SIGIR, 2018.
246
+
247
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In ICLR, 2013.
248
+
249
+ Brandon Tran, Jerry Li, and Aleksander Madry. Spectral signatures in backdoor attacks. In NeurIPS, 2018.
250
+
251
+ Loc Truong, Chace Jones, Brian Hutchinson, Andrew August, Brenda Praggastis, Robert Jasper, Nicole Nichols, and Aaron Tuor. Systematic evaluation of backdoor data poisoning attacks on image classifiers. In CVPR, 2020.
252
+
253
+ Alexander Turner, Dimitris Tsipras, and Aleksander Madry. Clean-label backdoor attacks. https://people.csail.mit.edu/madry/lab/, 2019.
254
+
255
+ Bolun Wang, Yuanshun Yao, Shawn Shan, Huiying Li, Bimal Viswanath, Haitao Zheng, and Ben Y Zhao. Neural cleanse: Identifying and mitigating backdoor attacks in neural networks. In S&P. IEEE, 2019a.
256
+
257
+ Yisen Wang, Xingjun Ma, James Bailey, Jinfeng Yi, Bowen Zhou, and Quanquan Gu. On the convergence and robustness of adversarial training. In ICML, 2019b.
258
+
259
+ Yisen Wang, Difan Zou, Jinfeng Yi, James Bailey, Xingjun Ma, and Quanquan Gu. Improving adversarial robustness requires revisiting misclassified examples. In ICLR, 2020.
260
+
261
+ Dongxian Wu, Yisen Wang, Shu-Tao Xia, James Bailey, and Xingjun Ma. Skip connections matter: On the transferability of adversarial examples generated with resnets. In ICLR, 2020.
262
+
263
+ Chulin Xie, Keli Huang, Pin-Yu Chen, and Bo Li. Dba: Distributed backdoor attacks against federated learning. In ICLR, 2019.
264
+
265
+ Yuanshun Yao, Huiying Li, Haitao Zheng, and Ben Y Zhao. Latent backdoor attacks on deep neural networks. In CCS, 2019.
266
+
267
+ Sergey Zagoruyko and Nikos Komodakis. Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. In ICLR, 2017.
268
+
269
+ Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR, 2018.
270
+
271
+ Pu Zhao, Pin-Yu Chen, Payel Das, Karthikeyan Natesan Ramamurthy, and Xue Lin. Bridging mode connectivity in loss landscapes and adversarial robustness. In ICLR, 2020a.
272
+
273
+ Ya Zhao, Rui Xu, Xinchao Wang, Peng Hou, Haihong Tang, and Mingli Song. Hearing lips: Improving lip reading by distilling speech recognizers. In AAAI, 2020b.
274
+
275
+ # A MORE IMPLEMENTATION DETAILS
276
+
277
+ The backdoor triggers used in our experiments are shown in Figure 6.
278
+
279
+ ![](images/27e6dd18b1e61d0115c810493559cdfc5f194aaf9563d510a5be254951c89e3c.jpg)
280
+ Figure 6: Examples of backdoored CIFAR-10 images by the 6 attacks.
281
+
282
+ Table 3: A configuration summary for the 6 backdoor attacks: datasets, models, and triggers.
283
+
284
+ <table><tr><td rowspan=1 colspan=1>Backdoork</td><td rowspan=1 colspan=1>BadNets</td><td rowspan=1 colspan=1>Trojan</td><td rowspan=1 colspan=1>Blend</td><td rowspan=1 colspan=1>Clean-Label</td><td rowspan=1 colspan=1>Signal</td><td rowspan=1 colspan=1>Refool</td></tr><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>GTSRB</td></tr><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>WideResNet</td><td rowspan=1 colspan=1>WideResNet</td><td rowspan=1 colspan=1>WideResNet</td><td rowspan=1 colspan=1>WideResNet</td><td rowspan=1 colspan=1>WideResNet</td><td rowspan=1 colspan=1>WideResNet</td></tr><tr><td rowspan=1 colspan=1>Inject Rate</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.05</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.08</td><td rowspan=1 colspan=1>0.08</td><td rowspan=1 colspan=1>0.08</td></tr><tr><td rowspan=1 colspan=1>Trigger Type</td><td rowspan=1 colspan=1>Grid</td><td rowspan=1 colspan=1>Square</td><td rowspan=1 colspan=1>Random Noise</td><td rowspan=1 colspan=1>Grid + PGDNoise</td><td rowspan=1 colspan=1>SinusoidalSignal</td><td rowspan=1 colspan=1>Reflection</td></tr><tr><td rowspan=1 colspan=1>Trigger Size</td><td rowspan=1 colspan=1>3×3</td><td rowspan=1 colspan=1>3×3</td><td rowspan=1 colspan=1>Full Image</td><td rowspan=1 colspan=1>3×3</td><td rowspan=1 colspan=1>Full Image</td><td rowspan=1 colspan=1>Full Image</td></tr><tr><td rowspan=1 colspan=1>Target Label</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>ASR</td><td rowspan=1 colspan=1>100.00%</td><td rowspan=1 colspan=1>100.00%</td><td rowspan=1 colspan=1>99.97%</td><td rowspan=1 colspan=1>99.21%</td><td rowspan=1 colspan=1>99.91%</td><td rowspan=1 colspan=1>95.16%</td></tr><tr><td rowspan=1 colspan=1>ACC</td><td rowspan=1 colspan=1>85.65%</td><td rowspan=1 colspan=1>81.24%</td><td rowspan=1 colspan=1>84.95%</td><td rowspan=1 colspan=1>82.43%</td><td rowspan=1 colspan=1>84.36%</td><td rowspan=1 colspan=1>82.38%</td></tr></table>
285
+
286
+ Detailed implementation on 6 state-of-the-art backdoor attacks:
287
+
288
+ • BadNets: The trigger is a $3 \times 3$ checkerboard (pixel values are 128 or 255) at the bottom right corner of images. We labeled the backdoor examples with a chosen target label and achieved an attack success rate of $100 \%$ with an injection rate of $10 \%$ .
289
+ • Trojan attack. We follow the method proposed in the paper to reverse engineer a $3 \times 3$ square trigger from the last fully-connected layer of the network. In order to reduce the impact on clean accuracy, we poisoned only $5 \%$ of training data with the reverse-engineered Trojan trigger. We achieved an attack success rate of $100 \%$ with an injection rate of $5 \%$ .
290
+ • Blend attack. We used the random patterns reported in the original paper. We achieved an attack success rate of $9 9 . 9 7 \%$ with an injection rate of $10 \%$ and a blend ratio of $\alpha = 0 . 2$ .
291
+ • Clean-label attack (CL). We followed the same settings as reported in the paper. Specifically, we used Projected Gradient Descent (PGD) to generate adversarial perturbations bounded to $L _ { \infty }$ maximum perturbation $\epsilon = 0 . 1 5$ . The trigger is a $3 \times 3$ grid at the bottom right corner of images. We achieved an attack success rate of $9 9 . 2 1 \%$ with an injection rate of $8 \%$ .
292
+
293
+ • Sinusoidal signal attack (SIG). We generate the backdoor trigger following the horizontal sinusoidal function defined in their paper with $\Delta = 2 0$ and $f = 6$ . We achieved an attack success rate of $9 9 . 9 1 \%$ with an injected rate of $8 \%$ .
294
+
295
+ • Reflection attack (Refool). The implementation is based on the open-source code†. We achieved an attack success rate of $9 5 . 1 6 \%$ with an injection rate of $8 \%$ .
296
+
297
+ More Details on Defense Baselines We adopted the same settings used in NAD for the standard finetuning approach and finetuned the model until convergence. We replicated Fine-pruning‡ via PyTorch and pruned the last convolutional layer of the model as suggested in the original paper Liu et al. (2018a). For a fair comparison, the pruning ratio was set to a value such that the ACC of the pruned network matched the ACC of our NAD approach. We used the open-source code§ for mode connectivity repair (MCR) and set the endpoint model $\mathrm { \Delta t } = 0$ and $\mathbf { t } = 1$ with the same backdoored WRN-16-1. We trained the connection path for 100 epochs and evaluated the defense performance of the model on the path. Other settings of the code remain unchanged.
298
+
299
+ # B COMPARISON WITH DATA AUGMENTATION TECHNIQUES
300
+
301
+ Cutout (DeVries & Taylor, 2017) and Mixup (Zhang et al., 2018) are popular data augmentation methods for CNNs. Cutout masks out random sections of input images during training and Mixup randomly morphs the training images. We evaluate in this section the independent effectiveness of Mixup and Cutout in erasing backdoor triggers. For Cutout¶, we set the number of patches to be cut out of each image to 1 and each patch is a $3 \times 3$ square. For Mixup||, we set $\alpha$ to be the default value of 1, indicating that we sample the weight uniformly between zero and one. Other settings for attacks and defenses are identical to the settings specified in Section 4.1. The results (see Table 4) can be a supplement of Table 1. We conclude that data augmentation techniques have mitigating effects on backdoors only when the transformation images are similar to the trigger patterns. They are hence not general against a wide range of backdoor attacks.
302
+
303
+ Table 4: Comparison with Mixup and Cutout on erasing backdoor triggers.
304
+
305
+ <table><tr><td rowspan="2">Backdoor Attack</td><td colspan="2">Before</td><td colspan="2">Mixup</td><td colspan="2">Cutout</td><td colspan="2">NAD (Ours)</td></tr><tr><td>ASR</td><td>ACC ASR</td><td>ACC</td><td>ASR</td><td>ACC</td><td>ASR</td><td></td><td>ACC</td></tr><tr><td>BadNets</td><td>100%</td><td>85.65%</td><td>68.22%</td><td>80.27%</td><td>28.17%</td><td>82.73%</td><td>3.81%</td><td>81.85%</td></tr><tr><td>Trojan</td><td>100%</td><td>81.24%</td><td>96.20%</td><td>71.83%</td><td>50.22%</td><td>80.13%</td><td>19.63%</td><td>79.16%</td></tr><tr><td>Blend</td><td>99.97%</td><td>84.95%</td><td>99.11%</td><td>80.51%</td><td>15.30%</td><td>81.78%</td><td>3.04%</td><td>81.68%</td></tr><tr><td>CL</td><td>99.21%</td><td>82.43%</td><td>93.77%</td><td>77.13%</td><td>73.33%</td><td>81.34%</td><td>9.18%</td><td>80.34%</td></tr><tr><td>SIG</td><td>99.91%</td><td>84.36%</td><td>52.11%</td><td>79.94%</td><td>99.95%</td><td>82.77%</td><td>2.52%</td><td>81.95%</td></tr><tr><td>Refool</td><td>95.16%</td><td>82.38%</td><td>8.76%</td><td>77.84%</td><td>91.86%</td><td>80.06%</td><td>3.18%</td><td>80.73%</td></tr><tr><td>Average</td><td>99.04%</td><td>83.50%</td><td>69.69%</td><td>77.92%</td><td>59.80%</td><td>81.46%</td><td>7.22%</td><td>80.83%</td></tr><tr><td>Deviation</td><td>-</td><td>-</td><td>↓29.35%</td><td>↓5.58%</td><td>↓39.24%</td><td>↓2.03%</td><td>91.82%</td><td>↓2.66%</td></tr></table>
306
+
307
+ # C MORE RESULTS OF MODE CONNECTIVITY REPAIR (MCR)
308
+
309
+ We use the open-source code of MCR and compare its performance to our NAD method. The experiments are conducted on CIFAR-10 dataset using $5 \%$ clean finetune data. We first run MCR with the two endpoint models $\mathrm { \Delta t = 0 }$ and $\mathrm { t } = 1$ which use the same backdoored WRN-16-1 model. Figure 7 shows the convergence rate of MCR and our NAD against BadNets attack. We then run an additional experiment for MCR using two different endpoint models: $\mathrm { \Delta t } = 0$ and $\mathbf { t } = 1$ use the backdoored WRN-16-1 and the finetuned backdoored WRN-16-1 respectively. This result is reported in Table 5. We find that using different endpoint models can not further improve the performance of MCR.
310
+
311
+ ![](images/2beb1db9d63b16484cdbd23893992113d34f089731ff6988ba87e137dc2f1417.jpg)
312
+ Figure 7: Convergence rate comparison between MCR and NAD against BadNets attack with $5 \%$ clean training data. We show the best result of MC at the connection point $\mathrm { t } = 0 . 3$ . Note that it takes longer for MCR to converge yet its ASR is still higher than that of the NAD’s.
313
+
314
+ Table 5: Performance of MCR with different endpoint models on CIFAR-10 dataset. B denotes the backdoored WRN-16-1 and F-B denotes the backdoored WRN-16-1 after Fine-tuning. MCR-(B,B) denotes the default setting where the two endpoint models are both B, while MCR-(B,F-B) denotes the MCR using two different endpoint models B and F-B. The best results are boldfaced.
315
+
316
+ <table><tr><td rowspan="2">Backdoor Attack</td><td colspan="2">Before</td><td colspan="2">MCR-(B.B)</td><td>MCR-(B,F-B)</td><td colspan="2">NAD (Ours)</td></tr><tr><td>ASR</td><td>ACC</td><td>ASR</td><td>ACC ASR</td><td>ACC</td><td>ASR</td><td>ACC</td></tr><tr><td>BadNets</td><td>100%</td><td>85.65%</td><td>4.65%</td><td>80.94%</td><td>6.00% 80.56%</td><td>4.77%</td><td>81.17%</td></tr><tr><td>Trojan</td><td>100%</td><td>81.24%</td><td>41.25%</td><td>78.76%</td><td>53.31% 78.31%</td><td>19.63%</td><td>79.16%</td></tr><tr><td>Blend</td><td>99.97%</td><td>84.95%</td><td>64.33%</td><td>80.34%</td><td>70.65% 80.51%</td><td>4.04%</td><td>81.68%</td></tr><tr><td>CL</td><td>99.21%</td><td>82.43%</td><td>32.95%</td><td>79.04%</td><td>42.66% 80.31%</td><td>9.18%</td><td>80.34%</td></tr><tr><td>SIG</td><td>99.91%</td><td>84.36%</td><td>1.62%</td><td>80.94%</td><td>7.32% 81.12%</td><td>2.52%</td><td>81.95%</td></tr><tr><td>Refool</td><td>95.15%</td><td>82.38%</td><td>8.76%</td><td>78.84%</td><td>10.95% 79.03%</td><td>3.18%</td><td>80.73%</td></tr></table>
317
+
318
+ # D EXPERIMENTAL RESULTS OF TRIGGER RECOVERING TECHNIQUE
319
+
320
+ Qiao et al. (2019) proposed MESA that recovers the trigger distribution via generative modeling and then removes the backdoor by model retraining. We implemented this work based on their open-source code\*\*. Note that we report the best averaging results of defense performance and we changed nothing in the code besides setting the proportion of available training data to $5 \%$ . We present the results in Table 5.
321
+
322
+ Table 6: Comparison between NAD and retraining-based approaches that use both the original trigger (Org-T) and the MESA-recovered trigger (Rec-T). While all methods are able to reduce the ASR of BadNets to a similar level, NAD is able to reduce the ASR of CL by 16 more percent in comparison to the model retrained with the original trigger and by 22 more percent in comparison to the model retrained with the MESA-generated trigger.
323
+
324
+ <table><tr><td rowspan="2">Backdoor Attack</td><td colspan="2">Before</td><td colspan="2">Retrain w/ rec-T</td><td colspan="2">Retrain w/ org-T</td></tr><tr><td>ASR ACC</td><td>ASR</td><td>ACC</td><td>ASR</td><td>NAD (Ours) ASR</td><td>ACC</td></tr><tr><td>BadNets</td><td>100%</td><td>85.65% 4.96%</td><td>81.23%</td><td>3.91%</td><td>ACC 82.14%</td><td>4.77% 81.17%</td></tr><tr><td>CL</td><td>99.21% 82.43%</td><td>31.23%</td><td>79.12%</td><td>25.23%</td><td>79.57% 9.18%</td><td>80.34%</td></tr></table>
325
+
326
+ # E EXPERIMENTAL RESULTS OF HYPER-PARAMETER
327
+
328
+ We only give a rough estimate of $\beta$ for all the backdoor attacks in Figure 8 and it certainly provides better results by a more granular level of tuning.
329
+
330
+ ![](images/6f3ab0b36d62431fad3c4f37afa3d50bc3cc39a9177492866de39d633190735f.jpg)
331
+ β β Figure 8: Parameter analysis: performance of our NAD approach under different $\beta$
332
+
333
+ # F EXPERIMENTAL RESULTS OF DIFFERENT ATTENTION FUNCTIONS
334
+
335
+ We compare the performance of NAD under scenarios where 4 different attention functions, $A _ { m e a n }$ , $\mathcal { A } _ { m e a n } ^ { 2 }$ , $\mathcal { A } _ { s u m }$ , and $\mathcal { A } _ { s u m } ^ { 2 }$ are employed. We use the BadNets attack as our benchmark attack. Again, we evaluate the performance of NAD using two metrics, the ASR and the ACC, and the results are summarized in Table 7.
336
+
337
+ ![](images/3839a76ea2153b2b36f85b5ca67075fdb0535da92148f6246eaf9a99a649f484.jpg)
338
+ Figure 9: Iterative NAD and Finetuning against Figure 10: Erasing all-target BadNets attack. BadNets.
339
+
340
+ Table 7: Performance of NAD using different attention functions against BadNets on CIFAR-10 with $5 \%$ clean data. ASR: attack success rate; ACC: clean accuracy. The best results are in boldfaced.
341
+
342
+ <table><tr><td rowspan="2">Attention Function</td><td colspan="2">Amean</td><td colspan="2">Amean</td><td colspan="2">Asum</td><td rowspan="2">Aum</td></tr><tr><td>ASR</td><td>ACC</td><td>ASR ACC</td><td>ASR</td><td>ACC</td><td>ASR ACC</td></tr><tr><td>Baseline</td><td>100%</td><td>85.86%</td><td>100%</td><td>85.86%</td><td>100% 85.86%</td><td>100%</td><td>85.86%</td></tr><tr><td>Epoch 1</td><td>11.81%</td><td>66.72%</td><td>1.98%</td><td>47.52%</td><td>9.38% 68.81%</td><td>1.36%</td><td>47.25%</td></tr><tr><td>Epoch 2</td><td>16.34%</td><td>79.92%</td><td>8.86%</td><td>78.14%</td><td>10.82% 79.34%</td><td>9.81%</td><td>77.91%</td></tr><tr><td>Epoch 3</td><td>13.86%</td><td>81.83%</td><td>4.50%</td><td>81.00%</td><td>7.67% 81.69%</td><td>5.12%</td><td>81.12%</td></tr><tr><td>Epoch 4</td><td>14.16%</td><td>81.90%</td><td>5.96%</td><td>80.67%</td><td>8.39% 81.38%</td><td>5.80%</td><td>80.83%</td></tr><tr><td>Epoch 5</td><td>12.28%</td><td>81.50%</td><td>4.60%</td><td>81.30%</td><td>6.89% 81.46%</td><td>4.21%</td><td>81.55%</td></tr></table>
343
+
344
+ # G EXPERIMENTAL RESULTS OF ITERATIVE NAD
345
+
346
+ We evaluate whether NAD can be further improved with multiple iterations of distillation. In this experiment, we adopted the same configuration and set the iteration times to 5. Taking the BadNets attack as an example. The results in Figure 9 show that the attack rate has not been further reduced, and has even slightly increased by $2 \%$ in some cases. We hypothesize that the attentions of the backdoored neurons have been correctly aligned with the attentions of the benign neurons after a single-iteration of erasing. Whereas multiple iterations of distillation will make NAD refocus on the trigger pattern. Therefore, we believe that one-iteration of distillation is sufficient to guarantee the best result. Note that iterative Finetuning does not lead to further improvement over one-time finetuning neither.
347
+
348
+ # H ERASING ALL-TARGET BACKDOOR ATTACKS
349
+
350
+ Unlike a single-target attack where the goal is to misclassify all backdoored images as one prespecified target class, an all-target attack aims to misclassify every source class label as different ones (in our case, misclassify the original label $i$ as $( i + 1 ) \% 1 0 \%$ ). In this experiment, we adopted the same settings (i.e. single target attacks on BadNets) to conduct all-target attacks on the WRN16-1 network. We found that an all-target attack is a tougher task than a single-target attack. It is harder to attain a satisfactory ASR with an all-target attack. The results in Figure 10 show that NAD is able to reduce the ASR across all poison-classes (from $79 \%$ to $9 . 7 \%$ ) effectively with only $5 \%$ of clean training data.
351
+
352
+ # I FEATURE MAPS V.S. ATTENTION MAPS
353
+
354
+ A natural question to ask is: why attention maps instead of feature maps? This can be traced back to the field of knowledge distillation. Directly aligning the feature maps could lead to an information loss on the sample density in the space, and this could lead to a decrement in the distillation performance (Zagoruyko & Komodakis, 2017; Huang & Wang, 2017; Lopez et al., 2019). In the context of backdoor erasing, aligning the feature maps is not a good option because the backdoor neurons are only weakly, if not at all, activated by clean samples (Gu et al., 2019). In contrast, attention maps contain integrated information (see Equation 1) of both backdoored and benign neurons’ feature maps, even when the neurons are not fired. (see Table 8). Figure 11 visualizes activation maps of a backdoored image on BadNets, Finetuned BadNets with $5 \%$ of clean training data, and BadNets erased by NAD with $5 \%$ of clean training data. The attention maps aggregated across the channels using 5 different attention functions are shown in Figure 12.
355
+
356
+ ![](images/cab0b0adf8bff82d24ae654d530eb5337b543846c0db55c0eb03e257c43ff9bd.jpg)
357
+ Figure 11: The activation map of one backdoored image at Group 3 of WRN-16-1 for (a) BadNets, (b) Finetuned BadNets with $5 \%$ of clean training data, and (c) BadNets erased by our NAD with $5 \%$ of clean training data. Each small patch is a channel (64 channels in total). The small red circles highlight the regions that are fired by the trigger pattern at different channels of the activation map.
358
+
359
+ Table 8: NAD using attention map versus activation map against BadNets.
360
+
361
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Before</td><td rowspan=1 colspan=1>Activation Map</td><td rowspan=1 colspan=1>Attention Map</td></tr><tr><td rowspan=2 colspan=1>CIFAR-10 ASR(WRN-16-1)ACC</td><td rowspan=1 colspan=1>100%</td><td rowspan=1 colspan=1>98.44%</td><td rowspan=1 colspan=1>3.81%</td></tr><tr><td rowspan=1 colspan=1>85.65%</td><td rowspan=1 colspan=1>82.66</td><td rowspan=1 colspan=1>81.85%</td></tr></table>
362
+
363
+ # J OVERFITTING IN NAD
364
+
365
+ Here, we run NAD for a sufficiently long time (e.g. 20 epochs) to test if the student will eventually overfit to the finetuned teacher network. This experiment is conducted on CIFAR-10 against BadNets and CL attacks. We also run the Finetuning defense as a comparison. Note that, the teacher network of NAD is only finetuned for 10 epochs, following the settings in Section 4.1. As shown in Figure 13 (Appendix J), the student network of NAD can indeed overfit to the partially purified teacher network. However, this can be effectively addressed by a simple early stopping strategy: stop the finetuning when there are no significant improvements on the validation accuracy within a few epochs (e.g. at epoch 5). As shown by the green curves, the clean accuracy of NAD first drops, then quickly recovers and stabilizes at a high level within a few epochs. This also highlights the efficiency of our NAD defense as only a few epochs of finetuning is sufficient to erase the backdoor trigger.
366
+
367
+ ![](images/aeeff32209a60ab276d3df107bdb6073e8cb6cb95cb4fa4efe7ed6f275ff86b1.jpg)
368
+ Figure 12: The attention maps derived by 5 different attention functions are shown for (a) BadNet, (b) Finetuned BadNet by $5 \%$ clean training data, and (c) BadNets erased by our NAD.
369
+
370
+ ![](images/cf632fb5fd36da6c1178691cbf5a00cdd674adde99cce85ba8b43f546ba45d80.jpg)
371
+ Figure 13: The learning curves (test ASR and ACC) of the NAD student network and a Finetuning network on CIFAR-10 against BadNets (left) and CL (right). In NAD, the student network tends to overfit to the teacher network, unless an early stopping is applied based on the validation ACC.
372
+
373
+ # K EFFECTIVENESS AGAINST ADAPTIVE ATTACKS
374
+
375
+ A backdoor adversary may attempt to construct a more stealthy backdoor trigger that does not cause obviouse shift of the attention. To simulate this scenario, we design an adaptive version of BadNets on CIFAR-10 that attaches the trigger pattern at the center region of the image. Such an adaptive attack will only shift the attention close to the center region and has a weaker activation response. Since most of the CIFAR-10 objects are located at the center of the clean images, this adaptive attack may make the attention distillation much less effective. Figure 14 illustrates a few examples of backdoored images for this type of attack. We use a scaling parameter $\alpha \in [ 0 , 1 ]$ to adjust the pixel value of a black-white square trigger pattern (all images are normalized into the range of $[ 0 , 1 ] )$ . For example, for $\alpha = 0 . 2$ , we scale pixel values of the trigger pattern $p$ to $p \times \alpha$ . The results of our NAD against this adaptive attack are reported in Table 9. Our NAD method can still effectively erase the adaptive attack while maintaining high accuracy on clean data. Interestingly, Finetuning can only effectively erase the weaker trigger, and not as effective as NAD (especially in the case of $\alpha = 1 . 0$ attack). We conjecture this is because the center regions are more hard overwritten by the clean images used for finetuning. We leave the exploration of more advanced adaptive attacks for future work.
376
+
377
+ ![](images/0f1acc6d955e694c06e6564283dc5d1a15ed9f0339eb7789a3b088cfd7c33ec2.jpg)
378
+ Figure 14: The triggers used by an adaptive BadNets attack against our NAD under different $\alpha$ (a scaling factor of the original black-white square). The trigger patterns are all placed at the center of the image.
379
+ Table 9: Performance of our NAD $\mathrm { \Delta } \beta = 2 { , } 0 0 0 0$ for $\alpha = 1 . 0$ and $\beta = 1 { , } 0 0 0 0$ for other $\alpha$ ) against an adaptive BadNets attack. ASR: attack success rate; ACC: clean accuracy. The best results are boldfaced.
380
+
381
+ <table><tr><td rowspan="2">Square Trigger</td><td colspan="2">Before</td><td colspan="2">Finetuning</td><td colspan="2">NAD (Ours)</td></tr><tr><td>ASR</td><td>ACC</td><td>ASR</td><td>ACC</td><td>ASR</td><td>ACC</td></tr><tr><td>α=0.2</td><td>99.85%</td><td>82.11%</td><td>7.51%</td><td>79.26%</td><td>4.92%</td><td>80.32%</td></tr><tr><td>α = 0.5</td><td>99.87%</td><td>83.04%</td><td>7.65%</td><td>77.84%</td><td>3.98%</td><td>78.91%</td></tr><tr><td>α =0.8</td><td>99.97%</td><td>82.85%</td><td>12.65%</td><td>79.91%</td><td>4.08%</td><td>80.38%</td></tr><tr><td>α = 1.0</td><td>100%</td><td>83.23%</td><td>90.77%</td><td>79.56%</td><td>5.83%</td><td>80.41%</td></tr></table>
md/train/B1QRgziT-/B1QRgziT-.md ADDED
@@ -0,0 +1,548 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPECTRAL NORMALIZATION FOR GENERATIVE ADVERSARIAL NETWORKS
2
+
3
+ Takeru Miyato1, Toshiki Kataoka1, Masanori Koyama2, Yuichi Yoshida3
4
+
5
+ {miyato, kataoka}@preferred.jp
6
+ koyama.masanori@gmail.com
7
+ yyoshida@nii.ac.jp
8
+ 1Preferred Networks, Inc. 2Ritsumeikan University 3National Institute of Informatics
9
+
10
+ # ABSTRACT
11
+
12
+ One of the challenges in the study of generative adversarial networks is the instability of its training. In this paper, we propose a novel weight normalization technique called spectral normalization to stabilize the training of the discriminator. Our new normalization technique is computationally light and easy to incorporate into existing implementations. We tested the efficacy of spectral normalization on CIFAR10, STL-10, and ILSVRC2012 dataset, and we experimentally confirmed that spectrally normalized GANs (SN-GANs) is capable of generating images of better or equal quality relative to the previous training stabilization techniques. The code with Chainer (Tokui et al., 2015), generated images and pretrained models are available at https://github.com/pfnet-research/sngan_ projection.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Generative adversarial networks (GANs) (Goodfellow et al., 2014) have been enjoying considerable success as a framework of generative models in recent years, and it has been applied to numerous types of tasks and datasets (Radford et al., 2016; Salimans et al., 2016; Ho & Ermon, 2016; Li et al., 2017). In a nutshell, GANs are a framework to produce a model distribution that mimics a given target distribution, and it consists of a generator that produces the model distribution and a discriminator that distinguishes the model distribution from the target. The concept is to consecutively train the model distribution and the discriminator in turn, with the goal of reducing the difference between the model distribution and the target distribution measured by the best discriminator possible at each step of the training. GANs have been drawing attention in the machine learning community not only for its ability to learn highly structured probability distribution but also for its theoretically interesting aspects. For example, (Nowozin et al., 2016; Uehara et al., 2016; Mohamed & Lakshminarayanan, 2017) revealed that the training of the discriminator amounts to the training of a good estimator for the density ratio between the model distribution and the target. This is a perspective that opens the door to the methods of implicit models (Mohamed & Lakshminarayanan, 2017; Tran et al., 2017) that can be used to carry out variational optimization without the direct knowledge of the density function.
17
+
18
+ A persisting challenge in the training of GANs is the performance control of the discriminator. In high dimensional spaces, the density ratio estimation by the discriminator is often inaccurate and unstable during the training, and generator networks fail to learn the multimodal structure of the target distribution. Even worse, when the support of the model distribution and the support of the target distribution are disjoint, there exists a discriminator that can perfectly distinguish the model distribution from the target (Arjovsky & Bottou, 2017). Once such discriminator is produced in this situation, the training of the generator comes to complete stop, because the derivative of the so-produced discriminator with respect to the input turns out to be 0. This motivates us to introduce some form of restriction to the choice of the discriminator.
19
+
20
+ In this paper, we propose a novel weight normalization method called spectral normalization that can stabilize the training of discriminator networks. Our normalization enjoys following favorable properties.
21
+
22
+ • Lipschitz constant is the only hyper-parameter to be tuned, and the algorithm does not require intensive tuning of the only hyper-parameter for satisfactory performance. • Implementation is simple and the additional computational cost is small.
23
+
24
+ In fact, our normalization method also functioned well even without tuning Lipschitz constant, which is the only hyper parameter. In this study, we provide explanations of the effectiveness of spectral normalization for GANs against other regularization techniques, such as weight normalization (Salimans & Kingma, 2016), weight clipping (Arjovsky et al., 2017), and gradient penalty (Gulrajani et al., 2017). We also show that, in the absence of complimentary regularization techniques (e.g., batch normalization, weight decay and feature matching on the discriminator), spectral normalization can improve the sheer quality of the generated images better than weight normalization and gradient penalty.
25
+
26
+ # 2 METHOD
27
+
28
+ In this section, we will lay the theoretical groundwork for our proposed method. Let us consider a simple discriminator made of a neural network of the following form, with the input $_ { \textbf { \em x } }$ :
29
+
30
+ $$
31
+ f ( \pmb { x } , \pmb { \theta } ) = W ^ { L + 1 } a _ { L } ( W ^ { L } ( a _ { L - 1 } ( W ^ { L - 1 } ( \dots a _ { 1 } ( W ^ { 1 } \pmb { x } ) \dots ) ) ) ) ,
32
+ $$
33
+
34
+ where $\theta : = \{ W ^ { 1 } , \ldots , W ^ { L } , W ^ { L + 1 } \}$ is the learning parameters set, $W ^ { l } ~ \in ~ \mathbb { R } ^ { d _ { l } \times d _ { l - 1 } }$ , $W ^ { L + 1 } \in$ $\mathbb { R } ^ { 1 \times d _ { L } }$ , and $a _ { l }$ is an element-wise non-linear activation function. We omit the bias term of each layer for simplicity. The final output of the discriminator is given by
35
+
36
+ $$
37
+ D ( \pmb { x } , \theta ) = \mathcal { A } ( f ( \pmb { x } , \theta ) ) ,
38
+ $$
39
+
40
+ where $\mathcal { A }$ is an activation function corresponding to the divergence of distance measure of the user’s choice. The standard formulation of GANs is given by
41
+
42
+ $$
43
+ \operatorname* { m i n } _ { G } \operatorname* { m a x } _ { D } V ( G , D )
44
+ $$
45
+
46
+ where min and max of $G$ and $D$ are taken over the set of generator and discriminator functions, respectively. The conventional form of $V ( G , D )$ (Goodfellow et al., 2014) is given by $\mathrm { E } _ { { \pmb x } \sim q _ { \mathrm { d a t a } } } [ \log D ( { \pmb x } ) ] + \mathrm { E } _ { { \pmb x } ^ { \prime } \sim p _ { G } } [ \log ( 1 - D ( { \pmb x } ^ { \prime } ) ) ]$ , where $q _ { \mathrm { d a t a } }$ is the data distribution and $p _ { G }$ is the (model) generator distribution to be learned through the adversarial min-max optimization. The activation function $\mathcal { A }$ that is used in the $D$ of this expression is some continuous function with range $[ 0 , 1 ]$ (e.g, sigmoid function). It is known that, for a fixed generator $G$ , the optimal discriminator for this form of $V ( G , D )$ is given by $D _ { G } ^ { * } ( { \pmb x } ) : = q _ { \mathrm { d a t a } } ( { \pmb x } ) / ( q _ { \mathrm { d a t a } } ^ { - } ( { \pmb x } ) + p _ { G } ( { \pmb x } ) )$ .
47
+
48
+ The machine learning community has been pointing out recently that the function space from which the discriminators are selected crucially affects the performance of GANs. A number of works (Uehara et al., 2016; Qi, 2017; Gulrajani et al., 2017) advocate the importance of Lipschitz continuity in assuring the boundedness of statistics. For example, the optimal discriminator of GANs on the above standard formulation takes the form
49
+
50
+ $$
51
+ D _ { G } ^ { * } ( x ) = \frac { q _ { \mathrm { d a t a } } ( x ) } { q _ { \mathrm { d a t a } } ( x ) + p _ { G } ( x ) } = \mathrm { s i g m o i d } ( f ^ { * } ( x ) ) \mathrm { , w h e r e ~ } f ^ { * } ( x ) = \log q _ { \mathrm { d a t a } } ( x ) - \log p _ { G } ( x ) \mathrm { , }
52
+ $$
53
+
54
+ and its derivative
55
+
56
+ $$
57
+ \nabla _ { \pmb { x } } { f } ^ { * } ( \pmb { x } ) = \frac { 1 } { q _ { \mathrm { d a t a } } ( \pmb { x } ) } \nabla _ { \pmb { x } } q _ { \mathrm { d a t a } } ( \pmb { x } ) - \frac { 1 } { p _ { G } ( \pmb { x } ) } \nabla _ { \pmb { x } } p _ { G } ( \pmb { x } )
58
+ $$
59
+
60
+ can be unbounded or even incomputable. This prompts us to introduce some regularity condition to the derivative of $f ( { \pmb x } )$ .
61
+
62
+ A particularly successful works in this array are (Qi, 2017; Arjovsky et al., 2017; Gulrajani et al., 2017), which proposed methods to control the Lipschitz constant of the discriminator by adding regularization terms defined on input examples $_ { \textbf { \em x } }$ . We would follow their footsteps and search for the discriminator $D$ from the set of $K$ -Lipschitz continuous functions, that is,
63
+
64
+ $$
65
+ \operatorname { a r g m a x } _ { \ell \| \mathbf { L i p } \leq K } V ( G , D ) ,
66
+ $$
67
+
68
+ where we mean by $\Vert f \Vert _ { \mathrm { L i p } }$ the smallest value $M$ such that $\| f ( \pmb { x } ) - f ( \pmb { x } ^ { \prime } ) \| / \| \pmb { x } - \pmb { x } ^ { \prime } \| \leq M$ for any ${ \mathbf { } } x , x ^ { \prime }$ , with the norm being the $\ell _ { 2 }$ norm.
69
+
70
+ While input based regularizations allow for relatively easy formulations based on samples, they also suffer from the fact that, they cannot impose regularization on the space outside of the supports of the generator and data distributions without introducing somewhat heuristic means. A method we would introduce in this paper, called spectral normalization, is a method that aims to skirt this issue by normalizing the weight matrices using the technique devised by Yoshida & Miyato (2017).
71
+
72
+ # 2.1 SPECTRAL NORMALIZATION
73
+
74
+ Our spectral normalization controls the Lipschitz constant of the discriminator function $f$ by literally constraining the spectral norm of each layer $g : h _ { i n } \mapsto h _ { o u t }$ . By definition, Lipschitz norm $\| g \| _ { \mathrm { L i p } }$ is equal to $\mathrm { { \bar { s u p } } } _ { h } \sigma ( \nabla g ( h ) )$ , where $\sigma ( A )$ is the spectral norm of the matrix $A$ ( $L _ { 2 }$ matrix norm of $A$ )
75
+
76
+ $$
77
+ \sigma ( A ) : = \operatorname* { m a x } _ { \pmb { h } : \pmb { h } \neq \mathbf { 0 } } \frac { \| A \pmb { h } \| _ { 2 } } { \| \pmb { h } \| _ { 2 } } = \operatorname* { m a x } _ { \| \pmb { h } \| _ { 2 } \leq 1 } \| A \pmb { h } \| _ { 2 } ,
78
+ $$
79
+
80
+ which is equivalent to the largest singular value of $A$ . Therefore, for a linear layer $g ( h ) = W h$ , the norm is given by $\| g \| _ { \mathrm { L i p } } = \operatorname* { s u p } _ { h } \sigma ( { \bar { \nabla } } g ( h ) ) = \operatorname* { s u p } _ { h } \sigma ( W ) = \sigma ( W )$ . If the Lipschitz norm of the activation function $\Vert a _ { l } \Vert _ { \mathrm { L i p } }$ is equal to $1 ^ { 1 }$ , we can use the inequality $\| g _ { 1 } \circ g _ { 2 } \| _ { \mathrm { L i p } } \leq \| g _ { 1 } \| _ { \mathrm { L i p } } \cdot \| g _ { 2 } \| _ { \mathrm { L i p } }$ to observe the following bound on $\Vert f \Vert _ { \mathrm { L i p } }$ :
81
+
82
+ $$
83
+ \begin{array} { r l } & { \| f \| _ { \mathrm { L i p } } \leq \| ( h _ { L } \mapsto W ^ { L + 1 } h _ { L } ) \| _ { \mathrm { L i p } } \cdot \| a _ { L } \| _ { \mathrm { L i p } } \cdot \| ( h _ { L - 1 } \mapsto W ^ { L } h _ { L - 1 } ) \| _ { \mathrm { L i p } } } \\ & { \qquad \cdots \| a _ { 1 } \| _ { \mathrm { L i p } } \cdot \| ( h _ { 0 } \mapsto W ^ { 1 } h _ { 0 } ) \| _ { \mathrm { L i p } } = \displaystyle \prod _ { l = 1 } ^ { L + 1 } \| ( h _ { l - 1 } \mapsto W ^ { l } h _ { l - 1 } ) \| _ { \mathrm { L i p } } = \displaystyle \prod _ { l = 1 } ^ { L + 1 } \sigma ( W ^ { l } ) . } \end{array}
84
+ $$
85
+
86
+ Our spectral normalization normalizes the spectral norm of the weight matrix $W$ so that it satisfies the Lipschitz constraint $\sigma ( W ) = 1$ :
87
+
88
+ $$
89
+ \bar { W } _ { \mathrm { S N } } ( W ) : = W / \sigma ( W ) .
90
+ $$
91
+
92
+ If we normalize each $W ^ { l }$ using (8), we can appeal to the inequality (7) and the fact that $\sigma \left( \bar { W } _ { \mathrm { S N } } ( W ) \right) = 1$ to see that $\Vert f \Vert _ { \mathrm { L i p } }$ is bounded from above by 1.
93
+
94
+ Here, we would like to emphasize the difference between our spectral normalization and spectral norm ”regularization” introduced by Yoshida & Miyato (2017). Unlike our method, spectral norm ”regularization” penalizes the spectral norm by adding explicit regularization term to the objective function. Their method is fundamentally different from our method in that they do not make an attempt to ‘set’ the spectral norm to a designated value. Moreover, when we reorganize the derivative of our normalized cost function and rewrite our objective function (12), we see that our method is augmenting the cost function with a sample data dependent regularization function. Spectral norm regularization, on the other hand, imposes sample data independent regularization on the cost function, just like L2 regularization and Lasso.
95
+
96
+ # 2.2 FAST APPROXIMATION OF THE SPECTRAL NORM $\sigma ( W )$
97
+
98
+ As we mentioned above, the spectral norm $\sigma ( W )$ that we use to regularize each layer of the discriminator is the largest singular value of $W$ . If we naively apply singular value decomposition to compute the $\sigma ( W )$ at each round of the algorithm, the algorithm can become computationally heavy. Instead, we can use the power iteration method to estimate $\sigma ( W )$ (Golub & Van der Vorst, 2000; Yoshida & Miyato, 2017). With power iteration method, we can estimate the spectral norm with very small additional computational time relative to the full computational cost of the vanilla GANs. Please see Appendix A for the detail method and Algorithm 1 for the summary of the actual spectral normalization algorithm.
99
+
100
+ # 2.3 GRADIENT ANALYSIS OF THE SPECTRALLY NORMALIZED WEIGHTS
101
+
102
+ The gradien $^ { - 2 }$ of $\bar { W } _ { \mathrm { S N } } ( W )$ with respect to $W _ { i j }$ is:
103
+
104
+ $$
105
+ \begin{array} { r l r } { \displaystyle \frac { \partial \bar { W } _ { \mathrm { S N } } ( W ) } { \partial W _ { i j } } = \frac { 1 } { \sigma ( W ) } E _ { i j } - \frac { 1 } { \sigma ( W ) ^ { 2 } } \frac { \partial \sigma ( W ) } { \partial W _ { i j } } W = \frac { 1 } { \sigma ( W ) } E _ { i j } - \frac { [ { \bf u } _ { 1 } { \bf v } _ { 1 } ^ { \mathrm { T } } ] _ { i j } } { \sigma ( W ) ^ { 2 } } W } & { } & \\ { = \frac { 1 } { \sigma ( W ) } \left( E _ { i j } - [ { \bf u } _ { 1 } { \bf v } _ { 1 } ^ { \mathrm { T } } ] _ { i j } \bar { W } _ { \mathrm { S N } } \right) , } & { } & \end{array}
106
+ $$
107
+
108
+ where $E _ { i j }$ is the matrix whose $( i , j )$ -th entry is 1 and zero everywhere else, and $\mathbf { \delta u } _ { 1 }$ and ${ \pmb v } _ { 1 }$ are respectively the first left and right singular vectors of $W$ . If $^ { h }$ is the hidden layer in the network to be transformed by $\bar { W } _ { S N }$ , the derivative of the $V ( G , D )$ calculated over the mini-batch with respect to $W$ of the discriminator $D$ is given by:
109
+
110
+ $$
111
+ \begin{array} { r l } & { \displaystyle \frac { \partial V ( \boldsymbol { G } , \boldsymbol { D } ) } { \partial W } = \frac { 1 } { \sigma ( W ) } \left( \hat { \mathrm { E } } \left[ \delta \boldsymbol { h } ^ { \mathrm { T } } \right] - \left( \hat { \mathrm { E } } \left[ \delta ^ { \mathrm { T } } \bar { W } _ { \mathrm { S N } } \boldsymbol { h } \right] \right) \boldsymbol { u } _ { 1 } \boldsymbol { v } _ { 1 } ^ { \mathrm { T } } \right) } \\ & { \displaystyle \quad \quad = \frac { 1 } { \sigma ( W ) } \left( \hat { \mathrm { E } } \left[ \delta \boldsymbol { h } ^ { \mathrm { T } } \right] - \lambda \boldsymbol { u } _ { 1 } \boldsymbol { v } _ { 1 } ^ { \mathrm { T } } \right) } \end{array}
112
+ $$
113
+
114
+ where $\delta : = \left( \partial V ( G , D ) / \partial \left( \bar { W } _ { \mathrm { S N } } h \right) \right) ^ { \mathrm { T } } , \lambda : = \hat { \mathrm { E } } \left[ \delta ^ { \mathrm { T } } \left( \bar { W } _ { \mathrm { S N } } h \right) \right]$ , and $\hat { \mathrm { E } } [ \cdot ]$ represents empirical expectation over the mini-batch. $\begin{array} { r } { \frac { \partial V } { \partial W } = 0 } \end{array}$ when $\hat { \mathrm { E } } [ \delta \pmb { h } ^ { \mathrm { T } } ] = k \pmb { u } _ { 1 } \pmb { v } _ { 1 } ^ { T }$ for some $k \in \mathbb { R }$ .
115
+
116
+ We would like to comment on the implication of (12). The first term $\hat { \mathrm { ~ E ~ } } ^ { \left[ \delta h ^ { \operatorname { T } } \right] }$ is the same as the derivative of the weights without normalization. In this light, the second term in the expression can be seen as the regularization term penalizing the first singular components with the adaptive regularization coefficient $\lambda$ . $\lambda$ is positive when $\delta$ and $\bar { W } _ { \mathrm { S N } } h$ are pointing in similar direction, and this prevents the column space of $W$ from concentrating into one particular direction in the course of the training. In other words, spectral normalization prevents the transformation of each layer from becoming to sensitive in one direction. We can also use spectral normalization to devise a new parametrization for the model. Namely, we can split the layer map into two separate trainable components: spectrally normalized map and the spectral norm constant. As it turns out, this parametrization has its merit on its own and promotes the performance of GANs (See Appendix E).
117
+
118
+ # 3 SPECTRAL NORMALIZATION VS OTHER REGULARIZATION TECHNIQUES
119
+
120
+ The weight normalization introduced by Salimans & Kingma (2016) is a method that normalizes the $\ell _ { 2 }$ norm of each row vector in the weight matrix. Mathematically, this is equivalent to requiring the weight by the weight normalization $\bar { W } _ { \mathrm { W N } }$ :
121
+
122
+ $$
123
+ \sigma _ { 1 } ( \bar { W } _ { \mathrm { W N } } ) ^ { 2 } + \sigma _ { 2 } ( \bar { W } _ { \mathrm { W N } } ) ^ { 2 } + \cdot \cdot \cdot + \sigma _ { T } ( \bar { W } _ { \mathrm { W N } } ) ^ { 2 } = d _ { o } , \mathrm { w h e r e } T = \mathrm { m i n } ( d _ { i } , d _ { o } ) ,
124
+ $$
125
+
126
+ where $\sigma _ { t } ( A )$ is a $t { \cdot }$ -th singular value of matrix $A$ . Therefore, up to a scaler, this is same as the Frobenius normalization, which requires the sum of the squared singular values to be 1. These normalizations, however, inadvertently impose much stronger constraint on the matrix than intended. If $\bar { W } _ { \mathrm { W N } }$ is the weight normalized matrix of dimension $d _ { i } \times d _ { o }$ , the norm $\| \bar { W } _ { \mathrm { W N } } h \| _ { 2 }$ for a fixed unit vector $^ { h }$ is maximized at $\lVert \bar { W } _ { \mathrm { W N } } \underline { { h } } \rVert _ { 2 } ~ = ~ \sqrt { \ d _ { o } }$ when $\sigma _ { 1 } ( \bar { W } _ { \mathrm { W N } } ) ~ { = } ~ \sqrt { d _ { o } }$ and $\sigma _ { t } ( \bar { W } _ { \mathrm { W N } } ) \ : = \ : 0$ for $t = 2 , \dots , T$ , which means that $\bar { W } _ { \mathrm { W N } }$ is of rank one. Similar thing can be said to the Frobenius normalization (See the appendix for more details). Using such $\bar { W } _ { \mathrm { W N } }$ corresponds to using only one feature to discriminate the model probability distribution from the target. In order to retain as much norm of the input as possible and hence to make the discriminator more sensitive, one would hope to make the norm of $\hat { W } _ { \mathrm { W N } } h$ large. For weight normalization, however, this comes at the cost of reducing the rank and hence the number of features to be used for the discriminator. Thus, there is a conflict of interests between weight normalization and our desire to use as many features as possible to distinguish the generator distribution from the target distribution. The former interest often reigns over the other in many cases, inadvertently diminishing the number of features to be used by the discriminators. Consequently, the algorithm would produce a rather arbitrary model distribution that matches the target distribution only at select few features. Weight clipping (Arjovsky et al., 2017) also suffers from same pitfall.
127
+
128
+ Our spectral normalization, on the other hand, do not suffer from such a conflict in interest. Note that the Lipschitz constant of a linear operator is determined only by the maximum singular value. In other words, the spectral norm is independent of rank. Thus, unlike the weight normalization, our spectral normalization allows the parameter matrix to use as many features as possible while satisfying local 1-Lipschitz constraint. Our spectral normalization leaves more freedom in choosing the number of singular components (features) to feed to the next layer of the discriminator.
129
+
130
+ Brock et al. (2016) introduced orthonormal regularization on each weight to stabilize the training of GANs. In their work, Brock et al. (2016) augmented the adversarial objective function by adding the following term:
131
+
132
+ $$
133
+ \| W ^ { \mathrm { T } } W - I \| _ { F } ^ { 2 } .
134
+ $$
135
+
136
+ While this seems to serve the same purpose as spectral normalization, orthonormal regularization are mathematically quite different from our spectral normalization because the orthonormal regularization destroys the information about the spectrum by setting all the singular values to one. On the other hand, spectral normalization only scales the spectrum so that the its maximum will be one.
137
+
138
+ Gulrajani et al. (2017) used Gradient penalty method in combination with WGAN. In their work, they placed $K$ -Lipschitz constant on the discriminator by augmenting the objective function with the regularizer that rewards the function for having local 1-Lipschitz constant (i.e. $\| \nabla _ { \hat { \pmb { x } } } f \| _ { 2 } = 1 )$ ) at discrete sets of points of the form $\hat { \pmb { x } } : = \epsilon \tilde { \pmb { x } } + \bar { ( 1 - \epsilon ) } \pmb { x }$ generated by interpolating a sample $\tilde { \pmb x }$ from generative distribution and a sample $_ { \textbf { \em x } }$ from the data distribution. While this rather straightforward approach does not suffer from the problems we mentioned above regarding the effective dimension of the feature space, the approach has an obvious weakness of being heavily dependent on the support of the current generative distribution. As a matter of course, the generative distribution and its support gradually changes in the course of the training, and this can destabilize the effect of such regularization. In fact, we empirically observed that a high learning rate can destabilize the performance of WGAN-GP. On the contrary, our spectral normalization regularizes the function the operator space, and the effect of the regularization is more stable with respect to the choice of the batch. Training with our spectral normalization does not easily destabilize with aggressive learning rate. Moreover, WGAN-GP requires more computational cost than our spectral normalization with single-step power iteration, because the computation of $\| \nabla _ { \hat { \pmb { x } } } f \| _ { 2 }$ requires one whole round of forward and backward propagation. In the appendix section, we compare the computational cost of the two methods for the same number of updates.
139
+
140
+ # 4 EXPERIMENTS
141
+
142
+ In order to evaluate the efficacy of our approach and investigate the reason behind its efficacy, we conducted a set of extensive experiments of unsupervised image generation on CIFAR-10 (Torralba et al., 2008) and STL-10 (Coates et al., 2011), and compared our method against other normalization techniques. To see how our method fares against large dataset, we also applied our method on ILSVRC2012 dataset (ImageNet) (Russakovsky et al., 2015) as well. This section is structured as follows. First, we will discuss the objective functions we used to train the architecture, and then we will describe the optimization settings we used in the experiments. We will then explain two performance measures on the images to evaluate the images produced by the trained generators. Finally, we will summarize our results on CIFAR-10, STL-10, and ImageNet.
143
+
144
+ As for the architecture of the discriminator and generator, we used convolutional neural networks. Also, for the evaluation of the spectral norm for the convolutional weight $W \in \mathbb { R } ^ { d _ { \mathrm { o u t } } \times d _ { \mathrm { i n } } \times h \times w }$ , we treated the operator as a 2-D matrix of dimension $d _ { \mathrm { o u t } } \times ( d _ { \mathrm { i n } } h w ) ^ { 3 }$ . We trained the parameters of the generator with batch normalization (Ioffe & Szegedy, 2015). We refer the readers to Table 3 in the appendix section for more details of the architectures.
145
+
146
+ For all methods other than WGAN-GP, we used the following standard objective function for the adversarial loss:
147
+
148
+ $$
149
+ V ( G , D ) : = \underset { x \sim q _ { \mathrm { d a t a } } ( \mathbf { x } ) } { \mathrm { ~ E ~ } } [ \log D ( \pmb { x } ) ] + \underset { z \sim p ( z ) } { \mathrm { ~ E ~ } } [ \log ( 1 - D ( G ( z ) ) ) ] ,
150
+ $$
151
+
152
+ where $z \in \mathbb { R } ^ { d _ { z } }$ is a latent variable, $p ( z )$ is the standard normal distribution $\mathcal { N } ( 0 , I )$ , and $G : \mathbb { R } ^ { d _ { z } } $ $\mathbb { R } ^ { d _ { 0 } }$ is a deterministic generator function. We set $d _ { z }$ to 128 for all of our experiments. For the updates of $G$ , we used the alternate cost proposed by Goodfellow et al. $( 2 0 1 4 ) - \mathrm { E } _ { z \sim p ( z ) } [ \log ( D ( G ( z ) ) ) ]$ as used in Goodfellow et al. (2014) and Warde-Farley & Bengio (2017). For the updates of $D$ , we used the original cost defined in (15). We also tested the performance of the algorithm with the so-called hinge loss, which is given by
153
+
154
+ $$
155
+ \begin{array} { r l } & { V _ { D } ( \hat { G } , D ) = \underset { x \sim q _ { \mathrm { d a t a } } ( x ) } { \mathrm { E } } \left[ \operatorname* { m i n } \left( 0 , - 1 + D ( x ) \right) \right] + \underset { z \sim p ( z ) } { \mathrm { E } } \left[ \operatorname* { m i n } \left( 0 , - 1 - D \left( \hat { G } ( z ) \right) \right) \right] } \\ & { V _ { G } ( G , \hat { D } ) = - \underset { z \sim p ( z ) } { \mathrm { E } } \left[ \hat { D } \left( G ( z ) \right) \right] , } \end{array}
156
+ $$
157
+
158
+ respectively for the discriminator and the generator. Optimizing these objectives is equivalent to minimizing the so-called reverse KL divergence : $\mathrm { K L } [ p _ { g } ] | q _ { \mathrm { d a t a } } ]$ . This type of loss has been already proposed and used in Lim & Ye (2017); Tran et al. (2017). The algorithm based on the hinge loss also showed good performance when evaluated with inception score and FID. For Wasserstein GANs with gradient penalty (WGAN-GP) (Gulrajani et al., 2017), we used the following objective function: $V ( G , D ) : = \operatorname { E } _ { x \sim q _ { \mathrm { d a t a } } } [ D ( \pmb { x } ) ] - \operatorname { E } _ { \pmb { z } \sim p ( \pmb { z } ) } [ D ( G ( \pmb { z } ) ) ] \underset { \ r { \ r { \ r { \ r { \alpha } } } } } { - } \lambda \operatorname { E } _ { \hat { \pmb { x } } \sim p _ { \hat { \pmb { x } } } } [ ( \lVert \nabla _ { \hat { \pmb { x } } } D ( \hat { \pmb { x } } ) \rVert _ { 2 } - 1 ) ^ { 2 } ]$ , where the regularization term is the one we introduced in the appendix section D.4.
159
+
160
+ For quantitative assessment of generated examples, we used inception score (Salimans et al., 2016) and Frechet inception distance ´ (FID) (Heusel et al., 2017). Please see Appendix B.1 for the details of each score.
161
+
162
+ # 4.1 RESULTS ON CIFAR10 AND STL-10
163
+
164
+ In this section, we report the accuracy of the spectral normalization (we use the abbreviation: SNGAN for the spectrally normalized GANs) during the training, and the dependence of the algorithm’s performance on the hyperparmeters of the optimizer. We also compare the performance quality of the algorithm against those of other regularization/normalization techniques for the discriminator networks, including: Weight clipping (Arjovsky et al., 2017), WGAN-GP (Gulrajani et al., 2017), batch-normalization (BN) (Ioffe & Szegedy, 2015), layer normalization (LN) (Ba et al., 2016), weight normalization (WN) (Salimans & Kingma, 2016) and orthonormal regularization (orthonormal) (Brock et al., 2016). In order to evaluate the stand-alone efficacy of the gradient penalty, we also applied the gradient penalty term to the standard adversarial loss of GANs (15). We would refer to this method as ‘GAN-GP’. For weight clipping, we followed the original work Arjovsky et al. (2017) and set the clipping constant $c$ at 0.01 for the convolutional weight of each layer. For gradient penalty, we set $\lambda$ to 10, as suggested in Gulrajani et al. (2017). For orthonormal, we initialized the each weight of $D$ with a randomly selected orthonormal operator and trained GANs with the objective function augmented with the regularization term used in Brock et al. (2016). For all comparative studies throughout, we excluded the multiplier parameter $\gamma$ in the weight normalization method, as well as in batch normalization and layer normalization method. This was done in order to prevent the methods from overtly violating the Lipschitz condition. When we experimented with different multiplier parameter, we were in fact not able to achieve any improvement.
165
+
166
+ For optimization, we used the Adam optimizer Kingma & Ba (2015) in all of our experiments. We tested with 6 settings for (1) $n _ { \mathrm { d i s } }$ , the number of updates of the discriminator per one update of the generator and (2) learning rate $\alpha$ and the first and second order momentum parameters $( \beta _ { 1 } , \beta _ { 2 } )$ of Adam. We list the details of these settings in Table 1 in the appendix section. Out of these 6 settings, A, B, and C are the settings used in previous representative works. The purpose of the settings D, E, and F is to the evaluate the performance of the algorithms implemented with more aggressive learning rates. For the details of the architectures of convolutional networks deployed in the generator and the discriminator, we refer the readers to Table 3 in the appendix section. The number of updates for GAN generator were 100K for all experiments, unless otherwise noted.
167
+
168
+ Firstly, we inspected the spectral norm of each layer during the training to make sure that our spectral normalization procedure is indeed serving its purpose. As we can see in the Figure 9 in the C.1, the spectral norms of these layers floats around 1–1.05 region throughout the training. Please see Appendix C.1 for more details.
169
+
170
+ Table 1: Hyper-parameter settings we tested in our experiments. $\dag , \ddag$ and $\star$ are the hyperparameter settings following Gulrajani et al. (2017), Warde-Farley & Bengio (2017) and Radford et al. (2016), respectively.
171
+
172
+ <table><tr><td>Setting</td><td>α</td><td>β</td><td>β</td><td>ndis</td></tr><tr><td>At</td><td>0.0001</td><td>0.5</td><td>0.9</td><td>5</td></tr><tr><td>B</td><td>0.0001</td><td>0.5</td><td>0.999</td><td>1</td></tr><tr><td>C*</td><td>0.0002</td><td>0.5</td><td>0.999</td><td>1</td></tr><tr><td>D</td><td>0.001</td><td>0.5</td><td>0.9</td><td>5</td></tr><tr><td>E</td><td>0.001</td><td>0.5</td><td>0.999</td><td>5</td></tr><tr><td>F</td><td>0.001</td><td>0.9</td><td>0.999</td><td>5</td></tr></table>
173
+
174
+ ![](images/0679674629753ae35ffe4c79d892afcc2435d4ac00bb331302ee5682e726268b.jpg)
175
+ Figure 1: Inception scores on CIFAR-10 and STL-10 with different methods and hyperparameters (higher is better).
176
+
177
+ In Figures 1 and 2 we show the inception scores of each method with the settings A–F. We can see that spectral normalization is relatively robust with aggressive learning rates and momentum parameters. WGAN-GP fails to train good GANs at high learning rates and high momentum parameters on both CIFAR-10 and STL-10. Orthonormal regularization performed poorly for the setting E on the STL-10, but performed slightly better than our method with the optimal setting. These results suggests that our method is more robust than other methods with respect to the change in the setting of the training. Also, the optimal performance of weight normalization was inferior to both WGAN-GP and spectral normalization on STL-10, which consists of more diverse examples than CIFAR-10. Best scores of spectral normalization are better than almost all other methods on both CIFAR-10 and STL-10.
178
+
179
+ In Tables 2, we show the inception scores of the different methods with optimal settings on CIFAR10 and STL-10 dataset. We see that SN-GANs performed better than almost all contemporaries on the optimal settings. SN-GANs performed even better with hinge loss (17).4. For the training with same number of iterations, SN-GANs fell behind orthonormal regularization for STL-10. For more detailed comparison between orthonormal regularization and spectral normalization, please see section 4.1.2.
180
+
181
+ In Figure 6 we show the images produced by the generators trained with WGAN-GP, weight normalization, and spectral normalization. SN-GANs were consistently better than GANs with weight normalization in terms of the quality of generated images. To be more precise, as we mentioned in Section 3, the set of images generated by spectral normalization was clearer and more diverse than the images produced by the weight normalization. We can also see that WGAN-GP failed to train good GANs with high learning rates and high momentums (D,E and F). The generated images with GAN-GP, batch normalization, and layer normalization is shown in Figure 12 in the appendix section.
182
+
183
+ ![](images/34bfed54b3a7c3a53dd749885543ecaeb015b22db3a4b3a3bc9ad66f2531c20e.jpg)
184
+ Figure 2: FIDs on CIFAR-10 and STL-10 with different methods and hyperparameters (lower is better).
185
+
186
+ Table 2: Inception scores and FIDs with unsupervised image generation on CIFAR-10. $\dagger$ (Radford et al., 2016) (experimented by Yang et al. (2017)), $^ \ddag$ (Yang et al., 2017), $^ *$ (Warde-Farley & Bengio, 2017), †† (Gulrajani et al., 2017)
187
+
188
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Inception score</td><td colspan="2">FID</td></tr><tr><td>CIFAR-10</td><td>STL-10</td><td>CIFAR-10</td><td>STL-10</td></tr><tr><td>Real data</td><td>11.24±.12</td><td>26.08±.26</td><td>7.8</td><td>7.9</td></tr><tr><td colspan="5">-Standard CNN-</td></tr><tr><td>Weight clipping</td><td>6.41±.11</td><td>7.57±.10</td><td>42.6</td><td>64.2</td></tr><tr><td>GAN-GP</td><td>6.93±.08</td><td></td><td>37.7</td><td></td></tr><tr><td>WGAN-GP</td><td>6.68±.06</td><td>8.42±.13</td><td>40.2</td><td>55.1</td></tr><tr><td>Batch Norm.</td><td>6.27±.10</td><td></td><td>56.3</td><td></td></tr><tr><td>Layer Norm.</td><td>7.19±.12</td><td>7.61±.12</td><td>33.9</td><td>75.6</td></tr><tr><td>Weight Norm.</td><td>6.84±.07</td><td>7.16±.10</td><td>34.7</td><td>73.4</td></tr><tr><td>Orthonormal</td><td>7.40±.12</td><td>8.56±.07</td><td>29.0</td><td>46.7</td></tr><tr><td>(ours) SN-GANs</td><td>7.42±.08</td><td>8.28±.09</td><td>29.3</td><td>53.1</td></tr><tr><td>Orthonormal (2x updates)</td><td></td><td>8.67±.08</td><td></td><td>44.2</td></tr><tr><td>(ours) SN-GANs (2x updates)</td><td></td><td>8.69±.09</td><td></td><td>47.5</td></tr><tr><td>(ours) SN-GANs,Eq.(17)</td><td>7.58±.12</td><td></td><td>25.5</td><td></td></tr><tr><td>(ours) SN-GANs,Eq.(17) (2x updates)</td><td></td><td>8.79±.14</td><td></td><td>43.2</td></tr><tr><td colspan="5">-ResNet-5</td></tr><tr><td>Orthonormal,Eq.(17)</td><td>7.92±.04</td><td>8.72±.06</td><td></td><td></td></tr><tr><td>(ours) SN-GANs,Eq.(17)</td><td>8.22±.05</td><td>9.10±.04</td><td>23.8±.58 21.7±.21</td><td>42.4±.99 40.1±.50</td></tr><tr><td>DCGANt</td><td>6.64±.14</td><td>7.84±.07</td><td></td><td></td></tr><tr><td>LR-GANs‡</td><td>7.17±.07</td><td></td><td></td><td></td></tr><tr><td>Warde-Farley et al.*</td><td>7.72±.13</td><td>8.51±.13</td><td></td><td></td></tr><tr><td>WGAN-GP (ResNet)++</td><td>7.86±.08</td><td></td><td></td><td></td></tr></table>
189
+
190
+ We also compared our algorithm against multiple benchmark methods ans summarized the results on the bottom half of the Table 2. We also tested the performance of our method on ResNet based GANs used in Gulrajani et al. (2017). Please note that all methods listed thereof are all different in both optimization methods and the architecture of the model. Please see Table 4 and 5 in the appendix section for the detail network architectures. Our implementation of our algorithm was able to perform better than almost all the predecessors in the performance.
191
+
192
+ ![](images/0fe08b80ae4b9ca468b508e150744d1efd2c8a94434418ec4387d95d307d0538.jpg)
193
+ Figure 3: Squared singular values of weight matrices trained with different methods: Weight clipping (WC), Weight Normalization (WN) and Spectral Normalization (SN). We scaled the singular values so that the largest singular values is equal to 1. For WN and SN, we calculated singular values of the normalized weight matrices.
194
+
195
+ # 4.1.1 ANALYSIS OF SN-GANS
196
+
197
+ Singular values analysis on the weights of the discriminator $D$ In Figure 3, we show the squared singular values of the weight matrices in the final discriminator $D$ produced by each method using the parameter that yielded the best inception score. As we predicted in Section 3, the singular values of the first to fifth layers trained with weight clipping and weight normalization concentrate on a few components. That is, the weight matrices of these layers tend to be rank deficit. On the other hand, the singular values of the weight matrices in those layers trained with spectral normalization is more broadly distributed. When the goal is to distinguish a pair of probability distributions on the low-dimensional nonlinear data manifold embedded in a high dimensional space, rank deficiencies in lower layers can be especially fatal. Outputs of lower layers have gone through only a few sets of rectified linear transformations, which means that they tend to lie on the space that is linear in most parts. Marginalizing out many features of the input distribution in such space can result in oversimplified discriminator. We can actually confirm the effect of this phenomenon on the generated images especially in Figure 6b. The images generated with spectral normalization is more diverse and complex than those generated with weight normalization.
198
+
199
+ Training time On CIFAR-10, SN-GANs is slightly slower than weight normalization (about 110 $\sim 1 2 0 \%$ computational time), but significantly faster than WGAN-GP. As we mentioned in Section 3, WGAN-GP is slower than other methods because WGAN-GP needs to calculate the gradient of gradient norm $\| \nabla _ { \pmb { x } } D \| _ { 2 }$ . For STL-10, the computational time of SN-GANs is almost the same as vanilla GANs, because the relative computational cost of the power iteration (18) is negligible when compared to the cost of forward and backward propagation on CIFAR-10 (images size of STL-10 is larger $( 4 8 \times 4 8 )$ ). Please see Figure 10 in the appendix section for the actual computational time.
200
+
201
+ # 4.1.2 COMPARISON BETWEEN SN-GANS AND ORTHONORMAL REGULARIZATION
202
+
203
+ In order to highlight the difference between our spectral normalization and orthonormal regularization, we conducted an additional set of experiments. As we explained in Section 3, orthonormal regularization is different from our method in that it destroys the spectral information and puts equal emphasis on all feature dimensions, including the ones that ’shall’ be weeded out in the training process. To see the extent of its possibly detrimental effect, we experimented by increasing the dimension of the feature space 6, especially at the final layer (7th conv) for which the training with our spectral normalization prefers relatively small feature space (dimension $< 1 0 0$ ; see Figure 3b). As for the setting of the training, we selected the parameters for which the orthonormal regularization performed optimally. The figure 4 shows the result of our experiments. As we predicted, the performance of the orthonormal regularization deteriorates as we increase the dimension of the feature maps at the final layer. Our SN-GANs, on the other hand, does not falter with this modification of the architecture. Thus, at least in this perspective, we may such that our method is more robust with respect to the change of the network architecture.
204
+
205
+ ![](images/3835c35b2adb678885bda11615c5ee28671aa080f9f713aeb097adb1f7a2405d.jpg)
206
+ Figure 4: The effect on the performance on STL-10 induced by the change of the feature map dimension of the final layer. The width of the highlighted region represents standard deviation of the results over multiple seeds of weight initialization. The orthonormal regularization does not perform well with large feature map dimension, possibly because of its design that forces the discriminator to use all dimensions including the ones that are unnecessary. For the setting of the optimizers’ hyper-parameters, We used the setting C, which was optimal for “orthonormal regularization”
207
+
208
+ ![](images/8040f692f6b49e627d307739c23a5985a583a57103d09e7349be855ee6209f5a.jpg)
209
+ Figure 5: Learning curves for conditional image generation in terms of Inception score for SNGANs and GANs with orthonormal regularization on ImageNet.
210
+
211
+ # 4.2 IMAGE GENERATION ON IMAGENET
212
+
213
+ To show that our method remains effective on a large high dimensional dataset, we also applied our method to the training of conditional GANs on ILRSVRC2012 dataset with 1000 classes, each consisting of approximately 1300 images, which we compressed to $1 2 8 \times 1 2 8$ pixels. Regarding the adversarial loss for conditional GANs, we used practically the same formulation used in Mirza & Osindero (2014), except that we replaced the standard GANs loss with hinge loss (17). Please see Appendix B.3 for the details of experimental settings.
214
+
215
+ GANs without normalization and GANs with layer normalization collapsed in the beginning of training and failed to produce any meaningful images. GANs with orthonormal normalization Brock et al. (2016) and our spectral normalization, on the other hand, was able to produce images. The inception score of the orthonormal normalization however plateaued around 20Kth iterations, while SN kept improving even afterward (Figure 5.) To our knowledge, our research is the first of its kind in succeeding to produce decent images from ImageNet dataset with a single pair of a discriminator and a generator (Figure 7). To measure the degree of mode-collapse, we followed the footstep of Odena et al. (2017) and computed the intra MS-SSIM Odena et al. (2017) for pairs of independently generated GANs images of each class. We see that our SN-GANs ((intra MS-SSIM) $\scriptstyle \begin{array} { l l l } { \scriptstyle - 0 . 1 0 1 } \end{array} $ ) is suffering less from the mode-collapse than AC-GANs ((intra MS-SSIM) ${ \sim } 0 . 2 5$ ).
216
+
217
+ To ensure that the superiority of our method is not limited within our specific setting, we also compared the performance of SN-GANs against orthonormal regularization on conditional GANs with projection discriminator (Miyato & Koyama, 2018) as well as the standard (unconditional) GANs. In our experiments, SN-GANs achieved better performance than orthonormal regularization for the both settings (See Figure 13 in the appendix section).
218
+
219
+ # 5 CONCLUSION
220
+
221
+ This paper proposes spectral normalization as a stabilizer of training of GANs. When we apply spectral normalization to the GANs on image generation tasks, the generated examples are more diverse than the conventional weight normalization and achieve better or comparative inception scores relative to previous studies. The method imposes global regularization on the discriminator as opposed to local regularization introduced by WGAN-GP, and can possibly used in combinations. In the future work, we would like to further investigate where our methods stand amongst other methods on more theoretical basis, and experiment our algorithm on larger and more complex datasets.
222
+
223
+ # ACKNOWLEDGMENTS
224
+
225
+ We would like to thank the members of Preferred Networks, Inc., particularly Shin-ichi Maeda, Eiichi Matsumoto, Masaki Watanabe and Keisuke Yahata for insightful comments and discussions. We also would like to thank anonymous reviewers and commenters on the OpenReview forum for insightful discussions.
226
+
227
+ # REFERENCES
228
+
229
+ Martin Arjovsky and Leon Bottou. Towards principled methods for training generative adversarial networks. ´ In ICLR, 2017.
230
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. In ´ ICML, pp. 214–223, 2017.
231
+ Devansh Arpit, Yingbo Zhou, Bhargava U Kota, and Venu Govindaraju. Normalization propagation: A parametric technique for removing internal covariate shift in deep networks. In ICML, pp. 1168–1176, 2016.
232
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
233
+ Andrew Brock, Theodore Lim, James M Ritchie, and Nick Weston. Neural photo editing with introspective adversarial networks. arXiv preprint arXiv:1609.07093, 2016.
234
+ Adam Coates, Andrew Ng, and Honglak Lee. An analysis of single-layer networks in unsupervised feature learning. In AISTATS, pp. 215–223, 2011.
235
+ Harm de Vries, Florian Strub, Jer´ emie Mary, Hugo Larochelle, Olivier Pietquin, and Aaron C Courville. Mod- ´ ulating early visual processing by language. In NIPS, pp. 6576–6586, 2017.
236
+ DC Dowson and BV Landau. The frechet distance between multivariate normal distributions. ´ Journal of Multivariate Analysis, 12(3):450–455, 1982.
237
+ Vincent Dumoulin, Jonathon Shlens, and Manjunath Kudlur. A learned representation for artistic style. In ICLR, 2017.
238
+ Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In AISTATS, pp. 315–323, 2011.
239
+ Gene H Golub and Henk A Van der Vorst. Eigenvalue computation in the 20th century. Journal of Computational and Applied Mathematics, 123(1):35–65, 2000.
240
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, pp. 2672–2680, 2014. of wasserstein GANs. arXiv preprint arXiv:1704.00028, 2017.
241
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016.
242
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, Gunter Klambauer, and Sepp ¨ Hochreiter. GANs trained by a two time-scale update rule converge to a nash equilibrium. arXiv preprint arXiv:1706.08500, 2017.
243
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In NIPS, pp. 4565–4573, 2016.
244
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, pp. 448–456, 2015.
245
+ Kevin Jarrett, Koray Kavukcuoglu, Marc’Aurelio Ranzato, and Yann LeCun. What is the best multi-stage architecture for object recognition? In ICCV, pp. 2146–2153, 2009.
246
+ Kui Jia, Dacheng Tao, Shenghua Gao, and Xiangmin Xu. Improving training of deep neural networks via singular value bounding. In CVPR, 2017.
247
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
248
+ Jiwei Li, Will Monroe, Tianlin Shi, Alan Ritter, and Dan Jurafsky. Adversarial learning for neural dialogue generation. In EMNLP, pp. 2147–2159, 2017.
249
+ Jae Hyun Lim and Jong Chul Ye. Geometric GAN. arXiv preprint arXiv:1705.02894, 2017.
250
+ Andrew L Maas, Awni Y Hannun, and Andrew Y Ng. Rectifier nonlinearities improve neural network acoustic models. In ICML Workshop on Deep Learning for Audio, Speech and Language Processing, 2013.
251
+ Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
252
+ Takeru Miyato and Masanori Koyama. cGANs with projection discriminator. In ICLR, 2018.
253
+ Shakir Mohamed and Balaji Lakshminarayanan. Learning in implicit generative models. NIPS Workshop on Adversarial Training, 2017.
254
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In ICML, pp. 807–814, 2010.
255
+ Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-GAN: Training generative neural samplers using variational divergence minimization. In NIPS, pp. 271–279, 2016.
256
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier GANs. In ICML, pp. 2642–2651, 2017.
257
+ Guo-Jun Qi. Loss-sensitive generative adversarial networks on lipschitz densities. arXiv preprint arXiv:1701.06264, 2017.
258
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016.
259
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
260
+ Masaki Saito, Eiichi Matsumoto, and Shunta Saito. Temporal generative adversarial nets with singular value clipping. In ICCV, 2017.
261
+ Tim Salimans and Diederik P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In NIPS, pp. 901–909, 2016.
262
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. In NIPS, pp. 2226–2234, 2016.
263
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, pp. 1–9, 2015.
264
+ Seiya Tokui, Kenta Oono, Shohei Hido, and Justin Clayton. Chainer: a next-generation open source framework for deep learning. In Proceedings of workshop on machine learning systems (LearningSys) in the twentyninth annual conference on neural information processing systems (NIPS), 2015.
265
+ Antonio Torralba, Rob Fergus, and William T Freeman. 80 million tiny images: A large data set for nonparametric object and scene recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 30 (11):1958–1970, 2008.
266
+ Dustin Tran, Rajesh Ranganath, and David M Blei. Deep and hierarchical implicit models. arXiv preprint arXiv:1702.08896, 2017.
267
+ Masatoshi Uehara, Issei Sato, Masahiro Suzuki, Kotaro Nakayama, and Yutaka Matsuo. Generative adversarial nets from a density ratio estimation perspective. NIPS Workshop on Adversarial Training, 2016.
268
+ David Warde-Farley and Yoshua Bengio. Improving generative adversarial networks with denoising feature matching. In ICLR, 2017.
269
+ Sitao Xiang and Hao Li. On the effect of batch normalization and weight normalization in generative adversarial networks. arXiv preprint arXiv:1704.03971, 2017.
270
+ Jianwei Yang, Anitha Kannan, Dhruv Batra, and Devi Parikh. LR-GAN: Layered recursive generative adversarial networks for image generation. ICLR, 2017.
271
+ Yuichi Yoshida and Takeru Miyato. Spectral norm regularization for improving the generalizability of deep learning. arXiv preprint arXiv:1705.10941, 2017.
272
+
273
+ ![](images/8cf255f3b58a6bc43644532566b02fd7e738201692f776d8f6a0ab38e5d25b26.jpg)
274
+ Figure 6: Generated images on different methods: WGAN-GP, weight normalization, and spectral normalization on CIFAR-10 and STL-10.
275
+
276
+ ![](images/bb0328547611a1ee65156172a7f8bc5bdb60d8ce966ebdaf79fa39d9944e929c.jpg)
277
+ Figure 7: $1 2 8 \mathrm { x } 1 2 8$ pixel images generated by SN-GANs trained on ILSVRC2012 dataset. The inception score is $2 1 . 1 { \pm } . 3 5$ .
278
+
279
+ # A THE ALGORITHM OF SPECTRAL NORMALIZATION
280
+
281
+ Let us describe the shortcut in Section 2.1 in more detail. We begin with vectors $\tilde { \mathbf { \pmb { u } } }$ that is randomly initialized for each weight. If there is no multiplicity in the dominant singular values and if $\tilde { \textbf { \em u } }$ is not orthogonal to the first left singular vectors7, we can appeal to the principle of the power method and produce the first left and right singular vectors through the following update rule:
282
+
283
+ $$
284
+ \begin{array} { r } { \tilde { \pmb { v } } W ^ { \mathrm { T } } \tilde { \pmb { u } } / \| W ^ { \mathrm { T } } \tilde { \pmb { u } } \| _ { 2 } , \tilde { \pmb { u } } W \tilde { \pmb { v } } / \| W \tilde { \pmb { v } } \| _ { 2 } . } \end{array}
285
+ $$
286
+
287
+ We can then approximate the spectral norm of $W$ with the pair of so-approximated singular vectors:
288
+
289
+ $$
290
+ \sigma ( W ) \approx \tilde { \pmb { u } } ^ { \mathrm { T } } W \tilde { \pmb { v } } .
291
+ $$
292
+
293
+ If we use SGD for updating $W$ , the change in $W$ at each update would be small, and hence the change in its largest singular value. In our implementation, we took advantage of this fact and reused the $\tilde { \mathbf { \pmb { u } } }$ computed at each step of the algorithm as the initial vector in the subsequent step. In fact, with this ‘recycle’ procedure, one round of power iteration was sufficient in the actual experiment to achieve satisfactory performance. Algorithm 1 in the appendix summarizes the computation of the spectrally normalized weight matrix $\bar { W }$ with this approximation. Note that this procedure is very computationally cheap even in comparison to the calculation of the forward and backward propagations on neural networks. Please see Figure 10 for actual computational time with and without spectral normalization.
294
+
295
+ # Algorithm 1 SGD with spectral normalization
296
+
297
+ • Initialize $\tilde { \mathbf { u } } _ { l } \in \mathcal { R } ^ { d _ { l } }$ for $l = 1 , \ldots , L$ with a random vector (sampled from isotropic distribution).
298
+
299
+ • For each update and each layer $l$ :
300
+
301
+ 1. Apply power iteration method to a unnormalized weight $W ^ { l }$ :
302
+
303
+ $$
304
+ \begin{array} { r l } & { \tilde { \pmb { v } } _ { l } ( W ^ { l } ) ^ { \mathrm { T } } \tilde { \pmb { u } } _ { l } / \| ( W ^ { l } ) ^ { \mathrm { T } } \tilde { \pmb { u } } _ { l } \| _ { 2 } } \\ & { \tilde { \pmb { u } } _ { l } W ^ { l } \tilde { \pmb { v } } _ { l } / \| W ^ { l } \tilde { \pmb { v } } _ { l } \| _ { 2 } } \end{array}
305
+ $$
306
+
307
+ 2. Calculate $\bar { W } _ { \mathrm { S N } }$ with the spectral norm:
308
+
309
+ $$
310
+ \bar { W } _ { \mathrm { S N } } ^ { l } ( W ^ { l } ) = W ^ { l } / \sigma ( W ^ { l } ) , \mathrm { w h e r e } \sigma ( W ^ { l } ) = \tilde { \mathbf { u } } _ { l } ^ { \mathrm { T } } W ^ { l } \tilde { \mathbf { v } } _ { l }
311
+ $$
312
+
313
+ 3. Update $W ^ { l }$ with SGD on mini-batch dataset $\mathcal { D } _ { M }$ with a learning rate $\alpha$ :
314
+
315
+ $$
316
+ W ^ { l } \gets W ^ { l } - \alpha \nabla _ { W ^ { l } } \ell ( \bar { W } _ { \mathrm { S N } } ^ { l } ( W ^ { l } ) , { \mathcal D } _ { M } )
317
+ $$
318
+
319
+ # B EXPERIMENTAL SETTINGS
320
+
321
+ # B.1 PERFORMANCE MEASURES
322
+
323
+ Inception score is introduced originally by Salimans et al. (2016): $\begin{array} { r l } { I ( \{ x _ { n } \} _ { n = 1 } ^ { N } ) } & { { } : = } \end{array}$ $\exp ( \mathrm { E } [ D _ { \mathrm { K L } } [ p ( y | \mathbf { x } ) | | p ( y ) ] ] )$ , where $p ( y )$ is approximated by $\begin{array} { r } { { \frac { 1 } { N } } \sum _ { n = 1 } ^ { N } p ( y | \mathbf { x } _ { n } ) } \end{array}$ and $p ( y | x )$ is the trained Inception convolutional neural network (Szegedy et al., 2015), which we would refer to Inception model for short. In their work, Salimans et al. (2016) reported that this score is strongly correlated with subjective human judgment of image quality. Following the procedure in Salimans et al. (2016); Warde-Farley & Bengio (2017), we calculated the score for randomly generated 5000 examples from each trained generator to evaluate its ability to generate natural images. We repeated each experiment 10 times and reported the average and the standard deviation of the inception scores.
324
+
325
+ Frechet inception distance (Heusel et al., 2017) is another measure for the quality of the generated ´ examples that uses 2nd order information of the final layer of the inception model applied to the examples. On its own, the Frechet distance ´ Dowson $\&$ Landau (1982) is 2-Wasserstein distance between two distribution $p _ { 1 }$ and $p _ { 2 }$ assuming they are both multivariate Gaussian distributions:
326
+
327
+ $$
328
+ F ( p _ { 1 } , p _ { 2 } ) = \| { \pmb \mu } _ { p _ { 1 } } - { \pmb \mu } _ { p _ { 2 } } \| _ { 2 } ^ { 2 } + \mathrm { t r a c e } \left( C _ { p _ { 1 } } + C _ { p _ { 2 } } - 2 ( C _ { p _ { 1 } } C _ { p _ { 2 } } ) ^ { 1 / 2 } \right) ,
329
+ $$
330
+
331
+ where $\{ \mu _ { p _ { 1 } } , C _ { p _ { 1 } } \}$ , $\{ \mu _ { p _ { 2 } } , C _ { p _ { 2 } } \}$ are the mean and covariance of samples from $q$ and $p$ , respectively. If $f _ { \ominus }$ is the output of the final layer of the inception model before the softmax, the Frechet inception ´ distance (FID) between two distributions $p _ { 1 }$ and $p _ { 2 }$ on the images is the distance between $f _ { \ominus } \circ p _ { 1 }$ and $f _ { \ominus } \circ p _ { 2 }$ . We computed the Frechet inception distance between the true distribution and the generated ´ distribution empirically over 10000 and 5000 samples. Multiple repetition of the experiments did not exhibit any notable variations on this score.
332
+
333
+ # B.2 IMAGE GENERATION ON CIFAR-10 AND STL-10
334
+
335
+ For the comparative study, we experimented with the recent ResNet architecture of Gulrajani et al. (2017) as well as the standard CNN. For this additional set of experiments, we used Adam again for the optimization and used the very hyper parameter used in Gulrajani et al. (2017) $( \alpha = 0 . 0 0 0 2 , \beta _ { 1 } = 0 , \beta _ { 2 } = 0 . 9 , n _ { d i s } = 5 )$ . For our SN-GANs, we doubled the feature map in the generator from the original, because this modification achieved better results. Note that when we doubled the dimension of the feature map for the WGAN-GP experiment, however, the performance deteriorated.
336
+
337
+ # B.3 IMAGE GENERATION ON IMAGENET
338
+
339
+ The images used in this set of experiments were resized to $1 2 8 \times 1 2 8$ pixels. The details of the architecture are given in Table 6. For the generator network of conditional GANs, we used conditional batch normalization (CBN) (Dumoulin et al., 2017; de Vries et al., 2017). Namely we replaced the standard batch normalization layer with the CBN conditional to the label information $y \in \{ 1 , \ldots , 1 0 0 0 \}$ . For the optimization, we used Adam with the same hyperparameters we used for ResNet on CIFAR-10 and STL-10 dataset. We trained the networks with 450K generator updates, and applied linear decay for the learning rate after 400K iterations so that the rate would be 0 at the end.
340
+
341
+ # B.4 NETWORK ARCHITECTURES
342
+
343
+ Table 3: Standard CNN models for CIFAR-10 and STL-10 used in our experiments on image Generation. The slopes of all lReLU functions in the networks are set to 0.1.
344
+
345
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ RM×M×3</td></tr><tr><td rowspan=1 colspan=1>3×3, stride=1 conv 64 IReLU4×4, stride=2 conv 64 IReLU</td></tr><tr><td rowspan=1 colspan=1>3×3, stride=1 conv 128 lReLU4×4, stride=2 conv 128 lReLU</td></tr><tr><td rowspan=1 colspan=1>3×3,stride=1 conv 256 lReLU4×4, stride=2 conv 256 lReLU</td></tr><tr><td rowspan=1 colspan=1>3×3, stride=1 conv. 512 IReLU</td></tr><tr><td rowspan=1 colspan=1>dense →1</td></tr></table>
346
+
347
+ (b) Discriminator, $M = 3 2$ for SVHN and CIFAR10, and $M = 4 8$ for STL-10
348
+
349
+ <table><tr><td rowspan=1 colspan=1>z ∈ R128 ~N(0,I)</td></tr><tr><td rowspan=1 colspan=1>dense →Mg × Mg × 512</td></tr><tr><td rowspan=1 colspan=1>4×4, stride=2 deconv. BN 256 ReLU</td></tr><tr><td rowspan=1 colspan=1>4×4, stride=2 deconv. BN 128 ReLU</td></tr><tr><td rowspan=1 colspan=1>4×4, stride=2 deconv. BN 64 ReLU</td></tr><tr><td rowspan=1 colspan=1>3×3,stride=1 conv.3 Tanh</td></tr></table>
350
+
351
+ (a) Generator, $M _ { g } = 4$ for SVHN and CIFAR10, and $M _ { g } = 6$ for STL-10
352
+
353
+ Table 4: ResNet architectures for CIFAR10 dataset. We use similar architectures to the ones used in Gulrajani et al. (2017).
354
+
355
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ R32×32×3</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 128</td></tr><tr><td rowspan=1 colspan=1>ResBlock down128</td></tr><tr><td rowspan=1 colspan=1>ResBlock 128</td></tr><tr><td rowspan=1 colspan=1>ResBlock 128</td></tr><tr><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Global sum pooling</td></tr><tr><td rowspan=1 colspan=1>dense →1</td></tr><tr><td rowspan=1 colspan=1>(b)Discriminator</td></tr></table>
356
+
357
+ <table><tr><td rowspan=1 colspan=1>z ∈ R128 ~ N(0,I)</td></tr><tr><td rowspan=1 colspan=1>dense,4 × 4 × 256</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 256</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 256</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 256</td></tr><tr><td rowspan=1 colspan=1>BN,ReLU,3×3 conv,3 Tanh</td></tr></table>
358
+
359
+ (a) Generator
360
+
361
+ Figure 8: ResBlock architecture. For the discriminator we removed BN layers in ResBlock.
362
+
363
+ Table 5: ResNet architectures for STL-10 dataset.
364
+
365
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ R48×48×3</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 64</td></tr><tr><td rowspan=1 colspan=1>ResBlock down128</td></tr><tr><td rowspan=1 colspan=1>ResBlock down1256</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 512</td></tr><tr><td rowspan=1 colspan=1>ResBlock 1024</td></tr><tr><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Global sum pooling</td></tr><tr><td rowspan=1 colspan=1>dense → 1</td></tr><tr><td rowspan=1 colspan=1>(b) Discriminator</td></tr></table>
366
+
367
+ <table><tr><td rowspan=1 colspan=1>z ∈ R128 ~ N(0,I)</td></tr><tr><td rowspan=1 colspan=1>dense,6 ×6 × 512</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 256</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 128</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 64</td></tr><tr><td rowspan=1 colspan=1>BN,ReLU,3×3 conv,3 Tanh</td></tr></table>
368
+
369
+ (a) Generator
370
+
371
+ <table><tr><td rowspan=1 colspan=1>z ∈ R128~ N(0,I)</td></tr><tr><td rowspan=1 colspan=1>dense,4 × 4 × 1024</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 1024</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 512</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 2256</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 128</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 64</td></tr><tr><td rowspan=1 colspan=1>BN, ReLU, 3×3 conv 3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr><tr><td rowspan=1 colspan=1>(a)Generator</td></tr></table>
372
+
373
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ R128×128×3</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 64</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 128</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 256</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 512</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 1024</td></tr><tr><td rowspan=1 colspan=1>ResBlock 1024</td></tr><tr><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Global sum pooling</td></tr><tr><td rowspan=1 colspan=1>dense → 1</td></tr></table>
374
+
375
+ (b) Discriminator for unconditional GANs.
376
+
377
+ Table 6: ResNet architectures for image generation on ImageNet dataset. For the generator of conditional GANs, we replaced the usual batch normalization layer in the ResBlock with the conditional batch normalization layer. As for the model of the projection discriminator, we used the same architecture used in Miyato & Koyama (2018). Please see the paper for the details.
378
+
379
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ R128×128×3</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 64</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 128</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 256</td></tr><tr><td rowspan=1 colspan=1>Concat(Embed(y), h)</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 512</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 1024</td></tr><tr><td rowspan=1 colspan=1>ResBlock 1024</td></tr><tr><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Global sum pooling</td></tr><tr><td rowspan=1 colspan=1>dense →1</td></tr></table>
380
+
381
+ (c) Discriminator for conditional GANs. For computational ease, we embedded the integer label $\begin{array} { c c l } { y } & { \in } & { \{ 0 , \dots , 1 0 0 0 \} } \end{array}$ into 128 dimension before concatenating the vector to the output of the intermediate layer.
382
+
383
+ # C APPENDIX RESULTS
384
+
385
+ # C.1 ACCURACY OF SPECTRAL NORMALIZATION
386
+
387
+ Figure 9 shows the spectral norm of each layer in the discriminator over the course of the training. The setting of the optimizer is C in Table 1 throughout the training. In fact, they do not deviate by more than 0.05 for the most part. As an exception, 6 and 7-th convolutional layers with largest rank deviate by more than 0.1 in the beginning of the training, but the norm of this layer too stabilizes around 1 after some iterations.
388
+
389
+ ![](images/4f34fb99ec89a2583d70dd633a1c123d846febd969abc8ea75a221e2987d8258.jpg)
390
+ Figure 9: Spectral norms of all seven convolutional layers in the standard CNN during course of the training on CIFAR 10.
391
+
392
+ # C.2 TRAINING TIME
393
+
394
+ ![](images/ffed4dd58cad72960ea9574822d13132c01f2defac6fa0718e3d754e192746ef.jpg)
395
+ Figure 10: Computational time for 100 updates. We set $n _ { \mathrm { d i s } } = 5$
396
+
397
+ ![](images/8ef62c13cbd0f20941e9ba74918ad7fce355e703ac43509f156ddec677984038.jpg)
398
+ Figure 11: The effect of $n _ { d i s }$ on spectral normalization and weight normalization. The shaded region represents the variance of the result over different seeds.
399
+
400
+ C.4 GENERATED IMAGES ON CIFAR10 WITH GAN-GP, LAYER NORMALIZATION AND BATCH NORMALIZATION
401
+
402
+ ![](images/a358835224f9b30ec7e9a3eedd494818f7845c1c66a1b8749837887072754057.jpg)
403
+ Figure 12: Generated images with GAN-GP, Layer Norm and Batch Norm on CIFAR-10
404
+
405
+ ![](images/a9e29090d88ba333220387bd4203eaac033ae69f2b1bd2230b882671a0bc1a27.jpg)
406
+ Figure 13: Learning curves in terms of Inception score for SN-GANs and GANs with orthonormal regularization on ImageNet. The figure (a) shows the results for the standard (unconditional) GANs, and the figure (b) shows the results for the conditional GANs trained with projection discriminator (Miyato & Koyama, 2018)
407
+
408
+ # D SPECTRAL NORMALIZATION VS OTHER REGULARIZATION TECHNIQUES
409
+
410
+ This section is dedicated to the comparative study of spectral normalization and other regularization methods for discriminators. In particular, we will show that contemporary regularizations including weight normalization and weight clipping implicitly impose constraints on weight matrices that places unnecessary restriction on the search space of the discriminator. More specifically, we will show that weight normalization and weight clipping unwittingly favor low-rank weight matrices. This can force the trained discriminator to be largely dependent on select few features, rendering the algorithm to be able to match the model distribution with the target distribution only on very low dimensional feature space.
411
+
412
+ # D.1 WEIGHT NORMALIZATION AND FROBENIUS NORMALIZATION
413
+
414
+ The weight normalization introduced by Salimans & Kingma (2016) is a method that normalizes the $\ell _ { 2 }$ norm of each row vector in the weight matrix8:
415
+
416
+ $$
417
+ \bar { W } _ { \mathrm { W N } } : = \left[ \bar { w } _ { 1 } ^ { \mathrm { T } } , \bar { w } _ { 2 } ^ { \mathrm { T } } , . . . , \bar { w } _ { d _ { o } } ^ { \mathrm { T } } \right] ^ { \mathrm { T } } , \mathrm { ~ w h e r e ~ } \bar { w } _ { i } ( w _ { i } ) : = w _ { i } / \| w _ { i } \| _ { 2 } ,
418
+ $$
419
+
420
+ where $\bar { \mathbf { \nabla } } \bar { \mathbf { w } } _ { i }$ and ${ \pmb w } _ { i }$ are the ith row vector of $\bar { W } _ { \mathrm { W N } }$ and $W$ , respectively.
421
+
422
+ Still another technique to regularize the weight matrix is to use the Frobenius norm:
423
+
424
+ $$
425
+ \bar { W } _ { \mathrm { F N } } : = W / \| W \| _ { F } ,
426
+ $$
427
+
428
+ where $\begin{array} { r } { \| W \| _ { F } : = \sqrt { \mathrm { t r } ( W ^ { \mathrm { T } } W ) } = \sqrt { \sum _ { i , j } w _ { i j } ^ { 2 } } . } \end{array}$
429
+
430
+ Originally, these regularization techniques were invented with the goal of improving the generalization performance of supervised training (Salimans & Kingma, 2016; Arpit et al., 2016). However, recent works in the field of GANs (Salimans et al., 2016; Xiang & Li, 2017) found their another raison d’etat as a regularizer of discriminators, and succeeded in improving the performance of the original.
431
+
432
+ These methods in fact can render the trained discriminator $D$ to be $K$ -Lipschitz for a some prescribed $K$ and achieve the desired effect to a certain extent. However, weight normalization (25) imposes the following implicit restriction on the choice of $\bar { W } _ { \mathrm { W N } }$ :
433
+
434
+ $$
435
+ \sigma _ { 1 } ( \bar { W } _ { \mathrm { W N } } ) ^ { 2 } + \sigma _ { 2 } ( \bar { W } _ { \mathrm { W N } } ) ^ { 2 } + \cdot \cdot \cdot + \sigma _ { T } ( \bar { W } _ { \mathrm { W N } } ) ^ { 2 } = d _ { o } , \mathrm { w h e r e } T = \mathrm { m i n } ( d _ { i } , d _ { o } ) ,
436
+ $$
437
+
438
+ where $\sigma _ { t } ( A )$ is a $t$ -th singular value of matrix $A$ . The above equation holds because Pmin(di,do)t=1 σt(W¯ WN)2 = tr(W¯ WNW¯ TWN) = Pdoi=1 wikw k wTikw k . Under this restriction, the norm $\| \bar { W } _ { \mathrm { W N } } h \| _ { 2 }$ for a fixed unit vector $^ { h }$ is maximized at $\| \bar { W } _ { \mathrm { W N } } h \| _ { 2 } = \sqrt { d _ { o } }$ when $\sigma _ { ^ 1 } ( \bar { W } _ { \mathrm { W N } } ) =$ $\sqrt { d _ { o } }$ and $\sigma _ { t } ( \bar { W } _ { \mathrm { W N } } ) = 0$ for $t = 2 , \dots , T$ , which means that $\bar { W } _ { \mathrm { W N } }$ is of rank one. Using such $W$ corresponds to using only one feature to discriminate the model probability distribution from the target. Similarly, Frobenius normalization requires $\sigma _ { 1 } ( \bar { W } _ { \mathrm { F N } } ) ^ { 2 } + \sigma _ { 2 } ( \bar { W } _ { \mathrm { F N } } ) ^ { 2 } + \dot { \bar { \cdots } } \dot { \cdot } + \sigma _ { T } ( \bar { W } _ { \mathrm { F N } } ) ^ { 2 } = 1 .$ , and the same argument as above follows.
439
+
440
+ Here, we see a critical problem in these two regularization methods. In order to retain as much norm of the input as possible and hence to make the discriminator more sensitive, one would hope to make the norm of $\hat { W } _ { \mathrm { W N } } h$ large. For weight normalization, however, this comes at the cost of reducing the rank and hence the number of features to be used for the discriminator. Thus, there is a conflict of interests between weight normalization and our desire to use as many features as possible to distinguish the generator distribution from the target distribution. The former interest often reigns over the other in many cases, inadvertently diminishing the number of features to be used by the discriminators. Consequently, the algorithm would produce a rather arbitrary model distribution that matches the target distribution only at select few features.
441
+
442
+ Our spectral normalization, on the other hand, do not suffer from such a conflict in interest. Note that the Lipschitz constant of a linear operator is determined only by the maximum singular value. In other words, the spectral norm is independent of rank. Thus, unlike the weight normalization, our spectral normalization allows the parameter matrix to use as many features as possible while satisfying local 1-Lipschitz constraint. Our spectral normalization leaves more freedom in choosing the number of singular components (features) to feed to the next layer of the discriminator.
443
+
444
+ To see this more visually, we refer the reader to Figure (14). Note that spectral normalization allows for a wider range of choices than weight normalization.
445
+
446
+ ![](images/ac47faa0c1479a5c920e45ca5c8809435766f2b6e19e29c7da0b704d2e4567ec.jpg)
447
+ Figure 14: Visualization of the difference between spectral normalization (Red) and weight normalization (Blue) on possible sets of singular values. The possible sets of singular values plotted in increasing order for weight normalization (Blue) and for spectral normalization (Red). For the set of singular values permitted under the spectral normalization condition, we scaled √ $\bar { W } _ { \mathrm { W N } }$ by $1 / \sqrt { d _ { o } }$ so that its spectral norm is exactly 1. By the definition of the weight normalization, the area under the blue curves are all bound to be 1. Note that the range of choice for the weight normalization is small.
448
+
449
+ In summary, weight normalization and Frobenius normalization favor skewed distributions of singular values, making the column spaces of the weight matrices lie in (approximately) low dimensional vector spaces. On the other hand, our spectral normalization does not compromise the number of feature dimensions used by the discriminator. In fact, we will experimentally show that GANs trained with our spectral normalization can generate a synthetic dataset with wider variety and higher inception score than the GANs trained with other two regularization methods.
450
+
451
+ # D.2 WEIGHT CLIPPING
452
+
453
+ Still another regularization technique is weight clipping introduced by Arjovsky et al. (2017) in their training of Wasserstein GANs. Weight clipping simply truncates each element of weight matrices so that its absolute value is bounded above by a prescribed constant $c \in \mathbb { R } _ { + }$ . Unfortunately, weight clipping suffers from the same problem as weight normalization and Frobenius normalization. With weight clipping with the truncation value $c$ , the value $\| W x \| _ { 2 }$ for a fixed unit vector $_ { \textbf { \em x } }$ is maximized when the rank of $W$ is again one, and the training will again favor the discriminators that use only select few features. Gulrajani et al. (2017) refers to this problem as capacity underuse problem. They also reported that the training of WGAN with weight clipping is slower than that of the original DCGAN (Radford et al., 2016).
454
+
455
+ # D.3 SINGULAR VALUE CLIPPING AND SINGULAR VALUE CONSTRAINT
456
+
457
+ One direct and straightforward way of controlling the spectral norm is to clip the singular values (Saito et al., 2017), (Jia et al., 2017). This approach, however, is computationally heavy because one needs to implement singular value decomposition in order to compute all the singular values.
458
+
459
+ A similar but less obvious approach is to parametrize $W \in \mathbb { R } ^ { d _ { o } \times d _ { i } }$ as follows from the get-go and train the discriminators with this constrained parametrization:
460
+
461
+ $$
462
+ W : = U S V ^ { \mathrm { T } } , \mathrm { ~ s u b j e c t ~ t o ~ } U ^ { \mathrm { T } } U = I , V ^ { \mathrm { T } } V = I , \operatorname* { m a x } _ { i } S _ { i i } = K ,
463
+ $$
464
+
465
+ where $U \in \mathbb { R } ^ { d _ { o } \times P }$ , $V \in \mathbb { R } ^ { d _ { i } \times P }$ , and $S \in \mathbb { R } ^ { P \times P }$ is a diagonal matrix. However, it is not a simple task to train this model while remaining absolutely faithful to this parametrization constraint. Our spectral normalization, on the other hand, can carry out the updates with relatively low computational cost without compromising the normalization constraint.
466
+
467
+ # D.4 WGAN WITH GRADIENT PENALTY (WGAN-GP)
468
+
469
+ Recently, Gulrajani et al. (2017) introduced a technique to enhance the stability of the training of Wasserstein GANs (Arjovsky et al., 2017). In their work, they endeavored to place $K$ -Lipschitz constraint (5) on the discriminator by augmenting the adversarial loss function with the following regularizer function:
470
+
471
+ $$
472
+ \lambda \operatorname { E } _ { \hat { \pmb { x } } \sim p _ { \hat { \pmb { x } } } } [ ( \| \nabla _ { \hat { \pmb { x } } } D ( \hat { \pmb { x } } ) \| _ { 2 } - 1 ) ^ { 2 } ] ,
473
+ $$
474
+
475
+ where $\lambda > 0$ is a balancing coefficient and $\hat { \pmb x }$ is:
476
+
477
+ $$
478
+ \begin{array} { r l } & { \hat { \pmb x } : = \epsilon { \pmb x } + ( 1 - \epsilon ) \tilde { \pmb x } } \\ & { \quad \mathrm { w h e r e } \ \epsilon \sim U [ 0 , 1 ] , \ { \pmb x } \sim p _ { \mathrm { d a t a } } , \ \tilde { \pmb x } = G ( z ) , \ z \sim p _ { z } . } \end{array}
479
+ $$
480
+
481
+ Using this augmented objective function, Gulrajani et al. (2017) succeeded in training a GAN based on ResNet (He et al., 2016) with an impressive performance. The advantage of their method in comparison to spectral normalization is that they can impose local 1-Lipschitz constraint directly on the discriminator function without a rather round-about layer-wise normalization. This suggest that their method is less likely to underuse the capacity of the network structure.
482
+
483
+ At the same time, this type of method that penalizes the gradients at sample points $\hat { \textbf { \textit { x } } }$ suffers from the obvious problem of not being able to regularize the function at the points outside of the support of the current generative distribution. In fact, the generative distribution and its support gradually changes in the course of the training, and this can destabilize the effect of the regularization itself.
484
+
485
+ On the contrary, our spectral normalization regularizes the function itself, and the effect of the regularization is more stable with respect to the choice of the batch. In fact, we observed in the experiment that a high learning rate can destabilize the performance of WGAN-GP. Training with our spectral normalization does not falter with aggressive learning rate.
486
+
487
+ Moreover, WGAN-GP requires more computational cost than our spectral normalization with single-step power iteration, because the computation of $\| \nabla _ { \pmb { x } } D \| _ { 2 }$ requires one whole round of forward and backward propagation. In Figure 10, we compare the computational cost of the two methods for the same number of updates.
488
+
489
+ Having said that, one shall not rule out the possibility that the gradient penalty can compliment spectral normalization and vice versa. Because these two methods regularizes discriminators by completely different means, and in the experiment section, we actually confirmed that combination of WGAN-GP and reparametrization with spectral normalization improves the quality of the generated examples over the baseline (WGAN-GP only).
490
+
491
+ # E REPARAMETRIZATION MOTIVATED BY THE SPECTRAL NORMALIZATION
492
+
493
+ We can take advantage of the regularization effect of the spectral normalization we saw above to develop another algorithm. Let us consider another parametrization of the weight matrix of the discriminator given by:
494
+
495
+ $$
496
+ \tilde { W } : = \gamma \bar { W } _ { \mathrm { S N } }
497
+ $$
498
+
499
+ where $\gamma$ is a scalar variable to be learned. This parametrization compromises the 1-Lipschitz constraint at the layer of interest, but gives more freedom to the model while keeping the model from becoming degenerate. For this reparametrization, we need to control the Lipschitz condition by other means, such as the gradient penalty (Gulrajani et al., 2017). Indeed, we can think of analogous versions of reparametrization by replacing $\bar { W } _ { \mathrm { S N } } ^ { \ }$ in (32) with $W$ normalized by other criterions. The extension of this form is not new. In Salimans & Kingma (2016), they originally introduced weight normalization in order to derive the reparametrization of the form (32) with $\bar { W } _ { \mathrm { S N } }$ replaced (32) by $W _ { \mathrm { W N } }$ and vectorized $\gamma$ .
500
+
501
+ # E.1 EXPERIMENTS: COMPARISON OF REPARAMETRIZATION WITH DIFFERENTNORMALIZATION METHODS
502
+
503
+ In this part of the addendum, we experimentally compare the reparametrizations derived from two different normalization methods (weight normalization and spectral normalization). We tested the reprametrization methods for the training of the discriminator of WGAN-GP. For the architecture of the network in WGAN-GP, we used the same CNN we used in the previous section. For the ResNet-based CNN, we used the same architecture provided by (Gulrajani et al., 2017) 9.
504
+
505
+ Tables 7, 8 summarize the result. We see that our method significantly improves the inception score from the baseline on the regular CNN, and slightly improves the score on the ResNet based CNN.
506
+
507
+ Figure 15 shows the learning curves of (a) critic losses, on train and validation sets and (b) the inception scores with different reparametrization methods. We can see the beneficial effect of spectral normalization in the learning curve of the discriminator as well. We can verify in the figure 15a that the discriminator with spectral normalization overfits less to the training dataset than the discriminator without reparametrization and with weight normalization, The effect of overfitting can be observed on inception score as well, and the final score with spectral normalization is better than the others. As for the best inception score achieved in the course of the training, spectral normalization achieved 7.28, whereas the spectral normalization and vanilla normalization achieved 7.04 and 6.69, respectively.
508
+
509
+ # F THE GRADIENT OF GENERAL NORMALIZATION METHOD
510
+
511
+ Let us denote ${ \bar { W } } : = W / N ( W )$ to be the normalized weight where $N ( W )$ to be a scalar normalized coefficient (e.g. Spectral norm or Frobenius norm). In general, we can write the derivative of loss
512
+
513
+ Table 7: Inception scores with different reparametrization mehtods on CIFAR10 without label supervisions. $( { } ^ { * } ) \mathrm { W e }$ reported N/A for the inception score and FID of Frobenius normalization because the training collapsed at the early stage.
514
+
515
+ <table><tr><td>Method</td><td>Inception score</td><td>FID</td></tr><tr><td>WGAN-GP (Standard CNN, Baseline)</td><td>6.68±.06</td><td>40.1</td></tr><tr><td>w/Frobenius Norm.</td><td>N/A*</td><td>N/A*</td></tr><tr><td>w/ Weight Norm.</td><td>6.36±.04</td><td>42.4</td></tr><tr><td>w/ Spectral Norm.</td><td>7.20±.08</td><td>32.0</td></tr><tr><td>(WGAN-GP, ResNet, Gulrajani et al. (2017))</td><td>7.86±.08</td><td></td></tr><tr><td>WGAN-GP (ResNet, Baseline)</td><td>7.80±.11</td><td>24.5</td></tr><tr><td>w/ Spectral norm.</td><td>7.85±.06</td><td>23.6</td></tr><tr><td>w/ Spectral norm. (1.5x feature maps in D)</td><td>7.96±.06</td><td>22.5</td></tr></table>
516
+
517
+ <table><tr><td>Method (ResNet)</td><td>Inception score</td><td>FID</td></tr><tr><td>(AC-WGAN-GP, Gulrajani et al. (2017))</td><td>8.42±.10</td><td></td></tr><tr><td>AC-WGAN-GP (Baseline)</td><td>8.29±.12</td><td>19.5</td></tr><tr><td>w/ Spectral norm.</td><td>8.59±.12</td><td>18.6</td></tr><tr><td>w/ Spectral norm. (1.5x feature maps in D)</td><td>8.60±.08</td><td>17.5</td></tr></table>
518
+
519
+ Table 8: Inception scores and FIDs with different reparametrization methods on CIFAR10 with the label supervision, by auxiliary classifier (Odena et al., 2017).
520
+
521
+ with respect to unnormalized weight $W$ as follows:
522
+
523
+ $$
524
+ \begin{array} { l } { \displaystyle \frac { \partial V ( G , D ( W ) ) } { \partial W } = \frac { 1 } { N ( W ) } \left( \frac { \partial V } { \partial \bar { W } } - \mathrm { t r a c e } \left( \left( \frac { \partial V } { \partial \bar { W } } \right) ^ { \mathrm { T } } \bar { W } \right) \frac { \partial ( N ( W ) ) } { \partial W } \right) } \\ { \displaystyle ~ = \frac { 1 } { N ( W ) } \left( \nabla _ { \bar { W } } V - \mathrm { t r a c e } \left( ( \nabla _ { \bar { W } } V ) ^ { \mathrm { T } } \bar { W } \right) \nabla _ { W } N \right) } \\ { \displaystyle ~ = \alpha \left( \nabla _ { \bar { W } } V - \lambda \nabla _ { W } N \right) , } \end{array}
525
+ $$
526
+
527
+ where $\alpha : = 1 / N ( W )$ and $\lambda : = \operatorname { t r a c e } \left( ( \nabla _ { \bar { W } } V ) ^ { \mathrm { T } } \bar { W } \right)$ . The gradient $\nabla _ { \boldsymbol { \bar { W } } } V$ is calculated by $\hat { \mathrm { ~ E ~ } } ^ { \left[ \delta h ^ { \mathrm { T } } \right] }$ where $\pmb { \delta } : = \left( \partial V ( G , D ) / \partial \left( \bar { W } \pmb { h } \right) \right) ^ { \mathrm { T } }$ , $^ { h }$ is the hidden node in the network to be transformed by $\bar { W }$ and $\hat { \mathrm { E } }$ represents empirical expectation over the mini-batch. When $N ( W ) : = \| W \| _ { F }$ , the derivative is:
528
+
529
+ $$
530
+ \frac { \partial V ( G , D ( W ) ) } { \partial W } = \frac { 1 } { \| W \| _ { F } } \left( \hat { \mathrm { E } } \left[ \delta h ^ { \mathrm { T } } \right] - \mathrm { t r a c e } \left( \hat { \mathrm { E } } \left[ \delta h ^ { \mathrm { T } } \right] ^ { \mathrm { T } } \bar { W } \right) \bar { W } \right) ,
531
+ $$
532
+
533
+ and when $N ( W ) : = \| W \| _ { 2 } = \sigma ( W )$ ,
534
+
535
+ $$
536
+ \frac { \partial V ( G , D ( W ) ) } { \partial W } = \frac { 1 } { \sigma ( W ) } \left( \hat { \mathrm { E } } \left[ \delta h ^ { \mathrm { T } } \right] - \mathrm { t r a c e } \left( \hat { \mathrm { E } } \left[ \delta h ^ { \mathrm { T } } \right] ^ { \mathrm { T } } \bar { W } \right) \boldsymbol { u } _ { 1 } \boldsymbol { v } _ { 1 } ^ { \mathrm { T } } \right) .
537
+ $$
538
+
539
+ Notice that, at least for the case $N ( W ) : = \| W \| _ { F }$ or $N ( W ) : = \| W \| _ { 2 }$ , the point of this gradient is given by :
540
+
541
+ $$
542
+ \nabla _ { \bar { W } } V = k \nabla _ { W } N .
543
+ $$
544
+
545
+ where $\exists k \in \mathbb { R }$
546
+
547
+ ![](images/90c73f0772cf8eedaa5318b515941da59ac9ace65c8e6f2b4e93f2d6a3b23aa3.jpg)
548
+ Figure 15: Learning curves of (a) critic loss and (b) inception score on different reparametrization method on CIFAR-10 ; weight normalization (WGAN-GP w/ WN), spectral normalization (WGANGP w/ SN), and parametrization free (WGAN-GP).
md/train/B1TTpYKgx/B1TTpYKgx.md ADDED
@@ -0,0 +1,670 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON THE EXPRESSIVE POWER OF DEEP NEURAL NETWORKS
2
+
3
+ Maithra Raghu Google Brain and Cornell University
4
+
5
+ Ben Poole Stanford University and Google Brain
6
+
7
+ Jon Kleinberg Cornell University
8
+
9
+ Surya Ganguli Stanford University
10
+
11
+ Jascha Sohl-Dickstein Google Brain
12
+
13
+ # ABSTRACT
14
+
15
+ We study the expressive power of deep neural networks before and after training. Considering neural nets after random initialization, we show that three natural measures of expressivity all display an exponential dependence on the depth of the network. We prove, theoretically and experimentally, that all of these measures are in fact related to a fourth quantity, trajectory length. This quantity grows exponentially in the depth of the network, and is responsible for the depth sensitivity observed. These results translate to consequences for networks during and after training. They suggest that parameters earlier in a network have greater influence on its expressive power – in particular, given a layer, its influence on expressivity is determined by the remaining depth of the network after that layer. This is verified with experiments on MNIST and CIFAR-10. We also explore the effect of training on the input-output map, and find that it trades off between the stability and expressivity of the input-output map.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Neural network architectures have proven “unreasonably effective” (LeCun, 2014; Karpathy, 2015) on many tasks, including image classification (Krizhevsky et al., 2012), identifying particles in high energy physics (Baldi et al., 2014), playing Go (Silver et al., 2016), and modeling human student learning (Piech et al., 2015). Despite their power, we have limited knowledge of how and why neural networks work, and much of this understanding is qualitative and heuristic.
20
+
21
+ To aim for a more precise understanding, we must disentangle factors influencing their effectiveness, trainability, or how well they can be fit to data; generalizability, or how well they perform on novel examples; and expressivity, or the set of functions they can compute.
22
+
23
+ All three of these properties are crucial for understanding the performance of neural networks. Indeed, for success at a particular task, neural nets must first be effectively trained on a dataset, which has prompted investigation into properties of objective function landscapes (Dauphin et al., 2014; Goodfellow et al., 2014; Choromanska et al., 2014), and the design of optimization procedures specifically suited to neural networks (Martens and Grosse, 2015). Trained networks must also be capable of generalizing to unseen data, and understanding generalization in neural networks is also an active line of research: (Hardt et al., 2015) bounds generalization error in terms of stochastic gradient descent steps, (Sontag, 1998; Bartlett and Maass, 2003; Bartlett et al., 1998) study generalization error through VC dimension, and (Hinton et al., 2015) looks at developing smaller models with better generalization.
24
+
25
+ In this paper, we focus on the third of these properties, expressivity — the capability of neural networks to accurately represent different kinds of functions. As the class of functions achievable by a neural network is dependent on properties of its architecture, e.g. depth, width, fully connected, convolutional, etc; a better understanding of expressivity may greatly inform architectural choice and inspire more tailored training methods.
26
+
27
+ Prior work on expressivity has yielded many fascinating results by directly examining the achievable functions of a particular architecture. Through this, neural networks have been shown to be universal approximators (Hornik et al., 1989; Cybenko, 1989), and connections between boolean and threshold networks and ReLU networks developed in (Maass et al., 1994; Pan and Srikumar, 2015). The inherent expressivity due to increased depth has also been studied in (Eldan and Shamir, 2015; Telgarsky, 2015; Martens et al., 2013; Bianchini and Scarselli, 2014), and (Pascanu et al., 2013; Montufar et al., 2014), with the latter introducing the number of linear regions as a measure of expressivity.
28
+
29
+ These results, while compelling, also highlight limitations of much of the existing work on expressivity. Much of the work examining achievable functions relies on unrealistic architectural assumptions, such as layers being exponentially wide (in the universal approximation theorem). Furthermore, architectures are often compared via ‘hardcoded’ weight values – a specific function that can be represented efficiently by one architecture is shown to only be inefficiently approximated by another.
30
+
31
+ Comparing architectures in such a fashion limits the generality of the conclusions, and does not entirely address the goal of understanding expressivity — to provide characteristic properties of a typical set of networks arising from a particular architecture, and extrapolate to practical consequences.
32
+
33
+ Random networks To address this, we begin our analysis of network expressivity on a family of networks arising in practice �� the behaviour of networks after random initialization. As random initialization is the starting point to most training methods, results on random networks provide natural baselines to compare trained networks with, and are also useful in highlighting properties of trained networks (see Section 3). The expressivity of these random networks is largely unexplored. In previous work (Poole et al., 2016) we studied the propagation of Riemannian curvature through random networks by developing a mean field theory approach, which quantitatively supports the conjecture that deep networks can disentangle curved manifolds in input space. Here, we take a more direct approach, exactly relating the architectural properties of the network to measures of expressivity and exploring the consequences for trained networks.
34
+
35
+ Measures of Expressivity In particular, we examine the effect of the depth and width of a network architecture on three different natural measures of functional richness: number of transitions, activation patterns, and number of dichotomies.
36
+
37
+ Transitions: Counting neuron transitions is introduced indirectly via linear regions in (Pascanu et al., 2013), and provides a tractable method to estimate the degree of non-linearity of the computed function.
38
+
39
+ Activation Patterns: Transitions of a single neuron can be extended to the outputs of all neurons in all layers, leading to the (global) definition of a network activation pattern, also a measure of nonlinearity. Network activation patterns directly show how the network partitions input space (into convex polytopes), through connections to the theory of hyperplane arrangements.
40
+
41
+ Dichotomies: We also measure the heterogeneity of a generic class of functions from a particular architecture by counting dichotomies, ‘statistically dual’ to sweeping input in some cases. This measure reveals the importance of remaining depth in expressivity, in both simulation and practice.
42
+
43
+ Connection to Trajectory Length All three measures display an exponential increase with depth, but not width (most strikingly in Figure 4). We discover and prove the underlying reason for this – all three measures are directly proportional to a fourth quantity, trajectory length. In Theorem 1) we show that trajectory length grows exponentially with depth (also supported by experiments, Figure 1) which explains the depth sensitivity of the other three measures.
44
+
45
+ Consequences for Trained Networks Our empirical and theoretical results connecting transitions and dichotomies to trajectory length also suggest that parameters earlier in the network should have exponentially greater influence on parameters later in the network. In other words, the influence on expressivity of parameters, and thus layers, is directly related to the remaining depth of the network after that layer. Experiments on MNIST and CIFAR-10 support this hypothesis — training only earlier layers leads to higher accuracy than training only later layers. We also find, with experiments on MNIST, that the training process trades off between the stability of the input-output map and its expressivity.
46
+
47
+ ![](images/9540c49cfa28a4a0970f68b2cc7aae5d214be508abe3d34f33db8a0812115d6c.jpg)
48
+ Figure 1: The exponential growth of trajectory length with depth, in a random deep network with hard-tanh nonlinearities. A circular trajectory is chosen between two random vectors. The image of that trajectory is taken at each layer of the network, and its length measured. $( a , b )$ The trajectory length vs. layer, in terms of the network width $k$ and weight variance $\sigma _ { w } ^ { 2 }$ , both of which determine its growth rate. $( c , d )$ The average ratio of a trajectory’s length in layer $d + 1$ relative to its length in layer (The $d$ . The solid line shows simulated data, while them 1). Growth rate is a function of layer width dashed lines show up, and weight variance and lower bounds. $k$ $\hat { \sigma } _ { w } ^ { 2 }$
49
+
50
+ # 2 GROWTH OF TRAJECTORY LENGTH AND MEASURES OF EXPRESSIVITY
51
+
52
+ In this section we examine random networks, proving and empirically verifing the exponential growth of trajectory length with depth. We then relate trajectory length to transitions, activation patterns and dichotomies, and show their exponential increase with depth.
53
+
54
+ # 2.1 NOTATION AND DEFINITIONS
55
+
56
+ Let $F _ { W }$ denote a neural network. In this section, we consider architectures with input dimension $m$ , $n$ hidden layers all of width $k$ , and (for convenience) a scalar readout layer. (So, $F _ { W } : \mathbb { R } ^ { m } \mathbb { R } .$ ) Our results mostly examine the cases where $\phi$ is a hard-tanh (Collobert and Bengio, 2004) or ReLU nonlinearity. All hard-tanh results carry over to tanh with additional technical steps.
57
+
58
+ We use v( $v _ { i } ^ { ( d ) }$ to denote the $i ^ { t h }$ neuron in hidden layer $d$ . We also let $x = z ^ { ( 0 ) }$ be an input, $h ^ { ( d ) }$ be the hidden representation at layer $d$ , and $\phi$ the non-linearity. The weights and bias are called $W ^ { ( d ) }$ and $b ^ { ( d ) }$ respectively. So we have the relations
59
+
60
+ $$
61
+ \begin{array} { r } { \boldsymbol { h } ^ { ( d ) } = \boldsymbol { W } ^ { ( d ) } \boldsymbol { z } ^ { ( d ) } + \boldsymbol { b } ^ { ( d ) } , \qquad \boldsymbol { z } ^ { ( d + 1 ) } = \phi ( \boldsymbol { h } ^ { ( d ) } ) . } \end{array}
62
+ $$
63
+
64
+ Definitions Say a neuron transitions when it switches linear region in its activation function (i.e. for ReLU, switching between zero and linear regimes, for hard-tanh, switching between negative saturation, unsaturated and positive saturation). For hard-tanh, we refer to a sign transition as the neuron switching sign, and a saturation transition as switching from being saturated between $\pm 1$ . The Activation Pattern of the entire network is defined by the output regions of every neuron. More precisely, given an input $x$ , we let ${ \mathcal { A } } ( F _ { W } , x )$ be a vector representing the activation region of every hidden neuron in the network. So for a ReLU network $F _ { W }$ , we can take $\mathcal { A } ( F _ { W } , x ) \ \in \{ - 1 , 1 \} ^ { n \bar { k } }$ with $- 1$ meaning the neuron is in the zero regime, and 1 meaning it is in the linear regime. For hard-tanh network $F _ { W }$ , we can (overloading notation slightly) take $\mathcal { A } ( F _ { W } , x ) \in \{ - 1 , 0 , 1 \} ^ { n k }$ . The use of this notation will be clear by context. Given a set of inputs $S$ , we say a dichotomy over $S$ is a labeling of each point in $S$ as $\pm 1$ .
65
+
66
+ We assume the weights of our neural networks are initialized as random Gaussians, with appropriate variance scaling to account for width, i.e. $W _ { i j } ^ { ( d ) } \sim \mathcal { N } ( 0 , \sigma _ { w } ^ { 2 } / k )$ , and biases $b _ { i } ^ { ( d ) } \sim \mathcal { N } ( 0 , \sigma _ { b } ^ { 2 } )$ . In the analysis below, we sweep through a one dimensional input trajectory $x ( t )$ . The results hold for almost any such smooth $x ( t )$ , provided that at any point $x ( t )$ , the trajectory direction has some non-zero magnitude perpendicular to $x ( t )$ .
67
+
68
+ # 2.2 TRAJECTORY LENGTH AND NEURON TRANSITIONS
69
+
70
+ We first prove how the trajectory length grows, and relate it to neuron transitions.
71
+
72
+ # 2.2.1 BOUND ON TRAJECTORY LENGTH GROWTH
73
+
74
+ We prove (with a more exact lower bound in the Appendix):
75
+
76
+ Theorem 1. Bound on Growth of Trajectory Length Let $F _ { W }$ be a hard tanh random neural network and $x ( t )$ a one dimensional trajectory in input space. Define $z ^ { ( d ) } ( x ( t ) ) = z ^ { ( d ) } ( t )$ to be the image of the trajectory in layer $d$ of $F _ { W }$ , and let $\begin{array} { r } { l ( z ^ { ( d ) } ( t ) ) = \int _ { t } \bigg | \bigg | \frac { d z ^ { ( d ) } ( t ) } { d t } \bigg | \bigg | \ a } \end{array}$ t be the arc length of $z ^ { ( d ) } ( t )$ . Then
77
+
78
+ $$
79
+ \mathbb { E } \left[ l ( z ^ { ( d ) } ( t ) ) \right] \geq O \left( \left( \frac { \sigma _ { w } } { ( \sigma _ { w } ^ { 2 } + \sigma _ { b } ^ { 2 } ) ^ { 1 / 4 } } \cdot \frac { \sqrt { k } } { \sqrt { \sqrt { \sigma _ { w } ^ { 2 } + \sigma _ { b } ^ { 2 } } + k } } \right) ^ { d } \right) l ( x ( t ) )
80
+ $$
81
+
82
+ This bound is tight in the limits of large $\sigma _ { w }$ and $k$ . An immediate Corollary for $\sigma _ { b } = 0$ , i.e. no bias, is
83
+
84
+ Corollary 1. Bound on Growth of Trajectory Length Without Bias For $F _ { W }$ with zero bias, we have
85
+
86
+ $$
87
+ \mathbb { E } \left[ l ( z ^ { ( d ) } ( t ) ) \right] \ge O \left( \left( \frac { \sqrt { \sigma _ { w } k } } { \sqrt { \sigma _ { w } + k } } \right) ^ { d } \right) l ( x ( t ) )
88
+ $$
89
+
90
+ The theorem shows that the image of a trajectory in layer $d$ has grown exponentially in $d$ , with the scaling $\sigma _ { w }$ and width of the network $k$ determining the base. We additionally state and prove a simple $O ( \sigma _ { w } ^ { d } )$ growth upper bound in the Appendix. Figure 1 demonstrates this behavior in simulation, and compares against the bounds. Note also that if the variance of the bias is comparatively too large i.e. $\sigma _ { b } > > \sigma _ { w }$ , then we no longer see exponential growth. This corresponds to the phase transition described in (Poole et al., 2016).
91
+
92
+ The proof can be found in the Appendix. A rough outline is as follows: we look at the expected growth of the difference between a point $z ^ { ( d ) } ( t )$ on the curve and a small perturbation ${ z } ^ { ( d ) } ( t + d t )$ , from layer $d$ to layer $d + 1$ . Denoting this quantity $\left| \left| \delta z ^ { ( d ) } ( t ) \right| \right|$ , we derive a recurrence relating $\left| \left| \delta z ^ { ( d + 1 ) } ( t ) \right| \right|$ and $\left| \left| \delta z ^ { ( d ) } ( t ) \right| \right|$ which can be composed to give the desired growth rate.
93
+
94
+ The analysis is complicated by the statistical dependence on the image of the input $z ^ { ( d + 1 ) } ( t )$ . So we instead form a recursion by looking at the component of the difference perpendicular to the image of the input in that layer, i.e. $\left| \left| \delta z _ { \perp } ^ { ( \bar { d } + 1 ) } ( t ) \right| \right|$ . For a typical trajectory, the perpendicular component preserves a fraction $\sqrt { \frac { k - 1 } { k } }$ of the total trajectory length, and our derived growth rate thus provides a close lower bound, as demonstrated in Figure 1(c,d).
95
+
96
+ # 2.2.2 RELATION TO NUMBER OF TRANSITIONS
97
+
98
+ Further experiments (Figure 2) show:
99
+
100
+ Observation 1. The number of sign transitions in a network $F _ { W }$ is directly proportional to the length of the latent image of the curve, $z ^ { ( n ) } ( t )$ .
101
+
102
+ ![](images/9cd2e88a477e6867512977c9f2ef2f08a422125962d1154b571d969f7c5b11c3.jpg)
103
+ Figure 2: The number of transitions is linear in trajectory length. Here we compare the empirical number of sign changes to the length of the trajectory, for images of the same trajectory at different layers of a hard-tanh network. We repeat this comparison for a variety of network architectures, with different network width k and weight variance σ2w.
104
+
105
+ We intuit a reason for this observation as follows: note that for a network $F _ { W }$ with $n$ hidden layers, the linear, one dimensional, readout layer outputs a value by computing the inner product $W ^ { ( n ) } z ^ { ( n ) }$ . The sign of the output is then determined by whether this quantity is $\geq 0$ or not. In particular, the decision boundary is a hyperplane, with equation $W ^ { ( n ) } z ^ { ( n ) } = 0$ . So, the number of transitions the output neuron makes as $x ( t )$ is traced is exactly the number of times $z ^ { ( n ) } ( t )$ crosses the decision boundary. As $F _ { W }$ is a random neural network, with signs of weight entries split purely randomly between $\pm 1$ , it would suggest that points far enough away from each other would have independent signs, i.e. a direct proportionality between the length of $z ^ { ( n ) } ( t )$ and the number of times it crosses the decision boundary.
106
+
107
+ We can also prove this in the special case when $\sigma _ { w }$ is very large. Note that by Theorem 1, very large $\sigma _ { w }$ results in a trajectory growth rate of
108
+
109
+ $$
110
+ g ( k , \sigma _ { w } , \sigma _ { b } , n ) = O \left( \left( \frac { \sqrt { k } } { \sqrt { 1 + \frac { \sigma _ { b } ^ { 2 } } { \sigma _ { w } ^ { 2 } } } } \right) ^ { n } \right)
111
+ $$
112
+
113
+ Large $\sigma _ { w }$ also means that for any input (bounded away from zero), almost all neurons are saturated. Furthermore, any neuron transitioning from 1 to $- 1$ (or vice versa) does so almost instantaneously. In particular, at most one neuron within a layer is transitioning for any input. We can then show that in the large $\sigma _ { w }$ limit the number of transitions matches the trajectory length (proof in the Appendix, via a reduction to magnitudes of independent Gaussians):
114
+
115
+ Theorem 2. Number of transitions in large weight limit Given $F _ { W }$ , in the very large $\sigma _ { w }$ regime, the number of sign transitions of the network as an input $x ( t )$ is swept is of the order of $g ( k , \sigma _ { w } , \sigma _ { b } , n )$ .
116
+
117
+ # 2.3 TRANSITIONS AND ACTIVATION PATTERNS
118
+
119
+ We can generalize the ’local’ notion of expressivity of a neuron‘s sign transitions to a ’global’ measure of activation patterns over the entire network. We can formally relate network activation patterns to specific hyperplane arrangements, which allows proof of three exciting results.
120
+
121
+ First, we can precisely state the effect of a neural network on input space, also visualized in Figure 3
122
+
123
+ Theorem 3. Regions in Input Space Given a network $F _ { W }$ with with ReLU or hard-tanh activations, input space is partitioned into convex regions (polytopes), with $F _ { W }$ corresponding to a different linear function on each region.
124
+
125
+ This results in a bijection between transitions and activation patterns for ‘well-behaved’ trajectories, see the proof of Theorem 3 and Corollary 2 in Appendix.
126
+
127
+ Finally, returning to the goal of understanding expressivity, we can upper bound the expressive power of a particular architecture according to the activation patterns measure:
128
+
129
+ ![](images/cc1ccb96b5adb9526cfa340865b7243e35efeb151e4f6828a97b8025882ee210.jpg)
130
+ Figure 3: Deep networks with piecewise linear activations subdivide input space into convex polytopes. Here we plot the boundaries in input space separating unit activation and inactivation for all units in a three layer ReLU network, with four units in each layer. The left pane shows activation boundaries (corresponding to a hyperplane arrangement) in gray for the first layer only, partitioning the plane into regions. The center pane shows activation boundaries for the first two layers. Inside every first layer region, the second layer activation boundaries form a different hyperplane arrangement. The right pane shows activation boundaries for the first three layers, with different hyperplane arrangements inside all first and second layer regions. This final set of convex regions correspond to different activation patterns of the network – i.e. different linear functions.
131
+
132
+ ![](images/29fc7bd83b5430c43b86733b033cebda70e32de272a32fd6a8ea5b55132a59e4.jpg)
133
+ Figure 4: The number of functions achievable in a deep hard-tanh network by sweeping a single layer’s weights along a one dimensional trajectory is exponential in the remaining depth, but increases only slowly with network width. Here we plot the number of classification dichotomies over $s = 1 5$ input vectors achieved by sweeping the first layer weights in a hard-tanh network along a one-dimensional great circle trajectory. We show this $( a )$ as a function of remaining depth for several widths, and $( b )$ as a function of width for several remaining depths. All networks were generated with weight variance $\sigma _ { w } ^ { 2 } = 8$ , and bias variance $\sigma _ { b } ^ { 2 } = 0$ .
134
+
135
+ Theorem 4. (Tight) Upper bound for Number of Activation Patterns Given a neural network $F _ { W }$ , inputs in $\mathbb { R } ^ { m }$ , with ReLU or hard-tanh activations, and with $n$ hidden layers of width $k$ , the number of activation patterns grows at most like $O ( k ^ { m n } )$ for ReLU, or $O ( ( 2 k ) ^ { \dot { m } n } )$ for hard-tanh.
136
+
137
+ # 2.4 DICHOTOMIES: A NATURAL DUAL
138
+
139
+ So far, we have looked at the effects of depth and width on the expressiveness (measured through transitions and activations) of a generic function computed by that network architecture. These measures are directly related to trajectory length, which is the underlying reason for exponential depth dependence.
140
+
141
+ A natural extension is to study a class of functions that might arise from a particular architecture. One such class of functions is formed by sweeping the weights of a network instead of the input. More formally, we pick random matrices, $W , W ^ { \prime }$ , and consider the weight interpolation $W \cos ( t ) +$ $W ^ { \prime } \sin ( t )$ , each choice of weights giving a different function. When this process is applied to just the first layer, we have a statistical duality with sweeping a circular input.
142
+
143
+ ![](images/a519d502464bf5ef469d00b624caf69f3040537762773ea4e586a81abc286e54.jpg)
144
+ Figure 5: Expressive power depends only on remaining network depth. Here we plot the number of dichotomies achieved by sweeping the weights in different network layers through a 1-dimensional great circle trajectory, as a function of the remaining network depth. The number of achievable dichotomies does not depend on the total network depth, only on the number of layers above the layer swept. All networks had width $k = 1 2 8$ , weight variance $\sigma _ { w } ^ { 2 } \ = \ 8$ , number of datapoints $s = 1 5$ , and hard-tanh nonlinearities. The blue dashed line indicates all $2 ^ { s }$ possible dichotomies for this random dataset.
145
+
146
+ ![](images/bea8634915238321c7c559cd938ddfb02ce5f355809275f5d8eb55e44d1a9a4c.jpg)
147
+ Figure 6: Demonstration of expressive power of remaining depth on MNIST. Here we plot train and test accuracy achieved by training exactly one layer of a fully connected neural net on MNIST. The different lines are generated by varying the hidden layer chosen to train. All other layers are kept frozen after random initialization. We see that training lower hidden layers leads to better performance. The networks had width $k = 1 0 0$ , weight variance $\sigma _ { w } ^ { 2 } = 2$ , and hard-tanh nonlinearities. Note that we only train from the second hidden layer (weights $W ^ { ( 1 ) }$ ) onwards, so that the number of parameters trained remains fixed. While the theory addresses training accuracy and not generalization accuracy, the same monotonic pattern is seen for both.
148
+
149
+ Given this class of functions, one useful measure of expressivity is determining how heterogeneous this class is. Inspired by classification tasks we formalize it as: given a set of inputs, $S = \{ x _ { 1 } , . . , x _ { s } \} \subset \mathbb { R } ^ { m }$ , how many of the $2 ^ { s }$ possible dichotomies does this function class produce on $S 2$
150
+
151
+ For non-random inputs and non-random functions, this is a well known question upper bounded by the Sauer-Shelah lemma (Sauer, 1972). We discuss this further in Appendix D.1. In the random setting, the statistical duality of weight sweeping and input sweeping suggests a direct proportion to transitions and trajectory length for a fixed input. Furthermore, if the $x _ { i } \in S$ are sufficiently uncorrelated (e.g. random) class label transitions should occur independently for each $x _ { i }$ Indeed, we show this in Figure 4 (more figures, e.g. dichotomies vs transitions and observations, are included in the Appendix).
152
+
153
+ Observation 2. Depth and Expressivity in a Function Class. Given the function class $\mathcal { F }$ as above, the number of dichotomies expressible by $\mathcal { F }$ over a set of random inputs $S$ by sweeping the first layer weights along a one dimensional trajectory $W ^ { ( 0 ) } ( t )$ is exponential in the network depth $n$ .
154
+
155
+ ![](images/2313ca1793045a2989e309b8086f17d5a552aae81eb646af9d6eea89db6de449.jpg)
156
+ Figure 7: We repeat a similar experiment in Figure 6 with a fully connected network on CIFAR-10, and mostly observe that training lower layers again leads to better performance. The networks had width $k = 2 0 0$ , weight variance $\sigma _ { w } ^ { 2 } = 1$ , and hard-tanh nonlinearities. We again only train from the second hidden layer on so that the number of parameters remains fixed.
157
+
158
+ Table 1: List and location of key theoretical and experimental results.
159
+
160
+ <table><tr><td rowspan=1 colspan=1>Property</td><td rowspan=1 colspan=1>Architecture</td><td rowspan=1 colspan=1>Results</td></tr><tr><td rowspan=1 colspan=1>Trajectory length</td><td rowspan=1 colspan=1>hard-tanh</td><td rowspan=1 colspan=1>Asymptotically tight lower bound (Thm 1)Upper bound (Appendix Section A)Simulation (Fig 1)</td></tr><tr><td rowspan=1 colspan=1>Neuron transitions</td><td rowspan=1 colspan=1>hard-tanh</td><td rowspan=1 colspan=1>Expectation in large weight limit (Thm 2)Simulation (Fig 2)</td></tr><tr><td rowspan=1 colspan=1>Dichotomies</td><td rowspan=1 colspan=1>hard-tanh</td><td rowspan=1 colspan=1>Simulation (Figs 4 and 10)</td></tr><tr><td rowspan=1 colspan=1>Regions in input space</td><td rowspan=1 colspan=1>hard-tanh andReLU</td><td rowspan=1 colspan=1>Consist of convex polytopes (Thm 3)</td></tr><tr><td rowspan=1 colspan=1>Network activation patterns</td><td rowspan=1 colspan=1>hard-tanh andReLU</td><td rowspan=1 colspan=1>Tight upper bound (Thm 6)</td></tr><tr><td rowspan=1 colspan=1>Effect of remaining depth</td><td rowspan=1 colspan=1>hard-tanh</td><td rowspan=1 colspan=1>Simulation (Fig 5)Experiment on MNIST (Fig 6)Experiments on CIFAR-10 (Fig 7)</td></tr><tr><td rowspan=1 colspan=1>Effect of training on trajec-tory length</td><td rowspan=1 colspan=1>hard-tanh</td><td rowspan=1 colspan=1>Experiment on MNIST (Fig 8, 9)</td></tr></table>
161
+
162
+ # 3 TRAINED NETWORKS
163
+
164
+ Remaining Depth The results from Section 2, particularly those linking dichotomies to trajectory length, suggest that earlier layers in the network might have more expressive power. In particular, the remaining depth of the network beyond the layer might directly influence its expressive power. We see that this holds in the random network case (Figure 5), and also for networks trained on MNIST and CIFAR-10. In Figures 6, 7 we randomly initialized a neural network, and froze all the layers except for one, which we trained.
165
+
166
+ Training trades off between input-output map stability and expressivity We also look at the effect of training on measures of expressivity by plotting the change in trajectory length and number of transitions (see Appendix) during the training process. We find that for a network initialized with large $\sigma _ { w }$ , the training process appears to stabilize the input-output map – monotonically decreasing trajectory length (Figure 8) except for the final few steps. Interestingly, this happens at a faster rate in the vicinity of the data than for random inputs, and is accomplished without reducing weight magnitudes.
167
+
168
+ For a network closer to the boundary of the exponential regime $\sigma _ { w } ^ { 2 } = 3$ , where trajectory length growth is still exponential but with a much smaller base, the training process increases the trajectory length, enabiling greater expressivity in the resulting input-output map, Figure 9
169
+
170
+ ![](images/74b0e9143975f9fba87768660c0d8e0017f914fc5b16041cdf306983578f823b.jpg)
171
+ Figure 8: Training acts to stabilize the input-output map by decreasing trajectory length for $\sigma _ { w }$ large. The left pane plots the growth of trajectory length as a circular interpolation between two MNIST datapoints is propagated through the network, at different train steps. Red indicates the start of training, with purple the end of training. Interestingly, and supporting the observation on remaining depth, the first layer appears to increase trajectory length, in contrast with all later layers, suggesting it is being primarily used to fit the data. The right pane shows an identical plot but for an interpolation between random points, which also display decreasing trajectory length, but at a slower rate. Note the output layer is not plotted, due to artificial scaling of length through normalization. The network is initialized with $\sigma _ { w } ^ { 2 } = 1 6$ . A similar plot is observed for the number of transitions (see Appendix.)
172
+
173
+ ![](images/7c6562e93cdc1645c1ebb86496984e065a90bf269f5672c46788b16a5102077b.jpg)
174
+ Figure 9: Training increases expressivity of input-output map for $\sigma _ { w }$ small. The left pane plots the growth of trajectory length as a circular interpolation between two MNIST datapoints is propagated through the network, at different train steps. Red indicates the start of training, with purple the end of training. We see that the training process increases trajectory length, likely to increase the expressivity of the input-output map to enable greater accuracy. The right pane shows an identical plot but for an interpolation between random points, which also displays increasing trajectory length, but at a slower rate. Note the output layer is not plotted, due to artificial scaling of length through normalization. The network is initialized with $\sigma _ { w } ^ { 2 } = 3$ .
175
+
176
+ # 4 CONCLUSION
177
+
178
+ In this paper, we studied the expressivity of neural networks through three measures, neuron transitions, activation patterns and dichotomies, and explained the observed exponential dependence on depth of all three measures by demonstrating the underlying link to latent trajectory length. Having explored these results in the context of random networks, we then looked at the consequences for trained networks (see Table 1). We find that the remaining depth above a network layer influences its expressive power, which might inspire new pre-training or initialization schemes. Furthermore, we see that training interpolates between expressive power and better generalization. This relation between initial and final parameters might inform early stopping and warm starting rules.
179
+
180
+ # ACKNOWLEDGEMENTS
181
+
182
+ We thank Samy Bengio, Ian Goodfellow, Laurent Dinh, and Quoc Le for extremely helpful discussion.
183
+
184
+ # REFERENCES
185
+
186
+ Yann LeCun. The unreasonable effectiveness of deep learning. In Seminar. Johns Hopkins University, 2014.
187
+ Andrej Karpathy. The unreasonable effectiveness of recurrent neural networks. In Andrej Karpathy blog, 2015.
188
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pages 1097–1105, 2012.
189
+ Pierre Baldi, Peter Sadowski, and Daniel Whiteson. Searching for exotic particles in high-energy physics with deep learning. Nature communications, 5, 2014.
190
+ 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.
191
+ Chris Piech, Jonathan Bassen, Jonathan Huang, Surya Ganguli, Mehran Sahami, Leonidas J Guibas, and Jascha Sohl-Dickstein. Deep knowledge tracing. In Advances in Neural Information Processing Systems, pages 505–513, 2015.
192
+ Yann N Dauphin, Razvan Pascanu, Caglar Gulcehre, Kyunghyun Cho, Surya Ganguli, and Yoshua Bengio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. In Advances in neural information processing systems, pages 2933–2941, 2014.
193
+ Ian J Goodfellow, Oriol Vinyals, and Andrew M Saxe. Qualitatively characterizing neural network optimization problems. arXiv preprint arXiv:1412.6544, 2014.
194
+ Anna Choromanska, Mikael Henaff, Michael Mathieu, Gerard Ben Arous, and Yann LeCun. The loss surfaces ´ of multilayer networks. arXiv preprint arXiv:1412.0233, 2014.
195
+ James Martens and Roger Grosse. Optimizing neural networks with kronecker-factored approximate curvature. arXiv preprint arXiv:1503.05671, 2015.
196
+ Moritz Hardt, Benjamin Recht, and Yoram Singer. Train faster, generalize better: Stability of stochastic gradient descent. arXiv preprint arXiv:1509.01240, 2015.
197
+ Eduardo D Sontag. Vc dimension of neural networks. NATO ASI SERIES F COMPUTER AND SYSTEMS SCIENCES, 168:69–96, 1998.
198
+ Peter L Bartlett and Wolfgang Maass. Vapnik-chervonenkis dimension of neural nets. The handbook of brain theory and neural networks, pages 1188–1192, 2003.
199
+ Peter L Bartlett, Vitaly Maiorov, and Ron Meir. Almost linear vc-dimension bounds for piecewise polynomial networks. Neural computation, 10(8):2159–2173, 1998.
200
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
201
+ Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989.
202
+ George Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of control, signals and systems, 2(4):303–314, 1989.
203
+ Wolfgang Maass, Georg Schnitger, and Eduardo D Sontag. A comparison of the computational power of sigmoid and Boolean threshold circuits. Springer, 1994.
204
+ Xingyuan Pan and Vivek Srikumar. Expressiveness of rectifier networks. arXiv preprint arXiv:1511.05678, 2015.
205
+ Ronen Eldan and Ohad Shamir. The power of depth for feedforward neural networks. arXiv preprint arXiv:1512.03965, 2015.
206
+ Matus Telgarsky. Representation benefits of deep feedforward networks. arXiv preprint arXiv:1509.08101, 2015.
207
+ James Martens, Arkadev Chattopadhya, Toni Pitassi, and Richard Zemel. On the representational efficiency of restricted boltzmann machines. In Advances in Neural Information Processing Systems, pages 2877–2885, 2013.
208
+ Monica Bianchini and Franco Scarselli. On the complexity of neural network classifiers: A comparison between shallow and deep architectures. Neural Networks and Learning Systems, IEEE Transactions on, 25(8):1553– 1565, 2014.
209
+ Razvan Pascanu, Guido Montufar, and Yoshua Bengio. On the number of response regions of deep feed forward networks with piece-wise linear activations. arXiv preprint arXiv:1312.6098, 2013.
210
+ Guido F Montufar, Razvan Pascanu, Kyunghyun Cho, and Yoshua Bengio. On the number of linear regions of deep neural networks. In Advances in neural information processing systems, pages 2924–2932, 2014.
211
+ Ben Poole, Subhaneil Lahiri, Maithra Raghu, Jascha Sohl-Dickstein, and Surya Ganguli. Exponential expressivity in deep neural networks through transient chaos. arXiv preprint, 2016.
212
+ Ronan Collobert and Samy Bengio. Links between perceptrons, mlps and svms. In Proceedings of the twentyfirst international conference on Machine learning, page 23. ACM, 2004.
213
+ Norbert Sauer. On the density of families of sets. Journal of Combinatorial Theory, Series A, 13(1):145–147, 1972.
214
+ D. Kershaw. Some extensions of w. gautschi’s inequalities for the gamma function. Mathematics of Computation, 41(164):607–611, 1983.
215
+ Andrea Laforgia and Pierpaolo Natalini. On some inequalities for the gamma function. Advances in Dynamical Systems and Applications, 8(2):261–267, 2013.
216
+ Richard Stanley. Hyperplane arrangements. Enumerative Combinatorics, 2011.
217
+ Vladimir Naumovich Vapnik and Vlamimir Vapnik. Statistical learning theory, volume 1. Wiley New York, 1998.
218
+
219
+ # Appendix
220
+
221
+ Here we include the full proofs from sections in the paper.
222
+
223
+ # A PROOFS AND ADDITIONAL RESULTS FROM SECTION 2.2
224
+
225
+ Proof of Theorem 1 We prove this result for $F _ { W }$ with zero bias for technical simplicity. The result also translates over to $F _ { W }$ with bias with a couple of technical modifications.
226
+
227
+ # A.1 NOTATION AND PRELIMINARY RESULTS
228
+
229
+ Difference of points on trajectory Given $x ( t ) = x , x ( t + d t ) = x + \delta x$ in the trajectory, let $\delta z ^ { ( d ) } = $ $z ^ { ( d ) } ( x + \delta x ) - z ^ { ( d ) } ( x )$
230
+
231
+ Parallel and Perpendicular Components: Given vectors $x , y$ , we can write $y = y _ { \perp } + y _ { \parallel }$ where $y _ { \perp }$ is the component of $y$ perpendicular to $x$ , and $y _ { \parallel }$ is the component parallel to $x$ . (Strictly speaking, these components should also have a subscript $x$ , but we suppress it as the direction with respect to which parallel and perpendicular components are being taken will be explicitly stated.)
232
+
233
+ This notation can also be used with a matrix $W$ , see Lemma 1.
234
+
235
+ Before stating and proving the main theorem, we need a few preliminary results.
236
+
237
+ Lemma 1. Matrix Decomposition Let $x , y \in \mathbb { R } ^ { k }$ be fixed non-zero vectors, and let $W$ be a (full rank) matrix. Then, we can write
238
+
239
+ $$
240
+ W = { } ^ { \parallel } W _ { \parallel } + { } ^ { \parallel } W _ { \perp } + { } ^ { \perp } W _ { \parallel } + { } ^ { \perp } W _ { \perp }
241
+ $$
242
+
243
+ such that
244
+
245
+ $$
246
+ \begin{array} { r l r } { { ^ { \parallel } W _ { \perp } x = 0 } } & { { } \quad } & { { ^ { \perp } W _ { \perp } x = 0 } } \\ { { y ^ { T \perp } W _ { \parallel } = 0 } } & { { } \quad } & { { y ^ { T \perp } W _ { \perp } = 0 } } \end{array}
247
+ $$
248
+
249
+ i.e. the row space of $W$ is decomposed to perpendicular and parallel components with respect to $x$ (subscript on right), and the column space is decomposed to perpendicular and parallel components of $y$ (superscript on left).
250
+
251
+ Proof. Let $V , U$ be rotations such that $V x = ( | | x | | , 0 . . . , 0 ) ^ { T }$ and $U y = ( | | y | | , 0 . . . 0 ) ^ { T }$ . Now let $\tilde { W } = U W V ^ { T }$ , and let $\tilde { W } = \mathbb { I } \tilde { W } _ { \parallel } + \mathbb { I } \tilde { W } _ { \perp } + { ^ \perp \tilde { W } _ { \parallel } } + { ^ \perp \tilde { W } _ { \perp } }$ , with ${ } ^ { \parallel } \tilde { W } _ { \parallel }$ having non-zero term exactly $\tilde { W } _ { 1 1 }$ , ${ \| } \tilde { W } _ { \perp }$ having non-zero entries exactly $\tilde { W } _ { 1 i }$ for $2 \leq i \leq k$ . Finally, we let $^ \perp \tilde { W } _ { \parallel }$ have non-zero entries exactly $\tilde { W } _ { i 1 }$ , with $2 \leq i \leq k$ and $^ { \perp } \tilde { W } _ { \perp }$ have the remaining entries non-zero.
252
+
253
+ If we define $\tilde { x } = V x$ and $\tilde { y } = U y$ , then we see that
254
+
255
+ $$
256
+ \begin{array} { r l r } { { ^ { \parallel } \tilde { W } _ { \perp } \tilde { x } = 0 } } & { { } \quad } & { { ^ { \perp } \tilde { W } _ { \perp } \tilde { x } = 0 } } \\ { { \tilde { y } ^ { T \perp } \tilde { W } _ { \parallel } = 0 } } & { { } \quad } & { { \tilde { y } ^ { T \perp } \tilde { W } _ { \perp } = 0 } } \end{array}
257
+ $$
258
+
259
+ as $\tilde { x } , \tilde { y }$ have only one non-zero term, which does not correspond to a non-zero term in the components of $\tilde { W }$ in the equations.
260
+
261
+ Then, defining $\mathbb { I } \mathbb { W } _ { \parallel } = U ^ { T \parallel } \tilde { W } _ { \parallel } V$ , and the other components analogously, we get equations of the form
262
+
263
+ $$
264
+ ^ { \parallel } W _ { \perp } x = U ^ { T \parallel } \tilde { W } _ { \perp } V x = U ^ { T \parallel } \tilde { W } _ { \perp } \tilde { x } = 0
265
+ $$
266
+
267
+ Observation 3. Given $W , x$ as before, and considering $W _ { \parallel }$ , $W _ { \perp }$ with respect to $x$ (wlog a unit vector) we can express them directly in terms of $W$ as follows: Letting $W ^ { ( i ) }$ be the ith row of $W$ , we have
268
+
269
+ $$
270
+ W _ { \parallel } = \left( \begin{array} { c } { ( ( W ^ { ( 0 ) } ) ^ { T } \cdot x ) x } \\ { \vdots } \\ { ( ( W ^ { ( k ) } ) ^ { T } \cdot x ) x } \end{array} \right)
271
+ $$
272
+
273
+ i.e. the projection of each row in the direction of $x$ . And of course
274
+
275
+ $$
276
+ W _ { \perp } = W - W _ { \parallel }
277
+ $$
278
+
279
+ The motivation to consider such a decomposition of $W$ is for the resulting independence between different components, as shown in the following lemma.
280
+
281
+ Lemma 2. Independence of Projections Let x be a given vector (wlog of unit norm.) If $W$ is a random matrix with $W _ { i j } \sim \mathcal { N } ( 0 , \overline { { \sigma ^ { 2 } } } )$ , then $W _ { \parallel }$ and $W _ { \perp }$ with respect to $x$ are independent random variables.
282
+
283
+ Proof. There are two possible proof methods:
284
+
285
+ (a) We use the rotational invariance of random Gaussian matrices, i.e. if $W$ is a Gaussian matrix, iid entries ${ \mathcal { N } } ( 0 , \sigma ^ { 2 } )$ , and $R$ is a rotation, then $R W$ is also iid Gaussian, entries ${ \mathcal { N } } ( 0 , \sigma ^ { 2 } )$ . (This follows easily from affine transformation rules for multivariate Gaussians.) Let $V$ be a rotation as in Lemma 1. Then $\tilde { W } = W V ^ { T }$ is also iid Gaussian, and furthermore, $\tilde { W } _ { \parallel }$ and $\tilde { W } _ { \perp }$ partition the entries of $\tilde { W }$ , so are evidently independent. But then $W _ { \parallel } =$ $\tilde { W } _ { \parallel } V ^ { T }$ and $W _ { \perp } = \tilde { W } _ { \perp } V ^ { T }$ are also independent.
286
+
287
+ (b) From the observation note that $W _ { \parallel }$ and $W _ { \perp }$ have a centered multivariate joint Gaussian distribution (both consist of linear combinations of the entries $W _ { i j }$ in $W$ .) So it suffices to show that $W _ { \parallel }$ and $W _ { \perp }$ have covariance 0. Because both are centered Gaussians, this is equivalent to showing $\mathbb { E } ( < W _ { \parallel } , W _ { \perp } > ) = 0$ . We have that
288
+
289
+ $$
290
+ \mathbb { E } ( < W _ { \parallel } , W _ { \perp } > ) = \mathbb { E } ( W _ { \parallel } W _ { \perp } ^ { T } ) = \mathbb { E } ( W _ { \parallel } W ^ { T } ) - \mathbb { E } ( W _ { \parallel } W _ { \parallel } ^ { T } )
291
+ $$
292
+
293
+ As any two rows of $W$ are independent, we see from the observation that $\mathbb { E } ( W _ { \parallel } W ^ { T } )$ is a diagonal matrix, with the ith diagonal entry just $( ( W ^ { ( 0 ) } ) ^ { T } \cdot x ) ^ { 2 }$ . But similarly, $\mathbb { E } ( W _ { \parallel } W _ { \parallel } ^ { T } )$ is also a diagonal matrix, with the same diagonal entries - so the claim follows.
294
+
295
+ In the following two lemmas, we use the rotational invariance of Gaussians as well as the chi distribution to prove results about the expected norm of a random Gaussian vector.
296
+
297
+ Lemma 3. Norm of a Gaussian vector Let $X \in \mathbb { R } ^ { k }$ be a random Gaussian vector, with $X _ { i }$ iid, $\sim \mathcal { N } ( 0 , \sigma ^ { 2 } )$ . Then
298
+
299
+ $$
300
+ \mathbb { E } \left[ | | X | | \right] = \sigma \sqrt { 2 } \frac { \Gamma ( ( k + 1 ) / 2 ) } { \Gamma ( k / 2 ) }
301
+ $$
302
+
303
+ Proof. We use the fact that if $Y$ is a random Gaussian, and $Y _ { i } \sim \mathcal { N } ( 0 , 1 )$ then $| | Y | |$ follows a chi distribution. This means that $\begin{array} { r } { \mathbb { E } ( | | X / \sigma | | ) = \sqrt { 2 } \Gamma ( ( k + 1 ) / 2 ) / \Gamma ( k / 2 ) . } \end{array}$ , the mean of a chi distribution with $k$ degrees of freedom, and the result follows by noting that the expectation in the lemma is $\sigma$ multiplied by the above expectation. □
304
+
305
+ We will find it useful to bound ratios of the Gamma function (as appear in Lemma 3) and so introduce the following inequality, from (Kershaw, 1983) that provides an extension of Gautschi’s Inequality.
306
+
307
+ Theorem 5. An Extension of Gautschi’s Inequality For $\cdot 0 < s < 1$ , we have
308
+
309
+ $$
310
+ \left( x + { \frac { s } { 2 } } \right) ^ { 1 - s } \leq { \frac { \Gamma ( x + 1 ) } { \Gamma ( x + s ) } } \leq \left( x - { \frac { 1 } { 2 } } + \left( s + { \frac { 1 } { 4 } } \right) ^ { { \frac { 1 } { 2 } } } \right) ^ { 1 - s }
311
+ $$
312
+
313
+ We now show:
314
+
315
+ Lemma 4. Norm of Projections Let $W$ be a $k$ by $k$ random Gaussian matrix with iid entries $\sim$ ${ \mathcal { N } } ( 0 , \sigma ^ { 2 } )$ , and $x , y$ two given vectors. Partition $W$ into components as in Lemma $I$ and let $x _ { \perp }$ be $a$ nonzero vector perpendicular to x. Then
316
+
317
+ $$
318
+ \mathbb { E } [ | | ^ { \perp } W _ { \perp } x _ { \perp } | ] = | | x _ { \perp } | | \sigma \sqrt { 2 } \frac { \Gamma ( k / 2 ) } { \Gamma ( ( k - 1 ) / 2 } \geq | | x _ { \perp } | | \sigma \sqrt { 2 } ( \frac { k } { 2 } - \frac { 3 } { 4 } ) ^ { 1 / 2 }
319
+ $$
320
+
321
+ $( b )$ If $\mathbb { 1 } _ { \mathcal { A } }$ is an identity matrix with non-zeros diagonal entry $i$ iff $i \in \mathcal { A } \subset [ k ]$ , and $| { \cal A } | > 2$ , then
322
+
323
+ $$
324
+ \mathbb { E } \left[ \left| \left| \mathbb { 1 } _ { \boldsymbol { A } } ^ { \bot } W _ { \bot } x _ { \bot } \right| \right| \right] \ge \left| \left| x _ { \bot } \right| \right| \sigma \sqrt { 2 } \frac { \Gamma ( \left| A \right| / 2 ) } { \Gamma ( ( \left| A \right| - 1 ) / 2 ) } \ge \left| \left| x _ { \bot } \right| \right| \sigma \sqrt { 2 } \left( \frac { \left| A \right| } { 2 } - \frac { 3 } { 4 } \right) ^ { 1 / 2 }
325
+ $$
326
+
327
+ Proof. (a) Let $U , V , \tilde { W }$ be as in Lemma 1. As $U , V$ are rotations, $\tilde { W }$ is also iid Gaussian. Furthermore for any fixed $W$ , with $\tilde { a } = V a$ , by taking inner products, and square-rooting, we see that $\left| \left| \tilde { W } \tilde { a } \right| \right| = \left| \left| W a \right| \right|$ . So in particular
328
+
329
+ $$
330
+ \mathbb { E } [ | | ^ { \perp } W _ { \perp } x _ { \perp } | | ] = \mathbb { E } [ | | ^ { \perp } \tilde { W } _ { \perp } \tilde { x } _ { \perp } | | ]
331
+ $$
332
+
333
+ But from the definition of non-zero entries of $^ { \perp } \tilde { W } _ { \perp }$ , and the form of $\tilde { x } _ { \perp }$ (a zero entry in the first coordinate), it follows that $\perp \tilde { W } _ { \perp } \tilde { x } _ { \perp }$ has exactly $k - 1$ non zero entries, each a centered Gaussian with variance $( k - 1 ) \sigma ^ { 2 } | | x _ { \perp } | | ^ { 2 }$ . By Lemma 3, the expected norm is as in the statement. We then apply Theorem 5 to get the lower bound.
334
+
335
+ (b) First note we can view $\mathbb { 1 } _ { \mathcal { A } } { } ^ { \perp } W _ { \perp } = { } ^ { \perp } \mathbb { 1 } _ { \mathcal { A } } W _ { \perp }$ . (Projecting down to a random (as $W$ is random) subspace of fixed size $| { \mathcal { A } } | = m$ and then making perpendicular commutes with making perpendicular and then projecting everything down to the subspace.)
336
+
337
+ So we can view $W$ as a random $m$ by $k$ matrix, and for $x , y$ as in Lemma 1 (with $y$ projected down onto $m$ dimensions), we can again define $U , V$ as $k$ by $k$ and $m$ by $m$ rotation matrices respectively, and $\tilde { W } = U W \bar { V ^ { T } }$ , with analogous properties to Lemma 1. Now we can finish as in part (a), except that $\perp _ { \tilde { W } _ { \perp } \tilde { x } }$ may have only $m - 1$ entries, (depending on whether $y$ is annihilated by projecting down by $\mathbb { 1 } _ { A }$ ) each of variance $( k - 1 ) \sigma ^ { 2 } \left| \left| x _ { \perp } \right| \right| ^ { 2 }$ .
338
+
339
+ Lemma 5. Norm and Translation Let $X$ be a centered multivariate Gaussian, with diagonal covariance matrix, and $\mu$ a constant vector.
340
+
341
+ $$
342
+ \mathbb { E } ( | | X - \mu | | ) \geq \mathbb { E } ( | | X | | )
343
+ $$
344
+
345
+ Proof. The inequality can be seen intuitively geometrically: as $X$ has diagonal covariance matrix, the contours of the pdf of $\vert \vert X \vert \vert$ are circular centered at 0, decreasing radially. However, the contours of the pdf of $\left| \left| X - \mu \right| \right|$ are shifted to be centered around $\lvert \lvert \mu \rvert \rvert$ , and so shifting back $\mu$ to 0 reduces the norm.
346
+
347
+ A more formal proof can be seen as follows: let the pdf of $X$ be $f _ { X } ( \cdot )$ . Then we wish to show
348
+
349
+ $$
350
+ \int _ { x } \left| | x - \mu | \right| f _ { X } ( x ) d x \geq \int _ { x } \left| | x | \right| f _ { X } ( x ) d x
351
+ $$
352
+
353
+ Now we can pair points $x , - x$ , using the fact that $f _ { X } ( x ) = f _ { X } ( - x )$ and the triangle inequality on the integrand to get
354
+
355
+ $$
356
+ \int _ { | x | } \left( | | x - \mu | | + | | - x - \mu | | \right) f _ { X } ( x ) d x \geq \int _ { | x | } | 2 x | | f _ { X } ( x ) d x = \int _ { | x | } \left( | | x | | + | | - x | | \right) f _ { X } ( x ) d x
357
+ $$
358
+
359
+ # A.2 PROOF OF THEOREM
360
+
361
+ Proof. We first prove the zero bias case, Theorem 1. To do so, it is sufficient to prove that
362
+
363
+ $$
364
+ \mathbb { E } \left[ \Big | \Big | \delta z ^ { ( d + 1 ) } ( t ) \Big | \right] \geq O \left( \left( \frac { \sqrt { \sigma k } } { \sqrt { \sigma + k } } \right) ^ { d + 1 } \right) \Big | \Big | \delta z ^ { ( 0 ) } ( t ) \Big | \Big |
365
+ $$
366
+
367
+ as integrating over $t$ gives us the statement of the theorem.
368
+
369
+ For ease of notation, we will suppress the $t$ in $z ^ { ( d ) } ( t )$ .
370
+
371
+ We first write
372
+
373
+ $$
374
+ W ^ { ( d ) } = W _ { \bot } ^ { ( d ) } + W _ { \parallel } ^ { ( d ) }
375
+ $$
376
+
377
+ where the division is done with respect to $z ^ { ( d ) }$ . Note that this means $h ^ { ( d + 1 ) } = W _ { \parallel } ^ { ( d ) } z ^ { ( d ) }$ as the other component annihilates (maps to 0) $z ^ { ( d ) }$ .
378
+
379
+ We can also define $\mathcal { A } _ { W _ { \parallel } ^ { ( d ) } } = \{ i : i \in [ k ] , | h _ { i } ^ { ( d + 1 ) } | < 1 \}$ i.e. the set of indices for which the hidden representation is not saturated. Letting $W _ { i }$ denote the $i$ th row of matrix $W$ , we now claim that:
380
+
381
+ $$
382
+ \mathbb { E } _ { W ^ { ( d ) } } \left[ \Big | \Big | \delta z ^ { ( d + 1 ) } \Big | \Big | \right] = \mathbb { E } _ { W _ { \parallel } ^ { ( d ) } } \mathbb { E } _ { W _ { \perp } ^ { ( d ) } } \left[ \left( \sum _ { i \in \mathcal { A } _ { W _ { \parallel } ^ { ( d ) } } } ( ( W _ { \perp } ^ { ( d ) } ) _ { i } \delta z ^ { ( d ) } + ( W _ { \parallel } ^ { ( d ) } ) _ { i } \delta z ^ { ( d ) } ) ^ { 2 } \right) ^ { 1 / 2 } \right]
383
+ $$
384
+
385
+ Indeed, by Lemma 2 we first split the expectation over $W ^ { ( d ) }$ into a tower of expectations over the two independent parts of $W$ to get
386
+
387
+ $$
388
+ \mathbb { E } _ { W ^ { ( d ) } } [ \Big | \Big | \delta z ^ { ( d + 1 ) } \Big | \Big | ] = \mathbb { E } _ { W _ { \parallel } ^ { ( d ) } } \mathbb { E } _ { W _ { \perp } ^ { ( d ) } } [ \Big | \Big | \phi ( W ^ { ( d ) } \delta z ^ { ( d ) } ) \Big | | ]
389
+ $$
390
+
391
+ But conditioning on $W _ { \parallel } ^ { ( d ) }$ in the inner expectation gives us $\smash { h ^ { ( d + 1 ) } }$ and $\mathcal { A } _ { W _ { \parallel } ^ { ( d ) } }$ , allowing us to replace the norm over $\phi ( W ^ { ( d ) } \delta z ^ { ( d ) } )$ with the sum in the term on the right hand side of the claim.
392
+
393
+ Till now, we have mostly focused on partitioning the matrix $W ^ { ( d ) }$ . But we can also set $\delta z ^ { ( d ) } = $ $\delta z _ { \parallel } ^ { ( d ) } + \delta z _ { \perp } ^ { ( d ) }$ where the perpendicular and parallel are with respect to $z ^ { ( d ) }$ . In fact, to get the expression in $( ^ { * * } )$ , we derive a recurrence as below:
394
+
395
+ $$
396
+ \mathbb { E } _ { W ^ { ( d ) } } [ \Big | \Big | \delta z _ { \perp } ^ { ( d + 1 ) } \Big | \Big | ] \geq O ( \frac { \sqrt { \sigma k } } { \sqrt { \sigma + k } } ) \mathbb { E } _ { W ^ { ( d ) } } [ \Big | \Big | \delta z _ { \perp } ^ { ( d ) } \Big | | ]
397
+ $$
398
+
399
+ To get this, we first need to define $\tilde { z } ^ { ( d + 1 ) } = \mathbb { 1 } _ { \mathcal { A } _ { w _ { \parallel } ^ { ( d ) } } } h ^ { ( d + 1 ) }$ - the latent vector $\boldsymbol { h } ^ { ( d + 1 ) }$ with all saturated units zeroed out.
400
+
401
+ We then split the column space of $W ^ { ( d ) } = { } ^ { \perp } W ^ { ( d ) } + \Vdash W ^ { ( d ) }$ , where the split is with respect to $\tilde { z } ^ { ( d + 1 ) }$ . Letting z(d+1)⊥ be the part perpendicular to z(d+1), and A the set of units that are unsaturated, we have an important relation:
402
+
403
+ # Claim
404
+
405
+ $$
406
+ \left| \left| \delta z _ { \perp } ^ { ( d + 1 ) } \right| \right| \geq \left| \left| ^ { \perp } W ^ { ( d ) } \delta z ^ { ( d ) } \mathbb { 1 } _ { \mathcal { A } } \right| \right|
407
+ $$
408
+
409
+ (where the indicator in the right hand side zeros out coordinates not in the active set.)
410
+
411
+ To see this, first note, by definition,
412
+
413
+ $$
414
+ \delta \boldsymbol { z } _ { \perp } ^ { ( d + 1 ) } = \boldsymbol { W } ^ { ( d ) } \delta \boldsymbol { z } ^ { ( d ) } \cdot \mathbb { 1 } _ { \boldsymbol { \mathcal { A } } } - \langle \boldsymbol { W } ^ { ( d ) } \delta \boldsymbol { z } ^ { ( d ) } \cdot \mathbb { 1 } _ { \boldsymbol { \mathcal { A } } } , \hat { \boldsymbol { z } } ^ { ( d + 1 ) } \rangle \hat { \boldsymbol { z } } ^ { ( d + 1 ) }
415
+ $$
416
+
417
+ where the ˆ· indicates a unit vector.
418
+
419
+ Similarly
420
+
421
+ $$
422
+ ^ { \perp } W ^ { ( d ) } \delta z ^ { ( d ) } = W ^ { ( d ) } \delta z ^ { ( d ) } - \langle W ^ { ( d ) } \delta z ^ { ( d ) } , { \hat { \tilde { z } } } ^ { ( d + 1 ) } \rangle { \hat { \tilde { z } } } ^ { ( d + 1 ) }
423
+ $$
424
+
425
+ Now note that for any index $i \in \mathcal A$ , the right hand sides of (1) and (2) are identical, and so the vectors on the left hand side agree for all $i \in \mathcal { A }$ . In particular,
426
+
427
+ $$
428
+ \delta \boldsymbol { z } _ { \perp } ^ { ( d + 1 ) } \cdot \mathbb { 1 } _ { A } = { } ^ { \perp } W ^ { ( d ) } \delta \boldsymbol { z } ^ { ( d ) } \cdot \mathbb { 1 } _ { A }
429
+ $$
430
+
431
+ Now the claim follows easily by noting that $\left| \left| \delta z _ { \perp } ^ { ( d + 1 ) } \right| \right| \geq \left| \left| \delta z _ { \perp } ^ { ( d + 1 ) } \cdot \mathbb { 1 } _ { A } \right| \right| .$
432
+
433
+ Returning to $( ^ { * } )$ , we split $\delta z ^ { ( d ) } = \delta z _ { \perp } ^ { ( d ) } + \delta z _ { \parallel } ^ { ( d ) }$ , $W _ { \perp } ^ { ( d ) } = { } ^ { \parallel } W _ { \perp } ^ { ( d ) } + { } ^ { \perp } W _ { \perp } ^ { ( d ) }$ (and $W _ { \parallel } ^ { ( d ) }$ analogously), and after some cancellation, we have
434
+
435
+ $$
436
+ \ ? \ ? \complement ^ { ( d + 1 ) } \left\| \Big | \right\| = \mathbb { E } _ { W _ { \parallel } ^ { ( d ) } } \mathbb { E } _ { W _ { \perp } ^ { ( d ) } } \left[ \left( \sum _ { i \in A _ { W _ { \parallel } ^ { ( d ) } } } \left( ( ^ { \perp } W _ { \perp } ^ { ( d ) } + \mathbb { I } W _ { \perp } ^ { ( d ) } ) _ { i } \delta z _ { \perp } ^ { ( d ) } + ( ^ { \perp } W _ { \parallel } ^ { ( d ) } + \mathbb { I } W _ { \parallel } ^ { ( d ) } ) _ { i } \delta z _ { \parallel } ^ { ( d ) } \right) \right) \right]
437
+ $$
438
+
439
+ We would like a recurrence in terms of only perpendicular components however, so we first drop the ${ } ^ { \parallel } W _ { \perp } ^ { ( d ) } , { } ^ { \parallel } W _ { \parallel } ^ { ( d ) }$ (which can be done without decreasing the norm as they are perpendicular to the remaining terms) and using the above claim, have
440
+
441
+ $$
442
+ \mathbb { E } _ { W ^ { ( d ) } } \left[ \Big | \Big | \delta z _ { \perp } ^ { ( d + 1 ) } \Big | \Big | \right] \ge \mathbb { E } _ { W _ { \parallel } ^ { ( d ) } } \mathbb { E } _ { W _ { \perp } ^ { ( d ) } } \left[ \left( \sum _ { i \in A _ { W _ { \parallel } ^ { ( d ) } } } \left( \big ( ^ { \perp } W _ { \perp } ^ { ( d ) } \big ) _ { i } \delta z _ { \perp } ^ { ( d ) } + \big ( ^ { \perp } W _ { \parallel } ^ { ( d ) } \big ) _ { i } \delta z _ { \parallel } ^ { ( d ) } \right) ^ { 2 } \right) ^ { 1 / 2 } \right]
443
+ $$
444
+
445
+ But in the inner expectation, the term $^ \perp W _ { \parallel } ^ { ( d ) } \delta z _ { \parallel } ^ { ( d ) }$ is just a constant, as we are conditioning on $W _ { \parallel } ^ { ( d ) }$ . So using Lemma 5 we have
446
+
447
+ $$
448
+ \hat { \tau } _ { W _ { \perp } ^ { ( d ) } } \left[ \left( \sum _ { i \in A _ { W _ { \parallel } ^ { ( d ) } } } \left( \binom { \perp } { W _ { \perp } ^ { ( d ) } } _ { i } \delta z _ { \perp } ^ { ( d ) } + \binom { \perp } { W _ { \parallel } ^ { ( d ) } } _ { i } \delta z _ { \parallel } ^ { ( d ) } \right) ^ { 2 } \right) ^ { 1 / 2 } \right] \geq \mathbb { E } _ { W _ { \perp } ^ { ( d ) } } \left[ \left( \sum _ { i \in A _ { W _ { \parallel } ^ { ( d ) } } } \left( \binom { \perp } { W _ { \perp } ^ { ( d ) } } _ { i } \delta z _ { \perp } ^ { ( d ) } + \binom { \perp } { W _ { \parallel } ^ { ( d ) } } _ { i } \delta z _ { \perp } ^ { ( d ) } \right) ^ { 2 } \right) ^ { 1 / 2 } \right] ,
449
+ $$
450
+
451
+ We can then apply Lemma 4 to get
452
+
453
+ $$
454
+ \mathbb { E } _ { W _ { \perp } ^ { ( d ) } } \left[ \left( \sum _ { i \in A _ { w _ { \parallel } ^ { ( d ) } } } \left( ( ^ { \perp } W _ { \perp } ^ { ( d ) } ) _ { i } \delta z _ { \perp } ^ { ( d ) } \right) ^ { 2 } \right) ^ { 1 / 2 } \right] \geq \frac { \sigma } { \sqrt { k } } \sqrt { 2 \frac { \sqrt { 2 | A _ { W _ { \parallel } ^ { ( d ) } } | - 3 } } { 2 } } \mathbb { E } \left[ \left| \left| \delta z _ { \perp } ^ { ( d ) } \right| \right| \right]
455
+ $$
456
+
457
+ The outer expectation on the right hand side only affects the term in the expectation through the size of the non-saturated set of units. Letting $p = \bar { \mathbb { P } } ( | h _ { i } ^ { ( d + 1 ) } | < 1 )$ , and noting that we get a non-zero norm only if $| \mathcal { A } _ { W _ { \parallel } ^ { ( d ) } } | \geq 2$ (else we cannot project down a dimension), and for $| \mathcal { A } _ { W _ { \parallel } ^ { ( d ) } } | \geq 2$ ,
458
+
459
+ $$
460
+ \sqrt { 2 } \frac { \sqrt { 2 | { \cal A } _ { W _ { \parallel } ^ { ( d ) } } | - 3 } } { 2 } \geq \frac { 1 } { \sqrt { 2 } } \sqrt { | { \cal A } _ { W _ { \parallel } ^ { ( d ) } } | }
461
+ $$
462
+
463
+ we get
464
+
465
+ $$
466
+ \mathbb { E } _ { W ^ { ( d ) } } [ \Big | \Big | \delta z _ { \perp } ^ { ( d + 1 ) } \Big | \Big | ] \ge \frac { 1 } { \sqrt { 2 } } ( \sum _ { j = 2 } ^ { k } \binom { k } { j } p ^ { j } ( 1 - p ) ^ { k - j } \frac { \sigma } { \sqrt { k } } \sqrt { j } ) \mathbb { E } [ \Big | \Big | \delta z _ { \perp } ^ { ( d ) } \Big | | ]
467
+ $$
468
+
469
+ We use the fact that we have the probability mass function for an √ $( k , p )$ binomial random variable to bound the $\sqrt { j }$ term:
470
+
471
+ $$
472
+ \begin{array} { c } { { \displaystyle \sum _ { i = 2 } ^ { k } { \binom { k } { j } } p ^ { j } ( 1 - p ) ^ { k - j } \frac { \sigma } { \sqrt { k } } \sqrt { j } = - { \binom { k } { 1 } } p ( 1 - p ) ^ { k - 1 } \frac { \sigma } { \sqrt { k } } + \displaystyle \sum _ { j = 0 } ^ { k } { \binom { k } { j } } p ^ { j } ( 1 - p ) ^ { k - j } \frac { \sigma } { \sqrt { k } } \sqrt { j } } } \\ { { = - \sigma \sqrt { k } p ( 1 - p ) ^ { k - 1 } + k p \cdot \frac { \sigma } { \sqrt { k } } \displaystyle \sum _ { j = 1 } ^ { k } \frac { 1 } { \sqrt { j } } { \binom { k } { j - 1 } } p ^ { j - 1 } ( 1 - p ) ^ { k - j } } } \end{array}
473
+ $$
474
+
475
+ But by using Jensen’s inequality with $1 / \sqrt { x }$ , we get
476
+
477
+ $$
478
+ \sum _ { j = 1 } ^ { k } { \frac { 1 } { \sqrt { j } } } { \binom { k - 1 } { j - 1 } } p ^ { j - 1 } ( 1 - p ) ^ { k - j } \geq { \frac { 1 } { \sqrt { \sum _ { j = 1 } ^ { k } j { \binom { k - 1 } { j - 1 } } p ^ { j - 1 } ( 1 - p ) ^ { k - j } } } } = { \frac { 1 } { \sqrt { ( k - 1 ) p + 1 } } }
479
+ $$
480
+
481
+ where the last equality follows by recognising the expectation of a binomial $( k - 1 , p )$ random variable. So putting together, we get
482
+
483
+ $$
484
+ \mathbb { E } _ { W ^ { ( d ) } } \left[ \left| \left| \delta z _ { \perp } ^ { ( d + 1 ) } \right| \right] \right] \ge \frac { 1 } { \sqrt { 2 } } \left( - \sigma \sqrt { k } p ( 1 - p ) ^ { k - 1 } + \sigma \cdot \frac { \sqrt { k } p } { \sqrt { 1 + ( k - 1 ) p } } \right) \mathbb { E } \left[ \left| \left| \delta z _ { \perp } ^ { ( d ) } \right| \right| \right]
485
+ $$
486
+
487
+ To lower bound $p$ , we first note that as $h _ { i } ^ { ( d + 1 ) }$ is a normal random variable with variance $\leq \sigma ^ { 2 }$ , if $A \sim { \mathcal { N } } ( 0 , \sigma ^ { 2 } )$
488
+
489
+ $$
490
+ \mathbb { P } ( | h _ { i } ^ { ( d + 1 ) } | < 1 ) \ge \mathbb { P } ( | A | < 1 ) \ge \frac { 1 } { \sigma \sqrt { 2 \pi } }
491
+ $$
492
+
493
+ where the last inequality holds for $\sigma \geq 1$ and follows by Taylor expanding $e ^ { - x ^ { 2 } / 2 }$ around 0. Similarly, we can also show that $\textstyle p \leq { \frac { 1 } { \sigma } }$ .
494
+
495
+ So this becomes
496
+
497
+ $$
498
+ \begin{array} { l } { \displaystyle \mathbb { E } [ | | \delta z ^ { ( d + 1 ) } | ] \geq ( \frac { 1 } { \sqrt { 2 } } ( \frac { 1 } { ( 2 \pi ) ^ { 1 / 4 } } \frac { \sqrt { \sigma k } } { \sqrt { \sigma \sqrt { 2 \pi } + ( k - 1 ) } } - \sqrt { k } ( 1 - \frac { 1 } { \sigma } ) ^ { k - 1 } ) ) \mathbb { E } [ | | \delta z _ { \perp } ^ { ( d ) } | ] ] } \\ { \displaystyle \qquad = O ( \frac { \sqrt { \sigma k } } { \sqrt { \sigma + k } } ) \mathbb { E } [ | | \delta z _ { \perp } ^ { ( d ) } | ] } \end{array}
499
+ $$
500
+
501
+ Finally, we can compose this, to get
502
+
503
+ $$
504
+ \mathbb { E } \left[ \Big | \Big | \delta z ^ { ( d + 1 ) } \Big | \right] \geq \left( \frac { 1 } { \sqrt { 2 } } \left( \frac { 1 } { ( 2 \pi ) ^ { 1 / 4 } } \frac { \sqrt { \sigma k } } { \sqrt { \sigma \sqrt { 2 \pi } + ( k - 1 ) } } - \sqrt { k } \left( 1 - \frac { 1 } { \sigma } \right) ^ { k - 1 } \right) \right) ^ { d + 1 } c \cdot | | \delta x ( t ) | |
505
+ $$
506
+
507
+ with the constant $c$ being the ratio of $| | \delta x ( t ) \perp | |$ to $| | \delta x ( t ) | |$ . So if our trajectory direction is almost orthogonal to $x ( t )$ (which will be the case for e.g. random circular arcs, $c$ can be seen to be $\approx 1$ by splitting into components as in Lemma 1, and using Lemmas 3, 4.)
508
+
509
+ Result for non-zero bias In fact, we can easily extend the above result to the case of non-zero bias. The insight is to note that because $\delta z ^ { ( d + 1 ) }$ involves taking a difference between $z ^ { ( d + 1 ) } ( t + d t )$ and $z ^ { ( d + 1 ) } ( t )$ , the bias term does not enter at all into the expression for $\delta z ^ { ( d + 1 ) }$ . So the computations above hold, and equation (a) becomes
510
+
511
+ $$
512
+ \mathbb { E } _ { W ^ { ( d ) } } \left[ \left| \left| \delta z _ { \perp } ^ { ( d + 1 ) } \right| \right] \right] \geq \frac { 1 } { \sqrt { 2 } } \left( - \sigma _ { w } \sqrt { k } p ( 1 - p ) ^ { k - 1 } + \sigma _ { w } \cdot \frac { \sqrt { k } p } { \sqrt { 1 + ( k - 1 ) p } } \right) \mathbb { E } \left[ \left| \left| \delta z _ { \perp } ^ { ( d ) } \right| \right| \right]
513
+ $$
514
+
515
+ We also now have that $h _ { i } ^ { ( d + 1 ) }$ is a normal random variable with variance $\leq \sigma _ { w } ^ { 2 } + \sigma _ { b } ^ { 2 }$ (as the bias is drawn from $\mathcal { N } ( 0 , \sigma _ { b } ^ { 2 } ) .$ ). So equation (b) becomes
516
+
517
+ $$
518
+ \mathbb { P } ( | h _ { i } ^ { ( d + 1 ) } | < 1 ) \ge \frac { 1 } { \sqrt { ( \sigma _ { w } ^ { 2 } + \sigma _ { b } ^ { 2 } ) } \sqrt { 2 \pi } }
519
+ $$
520
+
521
+ This gives Theorem 1
522
+
523
+ $$
524
+ \mathbb { E } [ | | \delta z ^ { ( d + 1 ) } | | ] \geq O ( \frac { \sigma _ { w } } { ( \sigma _ { w } ^ { 2 } + \sigma _ { b } ^ { 2 } ) ^ { 1 / 4 } } \cdot \frac { \sqrt { k } } { \sqrt { \sqrt { \sigma _ { w } ^ { 2 } + \sigma _ { b } ^ { 2 } } + k } } ) \mathbb { E } [ | | \delta z _ { \perp } ^ { ( d ) } | ]
525
+ $$
526
+
527
+ Statement and Proof of Upper Bound for Trajectory Growth Replace hard-tanh with a linear coordinate-wise identity map, h(d+1)i = $h _ { i } ^ { ( d + 1 ) } = ( W ^ { ( d ) } z ^ { ( d ) } ) _ { i } + b _ { i }$ . This provides an upper bound on the norm. We also then recover a chi distribution with $k$ terms, each with standard deviatio n σwk 12 ,
528
+
529
+ $$
530
+ \begin{array} { r l r } { { \mathbb { E } [ | | \delta z ^ { ( d + 1 ) } | ] ] \leq \sqrt { 2 } \frac { \Gamma ( ( k + 1 ) / 2 ) } { \Gamma ( k / 2 ) } \frac { \sigma _ { w } } { k ^ { \frac { 1 } { 2 } } } | | \delta z ^ { ( d ) } | | } } \\ & { } & { \leq \sigma _ { w } ( \frac { k + 1 } { k } ) ^ { \frac { 1 } { 2 } } | | \delta z ^ { ( d ) } | | , } \end{array}
531
+ $$
532
+
533
+ where the second step follows from (Laforgia and Natalini, 2013), and holds for $k > 1$
534
+
535
+ # B PROOFS AND ADDITIONAL RESULTS FROM SECTION 2.2.2
536
+
537
+ # Proof of Theorem 2
538
+
539
+ Proof. For $\sigma _ { b } = 0$ :
540
+
541
+ For hiddthe large layer case, $d < n$ , consideume that $v _ { 1 } ^ { ( d ) }$ . This has as input Furthermore, as si W (d−1)z(d−1). As we are in $\sigma$ we ass $| z _ { i } ^ { ( d - 1 ) } | = 1$ $z _ { i } ^ { ( d - 1 ) }$ and $W _ { i 1 } ^ { ( d - 1 ) }$ are both completely random, we can also assume wlog that z(d−1)i = 1. For a particular input, we can define v(d) as sensitive to $v _ { i } ^ { ( d - 1 ) }$ if $v _ { i } ^ { ( d - 1 ) }$ transitioning (to wlog $- 1$ ) will induce a transition in node $v _ { 1 } ^ { ( d ) }$ . A sufficient condition for this to happen is if $\begin{array} { r } { | W _ { i 1 } | \geq | \sum _ { j \neq i } W _ { j 1 } | } \end{array}$ . But $X = W _ { i 1 } \sim { \mathcal { N } } ( 0 , \sigma ^ { 2 } / k )$ and $\begin{array} { r } { \sum _ { j \neq i } W _ { j 1 } = Y ^ { \prime } \sim \mathcal { N } ( 0 , ( k - 1 ) \sigma ^ { 2 } / k ) } \end{array}$ . So we want to compute $\mathbb { P } ( | X | > | Y ^ { \prime } | )$ . For ease of computation, we instead look at $\mathbb { P } ( | X | > | Y | )$ , where $Y \sim { \mathcal { N } } ( 0 , \sigma ^ { 2 } )$ .
542
+
543
+ But this is the same as computing $\mathbb { P } ( | X | / | Y | > 1 ) = \mathbb { P } ( X / Y < - 1 ) + \mathbb { P } ( X / Y > 1 )$ . But the ratio of two centered independent normals with variances $\sigma _ { 1 } ^ { 2 } , \sigma _ { 2 } ^ { 2 }$ follows a Cauchy distribution, with parameter $\sigma _ { 1 } / \sigma _ { 2 }$ , which in this case is $1 / \sqrt { k }$ . Substituting this in to the cdf of the Cauchy distribution, we get that
544
+
545
+ $$
546
+ \mathbb { P } \left( \frac { | X | } { | Y | } > 1 \right) = 1 - \frac { 2 } { \pi } \arctan ( \sqrt { k } )
547
+ $$
548
+
549
+ Finally, using the identity $\arctan ( x ) + \arctan ( 1 / x )$ and the Laurent series for arctan $( 1 / x )$ , we can evaluate the right hand side to be $O ( 1 / \sqrt { k } )$ . In particular
550
+
551
+ $$
552
+ \mathbb { P } \left( { \frac { | X | } { | Y | } } > 1 \right) \geq O \left( { \frac { 1 } { \sqrt { k } } } \right)
553
+ $$
554
+
555
+ This means that in expectation, any neuron in layer $d$ will be sensitive to the transitions of $\sqrt { k }$ neurons in the layer below. Using this, and the fact the while $v _ { i } ^ { ( d - 1 ) }$ might flip very quickly from say $- 1$ to 1, the gradation in the transition ensures that neurons in layer $d$ sensitive to $v _ { i } ^ { ( d - 1 ) }$ will transition at distinct times, we get the desired growth rate in expectation as follows:
556
+
557
+ Let $T ^ { ( d ) }$ be a random variable denoting the number of transitions in layer $d$ . And let $T _ { i } ^ { ( d ) }$ be a random variable denoting the number of transitions of neuron $i$ in layer $d$ . Note that by linearity of expectation and symmetry, $\begin{array} { r } { \mathbb { E } \left[ T ^ { ( d ) } \right] = \sum _ { i } \mathbb { E } \left[ T _ { i } ^ { ( d ) } \right] = k \mathbb { E } \left[ T _ { 1 } ^ { ( d ) } \right] } \end{array}$
558
+
559
+ Now, $\begin{array} { r } { \mathbb { E } \left[ T _ { 1 } ^ { ( d + 1 ) } \right] \geq \mathbb { E } \left[ \sum _ { i } 1 _ { ( 1 , i ) } T _ { i } ^ { ( d ) } \right] = k \mathbb { E } \left[ 1 _ { ( 1 , 1 ) } T _ { 1 } ^ { ( d ) } \right] } \end{array}$ where $1 _ { ( 1 , i ) }$ is the indicator function of neuron 1 in layer $d + 1$ being sensitive to neuron $i$ in layer $d$ .
560
+
561
+ But by the independence of these two events, $\mathbb { E } \left[ 1 _ { ( 1 , 1 ) } T _ { 1 } ^ { ( d ) } \right] = \mathbb { E } \left[ 1 _ { ( 1 , 1 ) } \right] \cdot \mathbb { E } \left[ T _ { 1 } ^ { ( d ) } \right]$ . But the firt time on the right hand side is $O ( 1 / \sqrt { k } )$ by (c), so putting it all together, $\mathbb { E } \left[ T _ { 1 } ^ { ( d + \bar { 1 } ) } \right] \geq \sqrt { k } \mathbb { E } \left[ T _ { 1 } ^ { ( d ) } \right]$ . Written in terms of the entire layer, we have $\mathbb { E } \left[ T ^ { ( d + 1 ) } \right] \geq { \sqrt { k } } \mathbb { E } \left[ T ^ { ( d ) } \right]$ as desired.
562
+
563
+ For $\sigma _ { b } > 0$ :
564
+
565
+ We replace $\sqrt { k }$ with $\sqrt { k ( 1 + \sigma _ { b } ^ { 2 } / \sigma _ { w } ^ { 2 } ) }$ , by noting that $Y \sim \mathcal { N } ( 0 , \sigma _ { w } ^ { 2 } + \sigma _ { b } ^ { 2 } )$ . This results in a growth rate of form $\begin{array} { r } { O ( \sqrt { k } / \sqrt { 1 + \frac { \sigma _ { b } ^ { 2 } } { \sigma _ { w } ^ { 2 } } } ) } \end{array}$ . □
566
+
567
+ # C PROOFS AND ADDITIONAL RESULTS FROM SECTION 2.3
568
+
569
+ # Proof of Theorem 3
570
+
571
+ Proof. We show inductively that $F _ { W }$ partitions the input space into convex polytopes via hyperplanes. Consider the image of the input space under the first hidden layer. Each neuron $v _ { i } ^ { ( 1 ) }$ defines hyperplane(s) on the input space: letting $W _ { i } ^ { ( 0 ) }$ be the ith row of $W ^ { ( 0 ) }$ , b(0) the bias, we have the hyperplane W (0)i ${ W _ { i } ^ { ( 0 ) } } x + b _ { i } = 0$ for a ReLU and hyperplanes ${ W _ { i } ^ { ( 0 ) } x + b _ { i } = \pm 1 }$ for a hard-tanh. Considering all such hyperplanes over neurons in the first layer, we get a hyperplane arrangement in the input space, each polytope corresponding to a specific activation pattern in the first hidden layer.
572
+
573
+ Now, assume we have partitioned our input space into convex polytopes with hyperplanes from layers ≤ d−1. Consider v(d)i and a specific polytope $R _ { i }$ . Then the activation pattern on layers $\leq d - 1$ is constant on $R _ { i }$ , and so the input to $v _ { i } ^ { ( d ) }$ on $R _ { i }$ is a linear function of the inputs $\textstyle \sum _ { j } \lambda _ { j } x _ { j } + b$ and some constant term, comprising of the bias and the output of saturated units. Setting this expression to zero (for ReLUs) or to $\pm 1$ (for hard-tanh) again gives a hyperplane equation, but this time, the equation is only valid in $R _ { i }$ (as we get a different linear function of the inputs in a different region.) So the defined hyperplane(s) either partition $R _ { i }$ (if they intersect $R _ { i }$ ) or the output pattern of $v _ { i } ^ { ( d ) }$ is . The theorem then follows.
574
+
575
+ This implies that any one dimensional trajectory $x ( t )$ , that does not ‘double back’ on itself (i.e. reenter a polytope it has previously passed through), will not repeat activation patterns. In particular, after seeing a transition (crossing a hyperplane to a different region in input space) we will never return to the region we left. A simple example of such a trajectory is a straight line:
576
+
577
+ Corollary 2. Transitions and Output Patterns in an Affine Trajectory For any affine one dimensional trajectory $x ( t ) = x _ { 0 } + t ( x _ { 1 } - x _ { 0 } )$ input into a neural network $F _ { W }$ , we partition $\mathbb { R } \ni t$ into intervals every time a neuron transitions. Every interval has a unique network activation pattern on $F _ { W }$ .
578
+
579
+ Generalizing from a one dimensional trajectory, we can ask how many regions are achieved over the entire input – i.e. how many distinct activation patterns are seen? We first prove a bound on the number of regions formed by $k$ hyperplanes in $\mathbb { R } ^ { m }$ (in a purely elementary fashion, unlike the proof presented in (Stanley, 2011))
580
+
581
+ Theorem 6. Upper Bound on Regions in a Hyperplane Arrangement Suppose we have $k$ hyperplanes in $\mathbb { R } ^ { m }$ - i.e. $k$ equations of form $\alpha _ { i } x = \beta _ { i }$ . for $\alpha _ { i } \in \mathbb { R } ^ { m }$ , $\beta _ { i } \in \mathbb { R }$ . Let the number of regions (connected open sets bounded on some sides by the hyperplanes) be $r ( k , m )$ . Then
582
+
583
+ $$
584
+ r ( k , m ) \leq \sum _ { i = 0 } ^ { m } { \binom { k } { i } }
585
+ $$
586
+
587
+ # Proof of Theorem 6
588
+
589
+ Proof. Let the hyperplane arrangement be denoted $\mathcal { H }$ , and let $H \in { \mathcal { H } }$ be one specific hyperplane. Then the number of regions in $\mathcal { H }$ is precisely the number of regions in $\mathcal { H } - H$ plus the number of
590
+
591
+ regions in $\mathcal { H } \cap H$ . (This follows from the fact that $H$ subdivides into two regions exactly all of the regions in $\mathcal { H } \cap H$ , and does not affect any of the other regions.)
592
+
593
+ In particular, we have the recursive formula
594
+
595
+ $$
596
+ r ( k , m ) = r ( k - 1 , m ) + r ( k - 1 , m - 1 )
597
+ $$
598
+
599
+ We now induct on $k + m$ to assert the claim. The base cases of $r ( 1 , 0 ) = r ( 0 , 1 ) = 1$ are trivial, and assuming the claim for $\leq k + m - 1$ as the induction hypothesis, we have
600
+
601
+ $$
602
+ \begin{array} { r l } { r ( k - 1 , m ) + r ( k - 1 , m - 1 ) \le \displaystyle \sum _ { i = 0 } ^ { m } { \binom { k - 1 } { i } } + \displaystyle \sum _ { i = 0 } ^ { m - 1 } { \binom { k - 1 } { i } } } & { } \\ { \le \binom { k - 1 } { 0 } + \displaystyle \sum _ { i = 0 } ^ { d - 1 } { \binom { k - 1 } { i } } + \binom { k - 1 } { i + 1 } } & { } \\ { \le \binom { k } { 0 } + \displaystyle \sum _ { i = 0 } ^ { m - 1 } { \binom { k } { i + 1 } } } & { } \end{array}
603
+ $$
604
+
605
+ where the last equality follows by the well known identity
606
+
607
+ $$
608
+ { \binom { a } { b } } + { \binom { a } { b + 1 } } = { \binom { a + 1 } { b + 1 } }
609
+ $$
610
+
611
+ This concludes the proof.
612
+
613
+ With this result, we can easily prove Theorem 4 as follows:
614
+
615
+ Proof. First consider the ReLU case. Each neuron has one hyperplane associated with it, and so by Theorem 6, the first hidden layer divides up the inputs space into $r ( k , m )$ regions, with $r ( k , m ) \leq$ $O ( k ^ { m } )$ .
616
+
617
+ Now consider the second hidden layer. For every region in the first hidden layer, there is a different activation pattern in the first layer, and so (as described in the proof of Theorem 3) a different hyperplane arrangement of $k$ hyperplanes in an $m$ dimensional space, contributing at most $r ( k , m )$ regions.
618
+
619
+ In particular, the total number of regions in input space as a result of the first and second hidden layers is $\leq r ( k , m ) * r ( k , m ) \leq O ( \bar { k } ^ { 2 } m )$ . Continuing in this way for each of the $n$ hidden layers gives the $O ( k ^ { m } n )$ bound.
620
+
621
+ A very similar method works for hard tanh, but here each neuron produces two hyperplanes, resulting in a bound of $O ( ( 2 k ) ^ { m n } )$ .
622
+
623
+ # D PROOFS AND ADDITIONAL RESULTS FROM SECTION 2.4
624
+
625
+ # D.1 UPPER BOUND FOR DICHOTOMIES
626
+
627
+ The Vapnik-Chervonenkis (VC) dimension of a function class is the cardinality of the largest set of points that it can shatter. The VC dimension provides an upper (worst case) bound on the generalization error for a function class (Vapnik and Vapnik, 1998). Motivated by generalization error, VC dimension has been studied for neural networks (Sontag, 1998; Bartlett and Maass, 2003). In (Bartlett et al., 1998) an upper bound on the VC dimension $v$ of a neural network with piecewise polynomial activation function and binary output is derived. For hard-tanh units, this bound is
628
+
629
+ $$
630
+ v = 2 \left| W \right| n \log \left( 4 e \left| W \right| n k \right) + 2 \left| W \right| n ^ { 2 } \log 2 + 2 n ,
631
+ $$
632
+
633
+ where $| W |$ is the total number of weights, $n$ is the depth, and $k$ is the width of the network. The VC dimension provides an upper bound on the number of achievable dichotomies $| \mathcal F |$ by way of the
634
+
635
+ ![](images/6192e61c35ecf0f7a6277938370bb38b56e24e212f9ba4791a6dcac9ffc0fc64.jpg)
636
+ Figure 10: Here we plot the number of unique dichotomies that have been observed as a function of the number of transitions the network has undergone. Each datapoint corresponds to the number of transitions and dichotomies for a hard-tanh network of a different depth, with the weights in the first layer undergoing interpolation along a great circle trajectory $W ^ { ( 0 ) } ( \bar { t } )$ . We compare these plots to a random walk simulation, where at each transition a single class label is flipped uniformly at random. Dichotomies are measured over a dataset consisting of $s = 1 5$ random samples, and all networks had weight variance $\sigma _ { w } ^ { 2 } = 1 6$ . The blue dashed line indicates all $2 ^ { s }$ possible dichotomies.
637
+
638
+ Sauer–Shelah lemma (Sauer, 1972),
639
+
640
+ $$
641
+ | \mathcal { F } | \leq \left( \frac { e | S | } { v } \right) ^ { v } .
642
+ $$
643
+
644
+ By combining Equations 4 and 5 an upper bound on the number of dichotomies is found, with a growth rate which is exponential in a low order polynomial of the network size.
645
+
646
+ Our results further suggest the following conjectures:
647
+
648
+ Conjecture 1. As network width $k$ increases, the exploration of the space of dichotomies increasingly resembles a simple random walk on a hypercube with dimension equal to the number of inputs $| S |$ .
649
+
650
+ This conjecture is supported by Figure 10, which compares the number of unique dichotomies achieved by networks of various widths to the number of unique dichotomies achieved by a random walk. This is further supported by an exponential decrease in autocorrelation length in function space, derived in our prior work (Poole et al., 2016).
651
+
652
+ Conjecture 2. The expressive power of a single weight $W _ { i j } ^ { ( d ) }$ at layer $d$ in a random network $F$ , and for a set of random inputs $S$ , is exponential in the remaining network depth $d _ { r } = ( n - d )$ . Here expressive power is the number of dichotomies achievable by adjusting only that weight.
653
+
654
+ That is, the expressive power of weights in early layers in a deep hard-tanh network is exponentially greater than the expressive power of weights in later layers. This is supported by the invariance to layer number in the recurrence relations used in all proofs directly involving depth. It is also directly supported by simulation, as illustrated in Figure 5, and by experiments on MNIST and CIFAR10 as illustrated in Figures 6, 7.
655
+
656
+ # E FURTHER RESULTS AND IMPLEMENTATION DETAILS FROM SECTION 3
657
+
658
+ We implemented the random network architecture described in Section 2.1. In separate experiments we then swept an input vector along a great circle trajectory (a rotation) for fixed weights, and swept weights along a great circle trajectory for a fixed set of inputs, as described in Section 2.4. In both cases, the trajectory was subdivided into $1 0 ^ { 6 }$ segments. We repeated this for a grid of network widths $k$ , weight variances $\sigma _ { w } ^ { 2 }$ , and number of inputs $s$ . Unless otherwise noted, $\sigma _ { b } = 0$ for all experiments. We repeated each experiment 10 times and averaged over the results. The simulation results are discussed and plotted throughout the text.
659
+
660
+ The networks trained on MNIST and CIFAR-10 were implemented using Keras and Tensorflow, and trained for a fixed number of epochs with the ADAM optimizer.
661
+
662
+ ![](images/baa3de5a4a17cf91ab849afbbccdc7ce819cc80e05dc786a91e745d83bd94c72.jpg)
663
+ Figure 11: An identical plot to Figure 8 but for transition count.
664
+
665
+ ![](images/b480816386068e1373f6c6d1d2105e87978aeea710d002bb3cbc0fd0624b9d17.jpg)
666
+ Figure 12: We repeat the experiment in Figure 6 for a convolutional network trained on CIFAR10. The network has eight convolutional hidden layers, with three by three filters and 64 filters in each layer, all with ReLU activations. The final layer is a fully connected softmax, and is trained in addition to the single convolutional layer being trained. The results again support greater expressive power with remaining depth. Note the final three convolutional layers failed to effectively train, and performed at chance level.
667
+
668
+ We also have preliminary experimental results on Convolutional Networks. To try and make the comparisons fair, we implemented a fully convolutional network (no fully connected layers except for the last layer).
669
+
670
+ We also include the plot showing the effect of training on number of transitions for interpolated MNIST and interpolated random points.
md/train/B1twdMCab/B1twdMCab.md ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DYNAMIC INTEGRATION OF BACKGROUNDKNOWLEDGE IN NEURAL NLU SYSTEMS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Common-sense or background knowledge is required to understand natural language, but in most neural natural language understanding (NLU) systems, the requisite background knowledge is indirectly acquired from static corpora. We develop a new reading architecture for the dynamic integration of explicit background knowledge in NLU models. A new task-agnostic reading module provides refined word representations to a task-specific NLU architecture by processing background knowledge in the form of free-text statements, together with the taskspecific inputs. Strong performance on the tasks of document question answering (DQA) and recognizing textual entailment (RTE) demonstrate the effectiveness and flexibility of our approach. Analysis shows that our models learn to exploit knowledge selectively and in a semantically appropriate way.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Understanding natural language depends crucially on common-sense or background knowledge, for example, knowledge about what concepts are expressed by the words being read (lexical knowledge), and what relations hold between these concepts (relational knowledge). As a simple illustration, if an agent needs to understand that the statement “King Farouk signed his abdication” is entailed by “King Farouk was exiled to France in 1952, after signing his resignation”, it must know (among other things) that abdication means resignation of a king.
12
+
13
+ In most neural natural language understanding (NLU) systems, the requisite background knowledge is implicitly encoded in the models’ parameters. That is, what background knowledge is present has been learned from task supervision and also by pre-training word embeddings (where distributional information reliably reflects certain kinds of useful background knowledge, such as semantic relatedness). However, acquisition of background knowledge from static training corpora is limiting for two reasons. First, we cannot expect that all background knowledge that could be important for solving an NLU task can be extracted from a limited amount of training data. Second, as the world changes, the facts that may influence how a text is understood will likewise change. In short: building suitably large corpora to capture all relevant information, and keeping the corpus and derived models up to date with changes to the world would be impractical.
14
+
15
+ In this paper, we develop a new architecture for dynamically incorporating external background knowledge in NLU models. Rather than relying only on static knowledge implicitly present in the training data, supplementary knowledge is retrieved from a knowledge base to assist with understanding text inputs. Since NLU systems must necessarily read and understand text inputs, our approach incorporates background knowledge by repurposing this reading machinery—that is, we read the text being understood together with supplementary natural language statements that assert facts (assertions) which are relevant to understanding the content (§2).
16
+
17
+ Our knowledge-augmented NLU systems operate in a series of phases. First, given the text input that the system must understand, which we call the context, a set of relevant supporting assertions is retrieved. While learning to retrieve relevant information for solving NLU tasks is an important question (Nogueira & Cho, 2017; Narasimhan et al., 2016, inter alia), in this work, we focus on learning how to incorporate retrieved information, and use simple heuristic retrieval methods to identify plausibly relevant background from an external knowledge base. Once the supplementary texts have been retrieved, we use a word embedding refinement strategy that incrementally reads the context and retrieved assertions starting with context-independent word embeddings and building successively refined embeddings of the words that ultimately reflect both the relevant supporting assertions and the input context (§3). These contextually refined word embeddings, which serve as dynamic memory to store newly incorporated knowledge, are used in any task-specific reading architecture. The overall architecture is illustrated in Figure 1. Although we are incorporating a new kind of information into the NLU pipeline, a strength of this approach is that the architecture of the reading module is independent of the final NLU task—the only requirement is that the final architecture use word embeddings.
18
+
19
+ We carry out experiments on several different datasets on the tasks of document question answering (DQA) and recognizing textual entailment (RTE) evaluating the impact of our proposed solution with both basic task architectures and a sophisticated task architecture for RTE (§4). We find that our embedding refinement strategy is quite effective (§5). On four standard benchmarks, we show that refinement helps—even refining the embeddings just using the context (and no additional background information) can improve performance significantly, and adding background knowledge helps further. Our results are very competitive, setting a new state-of-the-art on the recent TriviaQA benchmarks which is remarkable considering the simplicity of the chosen task-specific architecture. Finally, we provide a detailed analysis of how knowledge is being used by an RTE system (§6), including experiments showing that our system is capable of making appropriate counterfactual inferences when provided with “false knowledge”.
20
+
21
+ # 2 EXTERNAL KNOWLEDGE AS SUPPLEMENTARY TEXT INPUTS
22
+
23
+ Knowledge resources make information that could potentially be useful for improving NLU available in a variety different formats, such as (subject, predicate, object)-triples, relational databases, and other structured formats. Rather than tailoring our solution to a particular structured representation, we assume that all supplementary information either already exists in natural language statements or can easily be recoded as natural language. In contrast to mapping from unstructured to structured representations, the inverse problem is not terribly difficult. For example, given a triple (monkey, isA, animal) we can construct the free-text assertion “a monkey is an animal” using a few simple rules. Finally, the free-text format means that knowledge that exists only in unstructured text form is usable by our system.
24
+
25
+ A major question that remains to be answered is: given some text that is to be understood, what supplementary knowledge should be incorporated? The retrieval of contextually relevant information from knowledge sources is a complex research topic by itself, and it is likewise crucially dependent on the format of the underlying knowledge base. There are several statistical (Manning et al., 1999) and more recently neural approaches (Mitra & Craswell, 2017) and approaches based on reinforcement learning (Nogueira & Cho, 2017). In this work we make use of a simple heuristic from which we almost exhaustively retrieve all potentially relevant assertions (see $\ S 4$ ), and rely on our reading architecture to learn to extract only relevant information.
26
+
27
+ In the next section, we turn to the question of how to leverage the retrieved supplementary knowledge (encoded as text) in a NLU system.
28
+
29
+ # 3 REFINING WORD EMBEDDINGS BY READING
30
+
31
+ In order to incorporate information from retrieved input texts we propose to compute contextually refined word representations prior to processing the NLU task at hand and pass them to the task in the form of word embeddings. Word embeddings thus serve as a form of memory that not only contains general-purpose knowledge (as in typical neural NLU systems) but also contextual information (including retrieved background knowledge). Our incremental refinement process encodes input texts followed by updates on the word embedding matrix using the encoded input in multiple reading steps. Words are first represented non-contextually (i.e., standard word type embeddings), which can be conceived of as the columns in an embedding matrix $\mathbf { E } ^ { 0 }$ . At each progressive reading step $\ell \geq 1$ , a new embedding matrix $\mathbf { E } ^ { \ell }$ is constructed by refining the embeddings from the previous step ${ \bf E } ^ { \ell - 1 }$ using (user-specified) contextual information $\mathcal { X } ^ { \ell }$ for reading step $\ell$ , which is a set of natural language sequences (i.e., texts). An illustration of our incremental refinement strategy can be found in Figure 1.
32
+
33
+ ![](images/4179c2872f585c02c0f019940fd51a9a5ec1281c1d407152a918799ff98b5b8b.jpg)
34
+ Figure 1: Illustration of our context-dependent, refinement strategy for word representations on an example from the SNLI dataset comprising the premise, hypothesis and additional external information in form of free-text assertions. The reading architecture constructs refinements of word representations incrementally (conceptually represented as columns in a series of embedding matrices) $\mathbf { E } ^ { \ell }$ are incrementally refined by reading the input text and textual renderings of relevant background knowledge before computing the representations used by the task model (in this figure, RTE).
35
+
36
+ In the following, we define this procedure formally. We denote the hidden dimensionality of our model by $n$ and a fully-connected layer by $\mathrm { F C } ( \mathbf { z } ) = \mathbf { W } \mathbf { z } + \mathbf { b } , \mathbf { W } \in \mathbb { R } ^ { n \times m } , \mathbf { b } \in \mathbb { R } ^ { n } , \mathbf { u } \in \mathbb { R } ^ { m }$ .
37
+
38
+ # 3.1 UNREFINED WORD EMBEDDINGS $( \mathbf { E } ^ { 0 }$ )
39
+
40
+ The first representation level consists of non-contextual word representations, that is, word representations that do not depend on any input; these can be conceived of as an embedding matrix $\mathbf { E } ^ { 0 }$ whose columns are indexed by words in $\Sigma ^ { * }$ . The non-contextual word representation $\mathbf { e } _ { w } ^ { 0 }$ for a single word $w$ is computed by using a gated combination of fixed, pre-trained word vectors ${ \bf e } _ { w } ^ { p } \in \mathbb { R } ^ { n ^ { \prime } }$ with learned character-based embeddings $\mathbf { e } _ { w } ^ { c h a r } \in \mathbb { R } ^ { n }$ . The formal definition of this combination is given in Eq. 1:
41
+
42
+ $$
43
+ \begin{array} { r l } & { { \mathbf { e } _ { w } ^ { p ^ { \prime } } } = \mathrm { R e L U } ( { \mathrm { F C } } ( { { \mathbf { e } _ { w } ^ { p } } } ) ) } \\ & { { \mathbf { g } _ { w } } = \sigma \left( { \mathrm { F C } } \left[ \mathbf { e } _ { w } ^ { p ^ { \prime } } \right] \right) } \\ & { { \mathbf { e } _ { w } ^ { 0 } } = \mathbf { g } _ { w } \odot { \mathbf { e } _ { w } ^ { p ^ { \prime } } } + \left( \mathbf { 1 } - \mathbf { g } _ { w } \right) \odot { { \mathbf { e } _ { w } ^ { c h a r } } } . } \end{array}
44
+ $$
45
+
46
+ We compute $\mathbf { e } _ { w } ^ { c h a r }$ using a single-layer convolutional neural network using $n$ convolutional filters of width 5 followed by a max-pooling operation over time. Combining pre-trained with character based word embeddings in such a way is common practice. Our approach follows (Seo et al., 2017; Weissenborn et al., 2017).
47
+
48
+ # 3.2 CONTEXTUALLY REFINED WORD REPRESENTATIONS $( \mathbf { E } ^ { \ell } , \ell \geq 1 )$
49
+
50
+ In order to compute contextually refined word embeddings $\mathbf { E } ^ { \ell }$ given prior representations ${ \bf E } ^ { \ell - 1 }$ we assume a given set of texts $\mathcal { X } ^ { \ell } \overset { \cdot } { = } \{ \mathbf { x } _ { 1 } ^ { \ell } , \mathbf { x } _ { 2 } ^ { \ell } , \ldots \}$ that are to be read at refinement iteration $\ell$ . Each text $\mathbf { \Delta } \mathbf { x } _ { i } ^ { \ell }$ is a sequence of word tokens. We embed all tokens of every $\pmb { x } _ { i } ^ { \ell }$ using the embedding matrix from the previous layer, ${ \bf E } ^ { \ell - 1 }$ . To each word, we concatenate a one-hot vector of length $L$ with position $\ell$ set to 1, indicating which layer is currently being processed.1 Stacking the vectors into a matrix, we obtain a $\mathbf { X } _ { i } ^ { \ell } \in \mathbb { R } ^ { d \times | \mathbf { x } _ { i } ^ { \ell } | }$ . This matrix is processed by a bidirectional recurrent neural network, a BiLSTM (Hochreiter & Schmidhuber, 1997) in this work. The resulting output is further projected to $\hat { \mathbf { X } } _ { i } ^ { \ell }$ by a fully-connected layer followed by a ReLU non-linearity (Eq. 2).
51
+
52
+ $$
53
+ \hat { \mathbf { X } } _ { i } ^ { \ell } = \mathrm { R e L U } ( \mathrm { F C } ( \mathrm { B i L S T M } ( \mathbf { X } _ { i } ^ { \ell } ) ) )
54
+ $$
55
+
56
+ To finally update the previous embedding ${ \bf e } _ { w } ^ { \ell - 1 }$ of word $w$ , we initially maxpool all representations of occurrences matching the lemma of $w$ in every $\pmb { x } \in \mathcal { X } ^ { \ell }$ resulting in $\hat { \mathbf { e } } _ { w } ^ { \ell }$ (Eq. 3). Finally, we combine the context-independent representation ${ \bf e } _ { w }$ with $\hat { \mathbf { e } } _ { w }$ to form a context-sensitive representation ${ \mathbf { e } } _ { w } ^ { \ell }$ via a gated addition which lets the model determine how much to revise the embedding with the newly read information (Eq. 5).
57
+
58
+ $$
59
+ \begin{array} { r l } & { \hat { \mathbf { e } } _ { w } ^ { \ell } = \operatorname* { m a x } \left\{ \hat { \mathbf { x } } _ { k } ^ { \ell } \mid \mathbf { \Delta } x ^ { \ell } \in \mathcal { X } ^ { \ell } , \mathrm { l e m m a } ( x _ { k } ^ { \ell } ) = \mathrm { l e m m a } ( w ) \right\} } \\ & { \mathbf { \Delta } \mathbf { u } _ { w } ^ { \ell } = \sigma \left( \mathrm { F C } \left( \left[ \mathbf { \hat { e } } _ { w } ^ { \ell - 1 } \right] \right) \right) } \\ & { \mathbf { e } _ { w } ^ { \ell } = \mathbf { u } _ { w } ^ { \ell } \odot \mathbf { e } _ { w } ^ { \ell - 1 } + ( \mathbf { 1 } - \mathbf { u } _ { w } ^ { \ell } ) \odot \hat { \mathbf { e } } _ { w } ^ { \ell } } \end{array}
60
+ $$
61
+
62
+ Note that we soften the matching condition for $w$ using lemmatization, $\operatorname { l e m m a } ( w )$ , during the pooling operation of Eq. 3 because contextual information about certain words is usually independent of the current word form $w$ they appear in. As a consequence, this minor linguistic pre-processing step allows for additional interaction between tokens of the same lemma.
63
+
64
+ The important difference between our contextual refinement step and conventional multi-layer (RNN) architectures is the pooling operation that is performed over occurrences of tokens that share the same lemma. This effectively connects different positions within and between different texts with each other thereby mitigating the problems arising from long-distance dependencies. More importantly, however, it allows models to make use of additional input such as relevant background knowledge.
65
+
66
+ # 4 EXPERIMENTAL SETUP
67
+
68
+ We run experiments on four benchmarks for two popular tasks, namely recognizing textual entailment (RTE) and document question answering (DQA). In the following we describe different aspects of our experimental setup in more detail.
69
+
70
+ Task-specific Models Our primary interest is to explore the value of our refinement strategy with relatively generic task architectures. Therefore, we chose basic single-layer bidirectional LSTMs (BiLSTMs) as encoders with a task-specific, feed-forward neural network on top for the final prediction. Such models are common baselines for NLU tasks and can be considered general reading architectures as opposed to the more highly tuned, task-specific NLU systems that are necessary to achieve state-of-the art results. However, since such models frequently underperform more customized architectures, we also add our refinement module to a reimplementation of a state-of-the-art architecture for RTE called ESIM (Chen et al., 2017b).
71
+
72
+ All models are trained end-to-end jointly with the refinement module. For the DQA baseline system we add a simple lemma-in-question feature (liq) as suggested in Weissenborn et al. (2017) when encoding the context to compare against competitive baseline results. We provide the exact model implementations for our BiLSTM baselines and general training details in Appendix A.
73
+
74
+ Question Answering We apply our DQA models on 2 recent DQA benchmark datasets, SQuAD (Rajpurkar et al., 2016) and TriviaQA (Joshi et al., 2017). The task is to predict an answer span within a provided document $\pmb { p }$ given a question $\pmb q$ . Both datasets are large-scale, containing on the order of $1 0 0 \mathrm { k }$ examples. Because TriviaQA is collected via distant supervision the test set is divided into a large but noisy distant supervision part and a much smaller (on the order of hundreds) human verified part. We report results on both. See Appendix A.1 for implementation details.
75
+
76
+ Recognizing Textual Entailment We test on the frequently used SNLI dataset (Bowman et al., 2015), a collection of $5 7 0 k$ sentence pairs, and the more recent MultiNLI dataset $4 3 3 k$ sentence pairs) (Williams et al., 2017). Given two sentences, a premise $\pmb { p }$ and a hypothesis $\pmb q$ , the task is to determine whether $\pmb { p }$ either entails, contradicts or is neutral to $\pmb q$ . See Appendix A.2 for implementation details.
77
+
78
+ Knowledge Source We make use of ConceptNet2 (Speer & Havasi, 2012), a freely-available, multi-lingual semantic network that originated from the Open Mind Common Sense project and incorporates selected knowledge from various other knowledge sources, such as Wiktionary3, Open Multilingual WordNet4, OpenCyc and DBpedia5. It presents information in the form of relational triples.6
79
+
80
+ Assertion Retrieval We would like to obtain information about the relations of words and phrases between $\pmb q$ and $\pmb { p }$ from ConceptNet in order to strengthen the connection between the two sequences. Because assertions $\textbf { \em a }$ in ConceptNet come in form of (subject, predicate, object)-triples $( s , r , o )$ , we retrieve all assertions for which $s$ appears in $\pmb q$ and $o$ appears in $\pmb { p }$ , or vice versa. Because still too many such assertions might be retrieved for an instance, we rank all retrievals based on their respective subject and object. To this end we compute a ranking score which is the inverse product of appearances of the subject and the object in the KB, that is $\mathrm { s c o r e } ( a ) =$ $\begin{array} { r } { ( \sum _ { \pmb { a } ^ { \prime } } \mathbb { I } ( s _ { a ^ { \prime } } = s _ { a } ) \cdot \sum _ { \pmb { a } ^ { \prime } } \mathbb { I } ( o _ { a ^ { \prime } } = o _ { a } ) ) ^ { - 1 } } \end{array}$ , where I denotes the indicator function. This is very related to the popular idf score (inverted document frequency) from information retrieval which ranks terms higher that appear less frequently across different documents. During training and evaluation we only retain the top- $k$ assertions which we specify for the individual experiments separately. Note that (although very rarely) it might happen that no assertions are retrieved at all.
81
+
82
+ Refinement Order When employing our embedding-refinement strategy, we first read the document $( p )$ followed by the question $( q )$ in case of DQA, and the premise $( p )$ followed by the hypothesis $( q )$ for RTE, that is, ${ \boldsymbol { \mathcal { X } } } ^ { 1 } = \{ { \boldsymbol { p } } \}$ and $\mathcal { X } ^ { 2 } = \{ \pmb q \}$ . Additional knowledge in the form of a set of assertions $\mathcal { A }$ is integrated after reading the task-specific input for both DQA and RTE, that is, $\mathcal { X } ^ { 3 } = \mathcal { A }$ . In preliminary experiments we found that the final performance is not significantly sensitive to the order of presentation so we decided to fix our order as defined above.
83
+
84
+ Table 1: Results on the SQuAD development set as well as TriviaQA-Wikipedia and -Web test sets for $n = 3 0 0 -$ dimensional models. TriviaQA results are further divided by distant supervision results (left) and human verified results (right). The model using external knowledge is trained with the top-20/50 retrieved ConceptNet assertions. The liq-feature (lemma-in-question) is only used for the baseline. $^ { 1 } \mathrm { H u }$ et al. (2017), 2Wang et al. (2017), 3Pan et al. (2017).
85
+
86
+ <table><tr><td></td><td colspan="2">SQuAD Dev</td><td colspan="2">TriviaQA Wiki Test</td><td colspan="2">TriviaQA Web Test</td></tr><tr><td>Model</td><td>F1</td><td>Exact</td><td>F1</td><td>Exact</td><td>F1</td><td>Exact</td></tr><tr><td>BiLSTM + liq</td><td>74.3</td><td>63.7</td><td>50.9 / 55.1</td><td>45.2 /48.8</td><td>50.9 / 60.0</td><td>44.2/54.7</td></tr><tr><td>+ reading</td><td>77.8</td><td>67.3</td><td>54.1 / 59.6</td><td>47.5 / 52.2</td><td>54.7 / 65.9</td><td>48.1/60.3</td></tr><tr><td>+ reading + knowledge (20)</td><td>79.2</td><td>69.0</td><td>54.6/60.7</td><td>48.4 / 55.1</td><td>56.9 / 67.3</td><td>50.6 / 61.9</td></tr><tr><td>+ reading + knowledge (50)</td><td>79.6</td><td>69.4</td><td>55.1 / 59.9</td><td>48.6/ 53.4</td><td>56.7 / 68.0</td><td>50.6 / 63.2</td></tr><tr><td>SotA Results</td><td>81.81</td><td>73.21</td><td>46.9 / 55.83</td><td>43.2 /49.33</td><td>48.3/57.63</td><td>44.3/ 53.33</td></tr><tr><td></td><td>82.8²</td><td>75.62</td><td>52.9 / 59.51</td><td>46.9 / 54.51</td><td>52.9 /61.51</td><td>46.7 /57.01</td></tr></table>
87
+
88
+ # 5 RESULTS
89
+
90
+ # 5.1 QUESTION ANSWERING: SQUAD AND TRIVIAQA
91
+
92
+ Table 1 presents our results on two question answering benchmarks. We report results on the SQuAD development set7 and the two more challenging TriviaQA test sets which demonstrate that the introduction of our reading architecture helps consistently with additional gains from using background knowledge. Our systems do even outperform current state-of-the-art models on TriviaQA which is surprising given the simplicity of our task-specific architecture and the complexity of the others. For instance, the system of Hu et al. (2017) uses a complex multi-hop attention mechanism to achieve their results. Even our baseline BiLSTM $^ +$ liq system reaches very competitive results on TriviaQA which is in line with findings of Weissenborn et al. (2017). To verify that it is not the additional computation that gives the performance boosts when using only our reading architecture (without knowledge), we also ran experiments with 2-layer BiLSTMs $\left( + \mathrm { l i q } \right)$ for our baselines which exhibit similar computational complexity to BiLSTM $^ +$ reading. We found that the second layer even hurts performance. This demonstrates that pooling over word/lemma occurrences in a given context between layers, which constitutes the main difference to conventional stacked RNNs, is a powerful, yet simple technique. In any case, the most important finding of these experiments is that knowledge actually helps considerably with up to $2 . 2 / 2 . 9 \%$ improvements on the F1/Exact measures.
93
+
94
+ # 5.2 RECOGNIZING TEXTUAL ENTAILMENT: SNLI AND MULTINLI
95
+
96
+ Table 2 shows the results of our RTE experiments. In general, the introduction of our refinement strategy almost always helps, both with and without external knowledge. When providing additional background knowledge from ConceptNet, our BiLSTM based models improve substantially, while the ESIM-based models improve only on the more difficult MultiNLI dataset. Compared to previously published state-of-the-art systems, our models acquit themselves very well on the MultiNLI benchmark, and competitively on the SNLI benchmark. In parallel to this work, Gong et al. (2017) developed a novel task-specific architecture for RTE that achieves slightly better performance on MultiNLI than our ESIM+reading+knowledge based models.8 It is worth observing that with our knowledge-enhanced embedding architecture, our generic BiLSTM-based task model outperforms ESIM on MultiNLI, which is architecturally much more complex and designed specifically for the RTE task. Finally, we remark that despite careful tuning, our re-implementation of ESIM fails to
97
+
98
+ Table 2: Results on the SNLI as well as MultiNLI-Matched and -Mismatched for $n \_ =$ 300−dimensional models. The model using external knowledge is trained with the top-20 retrieved ConceptNet assertions. 1Chen et al. (2017b), 2Gong et al. (2017). 3Chen et al. (2017a).
99
+
100
+ <table><tr><td></td><td colspan="2">SNLI</td><td colspan="2">MNLI Matched</td><td colspan="2">MNLIMismatched</td></tr><tr><td>Model</td><td>Dev</td><td>Test</td><td>Dev</td><td>Test</td><td>Dev</td><td>Test</td></tr><tr><td>BiLSTM</td><td>84.4</td><td>83.4</td><td>70.0</td><td>69.8</td><td>70.2</td><td>69.4</td></tr><tr><td>+ reading</td><td>86.1</td><td>85.4</td><td>75.3</td><td>75.8</td><td>76.3</td><td>74.9</td></tr><tr><td>+ reading + knowledge</td><td>86.5</td><td>85.7</td><td>76.8</td><td>77.3</td><td>77.5</td><td>76.3</td></tr><tr><td>ESIM</td><td>88.2</td><td>87.2</td><td>76.8</td><td>76.3</td><td>77.3</td><td>75.8</td></tr><tr><td>+ reading</td><td>88.0</td><td>87.3</td><td>77.8</td><td>77.8</td><td>78.4</td><td>77.0</td></tr><tr><td>+ reading + knowledge</td><td>87.8</td><td>87.3</td><td>78.8</td><td>78.2</td><td>78.8</td><td>77.0</td></tr><tr><td>SotA Results</td><td></td><td>88.03</td><td></td><td>74.52</td><td></td><td>73.52</td></tr><tr><td></td><td>1 1</td><td>88.61</td><td></td><td>78.83</td><td>1</td><td>77.83</td></tr></table>
101
+
102
+ <table><tr><td>Dim/Data</td><td>1/1k</td><td>3/3k</td><td>10/10k</td><td>30/30k</td><td>100/100k</td><td>300/Full</td></tr><tr><td colspan="7">SNLI</td></tr><tr><td>ESIM</td><td>52.2</td><td>59.3</td><td>69.7</td><td>75.5</td><td>81.3</td><td>88.2</td></tr><tr><td>+ reading</td><td>60.9(+8.7)</td><td>66.0(+6.7)</td><td>71.0(+1.3)</td><td>75.0(-0.5)</td><td>80.6(-0.7)</td><td>88.0(-0.2)</td></tr><tr><td>+ reading + knowledge</td><td>62.9(+2.0)</td><td>68.6(+2.6)</td><td>73.8(+2.8)</td><td>77.4(+2.4)</td><td>81.3(+0.7)</td><td>87.8(-0.2)</td></tr><tr><td colspan="7">MultiNLI Matched + Mismatched</td></tr><tr><td>ESIM</td><td>44.3</td><td>50.0</td><td>55.5</td><td>61.9</td><td>68.1</td><td>76.9</td></tr><tr><td>+ reading</td><td>51.8(+7.5)</td><td>55.8(+5.8)</td><td>60.1(+4.6)</td><td>65.0(+3.1)</td><td>70.7(+2.6)</td><td>78.1(+1.2)</td></tr><tr><td>+ reading + knowledge</td><td>52.4(+0.6)</td><td>57.9(+2.1)</td><td>62.4(+2.3)</td><td>66.6(+1.6)</td><td>71.3(+0.6)</td><td>78.8(+0.7)</td></tr></table>
103
+
104
+ Table 3: Development set results when reducing training data and embedding dimsensionality with PCA. In parenthesis we report the relative differences to the respective result directly above.
105
+
106
+ match the $8 8 \%$ reported in Chen et al. (2017b); however, with MultiNLI, we find that our implementation of ESIM performs considerably better (by approximately $5 \%$ ). The instability of the results suggests, as well as the failure of a custom RTE-architecture to consistently perform well suggests that current SotA RTE models may be overfit to the SNLI dataset.
107
+
108
+ # 5.3 REDUCING TRAINING DATA & DIMENSIONALITY OF PRE-TRAINED WORD EMBEDDINGS
109
+
110
+ We find that there is only little impact when using external knowledge on the RTE task when using a more sophisticated task model such as ESIM. We hypothesize that the attention mechanisms within ESIM jointly with powerful, pre-trained word representations allow for the recovery of some important lexical relations when trained on a large dataset. It follows that by reducing the number of training data and impoverishing pre-trained word representations the impact of using external knowledge should become larger.
111
+
112
+ To test this hypothesis, we gradually impoverish pre-trained word embeddings by reducing their dimensionality with PCA while reducing the number of training instances at the same time.9 Our joint data and dimensionality reduction results are presented in Table 3. They show that there is indeed a slightly larger benefit when employing background knowledge in the more impoverished settings with largest improvements over using only the novel reading architecture when using around $1 0 \mathrm { k }$ examples and reduced dimensionality to 10. However, we observe that the biggest overall impact over the baseline ESIM model stems from our contextual refinement strategy (reading) which is especially pronounced for the 1k and $3 \mathrm { k }$ experiments. This highlights once more the usefulness of our refinement strategy even without the use of additional knowledge.
113
+
114
+ <table><tr><td>p:</td><td>His off-the-cuff style seems am- ateurish [...]</td><td>the net cost of oper- ations.</td><td>but uh these guys [...] file their uh their final exams [.]</td></tr><tr><td>h:</td><td>He didn&#x27;t look like an amateur</td><td>The gross cost. gross antonym net</td><td>These men filed their midterm exams [...] midterm antonym final</td></tr><tr><td>a: →</td><td>look like synonym seem contradiction</td><td>contradiction</td><td>contradiction</td></tr><tr><td>a: →</td><td>look like antonym seem entailment</td><td>gross synonym net entailment</td><td>midterm synonym final entailment</td></tr></table>
115
+
116
+ ![](images/56196af4a40baf9b7d85efc1729eba839557a4afe84711536e71e75d2cfd2253.jpg)
117
+ Table 4: Three examples for the antonym synonym swapping experiment on MultiNLI. p-premise, h-hypothesis, a-assertion, ¯a-swapped assertion.
118
+ Figure 2: Performance differences when ignoring certain types of knowledge, i.e., relation predicates during evaluation. Normalized performance differences are measured on the subset of examples for which an assertion of the respective relation predicate occurs.
119
+
120
+ # 6 ANALYSIS OF KNOWLEDGE UTILIZATION
121
+
122
+ Is additional knowledge used? To verify whether and how our models make use of additional knowledge, we conducted several experiments. First, we evaluated models trained with knowledge on our tasks while not providing any knowledge at test time. This ablation drops performance by $3 . 7 { - } 3 . 9 \%$ accuracy on MultiNLI, and by $4 \%$ F1 on SQuAD. This indicates the model is refining the representations using the provided assertions in a useful way.
123
+
124
+ Are models sensitive to semantics of the provided knowledge? The previous result does not show that the models utilize the provided assertions in any consistent way (it may just reflect a mismatch of training and testing conditions). Therefore, to test our models sensitivity towards the semantics of the assertions, we run an experiment in which we swap the synonym with the antonym predicate in the provided assertions during test time. Because of our heuristic retrieval mechanism, not all such “counterfactuals” will affect the truth of the inference, but we still expect to see a more significant impact. The performance drop on MultiNLI examples for which either a synonym or an antonym-assertion is retrieved is about $10 \%$ for both the BiLSTM and the ESIM model. This very large drop clearly shows that our models are sensitive to the semantics of the provided knowledge. Examples of prediction changes are presented in Table 4. They demonstrate that the system has learned to trust the presented assertions to the point that it will make appropriate counterfactual inferences—that is, the change in knowledge has caused the change in prediction.
125
+
126
+ What knowledge is used? After establishing that our models are somehow sensitive to semantics we wanted to find out which type of knowledge is important for which task. For this analysis we exclude assertions including the most prominent predicates in our knowledge base individually when evaluating our models. The results are presented in Figure 2. They demonstrate that the biggest performance drop in total (blue bars) stems from related to assertions. This very prominent predicate appears much more frequently than other assertions and helps connecting related parts of the 2 input sequences with each other. We believe that related to assertions offer benefits mainly from a modeling perspective by strongly connecting the input sequences with each other and thus bridging long-range dependencies similar to attention. Looking at the relative drops obtained by normalizing the performance differences on the actually affected examples (green) we find that our models depend highly on the presence of antonym and synonym assertions for all tasks as well as partially on is a and derived from assertions. This is an interesting finding which shows that the sensitivity of our models is selective wrt. the type of knowledge and task. The fact that the largest relative impact stems from antonyms is very interesting because it is known that such information is hard to capture with distributional semantics contained in pre-trained word embeddings.
127
+
128
+ # 7 RELATED WORK
129
+
130
+ The role of background knowledge in natural language understanding has long been remarked on, especially in the context of classical models of AI (Schank & Abelson, 1977; Minsky, 2000); however, it has only recently begun to play a role in neural network models of NLU (Ahn et al., 2016; Xu et al., 2016; Long et al., 2017; Dhingra et al., 2017). However, previous efforts have focused on specific tasks or certain kinds of knowledge, whereas we take a step towards a more general-purpose solution for the integration of heterogeneous knowledge for NLU systems by providing a simple, general-purpose reading architecture that can read background knowledge encoded in simple natural language statements, e.g., “abdication is a type of resignation”.
131
+
132
+ Bahdanau et al. (2017) use textual word definitions as a source of information about the embeddings of OOV words. In the area of visual question answering Wu et al. (2016) utilize external knowledge in form of DBpedia comments (short abstracts/definitions) to improve the answering ability of a model. Marino et al. (2017) explicitly incorporate knowledge graphs into an image classification model. Xu et al. (2016) created a recall mechanism into a standard LSTM cell that retrieves pieces of external knowledge encoded by a single representation for a conversation model. Concurrently, Dhingra et al. (2017) exploit linguistic knowledge using MAGE-GRUs, an adapation of GRUs to handle graphs, however, external knowledge has to be present in form of triples. The main difference to our approach is that we incorporate external knowledge in free text form on the word level prior to processing the task at hand which constitutes a more flexible setup. Ahn et al. (2016) exploit knowledge base facts about mentioned entities for neural language models. Bahdanau et al. (2017) and Long et al. (2017) create word embeddings on-the-fly by reading word definitions prior to processing the task at hand. Pilehvar et al. (2017) seamlessly incorporate information about word senses into their representations before solving the downstream NLU task, which is similar. We go one step further by seamlessly integrating all kinds of fine-grained assertions about concepts that might be relevant for the task at hand.
133
+
134
+ Another important aspect of our approach is the notion of dynamically updating wordrepresentations. Tracking and updating concepts, entities or sentences with dynamic memories is a very active research direction (Kumar et al., 2016; Henaff et al., 2017; Ji et al., 2017; Kobayashi et al., 2017). However, those works typically focus on particular tasks whereas our approach is taskagnostic and most importantly allows for the integration of external background knowledge. Other related work includes storing temporary information in weight matrices instead of explicit neural activations (such as word representations) as a biologically more plausible alternative.
135
+
136
+ # 8 CONCLUSION
137
+
138
+ We have presented a novel task-agnostic reading architecture that allows for the dynamic integration of background knowledge into neural NLU models. Our solution, which is based on the incremental refinement of word representations by reading supplementary inputs, is flexible and be used with virtually any existing NLU architecture that rely on word embeddings as input. Our results show that embedding refinement using both the system’s text inputs, as well as supplementary texts encoding background knowledge can yield large improvements. In particular, we have shown that relatively simple task architectures (e.g., based on simple BiLSTM readers) can become competitive with state-of-the-art, task-specific architectures when augmented with our reading architecture.
139
+
140
+ # ACKNOWLEDGMENTS
141
+
142
+ # REFERENCES
143
+
144
+ Sungjin Ahn, Heeyoul Choi, Tanel Parnamaa, and Yoshua Bengio. A neural knowledge language ¨ model. arXiv, 2016.
145
+
146
+ Dzmitry Bahdanau, Tom Bosc, Stanisław Jastrzebski, Edward Grefenstette, Pascal Vincent, and Yoshua Bengio. Learning to compute word embeddings on the fly. arXiv, 2017.
147
+
148
+ Samuel R Bowman, Gabor Angeli, Potts Christopher, and Christopher D Manning. A large annotated corpus for learning natural language inference. In EMNLP. Association for Computational Linguistics, 2015.
149
+
150
+ Qian Chen, Xiaodan Zhu, Zhen-Hua Ling, Si Wei, Hui Jiang, and Diana Inkpen. Recurrent neural network-based sentence encoder with gated attention for natural language inference. arXiv, 2017a.
151
+
152
+ Qian Chen, Xiaodan Zhu, Zhenhua Ling, Si Wei, and Hui Jiang. Enhancing and Combining Sequential and Tree LSTM for Natural Language Inference. ACL, 2017b.
153
+
154
+ Bhuwan Dhingra, Zhilin Yang, William W Cohen, and Ruslan Salakhutdinov. Linguistic Knowledge as Memory for Recurrent Neural Networks. arXiv, 2017.
155
+
156
+ Yichen Gong, Heng Luo, and Jian Zhang. Natural language inference over interaction space. arXiv, 2017.
157
+
158
+ Mikael Henaff, Jason Weston, Arthur Szlam, Antoine Bordes, and Yann LeCun. Tracking the world state with recurrent entity networks. In ICLR, 2017.
159
+
160
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 1997.
161
+
162
+ Minghao Hu, Yuxing Peng, and Xipeng Qiu. Reinforced mnemonic reader for machine comprehension. arXiv, 2017.
163
+
164
+ Yangfeng Ji, Chenhao Tan, Sebastian Martschat, Yejin Choi, and Noah A Smith. Dynamic entity representations in neural language models. In EMNLP, 2017.
165
+
166
+ Mandar Joshi, Eunsol Choi, Daniel S. Weld, and Luke Zettlemoyer. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In ACL, July 2017.
167
+
168
+ Diederik Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. ICLR, 2015.
169
+
170
+ Sosuke Kobayashi, Naoaki Okazaki, and Kentaro Inui. A neural language model for dynamically representing the meanings of unknown words and entities in a discourse. arXiv preprint arXiv:1709.01679, 2017.
171
+
172
+ Ankit Kumar, Ozan Irsoy, Peter Ondruska, Mohit Iyyer, James Bradbury, Ishaan Gulrajani, Victor Zhong, Romain Paulus, and Richard Socher. Ask me anything: Dynamic memory networks for natural language processing. In ICML, pp. 1378–1387, 2016.
173
+
174
+ Teng Long, Emmanuel Bengio, Ryan Lowe, Jackie Chi Kit Cheung, and Doina Precup. World knowledge for reading comprehension: Rare entity prediction with hierarchical lstms using external descriptions. In EMNLP, 2017.
175
+
176
+ Christopher D Manning, Hinrich Schutze, et al. ¨ Foundations of statistical natural language processing, volume 999. MIT Press, 1999.
177
+
178
+ Kenneth Marino, Ruslan Salakhutdinov, and Abhinav Gupta. The more you know: Using knowledge graphs for image classification. CVPR, 2017.
179
+
180
+ Marvin Minsky. Commonsense-based interfaces. Communications of the ACM, 2000.
181
+
182
+ Bhaskar Mitra and Nick Craswell. Neural models for information retrieval. arXiv preprint arXiv:1705.01509, 2017.
183
+
184
+ Karthik Narasimhan, Adam Yala, and Regina Barzilay. Improving information extraction by acquiring external evidence with reinforcement learning. In EMNLP, 2016.
185
+ Rodrigo Nogueira and Kyunghyun Cho. Task-oriented query reformulation with reinforcement learning. In EMNLP, 2017.
186
+ Boyuan Pan, Hao Li, Zhou Zhao, Bin Cao, Deng Cai, and Xiaofei He. Memen: Multi-layer embedding with memory networks for machine comprehension. arXiv, 2017.
187
+ Jeffrey Pennington, Richard Socher, and Christopher D. Manning. Glove: Global vectors for word representation. In EMNLP, 2014.
188
+ Mohammad Taher Pilehvar, Jose Camacho-Collados, Roberto Navigli, and Nigel Collier. Towards a seamless integration of word senses into downstream nlp applications. In ACL, 2017.
189
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. In SQuAD: 100,000+ Questions for Machine Comprehension of Text, 2016.
190
+ Tim Rocktaschel, Edward Grefenstette, Karl Moritz Hermann, Tom ¨ as Kocisk ´ y, and Phil Blunsom. ´ Reasoning about entailment with neural attention. ICLR, 2015.
191
+ Roger Schank and Robert Abelson. Scripts, Plans, Goals, and Understanding. Psychology Press, 1977.
192
+ Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hananneh Hajishirzi. Bi-Directional Attention Flow for Machine Comprehension. In ICLR, 2017.
193
+ Robert Speer and Catherine Havasi. Representing General Relational Knowledge in ConceptNet 5. In LREC, 2012.
194
+ Wenhui Wang, Nan Yang, Furu Wei, Baobao Chang, and Ming Zhou. Gated self-matching networks for reading comprehension and question answering. In ACL, 2017.
195
+ Dirk Weissenborn, Georg Wiese, and Laura Seiffe. Making Neural QA as Simple as Possible but not Simpler. In CoNLL, 2017.
196
+ Adina Williams, Nikita Nangia, and Samuel R Bowman. A broad-coverage challenge corpus for sentence understanding through inference. arXiv, 2017.
197
+ Qi Wu, Peng Wang, Chunhua Shen, Anton van den Hengel, and Anthony Dick. Ask Me Anything: Free-form Visual Question Answering Based on Knowledge from External Sources. CVPR, 2016.
198
+ Zhen Xu, Bingquan Liu, Baoxun Wang, Chengjie Sun, and Xiaolong Wang. Incorporating LooseStructured Knowledge into LSTM with Recall Gate for Conversation Modeling. arXiv, 2016.
199
+
200
+ # A IMPLEMENTATION DETAILS
201
+
202
+ In the following we explain the detailed implementation of our two task-specific, baseline models. We assume to have computed the contextually (un-)refined word representations depending on the setup and embedded our input sequences $\pmb q = ( q _ { 1 } , . . . , q _ { L _ { Q } } )$ and $\pmb { p } = ( p _ { 1 } , . . . , p _ { L _ { P } } )$ to $\mathbf { Q } \in \mathbf { \mathbb { R } } ^ { n \times L _ { Q } }$ and $\mathbf { P } \in \mathbb { R } ^ { n \times L _ { P } }$ , respectively. The word representation update gate in Eq. 4 is initialized with a bias of 1 to refine representations only slightly in the beginning of training. In the following as before, we denote the hidden dimensionality of our model by $n$ and a fully-connected layer by $\mathrm { F C } ( \mathbf { z } ) = \mathbf { W } \mathbf { z } + \mathbf { b }$ , $\mathbf { W } \in \mathbb { R } ^ { n \times m }$ , $\mathbf { b } \in \mathbb { R } ^ { n } , \mathbf { u } \in \mathbb { R } ^ { m }$ .
203
+
204
+ # A.1 QUESTION ANSWERING
205
+
206
+ Encoding In the DQA task $\pmb q$ refers to the question and $\pmb { p }$ to the supporting text. At first we process both sequences by identical BiLSTMs in parallel (Eq. 6) followed by separate linear projections (Eq. 7) .
207
+
208
+ $$
209
+ \begin{array} { r l r l r l } & { \hat { \mathbf { Q } } = \mathrm { B i L S T M } ( \mathbf { Q } ) } & { \quad } & { \hat { \mathbf { P } } = \mathrm { B i L S T M } ( \mathbf { P } ) } & { \quad } & { \hat { \mathbf { Q } } \in \mathbb { R } ^ { 2 n \times L _ { Q } } , \ \hat { \mathbf { P } } \in \mathbb { R } ^ { 2 n \times L _ { P } } } \\ & { \tilde { \mathbf { Q } } = \mathbf { U } _ { Q } \hat { \mathbf { Q } } } & { \quad } & { \tilde { \mathbf { P } } = \mathbf { U } _ { P } \hat { \mathbf { P } } } & { \quad } & { \tilde { \mathbf { Q } } \in \mathbb { R } ^ { n \times L _ { Q } } , \ \tilde { \mathbf { P } } \in \mathbb { R } ^ { n \times L _ { P } } , } \end{array}
210
+ $$
211
+
212
+ ${ \bf U } _ { Q } , { \bf U } _ { P } \in \mathbb { R } ^ { n \times 2 n }$ are initialized by $[ I ; I ]$ where $I \in \mathbb { R } ^ { n \times n }$ is the identity matrix.
213
+
214
+ Prediction Our prediction– or answer layer is the same as in Weissenborn et al. (2017). We first compute a weighted, $n$ -dimensional representation $\tilde { \pmb q }$ of the processed question $\tilde { \mathbf { Q } }$ (Eq. 8).
215
+
216
+ $$
217
+ \begin{array} { l l } { \displaystyle \alpha = \mathrm { s o f t m a x } ( \mathbf { v } _ { q } \tilde { \mathbf { Q } } ) } & { , \mathbf { v } _ { q } \in \mathbb { R } ^ { n } } \\ { \displaystyle \tilde { \mathbf { q } } = \sum _ { i } \alpha _ { i } \tilde { \mathbf { q } } _ { i } } \end{array}
218
+ $$
219
+
220
+ The probability distribution ${ p _ { s } } / p _ { e }$ for the start/end location of the answer is computed by a 2-layer MLP with a ReLU activated, hidden layer $s _ { j }$ as follows:
221
+
222
+ $$
223
+ \begin{array} { r } { \begin{array} { c } { \mathbf { s } _ { j } = \mathrm { R e L U } \left( \mathrm { F C } _ { s } \left( \left[ \begin{array} { c } { \tilde { \mathbf { p } } _ { j } } \\ { \tilde { \mathbf { q } } } \\ { \tilde { \mathbf { p } } _ { j } \odot \tilde { \mathbf { q } } } \end{array} \right] \right) \right) } \\ { p _ { s } ( j ) \propto \mathrm { e x p } ( \mathbf { v } _ { s } \mathbf { s } _ { j } ) \qquad \mathbf { v } _ { s } \in \mathbb { R } ^ { n } } \end{array} \qquad \begin{array} { c } { \mathbf { e } _ { j } = \mathrm { R e L U } \left( \mathrm { F C } _ { e } \left( \left[ \begin{array} { c } { \tilde { \mathbf { p } } _ { j } } \\ { \tilde { \mathbf { q } } } \\ { \tilde { \mathbf { p } } _ { j } \odot \tilde { \mathbf { q } } } \end{array} \right] \right) \right) } \\ { p _ { e } ( j ) \propto \mathrm { e x p } ( \mathbf { v } _ { e } \mathbf { s } _ { j } ) \qquad \mathbf { v } _ { e } \in \mathbb { R } ^ { n } } \end{array} } \end{array}
224
+ $$
225
+
226
+ The model is trained to minimize the cross-entropy loss of the predicted start and end positions, respectively. During evaluation we extract the span $( i , k )$ with the best span-score $p _ { s } ( i ) \cdot p _ { e } ( k )$ of maximum token length $k - i = 1 6$ .
227
+
228
+ # A.2 RECOGNIZING TEXTUAL ENTAILMENT
229
+
230
+ Encoding Analogous to DQA we encode our input sequences by BiLSTMs, however, for RTE we use conditional encoding (Rocktaschel et al., 2015) instead. Therefore, we initially process the ¨ embedded hypothesis $\mathbf { Q }$ by a BiLSTM and use the respective end states of the forward and backward LSTM as initial states for the forward and backward LSTM that processes the embedded premise $\mathbf { P }$ .
231
+
232
+ Prediction We concatenate the outputs of the forward and backward LSTMs processing the premise $\pmb { p }$ , i.e., $\left[ \tilde { \mathbf { p } } _ { t } ^ { f w } ; \tilde { \mathbf { p } } _ { t } ^ { b w } \right] \ \in \ \mathbb { R } ^ { 2 n }$ and run each of the resulting $L _ { P }$ outputs through a fullyconnected layer with ReLU activation $\left( \mathbf { h } _ { t } \right)$ followed by a max-pooling operation over time resulting in a hidden state $\mathbf { h } \in \mathbb { R } ^ { n }$ . Finally, $\mathbf { h }$ is used to predict the RTE label as follows:
233
+
234
+ $$
235
+ \begin{array} { r l } & { \mathbf { h } _ { t } = \mathrm { R e L U } \left( \mathrm { F C } \left( \left[ \boldsymbol { \tilde { \mathbf { p } } } _ { t } ^ { f w } \right] \right) \right) } \\ & { \mathbf { h } = \mathrm { m a x p o o l } \ \mathbf { h } _ { t } } \\ & { p ( c ) \propto \exp ( \mathbf { v } _ { c } \mathbf { h } ) , \ \mathbf { v } _ { c } \in \mathbb { R } ^ { n } } \end{array}
236
+ $$
237
+
238
+ The probability of choosing category $c \in \{$ {entailment, contradiction, neutral $\}$ is defined in Eq. 10. Finally, the model is trained to minimize the cross-entropy loss of the predicted category probability distribution $p$ .
239
+
240
+ # A.3 TRAINING
241
+
242
+ As pre-processing steps we lowercase all inputs and tokenize it. Additionally, we make use of lemmatization as described $\ S 3 . 2$ in which is necessary for matching. As pre-trained word representations we use 300-dimensional word-embeddings from Glove (Pennington et al., 2014). We employed ADAM (Kingma & Ba, 2015) for optimization with an initial learning-rate of $1 0 ^ { - 3 }$ which was halved whenever the F1 measure (DQA) or the accuracy (RTE) dropped on the development set between 1000/2000 minibatches for DQA and RTE respectively. We used mini-batches of size 16 for DQA and 64 for RTE. Additionally, for regularization we make use of dropout with a rate of 0.2 on the computed non-contextual word representations ${ \bf e } _ { w }$ defined in $\ S 3 . 1$ with the same dropout mask for all words in a batch. All our models were trained with 3 different random seeds and the top performance is reported.
md/train/BJehNfW0-/BJehNfW0-.md ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DO GANS LEARN THE DISTRIBUTION? SOME THEORY AND EMPIRICS
2
+
3
+ # Sanjeev Arora
4
+
5
+ Department of Computer Science Princeton University Princeton, NJ 08544, USA arora@cs.princeton.edu
6
+
7
+ Andrej Risteski
8
+ Applied Mathematics Department and IDSS
9
+ Massachusetts Institute of Technology
10
+ Cambridge, MA 02139, USA
11
+ risteski@mit.edu
12
+
13
+ # Yi Zhang
14
+
15
+ Department of Computer Science Princeton University Princeton, NJ 08544, USA y.zhang@cs.princeton.edu
16
+
17
+ # ABSTRACT
18
+
19
+ Do GANS (Generative Adversarial Nets) actually learn the target distribution? The foundational paper of Goodfellow et al. (2014) suggested they do, if they were given “sufficiently large” deep nets, sample size, and computation time. A recent theoretical analysis in Arora et al. (2017) raised doubts whether the same holds when discriminator has bounded size. It showed that the training objective can approach its optimum value even if the generated distribution has very low support —in other words, the training objective is unable to prevent mode collapse. The current paper makes two contributions. (1) It proposes a novel test for estimating support size using the birthday paradox of discrete probability. Using this evidence is presented that well-known GANs approaches do learn distributions of fairly low support. (2) It theoretically studies encoder-decoder GANs architectures (e.g., BiGAN/ALI), which were proposed to learn more meaningful features via GANs and (consequently) to also solve the mode-collapse issue. Our result shows that such encoder-decoder training objectives also cannot guarantee learning of the full distribution because they cannot prevent serious mode collapse. More seriously, they cannot prevent learning meaningless codes for data, contrary to usual intuition.
20
+
21
+ # 1 INTRODUCTION
22
+
23
+ From the earliest papers on Generative Adversarial Networks the question has been raised whether or not they actually come close to learning the distribution they are trained with (henceforth refered to as the target distribution)? These methods train a generator deep net that converts a random seed into a realistic-looking image. Concurrently they train a discriminator deep net to discriminate between its output and real images, which in turn is used to produce gradient feedback to improve the generator net. In practice the generator deep net starts producing realistic outputs by the end, and the objective approaches its optimal value. But does this mean the deep net has learnt the target distribution of real images? Standard analysis introduced in Goodfellow et al. (2014) shows that given “sufficiently large” generator and discriminator, sample size, and computation time the training does succeed in learning the underlying distribution arbitrarily closely (measured in JensenShannon divergence). But this does not settle the question of what happens with realistic sample and net sizes.
24
+
25
+ Note that GANs differ from many previous methods for learning distributions in that they do not provide an estimate of a measure of distributional fit —e.g., perplexity score. Therefore researchers have probed their performance using surrogate qualitative tests, which were usually designed to rule out the most obvious failure mode of the training, namely, that the GAN has simply memorized the training data. One test checks the similarity of each generated image to the nearest images in the training set. Another takes two random seeds $s _ { 1 } , s _ { 2 }$ that produced realistic images and checks the images produced using seeds lying on the line joining $s _ { 1 } , s _ { 2 }$ . If such “interpolating” images are reasonable and original as well, then this may be taken as evidence that the generated distribution has many novel images. Yet other tests check for existence of semantically meaningful directions in the latent space, meaning that varying the seed along these directions leads to predictable changes e.g., (in case of images of human faces) changes in facial hair, or pose. A recent test proposed by Wu et al. (2016) checks the log-likelihoods of GANs using Annealed Importance Sampling, whose results indicate the mismatch between generator’s distribution and the target distribution. Poole et al. (2016) proposed a method to trade-off between sample quality and sample diversity but they don’t provide a clear definition or a quantitative metric of sample diversity.
26
+
27
+ Recently a new theoretical analysis of GANs with finite sample sizes and finite discriminator size Arora et al. (2017) revealed the possibility that training objective can sometimes approach optimality even if the generator is far from having actually learnt the distribution. Specifically, if the discriminator has size $p$ , then the training objective could be $\epsilon$ close to optimal even though the output distribution is supported on only $O ( \bar { p } \log p / \epsilon ^ { 2 } )$ images. By contrast one imagines that the target distribution usually must have very large support. For example, the set of all possible images of human faces (a frequent setting in GANs work) must involve all combinations of hair color/style, facial features, complexion, expression, pose, lighting, race, etc., and thus the possible set of images of faces approaches infinity. The above paper raises the possibility that the discriminator may be unable to meaningfully distinguish such a diverse target distribution from a trained distribution with fairly small support. Furthermore, the paper notes that this failure mode is different from the one usually feared, namely the generator memorizing training samples. The analysis of Arora et al. (2017) raises the possibility that the trained distribution has small support, and yet all its samples could be completely disjoint from the training samples.
28
+
29
+ However, the above analysis was only a theoretical one, exhibiting a particular near-equilibrium solution that can happen from certain hyper-parameter combinations. It left open the possibility that real-life GANs training avoids such solutions thanks to some not-as-yet-understood property of SGD, or hyper-parameter choices. Thus further experimental investigation seems necessary. And yet it seems difficult at first sight to do such an empirical evaluation of the support size of a distribution: it is not humanly possible to go through hundreds of thousands of images, whereas automated tests of image similarity can be thrown off by small changes in lighting, pose etc.
30
+
31
+ The current paper makes two important contributions. On the empirical side it introduces a new test for the support size of the trained distribution, and uses it to find that unfortunately these mode collapse problems do arise in many well-regarded GAN training methods. On the theoretical side we prove the limitations of encoder-decoder frameworks like BiGAN (Donahue et al., 2017) and Adversarially Learned Inference or ALI (Dumoulin et al., 2017), which, inspired by autoencoder models, require the setup to learn an inference mechanism as well as a generative mechanism. The result of Arora et al. (2017) applies only to standard GAN training objectives (including JS and Wasserstein), but not to encoder-decoder setups. The clear hope in defining encoder-decoder setups is that the encoding mechanism “inverts” the generator and thus forces the generator to learn meaningful featurizations of data that are useful in downstream applications. In fact it has often been proposed that this need to learn meaningful featurizations will also solve the mode collapse problem: (Dumoulin et al., 2017) provide experiments on 2-dimensional mixtures of Gaussians suggesting this phenomenon. Our analysis shows not only that encoder-decoder training objectives cannot avoid mode collapse, but that they also cannot enforce learning of meaningful codes/features.
32
+
33
+ # 1.1 BIRTHDAY PARADOX TEST FOR SUPPORT SIZE
34
+
35
+ Let’s consider a simple test that estimates the support size of a discrete distribution. Suppose a√ distribution has support $N$ . The famous birthday paradox1 says that a batch of about $\sqrt { N }$ samples would be likely to have a duplicate. Thus our proposed birthday paradox test for GANs is as follows.
36
+
37
+ # Birthday Paradox Test
38
+
39
+ (a) Sample a batch of $s$ images from the generator.
40
+ (b) Use an automated measure of image similarity to flag the $\sim 2 0$ most similar pairs in the batch.
41
+ (c) Visually inspect the flagged pairs and check for duplicates.
42
+ (d) Repeat.
43
+
44
+ If this test reveals that batches of size $s$ have duplicate images with good probability, then suspect that the distribution has support size about $s ^ { 2 }$ . Note that the test is not definitive, because the distribution could assign a probability $1 0 \%$ to a single image, and be uniform on a huge number of other images. Then the test would be likely to find a duplicate even with 20 samples, though the true support size is huge. But such nonuniformity (a lot of probability being assigned to a few images) is the only failure mode of the birthday paradox test calculation, and such nonuniformity would itself be considered a failure mode of GANs training. This is captured in the following theorems:
45
+
46
+ Theorem 1. Given a discrete probability distribution $P$ on a set $\Omega$ , if there exists a subset $S \subseteq \Omega$ of size $N$ such that $\begin{array} { r } { \sum _ { s \in S } P ( s ) \bar { \geq } \rho , } \end{array}$ , then the probability of encountering at least one collision among $M$ i.i.d. samples from $\begin{array} { r } { P i s \ge 1 - \exp \bigl ( - \frac { ( M ^ { 2 } - M ) \rho } { 2 N } \bigr ) } \end{array}$
47
+
48
+ Theorem 2. Given a discrete probability distribution $P$ on a set $\Omega ,$ , if the probability of encountering at least one collision among $M$ i.i.d. samples from $P$ is $\gamma ,$ , then for $\rho = 1 - o ( 1 )$ , there exists $a$ subset $S \subseteq \Omega$ such that $\begin{array} { r } { \sum _ { s \in S } P ( s ) \ge \rho w i t h s i z e \le \frac { 2 M \rho ^ { 2 } } { ( - 3 + \sqrt { 9 + \frac { 2 4 } { M } \ln \frac { 1 } { 1 - \gamma } } ) - 2 M ( 1 - \rho ) ^ { 2 } } } \end{array}$ , under realistic assumptions on parameters.
49
+
50
+ The proofs of these theorems are included in Appendix A. It is important to note that Theorem 1 and 2 do not assume that the tested distribution is uniform. In fact, Theorem 2 clarifies that if one can consistently see collisions in batches, then the distribution has a major component distribution that has limited support size but is almost indistinguishable from the full distribution via sampling a small number of samples. Thus the distribution effectively has small support size, which is what one should care about when sampling from it. Furthermore, without any further assumption, to accurately estimate the support size of an arbitrary distribution that has $n$ modes, $\Omega ( n / \log n )$ samples need to be seen, rendering it practically infeasible for a human examiner (Valiant & Valiant, 2011).
51
+
52
+ # 2 BIRTHDAY PARADOX TEST FOR GANS: EXPERIMENTAL DETAILS
53
+
54
+ In the GAN setting, the distribution is continuous, not discrete. When support size is infinite then in a finite sample, we should not expect exact duplicate images where every pixel is identical. Thus a priori one imagines the birthday paradox test to completely not work. But surprisingly, it still works if we look for near-duplicates. Given a finite sample, we select the 20 closest pairs according to some heuristic metric, thus obtaining a candidate pool of potential near-duplicates inspect. Then we visually identify if any of them would be considered duplicates by humans. Our test were done using two datasets, CelebA (faces) (Liu et al., 2015) and CIFAR-10 (Krizhevsky, 2009) . Note that CelebA reasonably balanced, since the constructors intentionally made it unbiased (it contains ten thousand identities, each of which has twenty images). Also, we report in Appendix B results on the Bedroom dataset from the LSUN (Yu et al., 2015).
55
+
56
+ For faces, we find Euclidean distance in pixel space works well as a heuristic similarity measure, probably because the samples are centered and aligned. For CIFAR-10, we pre-train a discriminative CNN for the full classification problem, and use the top layer representation as an embedding. Heuristic similarity is then measured as the Euclidean distance in the embedding space. These metrics can be crude, but note that improving them can only lower our estimate of the support size, since a better similarity measure can only increase the number of duplicates found. Thus our reported estimates should be considered as upper bounds on the support size of the distribution.
57
+
58
+ Note: Some GANs (and also older methods such as variational autoencoders) implicitly or explicitly apply noise to the training and generated images. This seems useful if the goal is to compute a perplexity score, which involves the model being able to assign a nonzero probability to every image.
59
+
60
+ Such noised images are usually very blurry and the birthday paradox test does not work well for them, primarily because the automated measure of similarity no longer works well. Even visually judging similarity of noised images is difficult. Thus our experiments work best with GANs that generate sharper, realistic images.
61
+
62
+ # 2.1 RESULTS ON CELEBA DATASET
63
+
64
+ We test the following methods, doing the birthday paradox test with Euclidean distance in pixel space as the heuristic similarity measure For judging whether two images are the same, we set the criterion that the two faces are not exactly identical but look like doppelgangers. (Of course, in real life the only doppelgangers we know are usually twins.)
65
+
66
+ • DCGAN —unconditional, with JSD objective as described in Goodfellow et al. (2014) and Radford et al. (2015).
67
+ • $\mathrm { M I X } +$ GAN protocol introduced in Arora et al. (2017), specifically, MIX $+$ DCGAN with 3 mixture components.
68
+ • ALI (Dumoulin et al., 2017) (or equivalently BiGANs (Donahue et al., 2017)).2
69
+
70
+ For fair comparison, we set the discriminator of ALI (or BiGANs) to be roughly the same in size as that of the DCGAN model, since the results of Section 2.1.1 below suggests that the discriminator size has a strong effect on diversity of the learnt distribution.
71
+
72
+ We find that with probability $\geq 5 0 \%$ , a batch of $\sim 8 0 0$ samples contains at least one pair of duplicates for both DCGAN and MIX $+$ DCGAN. Figure 1 displays duplicates and their nearest neighbors in training set. These results suggest that the support size of the distribution is less than $8 0 0 ^ { 2 } \approx 6 4 0 0 0 0$ , being at the same order of the size of the training set, but this distribution is not just memorizing the training set (see the dashed boxes).
73
+
74
+ ALI (or BiGANs) appears to be more diverse, in that collisions appear with $5 0 \%$ probability only with a batch size of 1200, implying a support size of a million. This is 6x the training set, but still much smaller than the diversity one would expect among human faces3. Nevertheless, these tests do support the suggestion in Dumoulin et al. (2017) and Donahue et al. (2017) that the bidirectional structure prevents some of the mode collapse observed in usual GANs.
75
+
76
+ # 2.1.1 DIVERSITY VS DISCRIMINATOR SIZE
77
+
78
+ The analysis of Arora et al Arora et al. (2017) suggested that the support size could be as low as near-linear in the capacity of the discriminator; in other words, there is a near-equilibrium in which a distribution of such a small support could suffice to fool the best discriminator. So it is worth investigating whether training in real life allows generator nets to exploit this “loophole” in the training that we now know is in principle available to them.
79
+
80
+ While a comprehensive test is beyond the scope of this paper, we do a first test with a simplistic version of discriminator size (i.e., capacity). We build DCGANs with increasingly larger discriminators while fixing the other hyper-parameters. The discriminator used here is a 5-layer Convolutional Neural Network such that the number of output channels of each layer is $1 \times , 2 \times , 4 \times , 8 \times d i m$ where dim is chosen to be 16, 24, . . . , 120, 128. Thus the discriminator size should be proportional to $d i m ^ { 2 }$ . Figure 2 suggests that in this simple setup the diversity of the learnt distribution does indeed grow near-linearly with the discriminator size.
81
+
82
+ # 2.2 RESULTS FOR CIFAR-10
83
+
84
+ On CIFAR-10, Euclidean distance in pixel space is not informative. So we adopt a classifying CNN with 3 convolutional layers, 2 fully-connected layer and a 10-class soft-max output pretrained with a multi-class classification objective, and use its top layer features as embeddings for similarity test using Euclidean distance. Firstly, we find that the result of the test is affected by the quality of samples. If the training uses noised samples (with noise being added either explicitly or implicitly in the objective) then the generated samples are also quite noisy. Then the most similar samples in a batch tend to be blurry blobs of low quality. Indeed, when we test a DCGAN (even the best variant with 7.16 Inception Score reported in Huang et al. (2016)), the pairs returned are mostly blobs.
85
+
86
+ ![](images/8c91f1594d9e91edd4e6cc6191589853afaa61e45429ed93a20f37b50b4a9bf6.jpg)
87
+ Figure 1: Most similar pairs found in batches of 800 generated faces samples from a DCGAN, a MIX $\dotplus$ DCGAN (with 3 component) and an ALI. Each pair is from a different batch. Shown in dashed boxes are the nearest neighbors in training data.
88
+
89
+ ![](images/87ea0319de44ee6e301898d95a72d704c53012dc96f41513814c445137e2bf58.jpg)
90
+ Figure 2: Diversity’s dependence on discriminator size. The diversity is measured as the square of the batch size needed to encounter collision w.p. $\geq 5 0 \%$ v.s. size of discriminator.
91
+
92
+ To get meaningful test results, we turn to a Stacked GAN which is the state-of-the-art generative model on CIFAR-10 (Inception Score 8.59 (Huang et al., 2016)). It also generates the most reallooking images. Since this model is trained by conditioning on class label, we measure its diversity within each class separately. The batch sizes needed for duplicates are shown in Table 1. Duplicate samples shown in Figure 3.
93
+
94
+ Table 1: Class specific batch size needed to encounter duplicate samples with $> 5 0 \%$ probability, from a Stacked GAN trained on CIFAR-10
95
+
96
+ <table><tr><td rowspan=1 colspan=1>Aeroplane</td><td rowspan=1 colspan=1>Auto-Mobile</td><td rowspan=1 colspan=1>Bird</td><td rowspan=1 colspan=1>Cat</td><td rowspan=1 colspan=1>Deer</td><td rowspan=1 colspan=1>Dog</td><td rowspan=1 colspan=1>Frog</td><td rowspan=1 colspan=1>Horse</td><td rowspan=1 colspan=1>Ship</td><td rowspan=1 colspan=1>Truck</td></tr><tr><td rowspan=1 colspan=1>500</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>500</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>500</td><td rowspan=1 colspan=1>300</td><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>200</td><td rowspan=1 colspan=1>500</td><td rowspan=1 colspan=1>100</td></tr></table>
97
+
98
+ ![](images/d0e837fdc8641815e1db8fc001e0f7e71bf7f90c4183ff97f04fc48de57c968f.jpg)
99
+ Figure 3: Duplicate pairs found in a batch of 1000 generated CIFAR-10 samples from a Stacked GAN.a)-b):pairs of duplicate samples; c): nearest neighbor of b) in the training set.
100
+
101
+ We check whether the detected duplicates are close to any of the training images, by looking for the nearest neighbor in the training set using our heuristic similarity measure and visually inspecting the closest suspects. We find that the closest image is quite different from the duplicates, suggesting the issue with GANs is indeed lack of diversity (low support size) instead of memorizing training set.
102
+
103
+ # 3 LIMITATIONS OF ENCODER-DECODER GAN ARCHITECTURES
104
+
105
+ We recall the Adversarial Feature Learning (BiGAN) setup from Donahue et al. (2017). The “generative” player consists of two parts: a generator $G$ and an encoder $E$ . The generator takes as input a latent variable $z$ and produces a sample $G ( z )$ ; the encoder takes as input a data sample $x$ and produces a guess for the latent variable $E ( x )$ . This produces two joint distributions over pairs of latent variables and data samples: $( z , G ( z ) )$ and $( E ( x ) , x )$ . The goal of the ��generative” player is to convince the discriminator that these two distributions are the same, whereas the discriminator is being trained to distinguish between them. In the ideal case, the hope is that the “generative” player converges to $( z , G ( z ) )$ and $( E ( x ) , x )$ both being jointly distributed as $p ( z , x )$ where $p$ is the joint distribution of the latent variables and data – i.e. $G ( z )$ is distributed as $p ( x | z )$ : the true generator distribution; and $E ( x )$ is distributed as $p ( z | x )$ : the true encoder distribution.
106
+
107
+ Using usual min-max formalism for adversarial training, the BiGAN objective is written as:
108
+
109
+ $$
110
+ \operatorname* { m i n } _ { G , E } \operatorname* { m a x } _ { D } | \ \operatorname* { \mathbb { E } } _ { x \sim \hat { \mu } } \phi ( D ( x , E ( x ) ) ) - \operatorname* { \mathbb { E } } _ { z \sim \hat { \nu } } \phi ( D ( G ( z ) , z ) ) |
111
+ $$
112
+
113
+ where $\hat { \mu }$ is the empirical distribution over data samples $x$ ; $\hat { \nu }$ is a distribution over random “seeds” for the latent variables: typically sampled from a simple distribution like a standard Gaussian; and $\phi$ is a concave “measuring” function. (The standard choice is log, though other options have been proposed in the literature.) For our purposes, we will assume that $\phi$ outputs values in the range $[ - \Delta , \Delta ] , \Delta \geq 1$ , and is $L _ { \phi }$ -Lipschitz.
114
+
115
+ For ease of exposition we will refer to $\mu$ as the image distribution. The proof is more elegant if we assume that $\mu$ consists of images that have been noised —concretely, think of replacing every 100th pixel by Gaussian noise. Such noised images would of course look fine to our eyes, and we would expect the learnt encoder/decoder to not be affected by this noise. For concreteness, we will take the seed/code distribution $\nu$ to be a spherical zero-mean Gaussian (in an arbitrary dimension and with an arbitrary variance). 4
116
+
117
+ Furthermore, we will assume that Domain $( \mu ) = \mathbb { R } ^ { d }$ , $\mathrm { D o m a i n } ( \nu ) = \mathbb { R } ^ { \tilde { d } }$ with $\tilde { d } < d$ (we think of $\widetilde d \ll d$ , which is certainly the case in practice). As in Arora et al. (2017) we assume that discriminators are $L$ -lipschitz with respect to their trainable parameters, and the support size of the generator’s distribution will depend upon this $L$ and the capacity $p$ $\left( = \right.$ number of parameters) of the discriminator.
118
+
119
+ Theorem 3 (Main). There exists a generator $G$ of support $\frac { p \Delta ^ { 2 } \log ^ { 2 } ( p \Delta L L _ { \phi } / \epsilon ) } { \epsilon ^ { 2 } }$ and an encoder $E$ with at most $\tilde { d }$ non-zero weights, s.t. for all discriminators $D$ that are $L$ -Lipschitz and have capacity less than $p$ , it holds that
120
+
121
+ $$
122
+ \begin{array} { r } { | \underset { x \sim \mu } { \mathbb { E } } \phi ( D ( x , E ( x ) ) ) - \underset { z \sim \nu } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) | \leq \epsilon } \end{array}
123
+ $$
124
+
125
+ The interpretation of the above theorem is as stated before: the encoder $E$ has very small complexity (we will subsequently specify it precisely and show it simply extracts noise from the input $x$ ); the generator $G$ is a small-support distribution (so presumably far from the true data distribution). Nevertheless, the value of the BiGAN objective is small. The argument of Arora et al. (2017) seems unable to apply to this setting. It is a simple concentration/epsilon-net argument showing that the discriminator of capacity $p$ cannot distinguish between a generator that samples from $\mu$ versus one that memorizes a subset of $\frac { p \log p } { \epsilon ^ { 2 } }$ random images in $\mu$ and outputs one randomly from this subset. By contrast, in the current setting we need to say what happens with the encoder.
126
+
127
+ The precise noise model: Denoting by $\tilde { \mu }$ the distribution of unnnoised images, and $\nu$ the distribution of seeds/codes, we define the distribution of noised images $\mu$ as the following distribution: to produce a sample in $\mu$ take a sample $\tilde { x }$ from $\tilde { \mu }$ and $z$ from $\nu$ independently and output $x = \tilde { x } \circledast z$ , which is defined as
128
+
129
+ $$
130
+ x _ { i } = \left\{ \begin{array} { l l } { z _ { \frac { i } { \lfloor \frac { d } { \tilde { d } } \rfloor } } , } & { \mathrm { i f ~ } i \equiv 0 ( \bmod \lfloor \frac { d } { { \tilde { d } } } \rfloor ) } \\ { \tilde { x } _ { i } , } & { \mathrm { o t h e r w i s e } } \end{array} \right.
131
+ $$
132
+
133
+ In other words, set every $\textstyle { \big \lfloor } { \frac { d } { \tilde { d } } } { \big \rfloor }$ -th to one of the coordinates of $z$ . In practical settings, $\widetilde d \ll d$ is usually chosen, so noising $\tilde { d }$ coordinates out of all $d$ will have no visually noticeable effect. 5
134
+
135
+ 3.1 PROOF SKETCH, THEOREM 3; DETAILED PROOF IN APPENDIX
136
+
137
+ The main idea is to show the existence of the generator/encoder pair via a probabilistic construction that is shown to succeed with high probability.
138
+
139
+ • Encoder $E$ : The encoder just extracts the noise from the noised image (by selecting the relevant $\tilde { d }$ coordinates). Namely, $E ( \tilde { x } \circledast z ) = z$ . (So the code is just gaussian noise and has no meaningful content.) It’s easy to see this can be captured using a ReLU network with $\tilde { d }$ weights: we can simply connect the $i$ -th output to the $( i \lfloor \frac { d } { \tilde { d } } \rfloor )$ -th input using an edge of weight 1.
140
+
141
+ • Generator $G$ : This is designed to produce a distribution of support size $m : =$ p∆2 log2(p∆LLφ/)2 . We first define a partition of Domain(ν) = Rd˜ into m equal-measure blocks under $\nu$ . Next, we sample $m$ samples $x _ { 1 } ^ { * } , x _ { 2 } ^ { * } , \ldots , x _ { m } ^ { * }$ from the image distribution. which z lies, and define the generator as G(z) = x∗ind(z) to be the index of the block in the partition in . Since the set of samples $x _ { i } ^ { * } : i \in [ m ]$ is random, this specifies a distribution over generators. We prove that with high probability, one of these generators satisfies the statement of Theorem 3. Moreover, we show that such a generator can be easily implemented using a ReLU network of complexity $O ( m d )$ in Theorem 5.
142
+
143
+ The basic intuition of the proof is as follows. We will call a set $T$ of samples from $\nu$ non-colliding if no two lie in the same block. Let $\mathcal { T } _ { n c }$ be the distribution over non-colliding sets $\{ z _ { 1 } , z _ { 2 } , \dots , z _ { m } \}$ , s.t. each $z _ { i }$ is sampled independently from the conditional distribution of $\nu$ inside the i-th block.
144
+
145
+ First, we notice that under the distribution for $G$ we defined, it holds that
146
+
147
+ $$
148
+ \underset { x \sim \mu } { \mathbb { E } } \phi ( D ( x , E ( x ) ) ) = \underset { x \sim \tilde { \mu } , z \sim \nu } { \mathbb { E } } \phi ( D ( x \circledast z , z ) ) = \underset { G } { \mathbb { E } } \underset { z \sim \nu } { \mathbb { E } } \phi ( G ( z ) , z )
149
+ $$
150
+
151
+ In other words, the “expected” encoder correctly matches the expectation of $\phi ( D ( x , E ( x ) ) )$ , so that the discriminator is fooled. We want to show that $\mathbb { E } _ { G } \mathbb { E } _ { z \sim \nu } \phi ( G ( z ) , z )$ concentrates enough around this expectation, as a function of the randomness in $G$ , so that we can say with high probability over the choice of $G$ , $| \mathbb { E } _ { x \sim \mu } \phi ( D ( x , E ( x ) ) ) - \mathbb { E } _ { z \sim \nu } \phi ( G ( z ) , z ) |$ is small. We handle the concentration argument in two steps:
152
+
153
+ First, we note that we can calculate the expectation of $\phi \bigl ( D ( G ( z ) , z ) \bigr )$ when $z \sim \nu$ by calculating the empirical expectation over $m$ -sized non-colliding sets $T$ sampled according to $\mathcal { T } _ { n c }$ . Namely, as we show in Lemma D.1:
154
+
155
+ $$
156
+ \begin{array} { r } { \underset { z \sim \nu } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) = \underset { T \sim { \mathcal { T } _ { n c } } z \sim T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) } \end{array}
157
+ $$
158
+
159
+ Thus, we have reduced our task to arguing about the concentration of $\mathbb { E } _ { T \sim \mathcal { T } _ { n c } } \mathbb { E } _ { z \sim T } \phi ( D ( G ( z ) , z ) )$ (viewed as a random variable in $G$ ). Towards this, we consider the random variable $\mathbb { E } _ { z \sim T } \phi ( D ( G ( z ) , z ) )$ as a function of the randomness in $G$ and $T$ both. Since $T$ is a non-colliding set of samples, we can write
160
+
161
+ $$
162
+ \underset { z \sim T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) = f ( x _ { i } ^ { * } , z _ { i } , i \in [ m ] )
163
+ $$
164
+
165
+ for some function $f$ , where the random variables $\boldsymbol { x } _ { i } ^ { * }$ , $z _ { i }$ are all mutually independent – thus use McDiarmid’s inequality to argue about the concentration of $f$ in terms of both $T$ and $G$ .
166
+
167
+ From this, we can use Markov’s inequality to argue that all but an exponentially small (in $p$ ) fraction of encoders $G$ satisfy that: for all but an exponentially small (in $p _ { \ell }$ ) fraction of non-colliding sets $T$ , $| \mathbb { E } _ { z \sim T } \phi ( D ( G ( z ) , z ) ) - \mathbb { E } _ { G } \mathbb { E } _ { T \sim T _ { n c } } \mathbb { E } _ { z \sim T } \phi ( D ( G ( z ) , z ) ) |$ is small. Note that this has to hold for all discriminators $D - { \bf s } 0$ we need to additionally build an epsilon-net, and union bound over all discriminators, similarly as in Arora et al. (2017). Then, it’s easy to extrapolate that for such $G$ ,
168
+
169
+ $$
170
+ \big | \operatorname* { \mathbb { E } } _ { T \sim \mathcal { T } _ { n c } } \operatorname* { \mathbb { E } } _ { z \sim T } \phi ( D ( G ( z ) , z ) ) - \operatorname* { \mathbb { E } } _ { G } \operatorname* { \mathbb { E } } _ { T \sim \mathcal { T } _ { n c } } \operatorname* { \mathbb { E } } _ { z \sim T } \phi ( D ( G ( z ) , z ) ) |
171
+ $$
172
+
173
+ is small, as we want. The details are in Lemma D.2 in the Appendix.
174
+
175
+ # 4 CONCLUSIONS
176
+
177
+ The paper reveals gaps in current thinking about GANs, and hopes to stimulate further theoretical and empirical study. GANs research has always struggled with the issue of mode collapse, and recent theoretical analysis of Arora et al. (2017) shows that the GANs training objective is not capable of preventing mode collapse. This exhibits the existence of bad solutions in the optimization landscape. This in itself is not definitive, since existence of bad solutions is also known for the more traditional classification tasks Zhang et al. (2017), where heldout sets can nevertheless prove that a good solution has been reached. The difference in case of GANs is lack of an obvious way to establish that training succeeded.
178
+
179
+ Our new Birthday Paradox test gives a new benchmark for testing the support size (i.e., diversity of images) in a distribution. Though it may appear weak, experiments using this test suggest that current GANs approaches, specifically, the ones that produce images of higher visual quality, do suffer mode collapse. Our rough experiments also suggest —again in line with the previous theoretical analysis—that the size of the distribution’s support scales near-linearly with discriminator capacity.
180
+
181
+ Researchers have raised the possibility that the best use of GANs is not distribution learning but feature learning. Encoder-decoder GAN architectures seem promising since they try to force the generator to use “meaningful” encodings of the image. While such architectures do exhibit slightly better diversity in our experiments, our theoretical result suggest that the the encoder-decoder objective is also unable to avoid mode collapse, furthermore, also fails to guarantee meaningful codes.
182
+
183
+ # REFERENCES
184
+
185
+ Sanjeev Arora, Rong Ge, Yingyu Liang, Tengyu Ma, and Yi Zhang. Generalization and equilibrium in generative adversarial nets (gans). arXiv preprint arXiv:1703.00573, 2017.
186
+
187
+ Jeff Donahue, Philipp Krahenb ¨ uhl, and Trevor Darrell. Adversarial feature learning. In ¨ International Conference on Learning Features (ICLR), 2017.
188
+
189
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. In International Conference on Learning Features (ICLR), 2017.
190
+
191
+ 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.
192
+
193
+ Xun Huang, Yixuan Li, Omid Poursaeed, John Hopcroft, and Serge Belongie. Stacked generative adversarial networks. arXiv preprint arXiv:1612.04357, 2016.
194
+
195
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In International Conference on Learning Representations (ICLR), 2014.
196
+
197
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
198
+
199
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 2015.
200
+
201
+ Ben Poole, Alexander A Alemi, Jascha Sohl-Dickstein, and Anelia Angelova. Improved generator objectives for gans. arXiv preprint arXiv:1612.02780, 2016.
202
+
203
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
204
+
205
+ Gregory Valiant and Paul Valiant. Estimating the unseen: an n/log (n)-sample estimator for entropy and support size, shown optimal via new clts. In Proceedings of the forty-third annual ACM symposium on Theory of computing, pp. 685–694. ACM, 2011.
206
+
207
+ Michael J Wiener. Bounds on birthday attack times. 2005.
208
+
209
+ Yuhuai Wu, Yuri Burda, Ruslan Salakhutdinov, and Roger Grosse. On the quantitative analysis of decoder-based generative models. arXiv preprint arXiv:1611.04273, 2016.
210
+
211
+ Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
212
+
213
+ C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017.
214
+
215
+ # A BIRTHDAY PARADOX CALCULATION
216
+
217
+ In this section, we prove the statemts of Theorems 1 and 2.
218
+
219
+ Proof of Theorem 1.
220
+
221
+ $$
222
+ \begin{array} { l } { \displaystyle \geq 1 - 1 \times ( 1 - \frac { \rho } { N } ) \times ( 1 - \frac { 2 \rho } { N } ) \times \cdots \times ( 1 - \frac { ( M - 1 ) \rho } { N } ) } \\ { \displaystyle \geq 1 - \exp ( - \frac { ( M ^ { 2 } - M ) \rho } { 2 N } ) } \end{array}
223
+ $$
224
+
225
+ We use the fact that the worst case is when the $\rho$ probability mass is uniformly distributed on $S$
226
+
227
+ Proof of Theorem 2. Suppose $X _ { 1 } , X _ { 2 } , \ldots$ are i.i.d. samples from the discrete distribution $P$ . We define $T \ = \ \operatorname* { i n f } \{ t \ \geq \ 2 , X _ { t } \ \in \ \{ X _ { 1 } , X _ { 2 } , \ldots , X _ { t - 1 } \} \}$ to be the collision time and also we use $\beta ~ = ~ { \frac { 1 } { \operatorname* { P r } [ T = 2 ] } } ~ = ~ { \frac { 1 } { \sum _ { X \in \Omega } P ( X ) ^ { 2 } } }$ = P 1P (X)2 as a surrogate for the uniformity of P . According Theorem 3 in Wiener (2005), √ $P r [ T \geq M ]$ can be upper-bounded using $\beta$ . Specifically, with $\beta > 1 0 0 0$ and $M \leq 2 { \sqrt { \beta \ln \beta } }$ , which is usually true when $P$ is the distribution of a generative model of images,
228
+
229
+ $$
230
+ \mathrm { P r } [ T \ge M ] \ge \exp ( - \frac { M ^ { 2 } } { 2 \beta } - \frac { M ^ { 3 } } { 6 \beta ^ { 2 } } )
231
+ $$
232
+
233
+ To estimate $\beta$ , we notice that
234
+
235
+ $\operatorname* { P r } [ T \geq M ] = 1 - \operatorname* { P r } [ T \leq M ] = 1 - \operatorname* { P r }$ [there is at least a collision among $M ] = 1 - \gamma \geq \exp ( - \frac { M ^ { 2 } } { 2 \beta } - \frac { M ^ { 3 } } { 6 \beta ^ { 2 } } )$
236
+
237
+ which immediately implies
238
+
239
+ $$
240
+ \beta \leq { \frac { 2 M } { - 3 + { \sqrt { 9 + { \frac { 2 4 } { M } } \ln { \frac { 1 } { 1 - \gamma } } } } } } = \beta ^ { * }
241
+ $$
242
+
243
+ This gives us a upper-bound of the uniformity of distribution $P$ , which we can utilize. Let $S \subseteq \Omega$ be the smallest set with probability mass $\geq \rho$ and suppose it size is $N$ . To estimate the largest possible $N$ such that the previous inequality holds, we let
244
+
245
+ $$
246
+ \frac { 1 } { ( \frac { \rho } { N } ) ^ { 2 } N + ( 1 - \rho ) ^ { 2 } } \leq \beta ^ { * }
247
+ $$
248
+
249
+ from which we obtain
250
+
251
+ $$
252
+ N \leq { \frac { 2 M \rho ^ { 2 } } { ( - 3 + { \sqrt { 9 + { \frac { 2 4 } { M } } \ln { \frac { 1 } { 1 - \gamma } } } } ) - 2 M ( 1 - \rho ) ^ { 2 } } }
253
+ $$
254
+
255
+ # B EXPLORATORY RESULTS ON BEDROOM DATASET
256
+
257
+ We test DCGANs trained on the trained on $6 4 \times 6 4$ center cropped Bedroom dataset(LSUN) using Euclidean distance to extract collision candidates since it is impossible to train a CNN classifier on such single-category (bedroom) dataset. We notice that the most similar pairs are likely to be the corrupted samples with the same noise pattern (top-5 collision candidates all contain such patterns). When ignoring the noisy pairs, the most similar ”clean” pairs are not even similar according to human eyes. This implies that the distribution puts significant probability on noise patterns, which can be seen as a form of under-fitting (also reported in the DCGAN paper). We manually counted the number of samples with a fixed noise pattern from a batch of 900 i.i.d samples. We find 43 such corrupted samples among the 900 generated images, which implies $4 3 / 9 0 0 \approx 5 \%$ probability.
258
+
259
+ ![](images/50a90eccb8141eacb69c250c7386f8053c31de83d4cf01a83bf3206ffb998d07.jpg)
260
+
261
+ Figure 4: Randomly generated samples from a DCGAN trained on Bedroom dataset. Note that there are corrupted images with a fixed noise pattern (emphasized in red boxes).
262
+
263
+ C BIRTHDAY PARADOX TEST FOR VAES
264
+
265
+ ![](images/fe13e23bc7a3a4909cc2dca43aa79f84daac4976c555edd9668302f6d35ac943.jpg)
266
+ Figure 5: Collision candidates found in Variation Auto-Encoder samples. The duplicated samples are frequently blurry ones because the crucial features (eyes, hair, mouth) of VAE samples are not as distinctive as those of GANs’.
267
+
268
+ Given these findings, it is natural to wonder about the diversity of distributions learned using earlier methods such as Variational Auto-Encoders Kingma & Welling (2014) (VAEs). Instead of using feedback from the discriminator, these methods train the generator net using feedback from an approximate perplexity calculation. Thus the analysis of Arora et al. (2017) does not apply as is to such methods and it is conceivable they exhibit higher diversity. However, we find the birthday paradox test difficult to run since samples from a VAE trained on CelebA are not realistic or sharp enough for a human to definitively conclude whether or not two images are almost the same. Fig 5 shows examples of collision candidates found in batches of 400 samples; clearly some indicative parts (hair, eyes, mouth, etc.) are quite blurry in VAE samples.
269
+
270
+ # D BIGAN’S DON’T EVADE THE CURSE OF LOW DIVERSITY
271
+
272
+ We recall the basic notation from the main part: the image distribution will be denoted as $\mu$ , and the code/seed distribution as $\nu$ , which we assume is a spherical Gaussian. For concreteness, we assumed the domain of $\tilde { \mu }$ is $\mathbb { R } ^ { d }$ and the domain of $\nu$ is $\mathbb { R } ^ { \bar { d } }$ with $\tilde { d } \leq d$ . (As we said, we are thinking of $\widetilde d \ll d$ .)
273
+
274
+ We also introduced the quantity m := p∆2 log2(p∆LLφ/)2 .
275
+
276
+ Before proving Theorem 3, let’s note that the claim can easily be made into a finite-sample version. Namely:
277
+
278
+ Corollary D.1 (Main, finite sample version). There exists a generator $G$ of support $m$ , s.t. if $\hat { \mu }$ is the uniform distribution over a training set $S$ of size at least $m$ , and $\hat { \nu }$ is the uniform distribution over a sample $T$ from $\nu$ of size at least $m$ , for all discriminators $D$ that are $L$ -Lipschitz and have less than $p$ parameters, with probability $1 - \exp ( - \Omega ( p ) )$ over the choice of training set $S , T$ we have:
279
+
280
+ $$
281
+ \begin{array} { r } { | \underset { x \sim \hat { \mu } } { \mathbb { E } } \phi ( D ( x , E ( x ) ) ) - \underset { z \sim \hat { \nu } } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) | \leq \epsilon } \end{array}
282
+ $$
283
+
284
+ Proof. As is noted in Theorem B.2 in Arora et al. (2017), we can build a LLφ - net for the discriminators with a size bounded by $e ^ { p \log ( L L _ { \phi } p / \epsilon ) }$ . By Chernoff and union bounding over the points in the $\frac { \epsilon } { L L _ { \phi } }$ -net, with probability at least $1 - \exp ( - \Omega ( p ) )$ over the choice of a training set $S$ , we have
285
+
286
+ $$
287
+ | \underset { x \sim \mu } { \mathbb { E } } \phi ( D ( x , E ( x ) ) ) - \underset { x \sim \hat { \mu } } { \mathbb { E } } \phi ( D ( x , E ( x ) ) ) | \leq \frac { \epsilon } { 2 }
288
+ $$
289
+
290
+ for all discriminators $D$ with capacity at most $p$ . Similarly, with probability at least $1 - \exp ( - \Omega ( p ) )$ over the choice of a noise set $T$ ,
291
+
292
+ $$
293
+ | \underset { z \sim \nu } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) - \underset { z \sim \hat { \nu } } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) | \leq \frac { \epsilon } { 2 }
294
+ $$
295
+
296
+ Union bounding over these two events, we get the statement of the Corollary.
297
+
298
+ Spelling out the distribution over generators more explicitly, we will in fact show:
299
+
300
+ Theorem 4 (Main, more detailed). Let $G$ follow the distribution over generators defined in Section 3. With probability $\begin{array} { r } { 1 - \exp ( - \Omega ( p \log ( \Delta / \epsilon ) ) , } \end{array}$ ) over the choice of $G$ , for all discriminators $D$ that are $L$ -Lipschitz and have capacity bounded by $p$ :
301
+
302
+ $$
303
+ \begin{array} { r } { | \underset { x \sim \mu } { \mathbb { E } } \phi ( D ( x , E ( x ) ) ) - \underset { z \sim \nu } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) | \leq \epsilon } \end{array}
304
+ $$
305
+
306
+ # D.1 PROOF OF THE MAIN CLAIM
307
+
308
+ Let us recall we call a set $T$ of samples from $\nu$ non-colliding if no two lie in the same block and we denoted $\mathcal { T } _ { n c }$ to be the distribution over non-colliding sets $\{ z _ { 1 } , z _ { 2 } , \dots , z _ { m } \}$ , s.t. each $z _ { i }$ is sampled independently from the conditional distribution of $\nu$ inside the i-th block of the partition.
309
+
310
+ First, notice the following Lemma:
311
+
312
+ Lemma D.1 (Reducing to expectations over non-colliding sets). Let $G$ be a fixed generator, and $D$ a fixed discriminator. Then,
313
+
314
+ $$
315
+ \begin{array} { r } { \underset { z \sim \nu } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) = \underset { T \sim { \mathcal { T } _ { n c } } z \sim T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) } \end{array}
316
+ $$
317
+
318
+ Proof. By definition,
319
+
320
+ $$
321
+ \underset { T \sim \mathcal { T } _ { n c } } { \mathbb { E } } \underset { z \sim T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \underset { z _ { i } \sim ( \mathcal { T } _ { n c } ) _ { i } } { \mathbb { E } } \phi ( D ( G ( z _ { i } ) , z _ { i } ) )
322
+ $$
323
+
324
+ where $( \mathcal { T } _ { n c } ) _ { i }$ is the conditional distribution of $\nu$ in the $i$ -th block of the partition. However, since the blocks form an equipartitioning, we have
325
+
326
+ $$
327
+ \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \underset { z _ { i } \sim ( \mathcal T _ { n c } ) _ { i } } { \mathbb { E } } \phi ( D ( G ( z _ { i } ) , z _ { i } ) ) = \sum _ { i = 1 } ^ { m } \underset { z \sim \nu } { \operatorname* { P r } } \left( z \mathrm { b e l o n g s ~ t o ~ c e l l } ~ i \right) \underset { z _ { i } \sim ( \mathcal T _ { n c } ) _ { i } } { \mathbb { E } } \phi ( D ( G ( z _ { i } ) , z _ { i } ) )
328
+ $$
329
+
330
+ Lemma D.2 (Concentration of good generators). With probability $\begin{array} { r } { 1 - \exp ( - \Omega ( p \log ( \Delta / \epsilon ) ) ) } \end{array}$ over the choice of $G$ ,
331
+
332
+ $$
333
+ | \underset { T \sim T _ { n c } } { \mathbb { E } } \underset { z \sim T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) - \underset { G T \sim T _ { n c } } { \mathbb { E } } \underset { z \sim T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) | \leq \epsilon
334
+ $$
335
+
336
+ for all discriminators $D$ of capacity at most $p$ .
337
+
338
+ Proof. Consider $\mathbb { E } _ { z \sim T } \phi ( D ( G ( z ) , z ) )$ as a random variable in $T \sim \tau _ { n c }$ and $G$ for a fixed $D$ . We can write
339
+
340
+ $$
341
+ \underset { z \sim T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) = f ( x _ { i } ^ { * } , z _ { i } , i \in [ m ] )
342
+ $$
343
+
344
+ where the random variables $x _ { i } ^ { * } , z _ { i }$ are all mutually independent. Note that the arguments that $f$ is a function of are all independent variables, so we can apply McDiarmid’s inequality. Towards that, let’s denote by $z _ { - i }$ the vector of all inputs to $f$ , except for $z _ { i }$ . Notice that
345
+
346
+ $$
347
+ | f ( z _ { - i } , z _ { i } ) - f ( z _ { - i } , \tilde { z } _ { i } ) | \leq \frac { 1 } { m } , \forall i \in [ m ]
348
+ $$
349
+
350
+ (as changing $z _ { i }$ to $\tilde { z } _ { i }$ only affect one out of the $m$ terms in $E _ { z \sim T } \phi ( D ( G ( z ) , z ) ) )$ . Analogously we have
351
+
352
+ $$
353
+ | f ( x _ { - i } ^ { * } , x _ { i } ^ { * } ) - f ( x _ { - i } ^ { * } , \tilde { x } _ { i } ^ { * } ) | \leq \frac { 1 } { m } , \forall i \in [ m ]
354
+ $$
355
+
356
+ Denoting $R _ { D , T , G } = f ( x _ { i } ^ { * } , z _ { i } , i \in [ m ] ) - \mathbb { E } _ { T , G } [ f ( x _ { i } ^ { * } , z _ { i } , i \in [ m ] ) ]$ , by McDiarmid we get
357
+
358
+ $$
359
+ \operatorname* { P r } _ { T , G } ( | R _ { D , T , G } | \geq \epsilon ) \leq \exp ( - \Omega ( m \epsilon ^ { 2 } ) )
360
+ $$
361
+
362
+ Building a $\frac { \epsilon } { L L _ { \phi } }$ -net for the discriminators and union bounding over the points in the net, we get that $\mathrm { P r } _ { T , G } ( \exists D , | \tilde { R _ { D , T , G } } | \geq \epsilon / 2 ) \leq \exp ( - \Omega ( p \log ( \Delta / \epsilon ) ) )$ . On the other hand, we also have
363
+
364
+ $$
365
+ \operatorname* { P r } _ { T , G } ( \exists D , | R _ { D , T , G } | \ge \epsilon / 2 ) = \underset { G } { \mathbb { E } } [ \operatorname* { P r } ( \exists D , | R _ { D , T , G } | \ge \epsilon ) ]
366
+ $$
367
+
368
+ so by Markov’s inequality, with probability $1 - \exp ( - \Omega ( p \log ( \Delta / \epsilon ) )$ over the choice of $G$ , ,
369
+
370
+ $$
371
+ \operatorname* { P r } _ { T } ( \exists D , | R _ { D , T , G } | \ge \epsilon / 2 ) ] \le \exp ( - \Omega ( p \log ( \Delta / \epsilon ) ) )
372
+ $$
373
+
374
+ Let us denote by ${ \tilde { T } } ( G )$ the sets $T$ , s.t. $\forall D , | R _ { D , T , G } | ~ \le ~ \epsilon / 2$ . Then, with probability $1 \ : -$ $\exp ( - \Omega ( p \log ( \Delta / \epsilon ) ) )$ ) over the choice of $G$ , we have that for all $D$ of capacity at most $p$ ,
375
+
376
+ $$
377
+ \begin{array} { r l } & { \underset { T \leq r \mathcal { T } } { \mathbb { E } } \ \underset { \mathcal { F } ^ { \prime } \times T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) - \underset { G , T \leq r \mathcal { T } } { \mathbb { E } } \ \underset { \mathcal { E } \times T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) | } \\ & { \leq \displaystyle \int _ { T \in \bar { T } ( G _ { x } ) } \ \underset { z \sim T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) - \underset { G , T \leq r \mathcal { T } } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) | d T _ { n c } ( T ) } \\ & { + \displaystyle \int _ { T \not \in \bar { T } ( G _ { x } ) } \ \underset { z \sim T } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) - \underset { G , T \leq r \mathcal { T } } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) | d T _ { n c } ( T ) } \\ & { \leq \epsilon / 2 + \exp ( - \Omega ( p \log ( \Delta / \epsilon ) ) ) } \\ & { \leq \epsilon / 2 + O ( ( \epsilon / \Delta ) ^ { p } ) } \\ & { \leq \epsilon } \end{array}
378
+ $$
379
+
380
+ which is what we want.
381
+
382
+ With these in mind, we can prove the main theorem:
383
+
384
+ Proof of Theorem 3. From Lemma D.1 and Lemma D.2 we get that with probability 1 − $\exp ( - \Omega ( p \log ( \Delta / \epsilon ) ) )$ ) over the choice of $G$ ,
385
+
386
+ $$
387
+ | \underset { z \sim \nu } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) - \underset { G , T \sim \mathcal { T } _ { G } } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) | \leq \epsilon
388
+ $$
389
+
390
+ for all discriminators $D$ of capacity at most $p$ . On the other hand, it’s easy to see that
391
+
392
+ $$
393
+ \underset { G , T \sim \mathcal { T } _ { G } } { \mathbb { E } } \phi ( D ( G ( z ) , z ) ) = \underset { x \sim \tilde { \mu } , z \sim \nu } { \mathbb { E } } \phi ( D ( x \circledast z , z ) )
394
+ $$
395
+
396
+ Furthermore,
397
+
398
+ $$
399
+ \underset { x \sim \mu } { \mathbb { E } } \phi ( D ( x , E ( x ) ) ) = \underset { x \sim \tilde { \mu } , z \sim \nu } { \mathbb { E } } \phi ( D ( x \circledast z , z ) )
400
+ $$
401
+
402
+ by the definition of $E ( x )$ , which proves the statement of the theorem.
403
+
404
+ # D.2 REPRESENTABILITY RESULTS
405
+
406
+ In this section, we show that a generator $G$ of the type we described in the previous section can be implemented easily using a ReLU network. The encoder can be parametrized by the set $x _ { 1 } ^ { * }$ ${ } _ { 1 } ^ { * } , x _ { 2 } ^ { * } , \ldots , x _ { m } ^ { * }$ of “memorized” training samples. The high-level overview of the network is rather obvious: we partition $\mathbb { R } ^ { \tilde { d } }$ into equal-measure blocks; subsequently, for a noise sample $z$ , we determine which block it belongs to, and output the corresponding sample $\boldsymbol { x } _ { i } ^ { * }$ , which is memorized in the weights of the network.
407
+
408
+ Theorem 5. Let $G$ be the generator determined by the samples $x _ { 1 } ^ { * }$ , $x _ { 2 } ^ { * } , \ldots , x _ { m } ^ { * } \in { \mathbb { R } } ^ { d }$ , i.e. $G ( z ) =$ $x _ { i n d ( z ) } ^ { * } \circledast z$ . For any , there exists a ReLU network with $O ( m d )$ non-zero weights, which implements a function $\tilde { G }$ , s.t. $\Vert \tilde { G } ( \nu ) - G ( \nu ) \Vert _ { T V } \leq \delta$ , where $\Vert \cdot \Vert _ { T V }$ denotes total variation distance.6
409
+
410
+ Proof. The construction of the network is pictorially depicted on Figure D.2. We expand on each of the individual parts of the network.
411
+
412
+ First, we show how to implement the partitioning into sectors. The easiest way to do this is to use the fact that the coordinates of a spherical Gaussian are independent, and simply partition each dimension separately into equimeasure blocks, depending on the value of $| z _ { i } |$ : the absolute value of the $i$ -th coordinate. Concretely, without loss of generality, let’s assume $m \stackrel { \cdot } { = } k ^ { \tilde { d } }$ , for some $k \in \mathbb N$ . Let us denote by $\tau _ { i } \in \mathbb { R } : i \in \dot { [ k ] }$ , $\tau _ { 0 } = 0$ the real-numbers, s.t. $\begin{array} { r } { \operatorname* { P r } _ { z _ { i } \sim \nu _ { i } } [ | z _ { i } | \in ( \tau _ { i - 1 } , \tau _ { i } ) ] = \frac { 1 } { k } } \end{array}$ . . We will associate to each $d$ -tuple $( i _ { 1 } , i _ { 2 } , \dots , i _ { d } ) \in [ k ] ^ { d }$ the cell $\{ z \in \mathbb { R } ^ { \tilde { d } } : | z _ { j } | \in ( \tau _ { i _ { j } - 1 } , \tau _ { i _ { j } } ) , \forall j \in [ \tilde { d } ] \}$ . These blocks clearly equipartition $\mathbb { R } ^ { \tilde { d } }$ with respect to the Gaussian measure.
413
+
414
+ Inferring the $\tilde { d }$ -tuple after calculating the absolute values $| z _ { j } |$ (which is trivially representable as a ReLU network as $\operatorname* { m a x } ( 0 , z _ { j } ) + \operatorname* { m a x } ( 0 , - z _ { j } ) )$ can be done using the “selector” circuit introduced in ‘Arora et al. (2017). Namely, by Lemma 3 there, there exists a ReLU network with $O ( k )$ nonzero weights that takes $| z _ { j } |$ as input and outputs $k$ numbers $( b _ { j , 1 } , b _ { j , 2 } , \dots , b _ { j , k } )$ , s.t. $b _ { j , i _ { j } } = 1$ and $b _ { j , l } = 0 , j \neq i _ { j }$ with probability $1 - \delta$ over the randomness of $z _ { j } , j \in [ \tilde { d } ]$ .
415
+
416
+ Since we care about $G ( \nu )$ and $\tilde { G } ( \nu )$ being close in total variation distance only, we can focus on the case where all $z _ { j }$ are such that $b _ { j , i _ { j } } = 1$ and $b _ { j , l } = 0 , j \neq i _ { j }$ for some indices $i _ { j }$ .
417
+
418
+ We wish to now “turn on” the memorized weights for the corresponding block in the partition. To do this, we first pass the calculated $\tilde { d }$ -tuple through a network which interprets it as a number in $k$ -ary and calculates it’s equivalent decimal representation. This is easily implementable as a ReLU network with $O ( \tilde { d } k )$ weights calculating $\begin{array} { r } { L = \sum _ { j = 1 } ^ { \tilde { d } } k ^ { j } \sum _ { l = 1 } ^ { k } b _ { j , l } i _ { j } } \end{array}$ . Then, we use use a simple circuit with $O ( m )$ non-zero weights to output $m$ numbers $\left( B _ { 1 } , B _ { 2 } , \ldots , B _ { m } \right)$ , s.t. $B _ { L } \ = \ 1$ and $B _ { i } = 0 , i \neq L$ (implemented in the obvious way). The subnetwork of $B _ { i }$ will be responsiple for the $i$ -th memorized sample.
419
+
420
+ Namely, we attach to each coordinate $B _ { i }$ a curcuit with fan-out of degree $d$ , s.t. the weight of edge $j \in [ d ]$ is $x _ { i , j } ^ { * }$ . Let’s denote these outputs as $F _ { i , j } , i \in [ m ] , j \in [ d ]$ and let ${ \tilde { F } } _ { i } : i \in [ d ]$ be defined as $\begin{array} { r } { \tilde { F } _ { i } = \sum _ { j = 1 } ^ { m } F _ { i , j } } \end{array}$ . It’s easy to see since $B _ { i } = 0 , i \neq L$ that $\tilde { F } _ { i } = x _ { L , i } ^ { * }$ .
421
+
422
+ Finally, the operation $\circledast$ can be trivially implemented using additional $d$ weights: we simply connect each output $i$ either to $z _ { \frac { i } { \lfloor \frac { d } { d } \rfloor } }$ if $i \equiv 0 ( \mathrm { \ m o d } \lfloor \frac { d } { \tilde { d } } \rfloor )$ or to $\tilde { F } _ { i }$ otherwise.
423
+
424
+ Adding up the sizes of the individual components, we see the total number of non-zero weights is $O ( m d )$ , as we wanted.
425
+
426
+ ![](images/8d4bc8efa8ef04438e1abc181556be8beb9ee6ab17819dd3dd628f1eec7915e0.jpg)
427
+ Figure 6: A ReLU implementation of a memorizing generator
md/train/BJgqqsAct7/BJgqqsAct7.md ADDED
@@ -0,0 +1,472 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NON-VACUOUS GENERALIZATION BOUNDS AT THE IM-AGENET SCALE: A PAC-BAYESIAN COMPRESSIONAPPROACH
2
+
3
+ Wenda Zhou
4
+ Columbia University
5
+ New York, NY
6
+ wz2335@columbia.edu
7
+ Victor Veitch
8
+ Columbia University
9
+ New York, NY
10
+ victorveitch@gmail.com
11
+
12
+ Morgane Austern Columbia University New York, NY ma3293@columbia.edu
13
+
14
+ Ryan P. Adams Princeton University Princeton, NJ rpa@princeton.edu
15
+
16
+ Peter Orbanz
17
+ Columbia University
18
+ New York, NY
19
+ porbanz@stat.columbia.edu
20
+
21
+ # ABSTRACT
22
+
23
+ Modern neural networks are highly overparameterized, with capacity to substantially overfit to training data. Nevertheless, these networks often generalize well in practice. It has also been observed that trained networks can often be “compressed” to much smaller representations. The purpose of this paper is to connect these two empirical observations. Our main technical result is a generalization bound for compressed networks based on the compressed size that, combined with off-theshelf compression algorithms, leads to state-of-the-art generalization guarantees. In particular, we provide the first non-vacuous generalization guarantees for realistic architectures applied to the ImageNet classification problem. Additionally, we show that compressibility of models that tend to overfit is limited. Empirical results show that an increase in overfitting increases the number of bits required to describe a trained network.
24
+
25
+ # 1 INTRODUCTION
26
+
27
+ A pivotal question in machine learning is why deep networks perform well despite overparameterization. These models often have many more parameters than the number of examples they are trained on, which enables them to drastically overfit to training data (Zhang et al., 2017a). In common practice, however, such networks perform well on previously unseen data.
28
+
29
+ Explaining the generalization performance of neural networks is an active area of current research. Attempts have been made at adapting classical measures such as VC-dimension (Harvey et al., 2017) or margin/norm bounds (Neyshabur et al., 2018; Bartlett et al., 2017), but such approaches have yielded bounds that are vacuous by orders of magnitudes. Other authors have explored modifications of the training procedure to obtain networks with provable generalization guarantees (Dziugaite & Roy, 2017; 2018). Such procedures often differ substantially from standard procedures used by practitioners, and empirical evidence suggests that they fail to improve performance in practice (Wilson et al., 2017).
30
+
31
+ We begin with an empirical observation: it is often possible to “compress” trained neural networks by finding essentially equivalent models that can be described in a much smaller number of bits; see Cheng et al. (2018) for a survey. Inspired by classical results relating small model size and generalization performance (often known as Occam’s razor), we establish a new generalization bound based on the effective compressed size of a trained neural network. Combining this bound with off-the-shelf compression schemes yields the first non-vacuous generalization bounds in practical problems. The main contribution of the present paper is the demonstration that, unlike many other measures, this measure is effective in the deep-learning regime.
32
+
33
+ Generalization bound arguments typically identify some notion of complexity of a learning problem, and bound generalization error in terms of that complexity. Conceptually, the notion of complexity we identify is:
34
+
35
+ complexity $=$ compressed size − remaining structure.
36
+
37
+ The first term on the right-hand side represents the link between generalization and explicit compression. The second term corrects for superfluous structure that remains in the compressed representation. For instance, the predictions of trained neural networks are often robust to perturbations of the network weights. Thus, a representation of a neural network by its weights carries some irrelevant information. We show that accounting for this robustness can substantially reduce effective complexity.
38
+
39
+ Our results allow us to derive explicit generalization guarantees using off-the-shelf neural network compression schemes. In particular:
40
+
41
+ • The generalization bound can be evaluated by compressing a trained network, measuring the effective compressed size, and substituting this value into the bound. • Using off-the-shelf neural network compression schemes with this recipe yields bounds that are state-of-the-art, including the first non-vacuous bounds for modern convolutional neural nets.
42
+
43
+ The above result takes a compression algorithm and outputs a generalization bound on nets compressed by that algorithm. We provide a complementary result by showing that if a model tends to overfit then there is an absolute limit on how much it can be compressed. We consider a classifier as a (measurable) function of a random training set, so the classifier is viewed as a random variable. We show that the entropy of this random variable is lower bounded by a function of the expected degree of overfitting. Additionally, we use the randomization tests of Zhang et al. (2017a) to show empirically that increased overfitting implies worse compressibility, for a fixed compression scheme.
44
+
45
+ The relationship between small model size and generalization is hardly new: the idea is a variant of Occam’s razor, and has been used explicitly in classical generalization theory (Rissanen, 1986; Blumer et al., 1987; MacKay, 1992; Hinton & van Camp, 1993; Rasmussen & Ghahramani, 2001). However, the use of highly overparameterized models in deep learning seems to directly contradict the Occam principle. Indeed, the study of generalization and the study of compression in deep learning has been largely disjoint; the later has been primarily motivated by computational and storage limitations, such as those arising from applications on mobile devices (Cheng et al., 2018). Our results show that Occam type arguments remain powerful in the deep learning regime. The link between compression and generalization is also used in work by Arora et al. (2018), who study compressibility arising from a form of noise stability. Our results are substantially different, and closer in spirit to the work of Dziugaite & Roy (2017); see Section 3 for a detailed discussion.
46
+
47
+ Zhang et al. (2017a) study the problem of generalization in deep learning empirically. They observe that standard deep net architectures—which generalize well on real-world data—are able to achieve perfect training accuracy on randomly labelled data. Of course, in this case the test error is no better than random guessing. Accordingly, any approach to controlling generalization error of deep nets must selectively and preferentially bound the generalization error of models that are actually plausible outputs of the training procedure applied to real-world data. Following Langford & Caruana (2002); Dziugaite & Roy (2017); Neyshabur et al. (2018), we make use of the PAC-Bayesian framework (McAllester, 1999; Catoni, 2007; McAllester, 2013). This framework allows us to encode prior beliefs about which learned models are plausible as a (prior) distribution $\pi$ over possible parameter settings. The main challenge in developing a bound in the PAC-Bayes framework bound is to articulate a distribution $\pi$ that encodes the relative plausibilities of possible outputs of the training procedure. The key insight is that, implicitly, any compression scheme is a statement about model plausibilities: good compression is achieved by assigning short codes to the most probable models, and so the probable models are those with short codes.
48
+
49
+ # 2 GENERALIZATION AND THE PAC-BAYESIAN PRINCIPLE
50
+
51
+ In this section, we recall some background and notation from statistical learning theory. Our aim is to learn a classifier using data examples. Each example $( x , y )$ consists of some features $x \in \mathcal { X }$ and a label $y \in \mathcal { V }$ . It is assumed that the data are drawn identically and independently from some data generating distribution, $( X _ { i } , Y _ { i } ) \stackrel { i i d } { \sim } \mathcal { D }$ . The goal of learning is to choose a hypothesis $h : \mathcal { X } \to \mathcal { Y }$ that predicts the label from the features. The quality of the prediction is measured by specifying some loss function $L$ ; the value $L ( h ( x ) , y )$ is a measure of the failure of hypothesis $h$ to explain example $( x , y )$ . The overall quality of a hypothesis $h$ is measured by the risk under the data generating distribution:
52
+
53
+ $$
54
+ L ( h ) = \mathbb { E } _ { ( X , Y ) \sim { \mathcal { D } } } [ L ( h ( X ) , Y ) ] .
55
+ $$
56
+
57
+ Generally, the data generating distribution is unknown. Instead, we assume access to training data $S _ { n } \stackrel { \cdot } { = } \{ ( x _ { 1 } , y _ { 1 } ) , \stackrel { - } { , } . . . , ( x _ { n } , \stackrel { \cdot } { y } _ { n } ) \}$ , a sample of $n$ points drawn i.i.d. from the data generating distribution. The true risk is estimated by the empirical risk:
58
+
59
+ $$
60
+ \begin{array} { r } { \hat { L } ( h ) = \frac { 1 } { n } \sum _ { ( x , y ) \in S } L ( h ( x ) , y ) . } \end{array}
61
+ $$
62
+
63
+ The task of the learner is to use the training data to choose a hypothesis $\hat { h }$ from among some prespecified set of possible hypothesis $\mathcal { H }$ , the hypothesis class. The standard approach to learning is to choose a hypothesis $\hat { h }$ that (approximately) minimizes the empirical risk. This induces a dependency between the choice of hypothesis and the estimate of the hypothesis’ quality. Because of this, it can happen that $\hat { h }$ overfits to the training data: $\hat { L } ( \hat { h } ) \ll L ( \hat { h } )$ . The generalization error $L ( \hat { h } ) - \hat { L } ( \hat { h } )$ measures the degree of overfitting. In this paper, we consider an image classification problem, where $x _ { i }$ is an image and $y _ { i }$ the associated label for that image. The selected hypothesis is a deep neural network. We mostly consider the $0 - 1$ loss, that is, $L ( h \bar { ( } x ) , y ) = 0$ if the prediction is correct and $L ( h ( x ) , y ) = 1$ otherwise.
64
+
65
+ We use the PAC-Bayesian framework to establish bounds on generalization error. In general, a PACBayesian bound attempts to control the generalization error of a stochastic classifier by measuring the discrepancy between a pre-specified random classifier (often called prior), and the classifier of interest. Conceptually, PAC-Bayes bounds have the form:
66
+
67
+ $$
68
+ \mathrm { g e n e r a l i z a t i o n } \mathrm { e r r o r } \mathrm { o f } \rho \le O \left( \sqrt { { \mathrm { K L } } ( \rho , \pi ) / n } \right) ,
69
+ $$
70
+
71
+ where $n$ is the number of training examples, $\pi$ denotes the prior, and $\rho$ denotes the classifier of interest (often called posterior).
72
+
73
+ More formally, we write $L ( \rho ) = \mathbb { E } _ { h \sim \rho } [ L ( h ) ]$ for the risk of the random estimator. The fundamental bound in PAC-Bayesian theory is (Catoni, 2007, Thm. 1.2.6):
74
+
75
+ Theorem 2.1 (PAC-Bayes). Let $L$ be a $\{ 0 , 1 \}$ -valued loss function, let $\pi$ be some probability measure on the hypothesis class, and let $\alpha > 1 , \epsilon > 0$ . Then, with probability at least $1 - \epsilon$ over the distribution of the sample:
76
+
77
+ $$
78
+ L ( \rho ) \leq \operatorname* { i n f } _ { \lambda > 1 } \Phi _ { \lambda / n } ^ { - 1 } \left\{ { \hat { L } } ( \rho ) + { \frac { \alpha } { \lambda } } \left[ { \mathrm { K L } } ( \rho , \pi ) - \log \epsilon + 2 \log \left( { \frac { \log ( \alpha ^ { 2 } \lambda ) } { \log \alpha } } \right) \right] \right\} ,
79
+ $$
80
+
81
+ where we define $\Phi _ { \gamma } ^ { - 1 } \ : a s$
82
+
83
+ $$
84
+ \Phi _ { \gamma } ^ { - 1 } ( x ) = \frac { 1 - e ^ { - \gamma x } } { 1 - e ^ { - \gamma } } .
85
+ $$
86
+
87
+ Remark 2.2. The above formulation of the PAC-Bayesian theorem is somewhat more opaque than other formulations (e.g., McAllester, 2003; 2013; Neyshabur et al., 2018). This form is significantly tighter when $\operatorname { K L } / n$ is large. See Bégin et al. (2014); Laviolette (2017) for a unified treatment of PAC-Bayesian bounds.
88
+
89
+ The quality of a PAC-Bayes bound depends on the discrepancy between the PAC-Bayes prior $\pi$ — encoding the learned models we think are plausible—and $\rho$ , which is the actual output of the learning procedure. The main challenge is finding good choices for the PAC-Bayes prior $\pi$ , for which the value of $\operatorname { K L } ( \rho , \pi )$ is both small and computable.
90
+
91
+ # 3 RELATIONSHIP TO PREVIOUS WORK
92
+
93
+ Generalization. The question of which properties of real-world networks explain good generalization behavior has attracted considerable attention (Langford, 2002; Langford & Caruana, 2002; Hinton & van Camp, 1993; Hochreiter & Schmidhuber, 1997; Baldassi et al., 2015; 2016; Chaudhari et al., 2017; Keskar et al., 2017; Dziugaite & Roy, 2017; Schmidt-Hieber, 2017; Neyshabur et al.,
94
+
95
+ 2017; 2018; Arora et al., 2018); see Arora (2017) for a review of recent advances. Such results typically identify a property of real-world networks, formalize it as a mathematical definition, and then use this definition to prove a generalization bound. Generally, the bounds are very loose relative to the true generalization error, which can be estimated by evaluating performance on held-out data. Their purpose is not to quantify the actual generalization error, but rather to give qualitative evidence that the property underpinning the generalization bound is indeed relevant to generalization performance. The present paper can be seen in this tradition: we propose compressibility as a key signature of performant real-world deep nets, and we give qualitative evidence for this thesis in the form of a generalization bound.
96
+
97
+ The idea that compressibility leads to generalization has a long history in machine learning. Minimum description length (MDL) is an early formalization of the idea (Rissanen, 1986). Hinton & van Camp (1993) applied MDL to very small networks, already recognizing the importance of weight quantization and stochasticity. More recently, Arora et al. (2018) consider the connection between compression and generalization in large-scale deep learning. The main idea is to compute a measure of noise-stability of the network, and show that it implies the existence of a simpler network with nearly the same performance. A variant of a known compression bound (see (McAllester, 2013) for a PAC-Bayesian formulation) is then applied to bound the generalization error of this simpler network in terms of its code length. In contrast, the present paper develops a tool to leverage existing neural network compression algorithms to obtain strong generalization bounds. The two papers are complementary: we establish non-vacuous bounds, and hence establish a quantitative connection between generalization and compression. An important contribution of Arora et al. (2018) is obtaining a quantity measuring the compressibility of a neural network; in contrast, we apply a compression algorithm and witness its performance. We note that their compression scheme is very different from the sparsity-inducing compression schemes (Cheng et al., 2018) we use in our experiments. Which properties of deep networks allow them to be sparsely compressed remains an open question.
98
+
99
+ To strengthen a naïve Occam bound, we use the idea that deep networks are insensitive to mild perturbations of their weights, and that this insensitivity leads to good generalization behavior. This concept has also been widely studied (e.g., Langford, 2002; Langford & Caruana, 2002; Hinton & van Camp, 1993; Hochreiter & Schmidhuber, 1997; Baldassi et al., 2015; 2016; Chaudhari et al., 2017; Keskar et al., 2017; Dziugaite & Roy, 2017; Neyshabur et al., 2018). As we do, some of these papers use a PAC-Bayes approach (Langford & Caruana, 2002; Dziugaite & Roy, 2017; Neyshabur et al., 2018). Neyshabur et al. (2018) arrive at a bound for non-random classifiers by computing the tolerance of a given deep net to noise, and bounding the difference between that net and a stochastic net to which they apply a PAC-Bayes bound. Like the present paper, Langford & Caruana (2002); Dziugaite & Roy (2017) work with a random classifier given by considering a normal distribution over the weights centered at the output of the training procedure. We borrow the observation of Dziugaite & Roy (2017) that the stochastic network is a convenient formalization of perturbation robustness.
100
+
101
+ The approaches to generalization most closely related to ours are, in summary:
102
+
103
+ <table><tr><td>Reference</td><td>Structure</td><td>Non-Vacuous</td><td></td></tr><tr><td></td><td></td><td>MNIST</td><td>ImageNet</td></tr><tr><td>Dziugaite &amp; Roy (2017)</td><td>Perturbation Robustness Perturbation Robustness</td><td>√</td><td>×</td></tr><tr><td>Neyshabur et al. (2018)</td><td></td><td>X</td><td>×</td></tr><tr><td>Arora et al. (2018) Present paper</td><td>Compressibility (from Perturbation Robustness) Compressibility and Perturbation Robustness</td><td>X</td><td>X</td></tr></table>
104
+
105
+ These represent the best known generalization guarantees for deep neural networks. Our bound provides the first non-vacuous generalization guarantee for the ImageNet classification task, the de facto standard problem for which deep learning dominates. It is also largely agnostic to model architecture: we apply the same argument to both fully connected and convolutional networks. This is in contrast to some existing approaches that require extra analysis to extend bounds for fully connected networks to bounds for convolutional networks (Neyshabur et al., 2018; Konstantinos et al.; Arora et al., 2018).
106
+
107
+ Compression. The effectiveness of our work relies on the existence of good neural network compression algorithms. Neural network compression has been the subject of extensive interest in the last few years, motivated by engineering requirements such as computational or power constraints. We apply a relatively simple strategy in this paper in the line of Han et al. (2016), but we note that our bound is compatible with most forms of compression. See Cheng et al. (2018) for a survey of recent results in this field.
108
+
109
+ # 4 MAIN RESULT
110
+
111
+ We first describe a simple Occam’s razor type bound that translates the quality of a compression into a generalization bound for the compressed model. The idea is to choose the PAC-Bayes prior $\pi$ such that greater probability mass is assigned to models with short code length. In fact, the bound stated in this section may be obtained as a simple weighted union bound, and a variation is reported in McAllester (2013). However, embedding this bound in the PAC-Bayesian framework allows us to combine this idea, reflecting the explicit compressible structure of trained networks, with other ideas reflecting different properties of trained networks.
112
+
113
+ We consider a non-random classifier by taking the PAC-Bayes posterior $\rho$ to be a point mass at $\hat { h }$ , the output of the training (plus compression) procedure. Recall that computing the PAC-Bayes bound effectively reduces to computing $\operatorname { K L } ( \rho , \pi )$ .
114
+
115
+ Theorem 4.1. Let $| h | _ { c }$ denote the number of bits required to represent hypothesis $h$ using some pre-specified coding c. Let $\rho$ denote the point mass at the compressed model $\hat { h }$ . Let m denote any probability measure on the positive integers. There exists a prior $\pi _ { c }$ such that:
116
+
117
+ $$
118
+ \begin{array} { r } { \mathrm { K L } ( \rho , \pi _ { c } ) \leq | \hat { h } | _ { c } \log 2 - \log ( m ( | \hat { h } | _ { c } ) ) . } \end{array}
119
+ $$
120
+
121
+ This result relies only on the quality of the chosen coding and is agnostic to whether a lossy compression is applied to the model ahead of time. In practice, the code $c$ is chosen to reflect some explicit structure—e.g., sparsity—that is imposed by a lossy compression.
122
+
123
+ Proof. Let $\mathcal { H } _ { c } \subseteq \mathcal { H }$ denote the set of estimators that correspond to decoded points, and note that $\hat { h } \in \mathcal { H } _ { c }$ by construction. Consider the measure $\pi _ { c }$ on $\mathcal { H } _ { c }$ :
124
+
125
+ $$
126
+ \pi _ { c } ( h ) = \frac { 1 } { Z } m ( | h | _ { c } ) 2 ^ { - | h | _ { c } } , \ \mathrm { w h e r e } \ Z = \sum _ { h \in \mathcal { H } _ { c } } m ( | h | _ { c } ) 2 ^ { - | h | _ { c } } .
127
+ $$
128
+
129
+ As $c$ is injective on $\mathcal { H } _ { c }$ , we have that $Z \leq 1$ . We may thus directly compute the KL-divergence from the definition to obtain the claimed result. □
130
+
131
+ Remark 4.2. To apply the bound in practice, we must make a choice of $m$ . A pragmatic solution is to simply consider a bound on the size of the model to be selected (e.g. in many cases it is reasonable to assume that the encoded model is smaller than $2 ^ { 6 4 }$ bytes, which is $2 ^ { 7 2 }$ bits), and then consider $m$ to be uniform over all possible lengths.
132
+
133
+ # 4.1 USING ROBUSTNESS TO WEIGHT PERTURBATIONS
134
+
135
+ The simple bound above applies to an estimator that is compressible in the sense that its encoded length with respect to some fixed code is short. However, such a strategy does not consider any structure on the hypothesis space $\mathcal { H }$ . In practice, compression schemes will often fail to exploit some structure, and generalization bounds can be (substantially) improved by accounting for this fact. We empirically observe that trained neural networks are often tolerant to low levels of discretization of the trained weights, and also tolerant to some low level of added noise in the trained weights. Additionally, quantization is an essential step in numerous compression strategies (Han et al., 2016). We construct a PAC-Bayes bound that reflects this structure.
136
+
137
+ This analysis requires a compression scheme specified in more detail. We assume that the output of the compression procedure is a triplet $\bar { ( S , C , Q ) }$ , where $S = \{ s _ { 1 } , \dotsc , s _ { k } \} \subseteq \{ 1 , \dotsc , p \}$ denotes the location of the non-zero weights, $C = \{ c _ { 1 } , \ldots , c _ { r } \} \subseteq \mathbb { R }$ is a codebook, and $Q = ( q _ { 1 } , \ldots , q _ { k } ) , q _ { i } \in \{ 1 , \ldots , r \}$ denotes the quantized values. Most state-of-the-art compression schemes can be formalized in this manner (Han et al., 2016).
138
+
139
+ Given such a triplet, we define the corresponding weight $w ( S , Q , C ) \in \mathbb { R } ^ { p }$ as:
140
+
141
+ $$
142
+ w _ { i } ( S , Q , C ) = { \left\{ \begin{array} { l l } { c _ { q _ { j } } } & { { \mathrm { ~ i f ~ } } i = s _ { j } , } \\ { 0 } & { { \mathrm { ~ o t h e r w i s e } } . } \end{array} \right. }
143
+ $$
144
+
145
+ Following Langford $\&$ Caruana (2002); Dziugaite & Roy (2017), we bound the generalization error of a stochastic estimator given by applying independent random normal noise to the nonzero weights of the network. Formally, we consider the (degenerate) multivariate normal centered at $w$ : $\rho \sim \mathcal { N } ( w , \sigma ^ { 2 } J )$ , with $J$ being a diagonal matrix such that $J _ { i i } = 1$ if $i \in S$ and $J _ { i i } = 0$ otherwise.
146
+
147
+ Theorem 4.3. Let $( S , C , Q )$ be the output of a compression scheme, and let $\rho _ { S , C , Q }$ be the stochastic estimator given by the weights decoded from the triplet and variance $\sigma ^ { 2 }$ . Let c denote some arbitrary (fixed) coding scheme and let m denote an arbitrary distribution on the positive integers. Then, for any $\tau > 0$ , there is some $P A C$ -Bayes prior $\pi$ such that:
148
+
149
+ $$
150
+ \begin{array} { l } { \displaystyle \mathrm { K L } ( \rho _ { S , C , Q } , \pi ) \leq ( k \lceil \log r \rceil + | S | _ { c } + | C | _ { c } ) \log 2 - \log m ( k \lceil \log r \rceil + | S | _ { c } + | C | _ { c } ) } \\ { \displaystyle \qquad + \sum _ { i = 1 } ^ { k } \mathrm { K L } \Big ( \mathrm { N o r m a l } ( c _ { q _ { i } } , \sigma ^ { 2 } ) , \sum _ { j = 1 } ^ { r } \mathrm { N o r m a l } ( c _ { j } , \tau ^ { 2 } ) \Big ) . } \end{array}
151
+ $$
152
+
153
+ Note that we have written the KL-divergence of a distribution with a unnormalized measure (the last term), and in particular this term may (and often will) be negative. We defer the construction of the prior $\pi$ and the proof of Theorem 4.3 to the supplementary material.
154
+
155
+ Remark 4.4. We may obtain the first term $k \lceil \log r \rceil + | S | _ { c } + | C | _ { c }$ from the simple Occam’s bound described in Theorem 4.1 by choosing the coding of the quantized values $Q$ as a simple array of integers of the correct bit length. The second term thus describes the adjustment (or number of bits we “gain back”) from considering neighbouring estimators.
156
+
157
+ # 5 GENERALIZATION BOUNDS IN PRACTICE
158
+
159
+ In this section we present examples combining our theoretical arguments with state-of-the-art neural network compression schemes.1 Recall that almost all other approaches to bounding generalization error of deep neural networks yield vacuous bounds for realistic problems. The one exception is Dziugaite & Roy (2017), which succeeds by retraining the network in order to optimize the generalization bound. We give two examples applying our generalization bounds to the models output by modern neural net compression schemes. In contrast to earlier results, this leads immediately to non-vacuous bounds on realistic problems. The strength of the Occam bound provides evidence that the connection between compressibility and generalization has substantive explanatory power.
160
+
161
+ We report $9 5 \%$ confidence bounds based on the measured effective compressed size of the networks. The bounds are achieved by combining the PAC-Bayes bound Theorem 2.1 with Theorem 4.3, showing that $\operatorname { K L } ( \rho , \pi )$ is bounded by the “effective compressed size”. We note a small technical modification: we choose the prior variance $\tau ^ { 2 }$ layerwise by a grid search, this adds a negligible contribution to the effective size (see Appendix A.1 for the technical details of the bound).
162
+
163
+ LeNet-5 on MNIST. Our first experiment is performed on the MNIST dataset, a dataset of $6 0 \mathrm { k }$ grayscale images of handwritten digits. We fit the LeNet-5 (LeCun et al., 1998) network, one of the first convolutional networks. LeNet-5 has two convolutional layers and two fully connected layers, for a total of $4 3 1 \mathrm { k }$ parameters.
164
+
165
+ We apply a pruning and quantization strategy similar to that described in Han et al. (2016). We prune the network using Dynamic Network Surgery (Guo et al., 2016), pruning all but $1 . 5 \%$ of the network weights. We then quantize the non-zero weights using a codebook with 4 bits. The location of the non-zero coordinates are stored in compressed sparse row format, with the index differences encoded using arithmetic compression.
166
+
167
+ We consider the stochastic classifier given by adding Gaussian noise to each non-zero coordinate before each forward pass. We add Gaussian noise with standard deviation equal to $5 \%$ of the difference between the largest and smallest weight in the filter. This results in a negligible drop in classification performance.We obtain a bound on the training error of $4 6 \%$ (with $9 \hat { 5 } \%$ confidence). The effective size of the compressed model is measured to be 6.23 KiB.
168
+
169
+ ImageNet. The ImageNet dataset (Russakovsky et al., 2015) is a dataset of about 1.2 million natural images, categorized into 1000 different classes. ImageNet is substantially more complex than the MNIST dataset, and classical architectures are correspondingly more complicated. For example, AlexNet (Krizhevsky et al., 2012) and VGG-16 (Simonoyan & Zisserman, 2014) contain 61 and 128 million parameters, respectively. Non-vacuous bounds for such models are still out of reach when applying our bound with current compression techniques. However, motivated by computational restrictions, there has been extensive interest in designing more parsimonious architectures that achieve comparable or better performance with significantly fewer parameters (Iandola et al., 2016; Howard et al., 2017; Zhang et al., 2017b). By combining neural net compression schemes with parsimonious models of this kind, we demonstrate a non-vacuous bounds on models with better performance than AlexNet.
170
+
171
+ Our simple Occam bound requires only minimal assumptions, and can be directly applied to existing compressed networks. For example, Iandola et al. (2016) introduce the SqueezeNet architecture, and explicitly study its compressibility. They obtain a model with better performance than AlexNet but that can be written in 0.47 MiB. A direct application of our naïve Occam bound yields non-vacuous bound on the test error of $9 8 . 6 \%$ (with $9 5 \%$ confidence). To apply our stronger bound—taking into account the noise robustness—we train and compress a network from scratch. We consider Mobilenet 0.5 (Howard et al., 2017), which in its uncompressed form has better performance and smaller size than SqueezeNet (Iandola et al., 2016).
172
+
173
+ Zhu & Gupta (2017) study pruning of MobileNet in the context of energy-efficient inference in resource-constrained environments. We use their pruning scheme with some small adjustments. In particular, we use Dynamic Network Surgery (Guo et al., 2016) as our pruning method but follow a similar schedule. We prune $6 7 \%$ of the total parameters. The pruned model achieves a validation accuracy of $6 0 \%$ . We quantize the weights using a codebook strategy (Han et al., 2016). We consider the stochastic classifier given by adding Gaussian noise to the non-zero weights, with the variance set in each layer so as not to degrade our prediction performance. For simplicity, we ignore biases and batch normalization parameters in our bound, as they represent a negligible fraction of the parameters. We consider top-1 accuracy (whether the most probable guess is correct) and top-5 accuracy (whether any of the 5 most probable guesses is correct). The final “effective compressed size” is $3 5 0 \mathrm { K i B }$ . The stochastic network has a top-1 accuracy of $6 5 \%$ on the training data, and top-5 accuracy of $8 7 \%$ on the training data. The small effective compressed size and high training data accuracy yield non-vacuous bounds for top-1 and top-5 test error. See Appendix B for the details of the experiment.
174
+
175
+ Table 1: Summary of bounds obtained from compression
176
+
177
+ <table><tr><td>Dataset</td><td>Orig. size</td><td>Comp. size</td><td>Robust. Adj.</td><td>Eff. Size</td><td>Error Bound</td><td></td></tr><tr><td>MNIST</td><td>168.4KiB</td><td>8.1KiB</td><td>1.88KiB</td><td>6.23KiB</td><td>Top 1 &lt;46%</td><td>Top5</td></tr><tr><td>ImageNet</td><td>5.93MiB</td><td>452KiB</td><td>102KiB</td><td>350KiB</td><td>&lt; 96.5%</td><td>NA &lt;89%</td></tr></table>
178
+
179
+ # 6 LIMITS ON COMPRESSIBILITY
180
+
181
+ We have shown that compression results directly imply generalization bounds, and that these may be applied effectively to obtain non-vacuous bounds on neural networks. In this section, we provide a complementary view: overfitting implies a limit on compressibility.
182
+
183
+ Theory. We first prove that the entropy of estimators that tend to overfit is bounded in terms of the expected degree of overfitting. That implies the estimators fail to compress on average. As previously, consider a sample $S _ { n } = \{ ( { \overset { - } { x } } _ { 1 } , y _ { 1 } ) , \dots , ( x _ { n } , y _ { n } ) \}$ sampled i.i.d. from some distribution $\mathcal { D }$ , and an
184
+
185
+ estimator (or selection procedure) $\hat { h }$ , which we consider as a (random) function of the training data. The key observation is:
186
+
187
+ $$
188
+ \begin{array} { r } { \mathbb { P } ( L ( \hat { h } ( x ) , y ) = 1 \mid ( x , y ) \in S _ { n } ) = \mathbb { E } ( \hat { L } ( \hat { h } ) ) , } \\ { \mathbb { P } ( L ( \hat { h } ( x ) , y ) = 1 \mid ( x , y ) \notin S _ { n } ) = \mathbb { E } ( L ( \hat { h } ) ) . } \end{array}
189
+ $$
190
+
191
+ That is, the probability of misclassifying an example in the training data is smaller than the probability of misclassifying a fresh example, and the expected strength of this difference is determined by the expected degree of overfitting. By Bayes’ rule, we thus see that the more $\hat { h }$ overfits, the better it is able to distinguish a sample from the training and testing set. Such an estimator $\hat { h }$ must thus “remember” a significant portion of the training data set, and its entropy is thus lower bounded by the entropy of its “memory”.
192
+
193
+ Theorem 6.1. Let $L$ , $\hat { L } _ { : }$ , and $\hat { h }$ be as in the text immediately preceeding the theorem. For simplicity, assume that both the sample space $\mathcal { X } \times \mathcal { V }$ and the hypothesis set $\mathcal { H }$ are discrete. Then,
194
+
195
+ $$
196
+ H ( \hat { h } ) \geq n g ( \mathbb { E } [ \hat { L } ( \hat { h } ) ] , \mathbb { E } [ L ( \hat { h } ) ] ) ,
197
+ $$
198
+
199
+ where g denotes some non-negative function (given explicitly in the proof).
200
+
201
+ We defer the proof to the supplementary material.
202
+
203
+ Experiments. We now study this effect empirically. The basic tool is the randomization test of Zhang et al. (2017a): we consider a fixed architecture and a number of datasets produced by randomly relabeling the categories of some fraction of examples from a real-world dataset.
204
+
205
+ If the model has sufficiently high capacity, it can be fit with approximately zero training loss on each dataset. In this case, the generalization error is given by the fraction of examples that have been randomly relabeled. We apply a standard neural net compression tool to each of the trained models, and we observe that the models with worse generalization require more bits to describe in practice.
206
+
207
+ For simplicity, we consider the CIFAR-10 dataset, a collection of 40000 images categorized into 10 classes. We fit the ResNet (He et al., 2016) architecture with 56 layers with no pre-processing and no penalization
208
+
209
+ ![](images/afd7d26de8b0910af21268b092a9afd51a10212b51314349fb68c87db36277b4.jpg)
210
+ Figure 1: Training performance after pruning at varying levels of label randomization.
211
+
212
+ on the CIFAR-10 dataset where the labels are subjected to varying levels of randomization. As noted in Zhang et al. (2017a), the network is able to achieve $1 0 0 \%$ training accuracy no matter the level of randomization.
213
+
214
+ We then compress the networks fitted on each level of label randomization by pruning to a given target sparsity. Surprisingly, all networks are able to achieve $5 0 \%$ sparsity with essentially no loss of training accuracy, even on completely random labels. However, we observe that as the compression level increases further, the scenarios with more randomization exhibit a faster decay in training accuracy, see Figure 1. This is consistent with the fact that network size controls generalization error.
215
+
216
+ # 7 DISCUSSION
217
+
218
+ It has been a long standing observation by practitioners that despite the large capacity of models used in deep learning practice, empirical results demonstrate good generalization performance. We show that with no modifications, a standard engineering pipeline of training and compressing a network leads to demonstrable and non-vacuous generalization guarantees. These are the first such results on networks and problems at a practical scale, and mirror the experience of practitioners that best results are often achieved without heavy regularization or modifications to the optimizer (Wilson et al., 2017).
219
+
220
+ The connection between compression and generalization raises a number of important questions. Foremost, what are its limitations? The fact that our bounds are non-vacuous implies the link between compression and generalization is non-trivial. However, the bounds are far from tight. If significantly better compression rates were achievable, the resulting bounds would even be of practical value. For example, if a network trained on ImageNet to $9 0 \%$ training and $7 0 \%$ testing accuracy could be compressed to an effective size of 30 KiB—about one order of magnitude smaller than our current compression—that would yield a sharp bound on the generalization error.
221
+
222
+ # 8 ACKNOWLEDGEMENTS
223
+
224
+ We acknowledge computing resources from Columbia University’s Shared Research Computing Facility project, which is supported by NIH Research Facility Improvement Grant 1G20RR030893- 01, and associated funds from the New York State Empire State Development, Division of Science Technology and Innovation (NYSTAR) Contract C090171, both awarded April 15, 2010
225
+
226
+ # REFERENCES
227
+
228
+ S. Arora, R. Ge, B. Neyshabur, and Y. Zhang. Stronger generalization bounds for deep nets via a compression approach, February 2018.
229
+ Sanjeev Arora. Generalization Theory and Deep Nets, An introduction. http://www. offconvex.org/2017/12/08/generalization1/, 2017.
230
+ Carlo Baldassi, Alessandro Ingrosso, Carlo Lucibello, Luca Saglietti, and Riccardo Zecchina. Subdominant dense clusters allow for simple learning and high computational performance in neural networks with discrete synapses. Phys. Rev. Lett., 115:128101, Sep 2015.
231
+ Carlo Baldassi, Christian Borgs, Jennifer T. Chayes, Alessandro Ingrosso, Carlo Lucibello, Luca Saglietti, and Riccardo Zecchina. Unreasonable effectiveness of learning neural networks: From accessible states and robust ensembles to basic algorithmic schemes. Proceedings of the National Academy of Sciences, 113(48):E7655–E7662, 2016.
232
+ Peter Bartlett, Dylan J. Foster, and Matus Telgarsky. Spectrally-normalized margin bounds for neural networks, 2017.
233
+ Anselm Blumer, Andrzej Ehrenfeucht, David Haussler, and Manfred K. Warmuth. Occam’s razor. Information Processing Letters, 24(6):377 – 380, 1987.
234
+ Luc Bégin, Pascal Germain, François Laviolette, and Jean-Francis Roy. PAC-Bayesian Theory for Transductive Learning. In Samuel Kaski and Jukka Corander (eds.), Proceedings of the Seventeenth International Conference on Artificial Intelligence and Statistics, volume 33 of Proceedings of Machine Learning Research, pp. 105–113, Reykjavik, Iceland, 22–25 Apr 2014. PMLR. URL http://proceedings.mlr.press/v33/begin14.html.
235
+ Olivier Catoni. Pac-Bayesian supervised classification: the thermodynamics of statistical learning, volume 56 of Institute of Mathematical Statistics Lecture Notes—Monograph Series. Institute of Mathematical Statistics, Beachwood, OH, 2007.
236
+ Pratik Chaudhari, Anna Choromanska, Stefano Soatto, Yann LeCun, Carlo Baldassi, Christian Borgs, Jennifer Chayes, Levent Sagun, and Riccardo Zecchina. Entropy-SGD: Biasing gradient descent into wide valleys. In International Conference on Learning Representations, 2017.
237
+ Y. Cheng, D. Wang, P. Zhou, and T. Zhang. Model compression and acceleration for deep neural networks: The principles, progress, and challenges. IEEE Signal Processing Magazine, 35(1): 126–136, Jan 2018.
238
+ Gintare Karolina Dziugaite and Daniel M. Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. In Conference on Uncertainty in Artificial Intelligence, 2017.
239
+
240
+ Gintare Karolina Dziugaite and Daniel M. Roy. Entropy-sgd optimizes the prior of a pac-bayes bound: Generalization properties of entropy-sgd and data-dependent priors. In International Conference on Machine Learning, 2018.
241
+
242
+ Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient DNNs. In Advances in Neural Information Processing Systems, 2016.
243
+
244
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. In International Conference on Learning Representations, 2016.
245
+
246
+ Nick Harvey, Christopher Liaw, and Abbas Mehrabian. Nearly-tight VC-dimension bounds for piecewise linear neural networks. In Satyen Kale and Ohad Shamir (eds.), Proceedings of the 2017 Conference on Learning Theory, volume 65 of Proceedings of Machine Learning Research, pp. 1064–1068, Amsterdam, Netherlands, 07–10 Jul 2017. PMLR.
247
+
248
+ Kaiming He, Xiangyu Zhang, Shaoqin Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition, pp. 770–778, June 2016.
249
+
250
+ Geoffrey E. Hinton and Drew van Camp. Keeping the neural networks simple by minimizing the description length of the weights. In Proceedings of the Sixth Annual Conference on Computational Learning Theory, pp. 5–13, 1993.
251
+
252
+ Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, January 1997.
253
+
254
+ Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications, 2017.
255
+
256
+ Forrest N Iandola, Song Han, Matthew W Moskewicz, Khalid Ashraf, William J Dally, and Kurt Keutzer. SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and $< 0 . 5 \mathrm { m b }$ model size. arXiv:1602.07360, 2016.
257
+
258
+ Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. In International Conference on Learning Representations, 2017.
259
+
260
+ P. Konstantinos, M. Davies, and P. Vandergheynst. PAC-Bayesian Margin Bounds for Convolutional Neural Networks - Technical Report.
261
+
262
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In F. Pereira, C. J. C. Burges, L. Bottou, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems, pp. 1097–1105. 2012.
263
+
264
+ John Langford. Quantitatively tight sample complexity bounds. PhD thesis, Carnegie Mellon University, 2002.
265
+
266
+ John Langford and Rich Caruana. (not) bounding the true error. In Advances in Neural Information Processing Systems, pp. 809–816, 2002.
267
+
268
+ François Laviolette. A tutorial on pac-bayesian theory. Talk at the NIPS 2017 Workshop: (Almost) 50 Shades of PAC-Bayesian Learning: PAC-Bayesian trends and insights, 2017. URL https: //bguedj.github.io/nips2017/pdf/laviolette_nips2017.pdf.
269
+
270
+ Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 11 1998.
271
+
272
+ David MacKay. Bayesian model comparison and backprop nets. In Advances in Neural Information Processing Systems, pp. 839–846. 1992.
273
+
274
+ David McAllester. Simplified pac-bayesian margin bounds. In Bernhard Schölkopf and Manfred K. Warmuth (eds.), Learning Theory and Kernel Machines, pp. 203–215, Berlin, Heidelberg, 2003. Springer Berlin Heidelberg. ISBN 978-3-540-45167-9.
275
+
276
+ David A. McAllester. Some PAC-Bayesian theorems. Machine Learning, 37(3):355–363, Dec 1999.
277
+
278
+ David A. McAllester. A PAC-Bayesian tutorial with A dropout bound, 2013.
279
+
280
+ Behnam Neyshabur, Srinadh Bhojanapalli, David Mcallester, and Nati Srebro. Exploring generalization in deep 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, pp. 5947–5956. 2017.
281
+
282
+ Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro. A PAC-bayesian approach to spectrally-normalized margin bounds for neural networks. In International Conference on Learning Representations, 2018.
283
+
284
+ Carl Edward Rasmussen and Zoubin Ghahramani. Occam’s razor. In Advances in Neural Information Processing Systems (NIPS), 2001.
285
+
286
+ Jorma Rissanen. Stochastic complexity and modeling. Ann. Statist., 14(3):1080–1100, 09 1986.
287
+
288
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 12 2015.
289
+
290
+ J. Schmidt-Hieber. Nonparametric regression using deep neural networks with relu activation function, August 2017.
291
+
292
+ Karen Simonoyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations. 2014.
293
+
294
+ Ashia C Wilson, Rebecca Roelofs, Mitchell Stern, Nati Srebro, and Benjamin Recht. The marginal value of adaptive gradient methods in machine 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, pp. 4148–4158. 2017.
295
+
296
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In International Conference on Learning Representations, 2017a.
297
+
298
+ Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices, 2017b.
299
+
300
+ Michael Zhu and Suyog Gupta. To prune, or not to prune: exploring the efficacy of model pruning for model compression. In NIPS Workshop on Machine Learning on the Phone and other Consumer Devices, 12 2017.
301
+
302
+ # A PROOF OF THEOREM 4.3
303
+
304
+ In this section we describe the construction of the prior $\pi$ and prove the bound on the KL-divergence claimed in Theorem 4.3. Intuitively, we would like to express our prior as a mixture over all possible decoded points of the compression algorithm. More precisely, define the mixture component $\pi _ { S , Q , C }$ associated with a triplet $( S , Q , C )$ as:
305
+
306
+ $$
307
+ \pi _ { S , Q , C } = \mathrm { N o r m a l } ( w ( S , Q , C ) , \tau ^ { 2 } ) .
308
+ $$
309
+
310
+ We then define our prior $\pi$ as a weighted mixture over all triplets, weighted by the code length of the triplet:
311
+
312
+ $$
313
+ \pi \propto \sum _ { S , Q , C } m ( | S | _ { c } + | C | _ { c } + k \lceil \log r \rceil ) 2 ^ { - | S | _ { c } - | C | _ { c } - k \lceil \log r \rceil } \pi _ { S , Q , C } ,
314
+ $$
315
+
316
+ where the sum is taken over all $S$ and $C$ which are representable by our code, and all $Q \ =$ $( q _ { 1 } , \ldots , q _ { k } ) \in \{ 1 , \ldots , r \} ^ { k }$ . In practice, $S$ takes values in all possible subsets of $\{ 1 , \ldots , p \}$ , and $C$ takes values in $F ^ { r }$ , where $F \subseteq \mathbb { R }$ is a chosen finite subset of representable real numbers (such as those that may be represented by IEEE-754 single precision numbers), and $r$ is a chosen quantization level. We now give the proof of Theorem 4.3.
317
+
318
+ Proof. We have that:
319
+
320
+ $$
321
+ \pi = \frac { 1 } { Z } \sum _ { S , Q , C } m ( | S | _ { c } + | C | _ { c } + k \lceil \log r \rceil ) 2 ^ { - | S | _ { c } - | C | _ { c } - k \lceil \log r \rceil } \pi _ { S , Q , C } ,
322
+ $$
323
+
324
+ where we must have $Z \leq 1$ by the same argument as in the proof of Theorem 4.1
325
+
326
+ Suppose that the output of our compression algorithm is a triplet $( \hat { S } , \hat { Q } , \hat { C } )$ . We recall that our posterior $\rho$ is given by a normal centered at $w ( \hat { S } , \hat { Q } , \hat { C } )$ with variance $\sigma ^ { 2 }$ , and we may thus compute the KL-divergence:
327
+
328
+ $$
329
+ \begin{array} { r l } & { \displaystyle \mathrm { \mathop { X L } } ( \rho , \pi ) \leq \mathrm { \mathop { K L } } \left( \rho , \displaystyle \sum _ { s , Q , C } m ( | S | _ { c } + | C | _ { c } + k / \log r ] ) 2 ^ { - | S | _ { c } - | C | _ { c } - k / \log r ] } \pi _ { S , Q , C } \right) } \\ & { \qquad \leq \mathrm { \mathop { K L } } \left( \rho , \displaystyle \sum _ { Q } m ( | \hat { S } | _ { c } + | \hat { C } | _ { c } + \hat { k } / \log \hat { r } ] ) 2 ^ { - | \hat { S } | _ { c } - | \hat { C } | _ { c } - \hat { k } / \log \hat { r } | } \pi _ { \hat { S } , Q , \hat { C } } \right) } \\ & { \qquad \leq \big ( | \hat { S } | _ { c } + | \hat { C } | _ { c } + \hat { k } / \log \hat { r } | \big ) \log 2 + \log m ( | \hat { S } | _ { c } + | \hat { C } | _ { c } + \hat { k } / \log \hat { r } | ) + \mathrm { \mathop { K L } } \left( \rho , \displaystyle \sum _ { Q } \pi _ { \hat { S } , Q , \hat { C } } \right) . } \end{array}
330
+ $$
331
+
332
+ We are now left with the mixture term, which is a mixture of $r ^ { k }$ many terms in dimension $k$ , and thus computationally untractable. However, we note that we are in a special case where the mixture itself is independent across coordinates. Indeed, let $\phi _ { \tau }$ denote the density of the univariate normal distribution with mean 0 and variance $\tau ^ { 2 }$ , we note that we may write the mixture as:
333
+
334
+ $$
335
+ \begin{array} { r } { \Big ( \displaystyle \sum _ { Q } \pi _ { \hat { S } , Q , \hat { C } } \Big ) ( x ) = \displaystyle \sum _ { q ^ { 1 } , \dots , q ^ { k } = 1 } ^ { r } \prod _ { i = 1 } ^ { k } \phi _ { \tau } ( x _ { i } - \hat { c } _ { q ^ { i } } ) } \\ { = \displaystyle \prod _ { i = 1 } ^ { k } \sum _ { q ^ { i } = 1 } ^ { r } \phi _ { \tau } ( x _ { i } - \hat { c } _ { q ^ { i } } ) . } \end{array}
336
+ $$
337
+
338
+ Additionally, as our chosen stochastic estimator $\rho$ is independent over the coordinates, the KLdivergence decomposes over the coordinates, to obtain:
339
+
340
+ $$
341
+ \mathrm { K L } \left( \rho , \sum _ { Q } \pi _ { \hat { S } , Q , \hat { C } } \right) = \sum _ { i = 1 } ^ { k } \mathrm { K L } \left( \rho _ { i } , \sum _ { q ^ { i } = 1 } ^ { r } \mathrm { N o r m a l } \left( \hat { c } _ { q ^ { i } } , \tau ^ { 2 } \right) \right) .
342
+ $$
343
+
344
+ Plugging the above computation into (13) gives the desired result.
345
+
346
+ # A.1 DETAILS IN PRACTICAL USES OF THE BOUND
347
+
348
+ Although Theorem 4.3 contains the main mathematical contents of our bound, applying the bound in a fully correct fashion requires some amount of minutiae and book-keeping we detail in this section. In particular, we are required to select a number of parameters (such as the prior variances). We extend the bound to account for such unrestricted (and possibly data-dependent) parameter selection. Typically, such adjustments have a negligible effect on the computed bounds.
349
+
350
+ Theorem A.1 (Union Bound for Discrete Parameters). Let $\pi _ { \xi }$ , $\xi \in \Xi$ , denote a family of priors parameterized by a discrete parameter $\xi$ , which takes values in a finite set Ξ. There exists a prior $\pi$ such that for any posterior $\rho$ and any $\xi \in \Xi$ :
351
+
352
+ $$
353
+ \mathrm { K L } ( \rho , \pi ) \leq \mathrm { K L } ( \rho , \pi _ { \xi } ) + \log \vert \Xi \vert .
354
+ $$
355
+
356
+ Proof. We define $\pi$ as a uniform mixture of the $\pi _ { \xi }$
357
+
358
+ $$
359
+ \pi = { \frac { 1 } { | \Xi | } } \sum _ { \xi \in \Xi } \pi _ { \xi } .
360
+ $$
361
+
362
+ We then have that:
363
+
364
+ $$
365
+ \operatorname { K L } ( \rho , \pi ) = \mathbb { E } _ { X \sim \rho } \log { \frac { d \rho } { d \pi } } ,
366
+ $$
367
+
368
+ but we can note that $\begin{array} { r } { \frac { d \rho } { d \pi } \leq | \Xi | \frac { d \rho } { d \pi _ { \xi } } } \end{array}$ , from which we deduce that:
369
+
370
+ $$
371
+ \mathrm { K L } ( \rho , \pi ) \leq \mathrm { K L } ( \rho , \pi _ { \xi } ) + \log \vert \Xi \vert .
372
+ $$
373
+
374
+ We make liberal use of this variant to control a number of discrete parameters which are chosen empirically (such as the quantization resolution at each layer). We also use this bound to control a number of continuous quantities (such as the prior variances) by discretizing these quantities as IEEE-754 single precision (32 bit) floating point numbers.
375
+
376
+ # B EXPERIMENT DETAILS
377
+
378
+ # B.1 LENET-5
379
+
380
+ We train the baseline model for LeNet-5 using stochastic gradient descent with momentum and no data augmentation. The batch size is set to 1024, and the learning rate is decayed using an inverse time decay starting at 0.01 and decaying every 125 steps. We apply a small $\ell _ { 2 }$ penalty of 0.005. We train a total of 20000 steps.
381
+
382
+ We carry out the pruning using Dynamic Network Surgery (Guo et al., 2016). The threshold is selected per layer as the mean of the layer coefficients offset by a constant multiple of the standard deviation of the coefficients, where the multiple is piecewise constant starting at 0.0 and ending at 4.0. We choose the pruning probability as a piecewise constant starting at 1.0 and decaying to $1 \bar { 0 } ^ { - 3 }$ We train for 30000 steps using the ADAM optimizer.
383
+
384
+ We quantize all the weights using a 4 bit codebook (Han et al., 2016) per layer initialized using $k$ -means. A single cluster in each weight is given to be exactly zero and contains the pruned weights. The remaining clusters centers are learned using the ADAM optimizer over 1000 steps.
385
+
386
+ # B.2 MOBILENET
387
+
388
+ MobileNets are a class of networks that make use of depthwise separable convolutions. Each layer is composed of two convolutions, with one depthwise convolution and one pointwise convolution. We use the pre-trained MobileNet model provided by Google as our baseline model. We then prune the pointwise (and fully connected) layers only, using Dynamic Network Surgery. The threshold is set for each weight as a quantile of the absolute values of the coordinates, which is increased according to the schedule given in (Zhu & Gupta, 2017). As the lower layers are smaller and more sensitive, we scale the target sparsity for each layer according to the size of the layer. The target sparsity is scaled linearly between $6 5 \%$ and $7 5 \%$ as a proportion of the number of elements in the layer compared to the largest layer (the final layer). We use stochastic gradient descent with momentum and decay the learning with an inverse time decay schedule, starting at $1 0 ^ { - 3 }$ and decaying by 0.05 every 2000 steps. We use a minibatch size of 64 and train for a total of 300000 steps, but tune the pruning schedule so that the target sparsity is reached after 200000 steps.
389
+
390
+ We quantize the weights by using a codebook for each layer with 6 bits for all layers except the last fully connected layer which only has 5 bits. The pointwise and fully connected codebooks have a reserved encoding for exact 0, whereas the non-pruned depthwise codebooks are fully learned. We initialize the cluster assignment using $k$ -means and train the cluster centers for 20000 steps with stochastic gradient with momentum with a learning rate of $1 0 ^ { - 4 }$ . Note that we also modify the batch normalization moving average parameters in this step so that it adapts faster, choosing .99 as the momentum parameter for the moving averages.
391
+
392
+ To witness noise robustness, we only add noise to the pointwise and fully connected layer. We are able to add Gaussian noise with standard deviation equal to $2 \%$ of the difference in magnitude between the largest and smallest coordinate in the layer for the fully connected layer. For pointwise layers we add noise equal to $1 \%$ of the difference scaled linearly by the relative size of the layer compared to the fully connected layer. These quantities were chosen to minimally degrade the training performance while obtaining good improvements on the generalization bound: in our case, we observe that the top-1 training accuracy is reduced to $6 5 \%$ with noise applied from $6 7 \%$ without noise.
393
+
394
+ # C PROOF THAT OVERFITTING IMPLIES HIGH CLASSIFIER ENTROPY
395
+
396
+ As previously, consider a sample $S = \{ ( x _ { 1 } , y _ { 1 } ) , \dots , ( x _ { n } , y _ { n } ) \}$ sampled i.i.d. from some distribution $\mathcal { D }$ , and an estimator (or selection procedure) $\hat { h }$ . The statement that $\hat { h }$ overfits may then be captured in terms of the training and testing error of $\hat { h }$ , namely that $\hat { L } ( \hat { h } ) \ll L ( \hat { h } )$ . We note that this statement depends on the randomness of the sample through its impact on $\hat { h }$ , and we will make the interpretation precise momentarily.
397
+
398
+ Such an estimator $\hat { h }$ that overfits may be transformed into a procedure which discriminates between samples from the training and testing set. Indeed, let $( x , y ) \in \mathcal { X } \times \mathcal { Y }$ be drawn from an independent mixture of the uniform distribution on $S$ and the data-generating distribution $\mathcal { D }$ , where by independent we mean that $I _ { ( x , y ) \in S }$ is independent of $S$ . Then, we have by Bayes rule that:
399
+
400
+ $$
401
+ \begin{array} { r l } { \mathbb { P } ( ( x , y ) \in S \mid L ( \hat { h } ( x ) , y ) = 1 ) = } \\ & { } \\ { \frac { \mathbb { P } ( L ( \hat { h } ( x ) , y ) = 1 \mid ( x , y ) \in S ) } { \mathbb { P } ( L ( \hat { h } ( x ) , y ) = 1 \mid ( x , y ) \in S ) + \mathbb { P } ( L ( \hat { h } ( x ) , y ) = 1 \mid ( x , y ) \notin S ) } , } \end{array}
402
+ $$
403
+
404
+ where the probability is taken with respect to the distribution of $( x , y )$ . By the definition of in-sample and out-of-sample loss, we have by independence that:
405
+
406
+ $$
407
+ \begin{array} { r } { \mathbb { P } ( L ( \hat { h } ( x ) , y ) = 1 \mid ( x , y ) \in S ) = \mathbb { E } ( \hat { L } ( \hat { h } ) ) , } \\ { \mathbb { P } ( L ( \hat { h } ( x ) , y ) = 1 \mid ( x , y ) \notin S ) = \mathbb { E } ( L ( \hat { h } ) ) . } \end{array}
408
+ $$
409
+
410
+ We may thus rewrite (19) (and its analogue conditional probability on the event $L ( \hat { h } ( x ) , y ) = 0 ,$ ) to obtain:
411
+
412
+ $$
413
+ \begin{array} { r l } & { \mathbb { P } ( ( x , y ) \in S \mid L ( \hat { h } ( x ) , y ) = 1 ) = \left( 1 + \frac { \mathbb { E } ( L ( \hat { h } ) ) } { \mathbb { E } ( \hat { L } ( \hat { h } ) ) } \right) ^ { - 1 } , } \\ & { \mathbb { P } ( ( x , y ) \in S \mid L ( \hat { h } ( x ) , y ) = 0 ) = \left( 1 + \frac { 1 - \mathbb { E } ( L ( \hat { h } ) ) } { 1 - \mathbb { E } ( \hat { L } ( \hat { h } ) ) } \right) ^ { - 1 } . } \end{array}
414
+ $$
415
+
416
+ We thus see that the more $\hat { h }$ overfits, the better it is able to distinguish a sample from the training and testing set. Such an estimator $\hat { h }$ must thus “remember” a significant portion of the training data set,
417
+
418
+ and its entropy is thus lower bounded by the entropy of its “memory”. Quantitatively, we note that the quality of $\hat { h }$ as a discriminator between the training and testing set is captured by the quantities
419
+
420
+ $$
421
+ p _ { n } = \Big ( 1 + \frac { \mathbb { E } ( L ( \hat { h } ) ) } { \mathbb { E } ( \hat { L } ( \hat { h } ) ) } \Big ) ^ { - 1 } , q _ { n } = \Big ( 1 + \frac { 1 - \mathbb { E } ( L ( \hat { h } ) ) } { 1 - \mathbb { E } ( \hat { L } ( \hat { h } ) ) } \Big ) ^ { - 1 } , l _ { n } = \frac { 1 } { 2 } \mathbb { E } [ \hat { L } ( \hat { h } ) + L ( \hat { h } ) ] .
422
+ $$
423
+
424
+ We may interpret $p _ { n }$ as the average proportion of false positives and $q _ { n }$ as the average proportion of true negatives when viewing $\hat { h }$ as a classifier. We prove that if those quantities are substantially different from a random classifier, then $\hat { h }$ must have high entropy. We formalize this statement and provide a proof below.
425
+
426
+ Theorem C.1. Let $S = \{ ( x _ { 1 } , y _ { 1 } ) , \dots , ( x _ { n } , y _ { n } ) \}$ be sampled i.i.d. from some distribution $\mathcal { D }$ , and let $\hat { h }$ be a selection procedure, which is only a function of the unordered set $S$ . Let us view $\hat { h }$ as $a$ random quantity through the distribution induced by the sample $S$ . For simplicity, we assume that both the sample space $\mathcal { X } \times \mathcal { V }$ and the hypothesis set $\mathcal { H }$ are discrete. We have that:
427
+
428
+ $$
429
+ H ( \hat { h } ) \geq n g ( p _ { n } , q _ { n } , l _ { n } ) ,
430
+ $$
431
+
432
+ where $g$ denotes some non-negative function.
433
+
434
+ Proof. Consider a sequence of pairs $( s _ { 1 } ^ { 0 } , s _ { 1 } ^ { 1 } ) , . . . , ( s _ { n } ^ { 0 } , s _ { n } ^ { 1 } )$ , where each $s _ { i } ^ { j } = ( x _ { i } ^ { j } , y _ { i } ^ { j } )$ is sampled independently according to the data generating distribution $\mathcal { D }$ . Let $E = ( ( s _ { i } ^ { 0 } , s _ { i } ^ { 1 } ) ) _ { i = 1 , \dots n }$ denote the of sample pairs. Additionally, let $b _ { 1 } , \ldots , b _ { n } \in \{ 0 , 1 \}$ denote $n$ i.i.d. Bernoulli random variables, and let $B = ( b _ { i } ) _ { i = 1 , \dots , n }$ denote the sequence. We may construct a sample $S$ by selecting elements of $E$ according to $B$ :
435
+
436
+ $$
437
+ S = ( ( x _ { i } ^ { b _ { i } } , y _ { i } ^ { b _ { i } } ) ) _ { i = 1 , \dots , n } ,
438
+ $$
439
+
440
+ and we note that $S$ is an i.i.d. sample of size $n$ from the data generating distribution $\mathcal { D }$ . Additionally, by independence of $B$ and $E$ , we have that $H ( B \mid E ) = H ( B ) = n \log 2$ . On the other hand, we have
441
+
442
+ $$
443
+ \begin{array} { l } { \displaystyle H ( B \mid E , \hat { h } ) \leq \sum _ { i = 1 } ^ { n } H ( B _ { i } \mid E , \hat { h } ) } \\ { \leq \sum _ { i = 1 } ^ { n } H ( B _ { i } \mid \hat { h } ( x _ { i } ^ { 0 } ) , \hat { h } ( x _ { i } ^ { 1 } ) , y _ { i } ^ { 0 } , y _ { i } ^ { 1 } ) } \\ { \leq \sum _ { i = 1 } ^ { n } H ( B _ { i } \mid L ( \hat { h } ( x _ { i } ^ { 0 } ) , y _ { i } ^ { 0 } ) ) . } \end{array}
444
+ $$
445
+
446
+ We compute the conditional distribution of $B _ { i }$ given $L ( \hat { h } ( x _ { i } ^ { 0 } ) , y _ { i } ^ { 0 } ) = L _ { i } ^ { 0 }$ . In particular, we claim that $B _ { i }$ | $L _ { i } ^ { 0 } = 0$ is Bernoulli with parameter $p _ { n }$ . Indeed, note that $B _ { i }$ , $L _ { i } ^ { 0 }$ and $\hat { h }$ have the same distribution as if they were sampled from the procedure described before (19). Namely, sample $S$ i.i.d. according to the data generating distribution, and let $\hat { h }$ be the corresponding estimator, $B _ { i }$ an independent Bernoulli random variable, and $L _ { i } = L ( \hat { h } ( x ) , y )$ where $( x , y )$ is sampled uniformly from S if $B _ { i } = 0$ and according to the data generating distribution if $B _ { i } = 1$ . Note that this distribution does not depend on $i$ due to the assumption that $\hat { h }$ is measurable with respect to the unordered sample $S$ . By (19), we thus deduce that:
447
+
448
+ $$
449
+ \mathbb { P } ( B _ { i } = 0 \mid L _ { i } ^ { 0 } = 1 ) = p _ { n }
450
+ $$
451
+
452
+ which yields the desired result by taking expectation over the distribution of $\hat { h } , \hat { L } ( \hat { h } )$ .
453
+
454
+ Similarly, we may compute the distribution of $B _ { i }$ conditional on the event where $L _ { i } ^ { 0 } ~ = ~ 0$ , as $\mathbb { P } ( B _ { i } = { \bf \bar { 0 } } \mid L _ { i } ^ { 0 } = { \bf \bar { 0 } } ) = q _ { n }$ . By definition, we now have that:
455
+
456
+ $$
457
+ H ( B _ { i } \mid L _ { i } ^ { 0 } ) = l _ { n } h _ { b } ( p _ { n } ) + ( 1 - l _ { n } ) h _ { b } ( q _ { n } ) ,
458
+ $$
459
+
460
+ where $h _ { b } ( p )$ denotes the binary entropy function. Finally, we apply the chain rule for entropy. We note that
461
+
462
+ $$
463
+ H ( B \mid E , { \hat { h } } ) = H ( B , { \hat { h } } \mid E ) - H ( { \hat { h } } \mid E ) ,
464
+ $$
465
+
466
+ and write $H ( B , { \hat { h } } \mid E ) \geq H ( B \mid E ) = n \log 2$ and $H ( \hat { h } \mid E ) \leq H ( \hat { h } )$ . In summary,
467
+
468
+ $$
469
+ \begin{array} { r l } & { H ( \hat { h } ) \geq H ( \hat { h } \mid E ) } \\ & { \qquad = H ( B , \hat { h } \mid E ) - H ( B \mid E , \hat { h } ) } \\ & { \qquad \geq n \log 2 - n [ l _ { n } h _ { b } ( p _ { n } ) - ( 1 - l _ { n } ) h _ { b } ( q _ { n } ) ] } \\ & { \qquad \geq n [ h _ { b } ( 1 / 2 ) - l _ { n } h _ { b } ( p _ { n } ) - ( 1 - l _ { n } ) h _ { b } ( q _ { n } ) ] \ , } \end{array}
470
+ $$
471
+
472
+ which yields (20).
md/train/BJl6AjC5F7/BJl6AjC5F7.md ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING TO REPRESENT EDITS
2
+
3
+ Pengcheng Yin∗, Graham Neubig Language Technology Institute Carnegie Mellon University Pittsburgh, PA 15213, USA {pcyin,gneubig}@cs.cmu.edu
4
+
5
+ # Miltiadis Allamanis, Marc Brockschmidt, Alexander L. Gaunt
6
+
7
+ Microsoft Research Cambridge, CB1 2FB, United Kingdom {miallama,mabrocks,algaunt}@microsoft.com
8
+
9
+ # ABSTRACT
10
+
11
+ We introduce the problem of learning distributed representations of edits. By combining a “neural editor” with an “edit encoder”, our models learn to represent the salient information of an edit and can be used to apply edits to new inputs. We experiment on natural language and source code edit data. Our evaluation yields promising results that suggest that our neural network models learn to capture the structure and semantics of edits. We hope that this interesting task and data source will inspire other researchers to work further on this problem.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ One great advantage of electronic storage of documents is the ease with which we can edit them, and edits are performed in a wide variety of contents. For example, right before a conference deadline, papers worldwide are finalized and polished, often involving common fixes for grammar, clarity and style. Would it be possible to automatically extract rules from these common edits? Similarly, program source code is constantly changed to implement new features, follow best practices and fix bugs. With the widespread deployment of (implicit) version control systems, these edits are quickly archived, creating a major data stream that we can learn from.
16
+
17
+ In this work, we study the problem of learning distributed representations of edits. We only look at small edits with simple semantics that are more likely to appear often and do not consider larger edits; i.e., we consider “add definite articles” rather than “rewrite act 2, scene 3.” Concretely, we focus on two questions: i) Can we group semantically equivalent edits together, so that we can automatically recognize common edit patterns? ii) Can we automatically transfer edits from one context to another? A solution to the first question would yield a practical tool for copy editors and programmers alike, automatically identifying the most common changes. By leveraging tools from program synthesis, such groups of edits could be turned into interpretable rules and scripts (Rolim et al., 2017). When there is no simple hard rule explaining how to apply an edit, an answer to the second question would be of great use, e.g., to automatically rewrite natural language following some stylistic rule.
18
+
19
+ We propose to handle edit data in an autoencoder-style framework, in which an “edit encoder” $f _ { \Delta }$ is trained to compute a representation of an edit ${ \pmb x } _ { - } { \pmb x } _ { + }$ , and a “neural editor” $\alpha$ is trained to construct $\mathbf { \pmb { x } } _ { + }$ from the edit representation and ${ \bf x } _ { - }$ . This framework ensures that the edit representation is semantically meaningful, and a sufficiently strong neural editor allows this representation to not be specific to the changed element. We experiment with various neural architectures that can learn to represent and apply edits and hope to direct the attention of the research community to this new and interesting data source, leading to better datasets and stronger models.
20
+
21
+ Briefly, the contributions of our paper are: (a) in Sect. 2, we present a new and important machine learning task on learning representations of edits (b) we present a family of models that capture the structure of edits and compute efficient representations in Sect. 3 (c) we create a new source code edit dataset, and release the data extraction code at https://github.com/Microsoft/msrc-dpu-learning-to-represent-edits and the data at http://www.cs.cmu.edu/˜pengchey/githubedits.zip. (d) we perform a set of experiments on the learned edit representations in Sect. 4 for natural language text and source code and present promising empirical evidence that our models succeed in capturing the semantics of edits.
22
+
23
+ ![](images/8d21428d5873234cdcd2a3a846d04788112a4f4b1f1086b00d37d61a8564e4d4.jpg)
24
+ Figure 1: Given an edit (Edit 1) of ${ \bf x } _ { - }$ to $\mathbf { \pmb { x } } _ { + }$ , $f _ { \Delta }$ computes an edit representation vector. Using that representation vector the neural editor $\alpha$ applies the same edit to a new $\mathbf { { x } } _ { - } ^ { \prime }$ . The code snippets shown here are real code change examples from the roslyn open-source compiler project.
25
+
26
+ # 2 TASK
27
+
28
+ In this work, we are interested in learning to represent and apply edits on discrete sequential or structured data, such as text or source code parse trees1. Figure 1 gives a graphical overview of the task, described precisely below.
29
+
30
+ Edit Representation Given a dataset of edits $\{ \mathbf { x } _ { - } ^ { ( i ) } \mathbf { x } _ { + } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ , where $\pmb { x } _ { - } ^ { ( i ) }$ is the original version of some object and $\pmb { x } _ { + } ^ { ( i ) }$ its edited form (see upper half of Figure 1 for an example), our goal is to learn a representation function $f _ { \Delta }$ that maps an edit operation ${ \pmb x } _ { - } { \pmb x } _ { + }$ to a real-valued edit representation $f _ { \Delta } ( \pmb { x } _ { - } , \pmb { x } _ { + } ) \in \mathbb { R } ^ { n }$ . A desired quality of $f _ { \Delta }$ is for the computed edit representations to have the property that semantically similar edits have nearby representations in $\mathbb { R } ^ { n }$ . Having distributed representations also allows other interesting downstream tasks, e.g., unsupervised clustering and visualization of similar edits from large-scale data (e.g. the GitHub commit stream), which would be useful for developing human-assistance toolkits for discovering and extracting emerging edit patterns (e.g. new bug fixes or emerging “best practices” of coding).
31
+
32
+ Neural Editor Given an edit representation function $f _ { \Delta }$ , we want to learn to apply edits in a new context. This can be achieved by learning a neural editor $\alpha$ that accepts an edit representation $f _ { \Delta } ( { \pmb x } _ { - } , { \pmb x } _ { + } )$ and a new input $\mathbf { x } _ { - } ^ { \prime }$ and generates $\pmb { x } _ { + } ^ { \prime }$ .2 This is illustrated in the lower half of Figure 1.
33
+
34
+ # 3 MODEL
35
+
36
+ We cast the edit representation problem as an autoencoding task, where we aim to minimize the reconstruction error of $\alpha$ for the edited version $\mathbf { \pmb { x } } _ { + }$ given the edit representation $f _ { \Delta } ( { \pmb x } _ { - } , { \pmb x } _ { + } )$ and the original version ${ \bf x } _ { - }$ . By limiting the capacity of $f _ { \Delta }$ ’s output and allowing the model to freely use information about ${ \bf x } _ { - }$ , we are introducing a “bottleneck” that forces the overall framework to not simply treat $f _ { \Delta } ( { \pmb x } _ { - } , { \pmb x } _ { + } )$ as an encoder of $\mathbf { \pmb { x } } _ { + }$ . The main difference from traditional autoencoders is that in our setup, an optimal solution requires to re-use as much information as possible from ${ \bf x } _ { - }$ to make the most of the capaneural network and a dataset $f _ { \Delta }$ ly, given a probabilistic editor function , we seek to minimize the negative likel $P _ { \alpha }$ such as aod loss $\{ \pmb { x } _ { - } ^ { ( i ) } \pmb { x } _ { + } ^ { ( i ) } \} _ { i = 1 } ^ { N }$
37
+
38
+ ![](images/e7efd8f1e1fb21d94866addf08fd7c5d752432d562b6fda6496edfb792ef9393.jpg)
39
+ Figure 2: (a) Graph representation of statement ${ \texttt { u } } = { \texttt { x } } + { \texttt { x } }$ . Rectangular (resp. rounded) nodes denote tokens (resp. non-terminals). (b) Sequence of tree decoding steps yielding $\mathrm { ~ ~ x ~ } + \mathrm { ~ ~ x ~ } - 2 3$ , where $\mathrm { ~ ~ { ~ x ~ } ~ } + \mathrm { ~ ~ { ~ x ~ } ~ }$ is copied (using the TREECP action) from the context graph in (a).
40
+
41
+ $$
42
+ \mathcal { L } = - \frac { 1 } { N } \sum _ { i } \log P _ { \alpha } ( \pmb { x } _ { + } \mid \pmb { x } _ { - } , f _ { \Delta } ( \pmb { x } _ { - } , \pmb { x } _ { + } ) ) .
43
+ $$
44
+
45
+ Note that this loss function can be interpreted in two ways: (1) as a conditional autoencoder that encodes the salient information of an edit, given ${ \bf x } _ { - }$ and (2) as an encoder-decoder model that encodes ${ \bf x } _ { - }$ and decodes $\mathbf { \delta } _ { \mathbf { x } _ { + } }$ conditioned on the edit representation $f _ { \Delta } ( { \pmb x } _ { - } , { \pmb x } _ { + } )$ . In the rest of this section, we discuss our methods to model $P _ { \alpha }$ and $f _ { \Delta }$ as neural networks.
46
+
47
+ # 3.1 NEURAL EDITOR
48
+
49
+ As discussed above, $\alpha$ should use as much information as possible from ${ \bf x } _ { - }$ , and hence, an encoderdecoder architecture with the ability to copy from the input is most appropriate. As we are primarily interested in edits on text and source code in this work, we explored two architectures: a sequenceto-sequence model for text, and a graph-to-tree model for source code, whose known semantics we can leverage both on the encoder as well as on the decoder side. Other classes of edits, for example, image manipulation, would most likely be better served by convolutional neural models.
50
+
51
+ Sequence-to-Sequence Neural Editor First, we consider a standard sequence-to-sequence model with attention (over the tokens of ${ \bf x } _ { - }$ ). The architecture of our sequence-to-sequence model is similar to that of Luong et al. (2015), with the difference that we use a bidirectional LSTM in the encoder and a token-level copying mechanism (Vinyals et al., 2015) that directly copies tokens into the decoded sequence. Whereas in standard sequence-to-sequence models the decoder is initialized with the representation computed by the encoder, we initialize it with the concatenation of encoder output and the edit representation. We also feed the edit representation as input to the decoder LSTM at each decoding time step. This allows the LSTM decoder to take the edit representation into consideration while generating the output sequence.
52
+
53
+ Graph-to-Tree Neural Editor Our second model aims to take advantage of the additional structure of ${ \pmb x } _ { - }$ and $\mathbf { \pmb { x } } _ { + }$ . To achieve this, we combine a graph-based encoder with a tree-based decoder. We use $T ( \pmb { x } )$ to denote a tree representation of an element, e.g., the abstract syntax tree (AST) of a fragment of source code. We extend $T ( { \pmb x } )$ into a graph form $G ( \pmb { x } )$ by encoding additional relationships (e.g., the “next token” relationship between terminal nodes, etc.) (see Figure 2(a)). To encode the elements of $G ( { \pmb x } _ { - } )$ into vector representations, we use a gated graph neural network (GGNN) (Li et al., 2015). Similarly to recurrent neural networks for sequences (such as biRNNs), GGNNs compute a representation for each node in the graph, which can be used in the attention mechanisms of a decoder. Additionally, we use them to obtain a representation of the full input ${ \bf x } _ { - }$ , by computing their weighted average following the strategy of Gilmer et al. (2017) (i.e., computing a score for each node, normalizing scores with a softmax, and using the resulting values as weights).
54
+
55
+ Our tree decoder follows the semantic parsing model of Yin & Neubig (2018), which sequentially generate a tree $T ( \pmb { x } _ { + } )$ as a series of expansion actions $a _ { 1 } \ldots a _ { N }$ . The probability of taking an action is modeled as $p ( a _ { t } \mid a _ { < t } , s )$ , where $s$ is the input (a sequence of words in the original semantic parsing setting) and $a _ { < t }$ is the partial tree that has been generated so far. The model of Yin & Neubig (2018) mainly uses two types of actions: EXPANDR expands the current non-terminal using a grammar rule, and GENTERM generates a terminal token from a vocabulary or copies a token from $s ^ { 3 }$ . The dependence on the partial tree $a _ { < t }$ is modeled by an LSTM cell which is used to maintain state throughout the generation procedure. Additionally, the LSTM receives the decoder state used to pick the action at the parent node as an additional input (“parent-feeding”). This process illustrated in Figure 2(b).
56
+
57
+ ![](images/cb39fb0e7c75647fcc65334fd303ed17c7e744415f2df8a569903205d9a687fa.jpg)
58
+ Figure 3: Sequence (a) and graph (b) representation of edit of $\mathrm { ~ v ~ . ~ F ~ } = \mathrm { ~ x ~ + ~ \ x ~ t o ~ u ~ = ~ x ~ + ~ \ x ~ }$
59
+
60
+ We extend this model to our setting by replacing the input sequence $s$ by ${ \bf x } _ { - }$ ; concretely, we condition the decoder on the graph-level representation computed for $G ( { \pmb x } _ { - } )$ . Additionally, we use the change representation $f _ { \Delta } ( \cdot )$ as an additional input to the LSTM initial state and at every decoding step. Based on the observation that edits to source code often manipulate the syntax tree by moving expressions around (e.g. by nesting statements in a conditional, or renaming a function while keeping its arguments), we extend the decoding model of Yin & Neubig (2018) by adding a facility to copy entire subtrees from the input. For this, we add a decoder action TREECP. This action is similar to standard copying mechanism known from pointer networks (Vinyals et al., 2015), but instead of copying only a single token, it copies the whole subtree pointed to.
61
+
62
+ However, adding the TREECP action means that there are many correct generation sequences for a target tree. This problem appears in token-copying as well, but can be easily circumvented by marginalizing over all correct choices at each generation step (by normalizing the probability distribution over allowed actions to sum up those that have the same effect). In the subtree-copying setting, the lengths of action sequences representing different choices may differ. In our implementation we handle this problem during training by simpling picking the generation sequence that greedily selecting TREECP actions.
63
+
64
+ # 3.2 EDIT REPRESENTATION
65
+
66
+ To compute a useful edit representation, a model needs to focus on the differences between ${ \bf x } _ { - }$ and $\mathbf { \pmb { x } } _ { + }$ . A risk in our framework is that $f _ { \Delta }$ degenerates into an encoder for $\mathbf { \pmb { x } } _ { + }$ , turning $\alpha$ into a decoder. To avoid this, we need to follow the standard autoencoder trick, i.e. it is important to limit the capacity of the result of $f _ { \Delta }$ by generating the edit representation in a low-dimensional space $\mathbb { R } ^ { N }$ . This acts as a bottleneck and encodes only the information that is needed to reconstruct $\mathbf { \pmb { x } } _ { + }$ from ${ \bf x } _ { - }$ . We again experimented with both sequence-based and graph-based representations of edits.
67
+
68
+ Sequence Encoding of Edits Given x− (resp. x+) as sequence of tokens t(0)− , . . . t(T−)− (resp. $t _ { + } ^ { ( 0 ) } , \ldots t _ { + } ^ { ( T _ { + } ) } )$ . t(T+)+ ), we can use a standard (deterministic) diffing algorithm to compute an alignment of tokens in the two sequences. We then use extra symbols for padding, for additions, − for deletions, for replacements, and $=$ for unchanged tokens to generate a single sequence representing both ${ \bf x } _ { - }$ and $\mathbf { \pmb { x } } _ { + }$ . This is illustrated in Figure 3(a). By embedding the three entries in each element of the sequence separately and concatenating their representation, they can be fed into a standard sequence encoder whose final state is our desired edit representation. In this work, we use a biLSTM.
69
+
70
+ Graph Encoding of Edits As in the graph-to-tree neural editor, we represent ${ \bf x } _ { - }$ and $\mathbf { \pmb { x } } _ { + }$ as trees $T ( { \pmb x } _ { - } )$ and $T ( \pmb { x } _ { + } )$ . We combine these trees into a graph representation $G ( \pmb { x } _ { - } \pmb { x } _ { + } )$ by merging both trees into one graph, using “Removed”, “Added” and “Replaced” edges. To connect the two trees, we compute the same alignment as in the sequence case, connecting leaves that are the same and each replaced leaf to its replacement. We also propagate this information up in the trees, i.e., two inner nodes are connected by $\cdot \underline { { \epsilon } } = \ '$ edges if all their descendants are connected by $\cdot \underline { { \epsilon } } = \ '$ edges. This is illustrated in Figure 3(b). Finally, we also use the same ${ ^ { 6 4 } + ^ { 9 3 } } / { ^ { 6 4 } - ^ { 3 3 } } / { ^ { 6 4 } } \{ ^ { 3 3 } / { ^ { 6 4 } = ^ { 3 3 } }$ tags for the initial node representation, computing it as the concatenation of the string label (i.e. token or nonterminal name) and the embedding of the tag. To obtain an edit representation, we use a GGNN unrolled for a fixed number of timesteps and again use the weighted averaging strategy of Gilmer et al. (2017).
71
+
72
+ # 4 EVALUATION
73
+
74
+ Evaluating an unsupervised representation learning method is challenging, especially for a newly defined task. Here, we aim to evaluate the quality of the learned edit representations with a series of qualitative and quantitative metrics on natural language and source code.
75
+
76
+ # 4.1 DATASETS AND CONFIGURATION
77
+
78
+ Natural Language Edits We use the WikiAtomicEdits (Faruqui et al., 2018) dataset of pairs of short edits on Wikipedia articles. We sampled $1 0 4 0 K$ edits from the English insertion portion of the dataset and split the samples into $1 0 0 0 K / 2 0 K / 2 0 K$ train-valid-test sets.
79
+
80
+ Source Code Edits To obtain a dataset for source code, we clone a set of $5 4 \mathrm { C } \#$ projects on GitHub and collected a GitHubEdits dataset (see Appendix A for more information). We selected all changes in the projects that are no more than 3 lines long and whose surrounding 3 lines of code before and after the edited lines have not been changed, ensuring that the edits are separate and short. We then parsed the two versions of the source code and take as ${ \bf x } _ { - }$ and $\mathbf { \pmb { x } } _ { + }$ the code that belongs to the top-most AST node that contains the edited lines. Finally, we remove trivial changes such variable renaming, changes within comments or formatting changes. Overall, this yields 111 724 edit samples. For each edit we run a simple C# analysis to detect all variables and normalize variable names such that each unique variable within ${ \bf x } _ { - }$ and $\mathbf { \pmb { x } } _ { + }$ has a unique normalized name V0, V1, etc. This step is necessary to avoid the sparsity of data induced by the variety of different identifier naming schemes. We split the dataset into $9 1 , 3 7 2 / 1 0 , 1 7 6 / 1 0 , 1 7 6$ samples as train/valid/test sets.
81
+
82
+ Additionally, we introduce a labeled dataset of source code edits by using C# “fixers”. Fixers are small tools built on top of the C# compiler, used to perform common refactoring and modernization tasks (e.g., using new syntactic sugar). We selected 16 of these fixers and ran them on 6 C# projects to generate a small C#Fixers dataset of 2,878 edit pairs with known semantics. We present descriptions and examples of each fixer in Appendix A.
83
+
84
+ Configuration Throughout the evaluation we use a fixed size of 512 for edit representations. The size of word embeddings and hidden states of encoding LSTMs is 128. The dimensionality of the decoding LSTM is set to 256. Details of model configuration can be found in Sect. A.
85
+
86
+ When generating the target $\mathbf { \pmb { x } } _ { + }$ , our neural editor model can optionally take as input the context of the original input ${ \bf x } _ { - }$ (e.g., the preceding and succeeding code segments surrounding $\mathbf { \delta _ { x _ { - } } }$ ), whose information could be useful for predicting $\mathbf { \pmb { x } } _ { + }$ . For example, in source code edits the updated code snippet $\mathbf { \pmb { x } } _ { + }$ may reuse variables defined in the preceding snippet. In our code experiments, we use a standard bidirectional LSTM network to encode the tokenized 3 lines of code before and after ${ \bf x } _ { - }$ as context. The encoded context is used to initialize the decoder, and as an additional source for the pointer network to copy tokens from.
87
+
88
+ # 4.2 QUALITY OF EDIT REPRESENTATIONS
89
+
90
+ First, we study the ability of our models to encode edits in a semantically meaningful way.
91
+
92
+ Visualizing Edits on Fixers Data In a first experiment, we train our sequential neural editor model on our GitHubEdits data and then compute representations for the edits generated by the C# fixers. A $\mathbf { t } { - } \mathbf { S N E }$ visualization (Maaten & Hinton, 2008) of the encodings is shown in Figure 4. For this visualization, we randomly selected 100 examples from the edits of each fixer (if that fixer has more than 100 samples) and discarded fixer categories with less than 40 examples. Readers are referred to Appendix A for detailed descriptions of each fixer category. We find that our model produces dense clusters for simple or distinctive code edits, e.g. fixer RCS1089 (using the $^ { + + }$ or -- unary operators instead of a binary operator (e.g., $\mathrm { ~ i ~ } = \mathrm { ~ i ~ } + \mathrm { ~ 1 ~ } \mathrm { ~ i + + } )$ , and fixer $\mathrm { C A } 2 0 0 7$ (adding .ConfigureAwait(false) for await statements). We also analyzed cases where (1) the edit examples from the same fixer
93
+
94
+ ![](images/3d44a6ec0b93f1baf6d11a9b7848e7e29d81ae5e78124e919ac758fa978f0ddd.jpg)
95
+ Figure 4: t-SNE visualization of edits from 13 $\mathbf { C } \#$ fixers, where point color indicates the fixer. Labels indicate the id of the fixer, see main text.
96
+
97
+ are scattered, or (2) the clusters of different fixers overlap with each other. For example, the fixer RCS1077 covers 12 different aspects of optimizing LINQ method calls (e.g., type casting, counting, etc.), and hence its edits are scattered. On the other hand, fixers $\mathtt { R C S 1 1 4 6 }$ and RCS1206 yield overlapping clusters, as both fixers change code to use the ?. operator. Fixers RCS1207 (change a lambda to a method group, e.g. foo $( \mathrm { x } { = } > \mathrm { b a r } ( \mathrm { x } ) ) \mathrm { f o o } ( \mathrm { b a r } )$ ) and RCS1021 (simplify lambda expressions, e.g. foo $( \mathrm { x } { = } > \left\{ \mathrm { r e t u r n ~ } ~ 4 \div \left. \right\} ) ~ \right. ~ \mathrm { f o o } ~ ( \mathrm { x } { = } > 4 ) ~ .$ ) are similar, as both inline lambda expressions in two different ways. Analysis yields that the representation is highly dependent on surface tokens. For instance, IDE004 (removing redundant type casts, e.g. (int) $2 2$ ) and RCS1207 (removing explicit argument lists) yield overlapping clusters, as both involve deleting identifiers wrapped by parentheses.
98
+
99
+ Human Evaluation on Encoding Natural Language WikiAtomicEdits In a second experiment, we test how well neighborhoods in edit representation space correspond to semantic similarity. We computed the five nearest neighbors of 200 randomly sampled seed edits from our training set, using both our trained sequence-to-sequence editing model with sequential edit encoder, as well as a simple bag-of-words baseline based on TF-IDF scores. We then rated the quality of the retrieved neighbors on a scale of 0 (“unrelated edit”), 1 (“similar edit”) and 2 (“semantically or syntactically same edit”). Details of the annotation schema is included in Sect. E. We show the (normalized) discounted cumulative gain (DCG, Manning et al. (2008)) for the two models at the top of Tab. 1 (higher is better). The relevance scores indicate that our neural model clearly outperforms the simplistic baseline. Tab. 1 also presents two example edits with their nearest neighbors. Example 1 shows that the neural edit models succeeded in representing syntactically and semantically similar edits, while the bag-of-words baseline relies purely on surface token overlap. Interestingly, we also observed that the edit representations learned by the neural editing model on WikiAtomicEdits are somewhat sensitive to position, i.e. the position of the inserted tokens in both the seed edit and the nearest neighbors is similar. This is illustrated in Example 2, where the second (“senegalese striker”) and the third (“republican incumbent”) nearest neighbors returned by the neural model have similar editing positions as the seed edit, while they are semantically diverse.
100
+
101
+ # 4.3 EDIT ENCODER PERFORMANCE
102
+
103
+ To evaluate the performance of our two edit encoders discussed in Sect. 3.2 and disentangle it from the choice of neural editor, we train various combinations of our neural editor model and manually evaluate the quality of the edit representation. More specifically, we trained our neural editor models on GitHubEdits and randomly sampled 200 seed edits and computed their 3 nearest neighbors using each end-to-end model. We then rated the resulting groups using the same 0-2 scale as above. The resulting relevance scores are shown in Tab. 2.
104
+
105
+ <table><tr><td colspan="2">Bag of Words Model</td><td>Seq2Seq - Seq Edit Encoder</td></tr><tr><td>DCG/NDCG@5</td><td>9.3 / 67.3%</td><td>13.5 / 90.3%</td></tr><tr><td>DCG@5 (by edit size)</td><td>1: 14.7 2-3: 10.8 &gt;3: 5.4</td><td>1: 16.2 2-3: 12.9 &gt;3: 12.4</td></tr></table>
106
+
107
+ Table 1: Natural language human evaluation results and 3 nearest neighbors. IInserted textJ marked. Example 1 neural editing model returns syntactically and semantically similar edits. Example 2 Neural edit representations are sensitive to position.
108
+
109
+ <table><tr><td colspan="2">DCG/NDCG@5 9.3 / 67.3% 13.5 / 90.3% DCG@5 (by edit size) 1: 14.7 2-3:10.8 &gt;3: 5.4 1: 16.2 2-3:12.9 &gt;3:12.4</td></tr><tr><td colspan="2">Example1 daniel james nava(born february 22,1983)is anamericanprofessional baseball outfielder nava is only the fourth player inmlb historyto hit a grand slam in his frst major league at bat and the second to</td></tr><tr><td>do it on the first pitch . NN-1 outfielder.</td><td>he batted .3O2 with 73 steals,and received a ?arthurraybriles(borndecember3,1955) september call -up to the major leaguesas an isaformer american football coach andhis most recent head coaching position was at bay- lor university,a position he held from the 2008</td></tr><tr><td>NN-2 he played as an outfielderfor the hanshin tigers.</td><td>season through the 2015 season . ?jonathan david disalvatore(bornmarch 30 ,1981)isaprofessional icehockeyhewas selected by the san jose sharks in the 4th round</td></tr><tr><td>NN-3 in 2012,his senior at oak mountain,dahl had a .412 batting average,34 runs batted in(rbis), and 18 stolen bases as an outfielder.</td><td>(104th overall)of the 2OOO nhl entry draft ■professor paul talalay(born march 31,1923 )is the john jacob abeldistinguished service professor of pharmacology and director of the laboratory for molecular sciences at johns hop- kins school of medicine in baltimore .</td></tr><tr><td colspan="2">Example2 she,along with her follow artist carolyn mase studied with impressionist landscape painter john henry twachtman at the art students league of new york . his brother was draughtsman william daniell the first painting was a portrait of a young girl</td></tr><tr><td>NN-1 daniell.</td><td>and his uncle was?landscape painterthomas ,emerantia van beresteyn,the sister of the landscape painternicolaes van beresteyn,the laterfounder of half of this hofje .</td></tr><tr><td>NN-2</td><td>william james linton(december7,1812 - de- he was the club &#x27;s top scorer with 22 goals in cember 29,1897)was an english - born ameri- all competitions,one more than?senegalese canwood engraver,?landscape painter,po- strikerlamine diarra,who left the club at the litical reformer and author of memoirs,novels, end of the season .</td></tr><tr><td>poetry and non-fiction NN-3 early on,hoppermodeled his style after chase and french?impressionist masters douard manet and edgar degas .</td><td>caforio ”aggressively attacked”his opponent, ?republican incumbentsteve knight,for his delayed response to the leak.</td></tr></table>
110
+
111
+ Table 2: Relevance scores of human evaluation on GitHubEdits data. Acc. $@ 1$ denotes the ratio that the 1-nearest neighbor has a score 2.
112
+
113
+ <table><tr><td>Model</td><td>DCG@3</td><td>NDCG@3 (%)</td><td>Acc.@1(%)</td></tr><tr><td>BoW</td><td>7.77</td><td>75.99</td><td>58.46</td></tr><tr><td>Seq2Seq - Seq Edit Encoder</td><td>10.09</td><td>90.05</td><td>75.90</td></tr><tr><td>Graph2Tree -Seq Edit Encoder</td><td>10.56</td><td>91.40</td><td>79.49</td></tr><tr><td>Graph2Tree-Graph Edit Encoder</td><td>9.44</td><td>86.20</td><td>72.31</td></tr></table>
114
+
115
+ Comparing the sequential edit encoders trained with Seq2Seq and Graph2Tree editors, we found that the edit encoder trained with the Graph2Tree objective performs better. We hypothesize that this is because the Graph2Tree editor better captures structural-level information about an edit. For instance, Example 1 in Tab. 3 removes explicit type casting. The Seq2Seq editor has difficulty distinguishing this type of edit, confusing it with changes of lambda expressions to method groups (1st and 2nd nearest neighbors) since both two types of edits involve removing paired parentheses.
116
+
117
+ Surprisingly, we found that the graph-based edit encoder does not outperform the sequence-based encoder. However, we observe that the graph edit encoder in many cases tends to better capture high-level and abstract structural edit patterns. Example 2 in Tab. 3 showcases a seed edit that swaps two consecutive declarations, which corresponds to swapping the intermediate Expression nodes representing each statement on the underlying AST. In this case, the graph edit encoder is capable of grouping semantically similar edits, while it seems to be more difficult for the sequential encoder encoder to capture the edit pattern. On the other hand, we found that the graph edit encoder often fails to capture simpler, lexical level edits (e.g., Example 1). This might suggest that terminal node information is not effectively propagated, an interesting issue worth future investigation.
118
+
119
+ Table 3: Two example source code edits and their nearest neighbors based on the edit representations computed by each model.
120
+
121
+ <table><tr><td colspan="2">Example 1 Example 2</td></tr><tr><td>x_:vo.SendSelectSoundRequest((int) V1); x+:v0.SendSelectSoundRequest (v1);</td><td>x_:string vO; string V1; x+:string V1; string vO;</td></tr><tr><td>Seq2Seq-Seq Edit Encoder</td><td>Seq2Seq-Seq Edit Encoder</td></tr><tr><td>? x_:VO.Debug(()=&gt; LITERAL); x+:VO.Debug(LITERAL);</td><td>? x_:RetryConfig V0; string V1; x+:string V1;RetryConfig V0;</td></tr><tr><td>1 x_:VO.Debug(() =&gt; LITERAL); x+:VO.Debug(LITERAL);</td><td>? x_: string[] vO; string[] V1;int V2; x+:int V2; string[] VO; string[] V1;</td></tr><tr><td>x_:V0.WriteCompressedInteger((uint)Vl);</td><td>x_:Type VO= null; BindingFlags V1= 0;</td></tr><tr><td>x+:v0.WriteCompressedInteger(v1); Graph2Tree-Seq Edit Encoder</td><td>x+:BindingFlags Vl= 0; Type VO= null;</td></tr><tr><td colspan="2">Graph2Tree-Seq Edit Encoder x_:V0.WriteCompressedInteger((uint)Vl);</td></tr><tr><td>x+:V0.WriteCompressedInteger(Vl);</td><td>x_:RetryConfig V0; string V1; x+:string Vl; RetryConfig V0;</td></tr><tr><td>x_:vo.WriteCompressedInteger((uint)V1);</td><td>x_:string[] V0; string[] Vl;int V2;</td></tr><tr><td>x+:V0.WriteCompressedInteger(v1);</td><td>x+:int V2; string[] VO; string[] V1;</td></tr><tr><td>x_:Vo.WriteCompressedInteger((uint)V1); x+:V0.WriteCompressedInteger(Vl);</td><td>? x_:int VO = V1;int V2 = V3; x+:int V2 = V3;int VO = V1;</td></tr><tr><td colspan="2">Graph2Tree-Graph Edit Encoder Graph2Tree-Graph Edit Encoder</td></tr><tr><td>x_:V0.UpdateLastRead(this.V1); ? x+:VO.UpdateLastRead(V1);</td><td>? x_:RetryConfig V0; string V1;</td></tr><tr><td>x_:V0.UpdateLastWrite(this.V1);</td><td>x+: string Vl;RetryConfig V0;</td></tr><tr><td>x+:VO.UpdateLastWrite(Vl);</td><td>? x_:int V0 = V1;int V2 = V3; x+:int V2 = V3; int VO = V1;</td></tr><tr><td>x_:vo.Append(this.V1);</td><td> x_: double V0= -1; double V1= -1;</td></tr></table>
122
+
123
+ Table 4: Test performance of different neural editors.
124
+
125
+ <table><tr><td>Model</td><td>Acc.@1 (%)</td><td>Recall@5 (%)</td><td>PPL per token</td></tr><tr><td>GitHubEdits</td><td></td><td></td><td></td></tr><tr><td>Seq2Seq-Bag-of-Edits Encoder</td><td>44.05</td><td>54.97</td><td>1.4808</td></tr><tr><td>Seq2Seq -Seq Edit Encoder</td><td>59.63</td><td>65.46</td><td>1.2792</td></tr><tr><td>Graph2Tree-Bag-of-Edits Encoder</td><td>40.66</td><td>49.42</td><td>1.5058</td></tr><tr><td>Graph2Tree -Seq Edit Encoder</td><td>57.49</td><td>62.94</td><td>1.3043</td></tr><tr><td>Graph2Tree -Graph Edit Encoder</td><td>48.05</td><td>56.51</td><td>1.3712</td></tr><tr><td>WikiAtomicEdits</td><td></td><td></td><td></td></tr><tr><td>Seq2Seq-Bag-of-Edits Encoder</td><td>23.73</td><td>43.47</td><td>1.3730</td></tr><tr><td>Seq2Seq - Seq Edit Encoder</td><td>72.94</td><td>76.53</td><td>1.0527</td></tr></table>
126
+
127
+ # 4.4 PRECISION OF NEURAL EDITORS
128
+
129
+ Finally, we evaluate the performance of our end-to-end system by predicting the edited input $\mathbf { \pmb { x } } _ { + }$ given ${ \pmb x } _ { - }$ and the edit representation. We are interested in answering two research questions: First, how well can our neural editors generate $\mathbf { \pmb { x } } _ { + }$ given the gold-standard edit representation $f _ { \Delta } ( { \pmb x } _ { - } , { \pmb x } _ { + } ) \ P$ Second, and perhaps more interestingly, can we use the representation of a similar edit $f _ { \Delta } ( \pmb { x } _ { - } ^ { \prime } , \pmb { x } _ { + } ^ { \prime } )$ to generate $\mathbf { \pmb { x } } _ { + }$ by applying that edit to ${ \bf x } _ { - }$ (i.e. $\hat { \pmb x } _ { + } = \alpha ( { \pmb x } _ { - } , f _ { \Delta } ( { \pmb x } _ { - } ^ { \prime } , { \pmb x } _ { + } ^ { \prime } ) ) ) _ \} ^ { \epsilon }$
130
+
131
+ To answer the first question, we trained our neural editor models on the WikiAtomicEdits and the GitHubEdits dataset, and evaluate the performance of encoding and applying edits on test sets. For completeness, we also evaluated the performance of our neural editor models with a simple “Bag-ofEdits” edit encoding scheme, where $f _ { \Delta } ( { \pmb x } _ { - } , { \pmb x } _ { + } )$ is modeled as the concatenation of two vectors, each representing the sum of the embeddings of added and deleted tokens in the edit, respectively. This edit encoding method is reminiscent of the model used in Guu et al. (2017) for solving a different task of language modeling by marginalizing over latent edits, which we will elaborate in Sect. 5. Tab. 4 lists the evaluation results. With our proposed sequence- and graph-based edit encoders, our neural editor models achieve reasonable end-to-end performance, surpassing systems using bag-of-edits representations. This is because many edits are context-sensitive and position-sensitive, requiring edit representation models that go beyond the bag-of-edits scheme to capture those effects (more analysis is included in Appendix B). Interestingly, on the GitHubEdits dataset, we find that the Seq2Seq editor with sequential edit encoder registers the best performance. However, it should be noted that in this set of experiments, we encode the gold-standard edit $f _ { \Delta } ( { \pmb x } _ { - } , { \pmb x } _ { + } )$ to predict $\mathbf { \boldsymbol { x } } _ { + }$ . As we will show later, better performance with the gold-standard edit does not necessarily imply better (more generalizable) edit representation. Nevertheless, we hypothesize that the higher accuracy of the Seq2Seq edit is due to the fact that a significant proportion of edits in this dataset is small and primarily syntactically simple. Indeed we find that $69 \%$ of test examples have a token-level edit distance of less than 5.
132
+
133
+ Table 5: Transfer learning results on C# fixers data, averaged across all fixer categories.
134
+
135
+ <table><tr><td>Model</td><td>Acc.(%)</td><td>Acc.*(%)</td><td>Recall@5(%)</td><td>Recall@5*(%)</td></tr><tr><td>Seq2Seq - Seq Edit Encoder</td><td>38.35</td><td>77.67</td><td>41.50</td><td>83.84</td></tr><tr><td>Graph2Tree -Seq Edit Encoder</td><td>49.21</td><td>77.30</td><td>51.93</td><td>81.77</td></tr><tr><td>Baselines (no edit encoding)</td><td>7.07</td><td></td><td>14.29</td><td></td></tr><tr><td>Seq2Seq w/o Edit Encoder</td><td>8.81</td><td></td><td>11.90</td><td></td></tr><tr><td>Graph2Tree w/o Edit Encoder</td><td></td><td></td><td></td><td></td></tr></table>
136
+
137
+ ∗: upper-bound performance of predicting $\mathbf { x } _ { + }$ using the gold-standard edit representations.
138
+
139
+ To answer the second question, we use the trained neural editors from the previous experiment, and test their performance in a “one-shot” transfer learning scenario. Specifically, we use our high-quality C#Fixers dataset, and for each fixer category $\mathcal { F }$ of semantically similar edits, we randomly select a seed edit $\{ \pmb { x } _ { - } ^ { \prime } \pmb { x } _ { + } ^ { \prime } \} \in \mathcal { F }$ , and use its edit representation $\bar { f } _ { \Delta } ( \pmb { x } _ { - } ^ { \prime } , \pmb { x } _ { + } ^ { \prime } )$ to predict the updated code for all examples in $\mathcal { F }$ , i.e., we have $\hat { \pmb { x } } _ { + } = \alpha ( \pmb { x } _ { - } , f _ { \Delta } ( \pmb { x } _ { - } ^ { \prime } , \pmb { x } _ { + } ^ { \prime } ) ) , \forall \{ \pmb { x } _ { - } \pmb { x } _ { + } \} \in \mathcal { F }$ . This task is highly non-trivial, since a fixer category could contain more than hundreds of edit examples collected from different $\mathbf { C } \#$ projects. Therefore, it requires the edit representations to generalize and transfer well, while being invariant of local lexical information like specific method names. To make the experimental evaluation more robust to noise, for each fixer category $\mathcal { F }$ , we randomly sample 10 seed edit pairs $\{ \pmb { x } _ { - } ^ { \prime } \pmb { x } _ { + } ^ { \prime } \}$ , compute their edit representations and use them to predict the edited version of the examples in $\mathcal { F }$ and evaluate accuracy of predicting the exact final version. We then report the best score among the 10 seed representations as the performance metric on $\mathcal { F }$ .
140
+
141
+ Tab. 5 summarizes the results and also reports the upper bound performance when using the goldstandard edit representation $f _ { \Delta } ( { \pmb x } _ { - } , { \pmb x } _ { + } )$ to predict $\mathbf { \delta } _ { \mathbf { x } _ { + } }$ , and an approximation of the “lower bound” accuracies using pre-trained Seq2Seq and Graph2Tree models without edit encoders. We found that our neural Graph2Tree editor with the sequential edit encoder significantly outperforms the Seq2Seq editor, even though Seq2Seq performs better when using gold-standard edit representations. This suggest that the edit representations learned with the Graph2Tree model generalize better, especially for edits discussed in Sect. 4.2 that involve syntactic variations like RCS1021 (lambda expression simplification, $7 . 8 \%$ vs. $3 0 . 7 \%$ for Seq2Seq and Graph2Tree), and RCS1207 (change lambdas to method groups, $7 . 1 \%$ vs. $2 6 . 2 \%$ ). Interestingly, we also observe that Seq2Seq outperforms the Graph2Tree model for edits with trivial surface edit sequences, where the Graph2Tree model does not have a clear advantage. For example, on RCS1015 (use nameof operator, e.g. Exception $( " \mathrm { x } " ) \mathrm { E x c } $ eption(nameof $\mathbf { \Psi } ( \mathbf { x } )$ )), the accuracies for Seq2Seq and Graph2Tree are $4 0 . 0 \%$ (14/35) and $2 8 . 6 \%$ (10/35), resp. We include more analysis of the results in Appendix C.
142
+
143
+ # 5 RELATED WORK
144
+
145
+ Edits have recently been considered in NLP, as they represent interesting linguistic phenomena in language modeling and discourse (Faruqui et al., 2018; Yang et al., 2017a). Specifically, Guu et al. (2017) present a generative model of natural language sentences via editing prototypes. Our work shares with Guu et al. (2017) in that (1) the posterior edit encoding model in Guu et al. (2017) is similar to our baseline “bag-of-edits” encoder in Sec. 4.4, and (2) the sequence-to-sequence sentence generation model given the prototype and edit representation is reminiscent of our Seq2Seq editor. In contrast, our work directly focuses on discriminative learning of representing edits and applying the learned edits for both sequential (NL) and structured (code) data. Another similar line of research is “retrieve-and-edit” models for text generation (Hashimoto et al., 2018), where given an input data $_ { \textbf { \em x } }$ , the target prediction $\textbf { { y } }$ is generated by editing a similar target $\boldsymbol { y } ^ { \prime }$ that is retrieved based on the similarity between its source $\mathbf { { x } ^ { \prime } }$ and the input $_ { \textbf { \em x } }$ . While these models typically require an “editor” component to generate the output by exploiting the difference between similar inputs, they usually use the simpler bag-of-edits representations (Wu et al., 2019), or implicitly capture it via end-to-end neural networks (Contractor et al., 2018). To our best knowledge, there is not any related work that classifies or otherwise explicitly represents the differences over similar input, with the exception of differential recurrent neural networks used for action recognition in videos (Veeriah et al., 2015; Zhuang et al., 2018). This is a substantially different task, as the data includes a temporal component as well.
146
+
147
+ Source code edits are a widely studied artifact. Specialized software, such as git, is widely used to store source code revision histories. Nguyen et al. (2013) studied the repetitiveness of source code changes by identifying identical types of changes using a deterministic differencing tool. In contrast, we employ on a neural network to cluster similar changes together. Rolim et al. (2017) use such clusters to synthesize small programs that perform the edit. The approach is based on Rolim et al. (2018) extract manually designed syntactic features from code and cluster over multiple changes to find repeatable edit rules. Similarly, Paletov et al. (2018) extract syntactic features specifically targeting edits in cryptography API protocols. In this work, we try to avoid hand-designed features and allow a neural network to learn the relevant aspects of a change by directly giving as input the original and final version of a changed code snippet.
148
+
149
+ Modeling tree generation with machine learning is an old problem that has been widely studied in NLP. Starting with Maddison & Tarlow (2014), code generation has also been considered as a tree generation problem. Close to our work is the decoder of Yin & Neubig (2017) which we use as the basis of our decoder. The work of Chen et al. (2018) is also related, since it provides a tree-to-tree model, but focuses on learning a single translation tasks and cannot be used directly to represent multiple types of edits. Both Yin & Neubig (2017) and Chen et al. (2018) have copying mechanism for single tokens, but our subtree copying mechanism is novel.
150
+
151
+ Autoencoders (see Goodfellow et al. (2016) for an overview) have a long history in machine learning. Variational autoencoders (Kingma & Welling, 2013) are similar to autoencoders but instead of focusing on the learned representation, they aim to create accurate generative probabilistic models. Most (variational) autoencoders focus on encoding images but there have been works that autoencode sequences, such as text (Dai & Le, 2015; Bowman et al., 2015; Yang et al., 2017b) and graphs (Simonovsky & Komodakis, 2018; Liu et al., 2018). Conditional variational autoencoders (Sohn et al., 2015) have a related form to our model (with the exception of the KL term), but are studied as generative models, whereas we are primarily interested in the edit representation.
152
+
153
+ # 6 DISCUSSION & CONCLUSIONS
154
+
155
+ In this work, we presented the problem of learning distributed representation of edits. We believe that the dataset of edits is highly relevant and should be studied in more detail. While we have presented a set of initial models and metrics on the problem and obtained some first promising results, further development in both of these areas is needed. We hope that our work inspires others to work on this interesting problem in the future.
156
+
157
+ # ACKNOWLEDGMENTS
158
+
159
+ We would like to thank Rachel Free for her insightful comments and suggestions.
160
+
161
+ # REFERENCES
162
+
163
+ Ron Artstein and Massimo Poesio. Inter-coder agreement for computational linguistics. Computational Linguistics, 34:555–596, 2008.
164
+
165
+ 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.
166
+
167
+ Xinyun Chen, Chang Liu, and Dawn Song. Tree-to-tree neural networks for program translation. arXiv preprint arXiv:1802.03691, 2018.
168
+
169
+ Danish Contractor, Vineet Kumar, Sachindra Joshi, and Gaurav Pandey. Exemplar encoder-decoder for neural conversation generation. In ACL, 2018.
170
+
171
+ Andrew M Dai and Quoc V Le. Semi-supervised sequence learning. In Advances in neural information processing systems, pp. 3079–3087, 2015.
172
+
173
+ Manaal Faruqui and Dipanjan Das. Identifying Well-formed Natural Language Questions. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2018.
174
+
175
+ Manaal Faruqui, Ellie Pavlick, Ian Tenney, and Dipanjan Das. WikiAtomicEdits: A multilingual corpus of Wikipedia edits for modeling language and discourse. In EMNLP, 2018.
176
+
177
+ Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International Conference on Machine Learning (ICML), 2017.
178
+
179
+ Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http: //www.deeplearningbook.org.
180
+
181
+ Kelvin Guu, Tatsunori B Hashimoto, Yonatan Oren, and Percy Liang. Generating sentences by editing prototypes. arXiv preprint arXiv:1709.08878, 2017.
182
+
183
+ Tatsunori B. Hashimoto, Kelvin Guu, Yonatan Oren, and Percy S. Liang. A retrieve-and-edit framework for predicting structured outputs. In NeurIPS, 2018.
184
+
185
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
186
+
187
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
188
+
189
+ Qi Liu, Miltiadis Allamanis, Marc Brockschmidt, and Alexander L. Gaunt. Constrained graph variational autoencoders for molecule design. In Neural Information Processing Systems (NIPS), 2018.
190
+
191
+ Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attention-based neural machine translation. In Proceedings of EMNLP, 2015.
192
+
193
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. Journal of machine learning research, 9(Nov):2579–2605, 2008.
194
+
195
+ Chris Maddison and Daniel Tarlow. Structured generative models of natural source code. In International Conference on Machine Learning (ICML), 2014.
196
+
197
+ Christopher D. Manning, Prabhakar Raghavan, and Hinrich Schutze. ¨ Introduction to Information Retrieval. Cambridge University Press, New York, NY, USA, 2008. ISBN 0521865719, 9780521865715.
198
+
199
+ Hoan Anh Nguyen, Anh Tuan Nguyen, Tung Thanh Nguyen, Tien N Nguyen, and Hridesh Rajan. A study of repetitiveness of code changes in software evolution. In Proceedings of the 28th IEEE/ACM International Conference on Automated Software Engineering, pp. 180–190. IEEE Press, 2013.
200
+
201
+ Rumen Paletov, Petar Tsankov, Veselin Raychev, and Martin Vechev. Inferring crypto API rules from code changes. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 450–464. ACM, 2018.
202
+
203
+ Reudismam Rolim, Gustavo Soares, Loris D’Antoni, Oleksandr Polozov, Sumit Gulwani, Rohit Gheyi, Ryo Suzuki, and Bjorn Hartmann. Learning syntactic program transformations from exam- ¨ ples. In Proceedings of the 39th International Conference on Software Engineering, pp. 404–415. IEEE Press, 2017.
204
+
205
+ Reudismam Rolim, Gustavo Soares, Rohit Gheyi, and Loris D’Antoni. Learning quick fixes from code repositories. arXiv preprint arXiv:1803.03806, 2018.
206
+
207
+ Martin Simonovsky and Nikos Komodakis. GraphVAE: Towards generation of small graphs using variational autoencoders. arXiv preprint arXiv:1802.03480, 2018.
208
+
209
+ 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.
210
+
211
+ Vivek Veeriah, Naifan Zhuang, and Guo-Jun Qi. Differential recurrent neural networks for action recognition. In Proceedings of the IEEE international conference on computer vision, pp. 4041– 4049, 2015.
212
+
213
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, pp. 2692–2700, 2015.
214
+
215
+ Yu Ping Wu, Furu Wei, Shaohan Huang, Zhoujun Li, and Ming Zhou. Response generation by context-aware prototype editing. 2019.
216
+
217
+ Diyi Yang, Aaron Halfaker, Robert Kraut, and Eduard Hovy. Identifying semantic edit intentions from revisions in wikipedia. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pp. 2000–2010, 2017a.
218
+
219
+ Zichao Yang, Zhiting Hu, Ruslan Salakhutdinov, and Taylor Berg-Kirkpatrick. Improved variational autoencoders for text modeling using dilated convolutions. arXiv preprint arXiv:1702.08139, 2017b.
220
+
221
+ Pengcheng Yin and Graham Neubig. A syntactic neural model for general-purpose code generation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 440–450, 2017.
222
+
223
+ Pengcheng Yin and Graham Neubig. TRANX: A transition-based neural abstract syntax parser for semantic parsing and code generation. In Conference on Empirical Methods in Natural Language Processing (EMNLP) Demo Track, 2018.
224
+
225
+ Naifan Zhuang, The Duc Kieu, Guo-Jun Qi, and Kien A Hua. Deep differential recurrent neural networks. arXiv preprint arXiv:1804.04192, 2018.
226
+
227
+ # A DATASETS AND CONFIGURATION
228
+
229
+ WikiAtomicEdits We randomly sampled $1 0 4 0 K$ insertion examples from the English portion of WikiAtomicEdits (Faruqui et al., 2018) dataset, with a train, development and test splits of $1 0 0 0 K$ , $2 0 K$ and $2 0 K$ .
230
+
231
+ GitHubEdits We cloned the top $5 4 \mathrm { C } \#$ GitHub repositories based on their popularity (Tab. 8). For each commit in the master branch, we collect the previous and updated versions of the source code, and extract all consecutive lines of edits that are smaller than three lines, and with at least three preceding and successive lines that have not been changed. We then filter trivial changes such as variable and identifier renaming, and changes happened within comments. We also limit the number of tokens for each edit to be smaller than 100, and down-sample edits whose frequency is larger than 30. Finally, we split the dataset by commit ids, ensuring that there are no edits in the training and testing (development) sets coming from the same commit. Tab. 6 lists some statistics of the dataset.
232
+
233
+ Table 6: Statistics of the GitHubEdits Dataset
234
+
235
+ <table><tr><td>Average Num. Tokens in x_ Average Num. Tokens in x+ Average Edit Distance Average size of AST for T(x_) Average size of AST for T(x+)</td><td>16.4 17.0 5.0 28.5 29.4</td></tr></table>
236
+
237
+ C#Fixers We selected $1 6 \ \mathrm { ~ C \# ~ }$ fixers from Roslyn4 and Roslynator5, and ran them on 6 C# projects to generate a small, high-quality $\mathbf { C } \#$ fixers dataset of 2 878 edit pairs with known semantics. Table 7 lists the detailed descriptions for each fixer category. And more information can be found at https://github.com/JosefPihrt/Roslynator/blob/master/ src/Analyzers/README.md.
238
+
239
+ Network Configuration Throughout the experiments, we use a fixed edit representation size of 512. The dimensionality of word embedding, the hidden states of the encoder LSTMs, as well as the gated graph neural network is 128, while the decoder LSTM uses a larger hidden size of 256. For the graph-based edit encoder, we used a two-layer graph neural network, with 5 information propagation steps at each layer. During training, we performed early stopping, and choose the best model based on perplexity scores on development set. During testing, we decode a target element $\mathbf { \pmb { x } } _ { + }$ using a beam size of 5.
240
+
241
+ Table 7: Descriptions of fixer categories in C#Fixers dataset
242
+
243
+ <table><tr><td>Fixer ID</td><td>Description</td><td>Num. Edits</td><td>Example</td><td></td></tr><tr><td>CA2007</td><td>apply .ConfigureAwait(false) to await statements</td><td>1051</td><td>x_:await x+:await</td><td>Console.WriteAsync() Console.WriteAsync() .ConfigureAwait(false)</td></tr><tr><td>IDE0004</td><td>Cast is redundant</td><td>53</td><td>x-:var X= x+:var X=</td><td>1; var b= (int)x; 1; var b=x;</td></tr><tr><td>RCS1015</td><td>Use nameof operator</td><td>35</td><td></td><td>x_:Exception(&quot;parameter&quot;); x+:Exception(nameof(parameter));</td></tr><tr><td>RCS1021</td><td>Simplify lambda expression</td><td>411</td><td>m_: });</td><td>var x = items.Select(f =&gt; return f.ToString();</td></tr><tr><td></td><td></td><td></td><td>var x+:</td><td>x = items.Select( f =&gt; f.ToString();</td></tr><tr><td>RCS1032</td><td> Remove redundant parentheses</td><td>24</td><td>x-:if x_:if (x){</td><td>((x)){}</td></tr><tr><td>RCS1058</td><td>Use compound assignment</td><td>43</td><td>c_:i = x+:i +=2;</td><td>i+2;</td></tr><tr><td>RCS1077</td><td>Optimize LINQ method call Use --/++ operator instead of</td><td>200</td><td></td><td>x-:items.Where(f =&gt; Foo(f)).Any(); x+:items.Any(f =&gt; Foo(f));</td></tr><tr><td>RCS1089</td><td>assignment</td><td>75</td><td>x_:i +=1; x+:i</td><td>=i+1; x_:var x = s.ToString();</td></tr><tr><td></td><td>Remove redundant ToSt ring call</td><td>20</td><td>x+:var . string x_:</td><td>x= s; &quot;a&quot;; s=</td></tr><tr><td></td><td></td><td></td><td>string const string s = x+: string s2</td><td>s2 2=s+ &quot;b&quot;; &quot;a&quot;; =s+&quot;b&quot;;</td></tr><tr><td>RCS1123</td><td>Add parentheses according to operator precedence</td><td>109</td><td>x_:if (x 二 x+:if (x 二</td><td>Y &amp;&amp;z) { (y&amp;&amp; z)){}</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>x+:items?.First().ToString();</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RCS1207</td><td>Use method group instead of anonymous function</td><td>42</td><td></td><td>x+: int i = x?.GetHashCode() ?? 0; x_:items.Select(f =&gt; Foo(f));</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>x-:sb.Append(s + &quot;x&quot;);</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RCS1146</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>Use conditional access</td><td>71</td><td>x_:x != null</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>&amp;&amp; x.StartsWith(&quot;a&quot;);</td></tr><tr><td></td><td>Optimize call of St ringBuilder&#x27;s</td><td></td><td></td><td> X+:x?.StartsWith(&quot;a&quot;);</td></tr><tr><td>RCS1197</td><td></td><td>95</td><td></td><td></td></tr><tr><td></td><td>Append/AppendLine</td><td></td><td></td><td>x+: sb.Append(s) .Append(&quot;x&quot;);</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RCS1202</td><td>Avoid NullReferenceException</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>56</td><td></td><td>x_:items.First().ToString();</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RCS1206</td><td>Use conditional access instead of</td><td></td><td></td><td>int i = (x != null) ?</td></tr><tr><td></td><td></td><td>116</td><td>x_:</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>conditional expression</td><td></td><td></td><td> x.Value.GetHashCode() : 0;</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr></table>
244
+
245
+ Table 8: Our C# GitHub dataset projects
246
+
247
+ <table><tr><td>Name</td><td>GitHub Id</td><td>Description</td></tr><tr><td>acat</td><td>intel/acat</td><td>Assistive Context-Aware Toolkit</td></tr><tr><td>akka.net</td><td>akka/akka.net</td><td>Distributed Actors</td></tr><tr><td>aspnetboilerplate</td><td>aspnetboilerplate/aspnetboilerplate</td><td>ASP.NET boilerplate</td></tr><tr><td>AutoMapper</td><td>AutoMaper/AutoMapper</td><td>Object-Object Mapper</td></tr><tr><td>BotBuilder</td><td>Microsoft/BotBuilder</td><td>Bot Framework</td></tr><tr><td>CefSharp</td><td>cefsharp/CefSharp</td><td>Chromium Embedded Framework Bindings</td></tr><tr><td>choco</td><td>chocolatey/choco</td><td>package mananger</td></tr><tr><td>cli</td><td>dotnet/cli</td><td>.NET CLI Tools</td></tr><tr><td>CodeHub</td><td>CodeHubApp/CodeHub</td><td>iOS application</td></tr><tr><td>coreclr</td><td>dotnet/coreclr</td><td>.NETFramework</td></tr><tr><td>corefx</td><td>dotnet/corefx</td><td>.NET FOundational Libraries</td></tr><tr><td>dapper</td><td>StackExchange/Dapper</td><td>Object Mapper</td></tr><tr><td>dnSpy</td><td>0xd4d/dnSpy</td><td>.NET debugger and assembly editor</td></tr><tr><td>duplicati</td><td>duplicati/duplicati</td><td>Encrypted Cloud Backups</td></tr><tr><td>EntityFramework</td><td>aspnet/EntityFramework</td><td>Object-Relational Mapper</td></tr><tr><td>EntityFrameworkCore</td><td>aspnet/EntityFrameworkCore</td><td>Object-Relational Mapper-Core</td></tr><tr><td>FluentValidation</td><td>JeremySkinner/FluentValidation</td><td>Validation Rules</td></tr><tr><td>framework</td><td>accord-net/framework</td><td>ML,CV Framework</td></tr><tr><td>GVFS</td><td>Microsoft/VFSForGit</td><td>Git Virual File System</td></tr><tr><td>Hangfire</td><td>HangfireIO/Hangfire</td><td>Background job library</td></tr><tr><td>ILSpy</td><td>icsharpcode/ILSpy</td><td>Decompiler</td></tr><tr><td>JavaScriptServices</td><td>aspnet/JavaScriptServices</td><td>ASP.NETJS Services</td></tr><tr><td>MahApps.Metro</td><td>MahApps/MahApps.Metro</td><td>WPFFramework</td></tr><tr><td>MaterialDesignInXamlToolkit</td><td>MaterialDesignInXamlToolkit/Materi-</td><td>DesignXAML&amp;WPF</td></tr><tr><td>mono</td><td>alDesignInXamlToolkit mono/mono</td><td>.NET implementation</td></tr><tr><td>monodevelop</td><td>mono/monodevelop</td><td>IDE</td></tr><tr><td>MonoGame</td><td>MonoGame/MonoGame</td><td>Game Framework</td></tr><tr><td>msbuild</td><td>Microsoft/msbuild</td><td>Build Tool</td></tr><tr><td>Mvc</td><td>aspnet/Mvc</td><td>MVCFramework</td></tr><tr><td>Nancy</td><td>NancyFx/Nancy</td><td>HTTP based services</td></tr><tr><td>Newtonsoft.Json</td><td>JamesNK/Newtonsoft.Json</td><td>JSON framework</td></tr><tr><td>NLog</td><td>NLog/NLog</td><td>Loggin for.NET</td></tr><tr><td>OpenLiveWriter</td><td>OpenLiveWriter/ OpenLiveWriter</td><td>Text editor</td></tr><tr><td>OpenRA</td><td>OpenRA/OpenRA</td><td>Strategy Game Engine</td></tr><tr><td>Opserver</td><td>opserver/Opserver</td><td>Monitoring System</td></tr><tr><td>orleans</td><td>dotnet/orleans</td><td>Distributed Virtual Actors</td></tr><tr><td>PowerShell</td><td>PowerShell/PowerShell</td><td>Command Line</td></tr><tr><td>Psychson</td><td>brandonlw/Psychson</td><td>Firmware</td></tr><tr><td>PushSharp</td><td>Redth/PushSharp</td><td>Push Notifications</td></tr><tr><td>ravendb</td><td>ravendb/ravendb</td><td>Database</td></tr><tr><td>ReactiveUI</td><td>reactiveui/ReactiveUI</td><td>Reactive MVC Framework</td></tr><tr><td>RestSharp</td><td>restsharp/RestSharp</td><td>HTTP/REST Client</td></tr><tr><td>roslyn</td><td>dotnet/roslyn</td><td>.NET Compiler</td></tr><tr><td>Rx.NET</td><td>dotnet/reactive</td><td>Reactive extensions.</td></tr><tr><td>ServiceStack</td><td>ServiceStack/ServiceStack</td><td>Web Service Framework</td></tr><tr><td>shadowsocks-windows</td><td></td><td>Cryptography</td></tr><tr><td></td><td>shadowsocks/ shadowsocks-windows</td><td>Screen Recorder</td></tr><tr><td>ShareX</td><td>ShareX/ShareX</td><td>Real-time web framework</td></tr><tr><td>SignalR</td><td>SignalR/SignalR Sonarr/Sonarr</td><td>PVR</td></tr><tr><td>Sonarr</td><td>KeenSoftwareHouse/ SpaceEngineers</td><td>Game</td></tr><tr><td>SpaceEngineers SparkleShare</td><td>hbons/SparkleShare</td><td>File Sharing</td></tr><tr><td>StackExchange.Redis</td><td>StackExchange/StackExchange.Redis</td><td>Redis Client</td></tr><tr><td>WaveFunctionCollapse</td><td>mxgmn/WaveFunctionCollapse</td><td>Bitmap/tilemap Generator</td></tr><tr><td>Wox</td><td>Wox-launcher/Wox</td><td>Launcher</td></tr></table>
248
+
249
+ # B CLUSTERING EXPERIMENTS
250
+
251
+ To qualitatively evaluate the quality of the learned edit representations. We use the models trained on the WikiAtomicEdits and GitHubEdits datasets to cluster natural language and code edits. We run K-Means clustering algorithm on 0.5 million sampled edits from WikiAtomicEdits, and all $9 0 K$ code edits from GitHubEdits, producing 50 000 and 20 000 clusters for each dataset.
252
+
253
+ Tab. 9 and Tab. 10 list some example clusters on WikiAtomicEdits and GitHub datasets, respectively. Due to the size of clusters, we omit out-liners and present distinctive examples from each cluster. On the WikiAtomicEdits dataset, we found clusters whose examples are semantically and syntactically similar. More interestingly, on the source code data, we find representative clusters that relate to idiomatic patterns and best practices of programming. The clustering results produced by our model would be useful for programming synthesis toolkits to generate interpretable code refractory rules, which we leave as interesting future work.
254
+
255
+ Finally, we remark that the clustering results indicate that the encoding of edits is context-sensitive and position-sensitive for both natural language and source code data. For instance, the WikiAtomicEdits examples we present in Tab. 9 clearly indicate that semantically similar insertions also share similar editing positions. This is even more visible in code edits (Tab. 10). For instance, in the first example in Tab. 10, Equal() can be changed to Empty() only in the Assert namespace (i.e., the context). These examples demonstrate that it is important for an edit encoder to capture the contextual and positional information in edits, a property that cannot be captured by simple “bag-of-edits” edit representation methods.
256
+
257
+ Description Add a person’s middle name
258
+
259
+ 1. isaiah ImarcusJ rankin ( born 22 may 1978 in london ) is an english professional footballer currently playing for stevenage borough .
260
+ 2. audrey IkathleenJ brown ( born 24 may , 1913 ) is a british athlete who competed mainly in the 100 metres .
261
+ 3. alice IedithJ rumph was a painter , etcher , and teacher .
262
+ 4. mark IlarryJ taufua is an australian professional rugby league player .
263
+ 5. monique IedithJ lamoureux ( born july 3 , 1989 ) is an american ice hockey player .
264
+ 1. mid-state regional airport I, also known as mid-state airport ,J is a small airport on in rush township , centre county in pennsylvania in the united states .
265
+ 2. islamic culture I, also known as saracenic culture ,J is a term primarily used in secular academia to describe the cultural practices common to historically islamic peoples .
266
+ 3. birds of prey I, also known as raptors ,J are birds that hunt for food primarily via flight , using their keen senses , especially vision .
267
+ 4. tetyana styazhkina I, also written as tetyana stiajkina ,J ( ; born april 10 , 1977 ) is a ukrainian cycle racer who rides for the chirio forno d’asolo team .
268
+ 5. acid jazz I, also known as club jazz ,J is a musical genre that combines elements of jazz , soul , funk , disco and hip hop .
269
+ 1. the douro fully enters portuguese territory just after the confluence with the gueda river ; once the douro enters portugal , major population centres are less frequent Ialong the riverJ .
270
+ 2. mochou lake and mochou lake park are located at 35 hanzhongmen da jie in the jianye district of nanjing , china I, west to qinhuai riverJ
271
+ 3. reiner gamma is an albedo feature that is located on the oceanus procellarum , to the west of the reiner crater Ion the moonJ
272
+ 4. she made a brief return to the screen in ” parrish ” ( 1961 ) , playing the supporting role of mother which received little attention Iby the pressJ .
273
+ 5. he was involved in a few storylines , including one where he broke his toe and had a heart attack after he was pushed by a mugger Iin the marketJ .
274
+
275
+ Description Add positional or temporal clause
276
+
277
+ 1. Iat the timeJ ajax and hercules were trapped behind a landslide at the gaillard cut , both were working to clear the landslide .
278
+ 2. Iat the docks ,J hikaru attempts to befriend the tiger , but finds that it dislikes humans .
279
+ 3. Iabout the second ,J i do know they exist , but the question is whether they are considered a genre outside of japan .
280
+ 4. Iin the battle ,J shirou uses his reality marble , unlimited blade works and defeats gilgamesh .
281
+ 5. Iin the game ,J red is a curious 11 - year - old boy from pallet town . $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ Type ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ == null ? null : V1.GetType();
282
+ $\mathbf { \pmb { x } } _ { + }$ Type V0 = V1?.GetType();
283
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ $\begin{array} { r l } { { \nabla } 0 } & { { } = } \end{array}$ ( $( \mathbb { V } \mathbb { 1 } \mathbb { 1 } =$ null) ? V1.Operand : null) as MemberExpression;
284
+ $\mathbf { \pmb { x } } _ { + }$ $\mathrm { V } 0 ~ = ~ \mathrm { V } 1 ? . 0$ perand as MemberExpression;
285
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ string ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1 ~ = =$ null ? null : V1.GetType().Name;
286
+ x+ string $\begin{array} { r } { \nabla 0 = \mathrm { ~ \nabla ~ } \mathrm { V } 1 \boldsymbol { ? } } \end{array}$ .GetType().Name;
287
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ == null ? null : V1(V2).ToArray();
288
+ $^ { \mathbf { \alpha } _ { \mathbf { \mathcal { X } } + \mathbf { \beta } } }$ var V0 = V1?.Invoke(V2).ToArray();
289
+
290
+ # Description Optimize LINQ queries
291
+
292
+ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ .Customers.Where( ${ \begin{array} { r l } { \ V { 2 } } & { { } = > } \end{array} }$ V2.CustomerID $= =$ LITERAL)
293
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ .FirstOrDefault();
294
+ $\mathbf { \pmb { x } } _ { + }$ var V0 $=$ V1.Customers .FirstOrDefault $( \nabla 2 \ ) \ = > \ \nabla 2$ .CustomerID $= =$ LITERAL);
295
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ .TypeConverters.Where(V2 $= >$ V2.CanConvertTo(V3, V1)) .FirstOrDefault();
296
+ x+ var V0 $=$ V1.TypeConverters .FirstOrDefault(V2 $= >$ V2.CanConvertTo(V3, V1));
297
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ var V0 $=$ this.V1.Where( ${ \begin{array} { r l } { \ V { 2 } } & { { } = > } \end{array} }$ V2.CanDeserialize(V3)) .FirstOrDefault();
298
+ $^ { \mathbf { \alpha } _ { \mathbf { \mathcal { X } } + \mathbf { \beta } } }$ var $\begin{array} { r l } { { \nabla } 0 } & { { } = } \end{array}$ this.V1.FirstOrDefault( $^ { ' } \mathrm { V } 2 \ = \mathrm { > }$ V2.CanDeserialize(V3));
299
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ var V0 $=$ V1.Where( ${ \begin{array} { r l } { \ V { 2 } } & { { } = > } \end{array} }$ V2.Item1 $\scriptstyle = = \ V 3$ && V2.Item2 $\scriptstyle \ = \ \ = \ \lor 4$ ) .FirstOrDefault();
300
+ x+ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ .FirstOrDefault( $\mathrm { ~ \textit ~ { ~ V ~ 2 ~ } ~ } = >$ V2.Item1 $\scriptstyle = = \ \nabla 3$ && V2.Item2 == V4);
301
+
302
+ Description Change from Add function to indexer.
303
+
304
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ V0.Add(V1.key, V1.V2);
305
+ $^ { \mathbf { \alpha } _ { \mathbf { \mathcal { X } } + \mathbf { \beta } } }$ V0[V1.key] $=$ V1.V2;
306
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ V0.Add(V1.Id, V2);
307
+ $\mathbf { \pmb { x } } _ { + }$ V0[V1.Id] = V2;
308
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ V0.Add(V1.Etag, V1);
309
+ $\mathbf { \pmb { x } } _ { + }$ V0[V1.Etag] = V1;
310
+ $\mathbf { _ { 2 } } \mathbf { _ { 2 } }$ V0.Add(V1.V2, V3.Merge(V1.V4));
311
+ $^ { \mathbf { \alpha } _ { \mathbf { \mathcal { X } } + \mathbf { \beta } } }$ V0[V1.V2] = V3.Merge(V1.V4);
312
+
313
+ Table 11: Break-down performance results on the transfer learning task. See Tab. 7 for descriptions of each fixer category.
314
+
315
+ <table><tr><td colspan="6">Graph2Tree Seq Edit Encoder</td><td colspan="3">Seq2Seq Seq Edit Encoder</td></tr><tr><td>Fixer ID</td><td>Acc.(%)</td><td>Acc.*(%)</td><td>Recall@5(%)</td><td>Recall@5*(%)</td><td>Acc.(%)</td><td>Acc.*(%)</td><td>Recall@5(%)</td><td>Recall@5*(%)</td></tr><tr><td>CA2007</td><td>88.0</td><td>89.2</td><td>88.2</td><td>94.3</td><td>52.7</td><td>91.9</td><td>61.0</td><td>93.8</td></tr><tr><td>IDE0004</td><td>69.8</td><td>92.5</td><td>73.6</td><td>94.3</td><td>45.3</td><td>98.1</td><td>45.3</td><td>98.1</td></tr><tr><td>RCS1015</td><td>28.6</td><td>82.9</td><td>40.0</td><td>82.9</td><td>40.0</td><td>71.4</td><td>42.9</td><td>71.4</td></tr><tr><td>RCS1021</td><td>30.7</td><td>60.8</td><td>33.3</td><td>67.6</td><td>7.8</td><td>56.2</td><td>17.8</td><td>72.3</td></tr><tr><td>RCS1032</td><td>8.3</td><td>37.5</td><td>8.3</td><td>45.8</td><td>20.8</td><td>45.8</td><td>20.8</td><td>45.8</td></tr><tr><td>RCS1058</td><td>93.0</td><td>88.4</td><td>95.3</td><td>90.7</td><td>37.2</td><td>69.8</td><td>39.5</td><td>76.7</td></tr><tr><td>RCS1077</td><td>6.5</td><td>69.5</td><td>6.5</td><td>74.0</td><td>7.5</td><td>84.0</td><td>7.5</td><td>84.5</td></tr><tr><td>RCS1089</td><td>96.0</td><td>98.7</td><td>98.7</td><td>98.7</td><td>76.0</td><td>98.7</td><td>76.0</td><td>98.7</td></tr><tr><td>RCS1097</td><td>15.0</td><td>90.0</td><td>15.0</td><td>90.0</td><td>25.0</td><td>90.0</td><td>25.0</td><td>95.0</td></tr><tr><td>RCS1118</td><td>95.4</td><td>98.1</td><td>99.6</td><td>99.6</td><td>93.7</td><td>99.6</td><td>98.7</td><td>1.00</td></tr><tr><td>RCS1123</td><td>66.1</td><td>81.7</td><td>68.8</td><td>86.2</td><td>64.2</td><td>87.2</td><td>65.1</td><td>94.5</td></tr><tr><td>RCS1146</td><td>54.9</td><td>81.7</td><td>56.3</td><td>85.9</td><td>45.1</td><td>76.1</td><td>57.7</td><td>91.5</td></tr><tr><td>RCS1197</td><td>5.3</td><td>25.3</td><td>5.3</td><td>33.7</td><td>12.6</td><td>40.0</td><td>12.6</td><td>50.0</td></tr><tr><td>RCS1202</td><td>28.6</td><td>67.9</td><td>37.5</td><td>75.0</td><td>28.6</td><td>69.6</td><td>32.1</td><td>80.4</td></tr><tr><td>RCS1206</td><td>75.0</td><td>99.1</td><td>75.9</td><td>99.1</td><td>50.0</td><td>1.00</td><td>50.0</td><td>1.00</td></tr><tr><td>RCS1207</td><td>26.2</td><td>73.8</td><td>28.6</td><td>90.5</td><td>7.1</td><td>64.3</td><td>11.9</td><td>88.1</td></tr></table>
316
+
317
+ ∗: upper-bound performance of predicting $\mathbf { x } _ { + }$ using the gold-standard edit representations.
318
+
319
+ # C BREAK-DOWN ANALYSIS OF TRANSFER LEARNING RESULTS
320
+
321
+ Tab. 11 lists the detailed evaluation results for the transfer learning experiments discussed in Sect. 4.4. We refer readers to Tab. 7 for detailed descriptions of each fixer category. The neural Graph2Tree editor outperforms the Seq2Seq editor (both with sequential edit encoders) on 10 out of 16 fixer categories. However, we found that there are categories where both end-to-end system under-performs, even though the upper-bound accuracy is high (e.g. RCS1077, RCSRCS1197, RCS1207, RCS1032). While improving the generalization ability of the neural editor models to achieve better transfer learning performance is an important future work, we remark that this task is indeed non-trivial. First, some fixer categories cover a broad range of similar edits, which could not be captured by a single seed edit. xSecond, some categories contain syntactically or semantically complex refactoring rules. For instance, RCS1207 converts method groups into anonymous functions, involving changing multiple positions of the source code, which might not be trivially captured by the sequential edit encoder from a single example edit. Additionally, RCS1197 requires reasoning about a chain of expressions. It turns sb.Append $( \ s 1 \ + \ \ s 2 \ + \ \ldots \ + \ \ s \mathrm { N } )$ ) into sb.Append(s1).Append(s2).[. . .]Append(sN)), which our current models are unable to reason about. More interestingly, we found that there are cases where the edits are syntactically simple, but could be semantically more difficult to learn. For instance, RCS1032 is about removing redundant parentheses from expressions. Although the edit pattern might seem to be syntactically simple at the AST level (replacing a ParethesizedExpressionSyntax node by its child node), determining which pair of parentheses is actually redundant in an expression (e.g. $( \ a + \ b )$ ) $\star \mathrm { ~ ~ { ~ ~ } ~ } / \mathrm { ~ ~ { ~ d ~ } ~ } )$ ) is semantically non-trivial to learn from a single edit example. We believe that further advances in (general) learning from source code are required to correctly handle these cases.
322
+
323
+ # D IMPACT OF TRAINING SET SIZE
324
+
325
+ To evaluate the data efficiency of our proposed approach, we tested the end-to-end performance of our neural editor model (Sect. 4.4, Tab. 4) with varying amount of training data. Tab. 12 lists the results. We found both Graph2Tree and Seq2Seq editors are relatively data efficient. They registered around $9 0 \%$ of the accuracies achieved using the full training set with only $6 0 \%$ of the training data.
326
+
327
+ # E DETAILS OF HUMAN EVALUATION
328
+
329
+ As discussed in Sect. 4.2, we performed human evaluation to rate the qualities of neighboring edits given a seed edit. The annotation instructions on GithubEdits and WikiAtomicEdits datasets are listed below. The annotation was carried out by three authors of this paper, and we anonymized the source of systems that generated the output. The three-way Fleiss’ kappa inter-rater agreement is $\kappa = 0 . 5 5$ , which shows moderate agreement (Artstein & Poesio, 2008), an agreement level that is also used in other annotation tasks in NLP (Faruqui & Das, 2018).
330
+
331
+ Table 12: Test performance of end-to-end experiments with varying amount of training data.
332
+
333
+ <table><tr><td>Training Set Size</td><td>Acc.@1(%)</td><td>Recall@5 (%)</td><td>PPL per token</td></tr><tr><td colspan="2">GitHubEdits</td><td></td><td></td></tr><tr><td colspan="2">Graph2Tree-Seq Edit Encoder</td><td></td><td></td></tr><tr><td>20%</td><td>43.88</td><td>50.53</td><td>1.5703</td></tr><tr><td>40%</td><td>50.44</td><td>56.63</td><td>1.4152</td></tr><tr><td>60%</td><td>53.78</td><td>60.00</td><td>1.3720</td></tr><tr><td>80%</td><td>55.51</td><td>60.85</td><td>1.3392</td></tr><tr><td>100%</td><td>57.49</td><td>62.94</td><td>1.3043</td></tr><tr><td colspan="2">WikiAtomicEdits</td><td></td><td></td></tr><tr><td colspan="2">Seq2Seq-Seq Edit Encoder</td><td></td><td></td></tr><tr><td>20%</td><td>42.87</td><td>48.24</td><td>1.4123</td></tr><tr><td>40%</td><td>57.72</td><td>62.31</td><td>1.1812</td></tr><tr><td>60%</td><td>65.22</td><td>69.62</td><td>1.1070</td></tr><tr><td>80%</td><td>68.44</td><td>73.34</td><td>1.0751</td></tr><tr><td>100%</td><td>72.94</td><td>76.53</td><td>1.0527</td></tr></table>
334
+
335
+ Table 13: Annotation Instruction for GitHubEdits Data
336
+
337
+ <table><tr><td>Rating 2 Semantically and Syntactically Equivalent</td></tr><tr><td>The changed constituents in the seed edit and the neighboring edit are applied to the similar positions of the original sentence, serving the same syntactic and semantic role. For example,</td></tr></table>
338
+
339
+ # Examples
340
+
341
+ # • Seed Edit
342
+
343
+ ${ \bf x } _ { - }$ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ .Where( ${ \begin{array} { r l } { \ V { 2 } } & { { } = > } \end{array} }$ V2.Name $= =$ LITERAL).Single();
344
+ $\mathbf { \pmb { x } } _ { + }$ var V0 $=$ V1.Single( ${ \bar { \mathsf { V } } } { \bar { \mathsf { Z } } } { = } { > }$ V2.Name $= =$ LITERAL);
345
+
346
+ # • Neighbor
347
+
348
+ ${ \bf x } _ { - }$ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ .GetMembers().Where(V2 $= >$ V2.Kind $= =$ SymbolKind.Property).Single();
349
+ $\mathbf { \pmb { x } } _ { + }$ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ .GetMembers().Single(V2 $= >$ V2.Kind $= =$ SymbolKind.Property);
350
+
351
+ # • Seed Edit
352
+
353
+ ${ \bf x } _ { - }$ Type $\mathrm { ~ \small ~ \displaystyle ~ V 0 ~ } ~ = ~ \mathrm { ~ \small ~ V 1 ~ } ~ = =$ null ? typeof(object) : V1.GetType();
354
+ $\mathbf { \pmb { x } } _ { + }$ Type V0 $=$ V1?.GetType() ?? typeof(object);
355
+
356
+ # • Neighbor
357
+
358
+ ${ \bf x } _ { - }$ string ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1 ~ = =$ null ? string.Empty : VAR1.ToString();
359
+ x+ string V0 = V1?.ToString() ?? string.Empty;
360
+
361
+ # • Seed Edit
362
+
363
+ ${ \bf x } _ { - }$ Assert.True(Directory.Exists(V0) $\scriptstyle \mathbf { \mu = } \mathbf { \mu } \mathbf { V } 1$ );
364
+ $\mathbf { \pmb { x } } _ { + }$ Assert.Equal(Directory.Exists(V0), V1);
365
+
366
+ # • Neighbor
367
+
368
+ ${ \bf x } _ { - }$ Assert.True(V0.GetString(V0.GetBytes(LITERAL)) $= =$ V1.ContainingAssembly.Identity.CultureName);
369
+ $\mathbf { \pmb { x } } _ { + }$ Assert.Equal(V0.GetString(VAR0.GetBytes(LITERAL)), V1.ContainingAssembly.Identity.CultureName);
370
+
371
+ The seed and neighboring edits share functionally or syntactically similar patterns.
372
+
373
+ # Examples
374
+
375
+ The following edit is a related edit of the first example above, as it applies the same simplification (.Where(COND).Func() to .Func(COND)), but for FirstOrDefault instead of Single:
376
+
377
+ • Seed Edit ${ \bf x } _ { - }$ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ .Where( ${ \begin{array} { r l } { \ V { 2 } } & { { } = > } \end{array} }$ V2.Name $= =$ LITERAL).Single(); $\mathbf { \pmb { x } } _ { + }$ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ .Single( ${ \bar { \mathsf { V } } } { \bar { \mathsf { Z } } } { = } { > }$ V2.Name $= =$ LITERAL);
378
+
379
+ # • Neighbor
380
+
381
+ ${ \bf x } _ { - }$ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ .Where( ${ \begin{array} { r l } { \ V { 2 } } & { { } = > } \end{array} }$ V3.ReportsTo $\scriptstyle \mathbf { \mu = } \mathbf { \mu } , \mathbf { \Lambda } _ { \mathsf { V 2 } }$ .EmployeeID).FirstOrDefault();
382
+ $\mathbf { \pmb { x } } _ { + }$ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ .FirstOrDefault(V2 ${ } = > { }$ V3.ReportsTo $= =$ V2.EmployeeID);
383
+
384
+ The following edit is a related edit of the second example above, as it also replaces a ternary expression for null checking with the ?. and ?? operators:
385
+
386
+ • Seed Edit ${ \bf x } _ { - }$ Type ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ == null ? typeof(object) : V1.GetType(); $\mathbf { \pmb { x } } _ { + }$ Type $\begin{array} { r } { \nabla 0 \ \mathrm { ~ ~ } \nabla 1 \ ? } \end{array}$ .GetType() ?? typeof(object);
387
+
388
+ # • Neighbor
389
+
390
+ ${ \bf x } _ { - }$ var ${ \mathrm { V } } 0 ~ = ~ { \mathrm { V } } 1$ != null ? V1.ToList() : new List<TextSpan $>$ ();
391
+ $\mathbf { \pmb { x } } _ { + }$ var $\begin{array} { r } { \nabla 0 \ \mathrm { ~ ~ } \nabla 1 \ ? } \end{array}$ .ToList() ?? new List<TextSpan>();
392
+
393
+ We also considered pairs such as the following related, since they share similar syntactic structure
394
+
395
+ • Seed Edit ${ \bf x } _ { - }$ V0.State = V1; $\mathbf { \pmb { x } } _ { + }$ V0.SetState(VAR1);
396
+
397
+ • Neighbor ${ \pmb x } _ { - }$ V0.Quantity $\begin{array} { r l } { = } & { { } \nabla 1 } \end{array}$ ; x+ V0.SetQuantity(V1);
398
+
399
+ # Rating 0 Not Related
400
+
401
+ The seed and neighboring edits are not related based on the above criteria.
402
+
403
+ Rating 2 Semantically and Syntactically Equivalent
404
+
405
+ The changed constituents in the seed edit and the neighboring edit are applied to the similar positions of the original sentence, serving the same syntactic and semantic role. For example,
406
+
407
+ <table><tr><td>Seed Edit</td><td>Neighbor</td></tr><tr><td>chaz guest(born 196l ) was born in ni- agra falls,...,a decorated hero in wwii in europe ,including the purple heart .</td><td>randal l. schwartz( born november 22, →1961),also known as merlyn,is an amer- ican author,system administrator and pro- gramming consultant.</td></tr><tr><td>he was elected to donegal county council for sinn fin in 1979 ,and held his seat until his death at age 56.</td><td>davis graduated from high school in january 1947,immediately enrolling at wittenberg college in rural ohio at age 17.</td></tr><tr><td>●drorfeiler served as a paratrooper in the israel defense forces.</td><td>●nagaurfort - sandy fort ; centrally located ; 2nd century old ;witnessed many battles ; lofty walls &amp; spacious campus ; having many palaces &amp; temples inside .</td></tr><tr><td>the original old bay house,home of the chief factor,still exists and is now part of the fort vermilion national historic site.</td><td>the population was 6,400 at the 2010 cen- sus and ispartof the st.louismetropolitan area.</td></tr></table>
408
+
409
+ Rating 1 Syntactically Related
410
+
411
+ The changed constituents in the seed and the neighboring edit are applied to the similar positions of the original sentence, and they play similar syntactic roles. This includes examples like adding a disfunction, adding a complement, prepositional clause or other syntactic constructs with similar phrases or language structures. For example,
412
+
413
+ <table><tr><td>Seed Edit</td><td>Neighbor</td></tr><tr><td>the douro fully enters portuguese territory just after the confluence with the gueda river ; once the douro enters portugal,major pop- ulation centres are less frequent?along the river.</td><td>she made a brief return to the screen in ” par- rish ”(1961),playing the supporting role of mother which received little attention by the press.</td></tr><tr><td>of pagumon living there instead who imme- diately proceeded to treat the digidestined as honored guests ,saying that pagumon are the fresh form of koromon</td><td>when they found it,they discovered a groupin 2O12 slote and his baseball book ” jake ” were the subject of an espn(30 for 30) short documentary in which slote describes his writing process and reads from the book D,saying it is his best writing.</td></tr><tr><td>and supplied as a complete ready - to - fly - aircraft for the flight training and aerial work markets .</td><td>the aircraft was intended to be certifiedin june reinforcements finally did arrive when ?provincial andmilitia units from new york,new jersey,and new hampshire were sent up from fort edward by general daniel webb .</td></tr></table>
414
+
415
+ <table><tr><td>Rating 0 Not Related</td></tr><tr><td>The seed and neighboring edits are not related based on the above criteria.</td></tr></table>
md/train/BkeOp6EKDH/BkeOp6EKDH.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TRIMAP: LARGE-SCALE DIMENSIONALITY REDUCTION USING TRIPLETS
2
+
3
+ # ABSTRACT
4
+
5
+ We introduce “TriMap”; a dimensionality reduction technique based on triplet constraints that preserves the global accuracy of the data better than the other commonly used methods such as t-SNE, LargeVis, and UMAP. To quantify the global accuracy, we introduce a score which roughly reflects the relative placement of the clusters rather than the individual points. We empirically show the excellent performance of TriMap on a large variety of datasets in terms of the quality of the embedding as well as the runtime. On our performance benchmarks, TriMap easily scales to millions of points without depleting the memory and clearly outperforms t-SNE, LargeVis, and UMAP in terms of runtime.
6
+
7
+ # 1 INTRODUCTION
8
+
9
+ Data visualization based on dimensionality reduction (DR) is a core problem in data analysis and machine learning. The aim of DR is to provide a low-dimensional representation (typically in 2D or 3D) of a given high-dimensional dataset that preserves the overall structure of the data as much as possible. The earlier approaches for DR involve linear methods such as PCA $( | \mathbf { P e a r s o n } | , | 1 9 0 1 | )$ . PCA aims to maintain the second-order statistics of the data by projecting the points into the low dimensional space that preserves the maximum amount of variance among all such projections. As a result, PCA has been shown to be effective in preserving the global structure of the data $\mathrm { ( | \overline { { { S i l v a } } } } |$ & Tenenbaum, 2003). The global structure includes the overall shape of the dataset, placement of the clusters, and existence of potential outliers. Unlike PCA, much of the focus of the more recent non-linear methods including t-SNE (Maaten & Hinton, $\textcircled { 2 0 0 8 }$ , LargeVis $\left( \mathbb { T a n g e t a l . } \right) , \left[ 2 0 1 6 \right)$ and UMAP (McInnes et al., 2018) has been on preserving the local neighborhood structure of each individual point. Similarly, the common performance measures of DR such as trustworthinesscontinuity (Venna & Kaski, 2005), precision-recall (i.e. AUC) $\left( \mathrm { N e n n a ~ e t ~ a l . } \right) \left[ \mathrm { 2 0 1 0 } \right]$ , and nearestneighbor accuracy have also been developed by retaining the same focus on reflecting the local accuracy of the embedding. Thus, there has been a lack of attention on developing methods that focus on preserving the global structure of the data and likewise, practical performance measures to assess the global accuracy.
10
+
11
+ We first introduce the global score, a quantitative measure which reflects the closeness of a given embedding to the PCA embedding (which is optimal by means of preserving the data variance). The purpose of this score is to measure the accuracy of an embedding in reflecting the overall placement of the clusters of points relative to their original representation in high-dimension. By design, PCA yields the highest global score among all the DR methods and high values of global score indicates the efficacy of a DR method in reflecting the global structure.
12
+
13
+ Next, we introduce TriMap, a DR method which focuses on preserving the global structure of the data in the embedding. Pairwise (dis)similarities between points (used by the previous DR methods) seem to be insufficient in capturing the global structure. Instead, TriMap incorporates a higher order of structure to construct the embedding by means of triplets:
14
+
15
+ $$
16
+ ( i , j , k ) \Leftrightarrow p o i n t i s c l o s e r t o p o i n t j t h a n p o i n t k .
17
+ $$
18
+
19
+ The key idea behind TriMap stems from semi-supervised metric learning $\left( \overline { { \mathrm { A m i d e t a l . } } } , \overline { { 2 0 1 6 } } \right)$ : Given an initial low-dimensional representation for the data points, the triplet information from the highdimensional representation of the points is used to enhance the quality of the embedding. Similarly, TriMap is initialized with the low dimensional PCA embedding, and this embedding is then modified using a set of carefully selected triplets from the high-dimensional representation.
20
+
21
+ ![](images/126550d3d027ba058dc4c638816e25f31438dc6863e0896965d53054c49a4bed.jpg)
22
+ Figure 1: 2-D Visualizations of the S-curve dataset: (a) original dataset in 3-D, (b) t-SNE, (c) UMAP, (d) TriMap, and (e) PCA. The values of AUC and global score, for respectively measuring local and global accuracy, are shown in order as a pair (AUC, GS) for each embedding. Despite having higher AUC values, t-SNE and UMAP both fail to reflect the overall shape of the S-curve. On the other hand, TriMap successfully unveils the underlying structure in the original dataset. Note that GS is the only DR performance measure that can reflect this property.
23
+
24
+ With an extensive set of experiments, we show that TriMap produces excellent results on a variety of real-world as well as synthetic datasets. We show that in many cases TriMap outperforms all the competitor non-linear methods by means of global score and provides comparable local accuracy. While being significantly faster than t-SNE, TriMap provides comparable runtime to UMAP and LargeVis while scaling drastically better to larger datasets. On the Character Font Images dataset of ${ \sim } 1 . 7 \mathbf { M }$ points, TriMap calculates the embedding in ${ \sim } 1 . 3$ hours while LargeVis takes more than 3 hours and UMAP exceeds the 12 hours time limit. Our contributions can be summarized as follows:
25
+
26
+ • We introduce a global score to quantify the quality of a low-dimensional embedding in reflecting the global structure of the high-dimensional data such as placement of the clusters rather than the local neighborhood of individual points.
27
+ We introduce TriMap, a fast dimensionality reduction method which provides embeddings of the data that are globally more accurate than other non-linear DR methods such as t-SNE, LargeVis, and UMAP.
28
+ • We provide an efficient implementation1 of TriMap that can easily scale to millions of points on commodity hardware and outperforms the competing methods in terms of runtime. We also perform many large-scale experiments on various datasets to show the efficacy of TriMap in terms of DR performance measures and runtime.
29
+
30
+ # 2 A MEASURE OF GLOBAL ACCURACY
31
+
32
+ Consider the S-curve dataset2 which consists of 5000 points in 3-D uniformly sampled from an S-shaped manifold (Figure 1.(a)). This dataset serves as a paradigmatic problem for evaluating the performance of DR methods. In Figure $\bigstar \bigstar$ we show the results of 2-D embeddings of the S-curve dataset using t-SNE, UMAP, TriMap, and PCA. The top of each graph is labeled by the scoring pair (AUC, GS) where GS stands for global score (introduced below). Note that both t-SNE and UMAP provide higher values of the AUC score and locally preserve the continuity of the manifold. However, they both fail to recover the global structure of the S-curve, which is naturally reflected in the PCA embedding. On the other hand, our TriMap method (formally defined later) successfully recovers the structure of the S-curve by “unveiling” the curved shape of the manifold at both ends. Overall, the 2-D TriMap embedding resembles the original 3-D representation as much as possible. Note also that GS is the only measure that can reflect the global accuracy of the embedding.
33
+
34
+ The previous example indicates that the local measures of DR performance (such as AUC) cannot reflect the global accuracy of a low-dimensional embedding. In fact, the low-granular structure of the data can only be estimated by considering the global statistics of the dataset, as regarded by the PCA method. PCA is a linear DR method that projects the high-dimensional data onto the top- $d$ orthogonal directions having the highest variance. In order to calculate the mapping, PCA only considers the aggregate statistics of the dataset rather than the local information of each individual data point. As a result, PCA is extremely well suited at retaining the global structure of the data, i.e. the overall shape of the dataset, placement of the clusters, and existence of potential outliers.
35
+
36
+ ![](images/90058bdad23fe495c6d48369d44b01219a795fa12a3178643624027d56f79383.jpg)
37
+ Figure 2: The Effect of the weight transformation on the MNIST dataset: (a) no weight transformation, (b) $\gamma = 5 0$ , (c) $\gamma = 5 0 0$ (default), and (d) $\gamma = 5 0 0 0$ . The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure. Larger values of $\gamma$ emphasizes more on the local accuracy rather than the global accuracy.
38
+
39
+ However, by focusing on the global structure, PCA loses much of the local information such as the neighborhood structure of each data point.
40
+
41
+ Given a low-dimensional mapping produced by PCA, it is possible to calculate an optimal inverse mapping into the original high-dimensional space by means of minimizing the squared error. The optimal inverse map also corresponds to a linear mapping3. In order to quantify the global accuracy of a DR result, we focus on the accuracy of the embedding in reflecting the global structure of the data similar to PCA. That is, we consider the minimum reconstruction error of the original dataset by means of a linear inverse map. Given $n$ data points $\{ \pmb { x } _ { i } \in \mathbb { R } ^ { m } \} _ { i = 1 } ^ { n }$ , let $\pmb { X } \in \mathbb { R } ^ { m \times \bar { n } }$ denote the high-dimensional data matrix where the $i$ -th column corresponds to $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ . Similarly, let $\pmb { Y } \in \mathbb { R } ^ { d \times n }$ denote the matrix of the low-dimensional embedding of the points $\{ \pmb { y } _ { i } \in \mathbb { R } ^ { d } \} _ { i = 1 } ^ { n }$ . Without loss of generality, we assume both $\boldsymbol { X }$ and $\mathbf { Y }$ are centered. We define the Minimum Reconstruction Error $( M R E )$ from the embedding as
42
+
43
+ $$
44
+ \mathcal { E } ( \boldsymbol { Y } | \boldsymbol { X } ) : = \operatorname* { m i n } _ { \boldsymbol { A } \in \mathbb { R } ^ { m \times d } } \| \boldsymbol { X } - \boldsymbol { A } \boldsymbol { Y } \| _ { \mathrm { F } } ^ { 2 } ,
45
+ $$
46
+
47
+ where $\| \cdot \| _ { \mathrm { F } }$ denotes the Frobenius norm4. Note that PCA has the lowest possible MRE among all the DR methods. Thus, in order to obtain a normalized measure of global accuracy of a given embedding $\mathbf { Y }$ for a data $\boldsymbol { X }$ , we define the global score $( G S )$ as
48
+
49
+ $$
50
+ \mathrm { G S } ( Y | X ) : = \exp \Big ( - \frac { \mathcal { E } ( Y | X ) - \mathcal { E } _ { \mathrm { P C A } } } { \mathcal { E } _ { \mathrm { P C A } } } \Big ) \in [ 0 , 1 ] ,
51
+ $$
52
+
53
+ where $\mathcal { E } _ { \mathrm { P C A } } : = \mathcal { E } ( Y _ { \mathrm { P C A } } | X )$ denotes the MRE achieved by the PCA embedding $\mathbf { Y } _ { \mathrm { P C A } }$ on the same dataset $\boldsymbol { X }$ . Note that $\mathrm { \bf G S } ( Y _ { \mathrm { P C A } } | X ) = 1$ and we claim that larger values of GS indicate a higher capacity of a DR method to reflect the global structure of the data, as shown in the experiments.
54
+
55
+ In the remainder of the paper, we use GS as the global measure of performance. Due to the high computational complexity for calculating the trustworthiness-continuity and AUC scores for large data sets, we use nearest-neighbors accuracy as the local measure of performance henceforth.
56
+
57
+ # 3 THE TRIMAP METHOD
58
+
59
+ We now formally introduce the TriMap method. Recall that a triplet consists of three points $( i , j , k )$ where point $i$ is closer to point $j$ than point $k$ . TriMap chooses a subset $\mathcal { T } = \{ ( i , j , \bar { k } ) \}$ of triplets and assigns a weight $\omega _ { i j k } \geq 0$ for each triplet: a higher value of $\omega _ { i j k }$ implies that the pair $( i , k )$ is located much farther than the pair $( i , j )$ . We define the loss of the triplet $( i , j , k )$ as
60
+
61
+ $$
62
+ \ell _ { i j k } : = \omega _ { i j k } \frac { s ( y _ { i } , y _ { k } ) } { s ( y _ { i } , y _ { j } ) + s ( y _ { i } , y _ { k } ) } , \mathrm { ~ w h e r e ~ } s ( y _ { i } , y _ { j } ) = \left( 1 + | y _ { i } - y _ { j } | | ^ { 2 } \right) ^ { - 1 } ,
63
+ $$
64
+
65
+ ![](images/922bb546e53ad0604be26eae945edea542602a5fe252f6a85aabb42a6bfac050.jpg)
66
+ Figure 3: Effect of changing the number of triplets on the quality of the embeddings of the MNIST dataset. We consider $( m , m ^ { \prime } , r ) = c \times ( 2 , 1 , 1 )$ for: (a) $c = 1$ , (b) $c = 2$ , (c) $c = 5$ (default), (d) $c = 1 0$ , and (e) $c = 2 0$ . The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure. The quality of embedding does not improve significantly after adding a certain number of triplets.
67
+
68
+ is a similarity function between $\mathbf { \nabla } _ { \mathbf { \boldsymbol { y } } _ { i } }$ and ${ \pmb y } _ { j }$ . The choice of $s$ is motivated by the good performance of Student t-distribution for similarities in low-dimension in the t-SNE method. Note that the loss of the triplet $( i , j , k )$ approaches zero as $\| \pmb { y } _ { i } - \pmb { y } _ { j } \|$ decreases and $\| \pmb { y } _ { i } - \pmb { y } _ { k } \|$ increases.
69
+
70
+ We first develop the weighing scheme for the triplets. To reflect the relative similarities in high-dimension, we define the unnormalized weight of the triplet $( i , j , k )$ as
71
+
72
+ $$
73
+ \tilde { \omega } _ { i j k } = \exp ( d _ { i k } ^ { 2 } - d _ { i j } ^ { 2 } ) \geq 0 ,
74
+ $$
75
+
76
+ in which, $d _ { i j }$ is any distance measure between $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ in highdimension. For Euclidean distances, we use the scaling introduced in (Zelnik-Manor & Perona, $\textcircled { 2 0 0 5 }$ ,
77
+
78
+ $$
79
+ d _ { i j } ^ { 2 } = \frac { \lVert \pmb { x } _ { i } - \pmb { x } _ { j } \rVert ^ { 2 } } { \sigma _ { i j } } ,
80
+ $$
81
+
82
+ where $\sigma _ { i j } = \sigma _ { i } \sigma _ { j }$ and $\sigma _ { i }$ is set to the average Euclidean distance between $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and the set of nearest-neighbors of $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ from 4-th to 6-th neighbors. This choice of $\sigma _ { i j }$ adaptively adjusts the scaling based on the density of the data.
83
+
84
+ ![](images/ccbf9f3fa2e2973959a501e01799674558f18b1188314acb65e1070afdf301e8.jpg)
85
+ Figure 4: $\gamma$ -scaled logtransformation with different values of $\gamma$ . The value NIL corresponds to no transformation.
86
+
87
+ While the choice of weights $\tilde { \omega } _ { i j k }$ works well in practice, we adjust the weights further by applying a non-linear transformation that emphasizes the smaller weights. Expanding the values of small weights has the effect of placing the nearest-neighbors closer to the point and pushing the remaining points farther away, thus improving the local accuracy (as shown in Figure $\bigtriangledown$ and discussed later). The final value of the weight $\omega _ { i j k }$ is obtained by applying the $\gamma$ -scaled log-transformation (see Figure 4),
88
+
89
+ $$
90
+ \omega _ { i j k } = \zeta _ { \gamma } \big ( \frac { \tilde { \omega } _ { i j k } } { \gamma } + \delta \big ) \quad \mathrm { w h e r e } \zeta _ { \gamma } ( u ) : = \log \big ( 1 + \gamma u \big ) ,
91
+ $$
92
+
93
+ in which $\mathcal { W } = \mathrm { m a x } _ { ( i ^ { \prime } , j ^ { \prime } , k ^ { \prime } ) \in \mathcal { T } } \tilde { \omega } _ { i ^ { \prime } j ^ { \prime } k ^ { \prime } } , ~ \gamma > 0$ is a scaling factor, and $\delta$ is a small constant. We use $\gamma = 5 0 0$ and $\delta = 1 0 ^ { - 4 }$ in all our experiments.
94
+
95
+ To construct the embedding, we consider a small subset of all possible triplets $( i , j , k )$ for which, the closer point $j$ belongs to the set of nearest-neighbors of the point $i$ and the farther point $k$ is among the points that are more distant from $i$ than $j$ , chosen uniformly at random. For each point we consider its $m = 1 0$ nearest neighbors and sample $m ^ { \prime } = 5$ triplets per nearest-neighbor. This yields $m \times m ^ { \prime } = 5 0$ nearest-neighbor triplets per point. In addition, we also add $r = 5$ random triplets $( i , j , k )$ per each point $i$ where $j$ and $k$ are sampled uniformly at random and their order is possibly switched based on their nearness to $i$ . This yields $m \times m ^ { \prime } + r = 5 5$ triplets per point in total. Thus, the overall complexity of the optimization step is linear in number of points $n$ . The computational complexity is dominated by the nearest-neighbor search, which is shared among all the recent methods such as t-SNE, LargeVis, and UMAP. We use ANNOY for the approximate nearest-neighbor search5 which is based on random projection trees.
96
+
97
+ While a random initialization for the embedding also works well in practice, we initialize the embedding to the PCA solution $\mathbf { Y } _ { \mathrm { P C A } }$ (scaled by a small constant value for better convergence). The PCA initialization for TriMap allows faster convergence while preserving much of the global structure discovered by PCA. Note that the other DR methods such as t-SNE are extremely sensitive to the initialization and do not converge well with any initial solution other than small random initialization around the origin.
98
+
99
+ Table 1: Runtime of the methods in hh:mm:ss format on single machine with $2 . 6 \ : \mathrm { G H z }$ Intel Core i5 CPU and 16 GB of memory. We limit the runtime of each method to 12 hours. Also, UMAP runs out of memory on datasets larger than ${ \sim } 4 \mathbf { M }$ points.
100
+
101
+ <table><tr><td>Dataset (size)</td><td>t-SNE</td><td>LargeVis</td><td>UMAP</td><td>TriMap</td><td>Speedup</td></tr><tr><td>COIL-20 (1440)</td><td>00:00:08</td><td>00:05:51</td><td>00:00:04</td><td>00:00:02</td><td>2.00×</td></tr><tr><td>USPS (11K)</td><td>00:02:02</td><td>00:06:12</td><td>00:00:12</td><td>00:00:11</td><td>1.10×</td></tr><tr><td>Epileptic Seizure (11.5K)</td><td>00:03:11</td><td>00:06:17</td><td>00:00:15</td><td>00:00:12</td><td>1.25×</td></tr><tr><td>20 Newsgroup (18K)</td><td>00:05:34</td><td>00:06:57</td><td>00:00:26</td><td>00:00:21</td><td>1.24×</td></tr><tr><td>TabulaMuris (54K)</td><td>00:17:32</td><td>00:09:29</td><td>00:01:12</td><td>00:01:06</td><td>2.00×</td></tr><tr><td>MNIST(70K)</td><td>00:20:38</td><td>00:11:29</td><td>00:01:15</td><td>00:01:23</td><td>0.90×</td></tr><tr><td>FashionMNIST(70K)</td><td>00:19:10</td><td>00:11:04</td><td>00:01:18</td><td>00:01:24</td><td>0.93×</td></tr><tr><td>TVNews (~129K)</td><td>00:38:59</td><td>00:16:26</td><td>00:02:57</td><td>00:02:45</td><td>1.07×</td></tr><tr><td>360+KLyrics (~360K)</td><td>08:50:49</td><td>00:44:16</td><td>00:25:23</td><td>00:13:49</td><td>1.84×</td></tr><tr><td>Covertype(~581K)</td><td>二</td><td>00:44:54</td><td>02:59:41</td><td>00:24:42</td><td>1.82×</td></tr><tr><td>RCV1 (800K)</td><td>二</td><td>01:34:38</td><td>04:55:53</td><td>00:36:59</td><td>2.56×</td></tr><tr><td>Character Font Images (~1.7M)</td><td>二</td><td>03:16:19</td><td>二</td><td>01:17:50</td><td>2.52×</td></tr><tr><td>KDDCup99 (~4.9M)</td><td>二</td><td>二</td><td>二</td><td>04:17:01</td><td>二</td></tr><tr><td>HIGGS (11M)</td><td>1</td><td>1</td><td>1</td><td>10:08:36</td><td>1</td></tr></table>
102
+
103
+ We define the final loss as the sum of the losses of the sampled triplets in $\tau$
104
+
105
+ $$
106
+ \ell _ { \mathrm { T r i M a p } } = \sum _ { ( i , j , k ) \in \mathcal { T } } \ell _ { i j k } .
107
+ $$
108
+
109
+ The loss is minimized using the full-batch gradient descent with momentum using the delta-bar-delta method. In all our experiments, we perform 400 iterations with the value of momentum parameter equal to 0.5 during the first 250 iterations and 0.8 afterwards.
110
+
111
+ Finally, note that there exists connections between TriMap and a number of triplet (aka ordinal) embedding methods such as t-STE (Van Der Maaten & Weinberger, $\boxed { 2 0 1 2 } )$ . The triplet embedding methods have been developed for a different setting where the goal is to find an embedding based on a given pre-specified set of triplets obtained from human evaluators (or some form of implicit feedback). For instance, t-STE maximizes the sum of log of the satisfaction probabilities of the triplets to calculate the embedding. It is worth mentioning that TriMap is a DR method that is designed to sample the informative triplets from the high-dimensional representation of a set of points and assign weights to these triplets to reflect the relative similarities of these points. Although TriMap can also be used for the triplet embedding task, we only focus on the DR results 6.
112
+
113
+ # 3.1 EFFECT OF DIFFERENT PARAMETERS
114
+
115
+ We briefly discuss the effect of different parameters, namely the total number of triplets $| \tau |$ and the $\gamma$ -scaled log-transformation, on the quality of the embedding. TriMap is particularly robust to the number of sampled triplet for constructing the embedding. This can be explained by the high amount of redundancy in the triplets (the triplets $( i , j , k )$ and $\bar { ( } i , j , k ^ { \prime } )$ convey the same information if $k$ and $k ^ { \prime }$ are nearest neighbors and also mapped nearby). In Figure $\textcircled { 3 }$ we consider various values for $m$ , $m ^ { \prime }$ , and $r$ for the MNIST dataset while fixing the remaining parameters. In fact, using large number of triplets can sometimes introduce an overhead and require larger number of iterations to converge.
116
+
117
+ A more important parameter is $\gamma$ which controls the trade-off between the local and global accuracy. Larger values of $\gamma$ increases the relative importance of triplets with smaller weights. This causes the method to focus on the nearest-neighbor points rather than the points that are far away, thus improving the local accuracy. On the other hand, improving the local accuracy can impair the global accuracy. In Figure $^ { 2 , }$ we plot the $\gamma$ -scaled log-transformation for various $\gamma$ values and illustrate the results on MNIST without the log-transformation as well as the results with different $\gamma$ values. For larger values of $\gamma$ the clusters tend to become more compressed and as a result, the nearest-neighbor accuracy is improved. On the other hand, the global score starts to decrease for larger $\gamma$ values.
118
+
119
+ ![](images/2ce1b1fc67b1b7febaf375f4781a2a98d8cfd034c15252995fbc93981b425354.jpg)
120
+ Figure 5: Visualizations of different datasets using t-SNE, UMAP, TriMap, and PCA. Each row corresponds to one dataset and each column represents one method. The values of nearest neighbor accuracy and global score are shown as a pair (NN,GS) on top of each figure.
121
+
122
+ # 4 EXPERIMENTS
123
+
124
+ In this section, we apply TriMap on a set of real-world as well as synthetic datasets and compare the results to t-SNE, LargeVis, UMAP, and PCA methods. The datasets used in our experiments are listed in Table 1 and a short description is given in the appendix. All experiments are conducted on a single machine with $2 . 6 \ : \mathrm { G H z }$ Intel Core i5 CPU and $1 6 \mathrm { \ G B }$ of memory. We limit the runtime of each algorithm to 12 hours. For implementations, we use the default sklearn implementation for t-SNE and the official implementations of LargeVis and UMAP provided by the authors7,8. Due to lack of space, we provide the comparison to the LargeVis results as well additional TriMap results on the larger datasets in the appendix.
125
+
126
+ ![](images/c30bd6f21a0a26542831274847c6c7fa12491842072df61b0d6c9e9ef3c98985.jpg)
127
+ Figure 5: Visualizations of different datasets (continued) using t-SNE, UMAP, TriMap, and PCA. Each row corresponds to one dataset and each column represents one method. The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure.
128
+
129
+ In order to have a fair comparison, we use the default parameter values for all methods, including ours $\mathbf { \Phi } _ { m } = 1 0 \mathbf { \Phi } $ , $m ^ { \prime } = 5$ , $r \ = \ 5$ , $\gamma ~ = ~ 5 0 0$ , and 400 iterations). Also to reduce the overhead induced by the dimensionality of the data in the nearest-neighbor search step, we reduce the number of dimensions of the dataset to 100 if necessary, using the PCA method. To evaluate the local performance, we show the nearest-neighbor accuracy of each result. We also show the GS as a measure of global performance. The performance measures are shown on top of each figure as a pair (NN, GS).
130
+
131
+ # 4.1 RUNTIME
132
+
133
+ The runtime of the methods are provided in Table $^ 1$ in the hh:mm:ss format. We limit the runtime of each method to 12 hours. As can be seen from the results, TriMap provides excellent runtime and outperforms all the other methods in most cases. Also, TriMap easily scales to millions of points while the other methods exceed the time limit or run out of memory. For instance, UMAP causes an out of memory error for datasets larger than ${ \sim } 4 \mathbf { M }$ points.
134
+
135
+ # 4.2 VISUALIZATIONS
136
+
137
+ The visualizations of the datasets using TriMap as well as the other competing methods are shown in Figure $5$ and $\bigtriangledown$ For some results, we provide a zoomed in snippet over the main figure to provide a more detailed illustration. Overall, TriMap preserves the underlying global structure of the data better than the other competing methods. This is reflected by the larger GS values for TriMap as well as visually comparing the embeddings to the PCA result. For example, TriMap recovers the continuous structure of the TV news dataset and separates the remaining outliers in the data which are also identified by the PCA method. This can be verified by comparing the placement of an example outlier point, marked with a red $\times$ , by the different methods: TriMap shows this point among other outliers whereas t-SNE and UMAP fail to uncover this information. Also, the global score of TriMap on this dataset is much higher than the other methods. Further discussion is given in the appendix.
138
+
139
+ ![](images/96f7feaeec77ebd9f9917f45d0ce034c8fd693edd822483e4711782fd49320fc.jpg)
140
+ Figure 6: Visualizations of Covertype and RCV1 datasets using UMAP, TriMap, and PCA, and visualizations of the Character Font Images dataset using LargeVis, TriMap, and PCA. The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure.
141
+
142
+ # 5 CONCLUSION AND FUTURE WORK
143
+
144
+ TriMap is a fast and efficient method that can be easily applied to large datasets. While TriMap is extremely effective for uncovering the global structure of the data, other methods such as t-SNE can provide additional insight about the local neighborhood of individual points. As a future research direction, we consider using pairwise constraints along with triplet constraints to improve the local accuracy. The current implementation of TriMap utilizes a single core. Parallel implementation of the method that can exploit multiple cores is another future direction. Furthermore, the global accuracy is measured in terms of the global score which is based on the assumption that linear projection obtained by PCA is globally optimal. While our global score can provide insight about the global accuracy of the embedding in many cases, it appears to be ineffective when the data is highly non-linear or contains a large amount of outliers. Developing non-linear and more robust global performance measures could significantly improve the assessment of the DR results and provide guidelines for developing more accurate DR techniques.
145
+
146
+ # REFERENCES
147
+
148
+ Ehsan Amid, Aristides Gionis, and Antti Ukkonen. Semi-supervised kernel metric learning using relative comparisons. arXiv preprint arXiv:1612.00086, 2016.
149
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
150
+ Leland McInnes, John Healy, and James Melville. Umap: Uniform manifold approximation and projection for dimension reduction. arXiv preprint arXiv:1802.03426, 2018.
151
+ Karl Pearson. Liii. on lines and planes of closest fit to systems of points in space. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 2(11):559–572, 1901.
152
+ Vin D Silva and Joshua B Tenenbaum. Global versus local methods in nonlinear dimensionality reduction. In Advances in neural information processing systems, pp. 721–728, 2003.
153
+ Jian Tang, Jingzhou Liu, Ming Zhang, and Qiaozhu Mei. Visualizing large-scale and highdimensional data. In Proceedings of the 25th international conference on world wide web, pp. 287–297. International World Wide Web Conferences Steering Committee, 2016.
154
+ Laurens Van Der Maaten and Kilian Weinberger. Stochastic triplet embedding. In 2012 IEEE International Workshop on Machine Learning for Signal Processing, pp. 1–6. IEEE, 2012.
155
+ Jarkko Venna and Samuel Kaski. Local multidimensional scaling with controlled tradeoff between trustworthiness and continuity. In Proceedings of 5th Workshop on Self-Organizing Maps, pp. 695–702. Citeseer, 2005.
156
+ Jarkko Venna, Jaakko Peltonen, Kristian Nybo, Helena Aidos, and Samuel Kaski. Information retrieval perspective to nonlinear dimensionality reduction for data visualization. Journal of Machine Learning Research, 11(Feb):451–490, 2010.
157
+ Lihi Zelnik-Manor and Pietro Perona. Self-tuning spectral clustering. In Advances in neural information processing systems, pp. 1601–1608, 2005.
158
+
159
+ # A DATASETS
160
+
161
+ The datasets used in the experiments are listed below. All datasets are publicly available online and a download link is provided.
162
+
163
+ • COIL- ${ \bf \nabla } \cdot 2 { \bf 0 } ^ { 9 }$ (1440): gray-scale images of 20 objects in uniformly sampled orientations (5 degrees of rotation, 72 images per object). Each image is pre-processed by having the background removed and cropped into size $1 2 8 \times 1 2 8$ . $\mathbf { U S P S } ^ { 1 0 }$ (11K): images of handwritten digits (0–9) of size $1 6 \times 1 6$ . Epileptic Seizure11 (11.5K): EEG signal recordings of brain activity for seizure recognition. It contains 178-dimensional vectors belonging to 5 categories.
164
+ 20 Newsgroup11 (18K): newsgroup posts categorized into 20 topics. We use a TF-IDF representation of the words in each document as the features.
165
+ Tabula Muris12 $( \sim 5 4 \mathrm { K } )$ : single cell transcriptome data from the mouse from 20 organs.
166
+ • MNIST13 (70K): images of handwritten digits (0–9) of size $2 8 \times 2 8$ .
167
+ • Fashion MNIST14 (70K): gray-scale images of clothing items such as t-shirt, pullover, bag, etc. of size $2 8 \times 2 8$ .
168
+ TV News11 $( \sim 1 2 9 \mathrm { K } )$ : audio-visual features from TV news broadcast categorized into commercial and non-commercial.
169
+ • $\mathbf { 3 6 0 K + }$ Lyrics15 $( \sim 3 6 2 \mathrm { K } )$ : lyrics of songs from 12 different genres. We group similar genres together (metal-rock, R&B-pop, etc.) to form 7 groups. We use the TF-IDF representation of the words in the song as the features. Covertype11 $( \sim 5 8 1 \mathrm { K } )$ : cartographic features for forest cover type prediction.
170
+ • $\mathbf { R C V 1 } ^ { 1 6 }$ (800K): Reuters Corpus Volume I archive of categorized newswire stories. Character Font Images11 $( { \sim } 1 . 7 \mathrm { M } )$ : images of character from scanned and computer generated fonts.
171
+ • $\mathbf { K D D C u p 9 9 } ^ { \mathrm { 1 1 } }$ $( { \sim } 4 . 9 \mathrm { { M } ) }$ : computer network intrusion detection.
172
+ • $\mathbf { H } \mathbf { I } \mathbf { G } \mathbf { G } \mathbf { S } ^ { 1 1 }$ (11M): Higgs bosons recognition from a background process.
173
+
174
+ # B MORE VISUALIZATIONS
175
+
176
+ We compare the results of TriMap to LargeVis in Figure 7 and 8. We also provide more visualizations obtained using TriMap in Figure 9.
177
+
178
+ # C DISCUSSION
179
+
180
+ We briefly discuss the results of TriMap and draw a comparison to the other methods.
181
+
182
+ TriMap generally provides better global accuracy compared to the competing methods. It also successfully maintains the continuity of the underlying manifold. This can be seen from the COIL-20 result where certain clusters are located farther away from the remaining clusters. However, the underlying structure for the main cluster resembles the one provided by the other methods. TriMap also preserves the continuous structure in the Fashion MNIST and the TV News datasets.
183
+
184
+ TriMap is also efficient in uncovering the possible outliers in the data. For instance, PCA reveals a large number of outliers in the Tabula Muris and the $3 6 0 \mathrm { + K }$ Lyrics datasets. These outliers are located far away from the main clusters in the TriMap results. However, the same points are located very close to the remaining points in the t-SNE results.
185
+
186
+ <table><tr><td>http://www.cs.columbia.edu/CAvE/software/softlib/coil-20.php</td></tr><tr><td>https://www.kaggle.com/bistaumanga/usps-dataset</td></tr><tr><td>http://archive.ics.uci.edu/ml/index.php</td></tr><tr><td>https://tabula-muris.ds.czbiohub.org/</td></tr><tr><td>http://yann.lecun.com/exdb/mnist/</td></tr><tr><td>https://github.com/zalandoresearch/fashion-mnist</td></tr><tr><td>https://www.kaggle.com/gyani95/380000-lyrics-from-metrolyrics</td></tr><tr><td>https://scikit-learn.org/0.18/datasets/rcv1.html</td></tr></table>
187
+
188
+ ![](images/1b3d08ee2fd1e362cbb60fdc07451f5e9efbec7336f6557e5cc45d24a6ff6924.jpg)
189
+ Figure 7: Visualizations of different datasets using LargeVis, TriMap, and PCA. Each row corresponds to one dataset and each column represents one method. The values of nearest neighbor accuracy and global score are shown as a pair (NN,GS) on top of each figure.
190
+
191
+ ![](images/02894110afa287f8baca3934fc4118784cc7dec51a228d2a276abdd1c244e9a6.jpg)
192
+ Figure 7: Visualizations of different datasets (continued) using LargeVis, TriMap, and PCA. Each row corresponds to one dataset and each column represents one method. The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure.
193
+
194
+ Additionally, both t-SNE and LargeVis tend to form spurious clusters by splitting the underlying connected manifold. This can be seen from the TV News results and the result of LargeVis on the Covertype dataset.
195
+
196
+ Finally, notice that in some cases GS fails to reflect the global accuracy of the embeddings. This can be seen from the low GS values for all methods on the Covertype dataset. GS may become uninformative when there exists a high degree of non-linearity in the data that cannot be reflected using PCA. GS also cannot reflect the accuracy of the embedding in uncovering single outliers. Developing more accurate global measures for these scenarios is a future research direction.
197
+
198
+ ![](images/cf9669f5038690e85b2e3c5971d63271a86fb8c99aa4da0cb5ee4f8f808801dd.jpg)
199
+ Figure 8: Visualizations of Covertype and RCV1 datasets using LargeVis, TriMap, and PCA, and visualizations of the Character Font Images dataset using LargeVis, TriMap, and PCA. The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure.
200
+
201
+ ![](images/3861d063bab8a11cd7e97eb87ff420798a417be26fec70be2875a5b800d7374e.jpg)
202
+ Figure 9: Visualizations of KKDCup99 and HIGGS datasets TriMap and PCA. Each row corresponds to one dataset and each column represents one method. The values of nearest neighbor accuracy and global score are shown as a tuple (NN,GS) on top of each figure. TriMap shows more structure for both datasets than PCA. Note that GS is uninformative for the KDDCup99 dataset.
md/train/Bkeeca4Kvr/Bkeeca4Kvr.md ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FEW-SHOT LEARNING ON GRAPHS VIA SUPERCLASSES BASED ON GRAPH SPECTRAL MEASURES
2
+
3
+ Jatin Chauhan, Deepak Nathani, Manohar Kaul
4
+
5
+ Department of Computer Science
6
+ Indian Institute of Technology Hyderabad
7
+ {chauhanjatin100,deepakn1019,manohar.kaul}@gmail.com
8
+
9
+ # ABSTRACT
10
+
11
+ We propose to study the problem of few-shot graph classification in graph neural networks (GNNs) to recognize unseen classes, given limited labeled graph examples. Despite several interesting GNN variants being proposed recently for node and graph classification tasks, when faced with scarce labeled examples in the few-shot setting, these GNNs exhibit significant loss in classification performance. Here, we present an approach where a probability measure is assigned to each graph based on the spectrum of the graph’s normalized Laplacian. This enables us to accordingly cluster the graph base-labels associated with each graph into super-classes, where the $L ^ { p }$ Wasserstein distance serves as our underlying distance metric. Subsequently, a super-graph constructed based on the super-classes is then fed to our proposed GNN framework which exploits the latent inter-class relationships made explicit by the super-graph to achieve better class label separation among the graphs. We conduct exhaustive empirical evaluations of our proposed method and show that it outperforms both the adaptation of state-ofthe-art graph classification methods to few-shot scenario and our naive baseline GNNs. Additionally, we also extend and study the behavior of our method to semi-supervised and active learning scenarios.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ The need to analyze graph structured data coupled with the ubiquitous nature of graphs (Borgwardt et al., 2005; Duvenaud et al., 2015; Backstrom & Leskovec, 2010; Chau et al., 2011), has given greater impetus to research interest in developing graph neural networks (GNNs) (Defferrard et al., 2016; Kipf & Welling, 2016; Hamilton et al., 2017; Velikovi et al., 2018) for learning tasks on such graphs. The overarching theme in GNNs is for each node’s feature vector to be generated by passing, transforming, and recursively aggregating feature information from a given $k$ -hop neighborhood surrounding the node. However, GNNs still fall short in the ”few-shot” learning setting, where the classifier must generalize well after seeing abundant base-class samples (while training) and very few (or even zero) samples from a novel class (while testing). Given the scarcity and difficulty involved with generation of labeled graph samples, it becomes all the more important to solve the problem of graph classification in the few-shot setting.
16
+
17
+ Limitations and challenges: Recent work by Xu et. al. (Xu et al., 2019) indicated that most recently proposed GNNs were designed based on empirical intuition and heuristic approaches. They studied the representational power of these GNNs and identified that most neighborhood aggregation and graph-pooling schemes had diminished discriminative power. They rectified this problem with the introduction of a novel injective neighborhood aggregation scheme, making it as strong as the Weisfeiler-Lehman (WL) graph isomorphism test (Weisfeiler & Leman, 1968).
18
+
19
+ Nevertheless, the problem posed by extremely scarce novel-class samples in the few-shot setting remains to persist as a formidable challenge, as it requires more rounds of aggregation to affect larger neighborhoods and hence necessitate greater depth in the GNN. However, when it comes to GNNs, experimental studies have shown that an increase in the number of layers results in dramatic performance drops in GNNs (Wu et al., 2019; Li et al., 2018b).
20
+
21
+ Our work: Motivated by the aforementioned observations and challenges, our method does the following. We begin with a once-off preprocessing step. We assign a probability measure to each graph, which we refer to as a graph spectral measure (similar to (Gu et al., 2015)), based on the spectrum of the graph’s normalized Laplacian matrix representation. Given this metric space of graph spectral measures and the underlying distance as the $L ^ { p }$ Wasserstein distance, we compute Wasserstein barycenters (Agueh & Carlier, 2011) for each set of graphs specific to a base class and term these barycenters as prototype graphs. With this set of prototype graphs for each base class label, we cluster the spectral measures associated with each prototype graph in Wasserstein space to create a super-class label.
22
+
23
+ Utilizing this super-class information, we then build a graph of graphs called a super-graph. The intuition behind this is to exploit the non-explicit and latent inter-class relationships between graphs via their spectral measures and use a GNN on this to also introduce a relational inductive bias (Battaglia et al., 2018), which in turn affords us an improved sample complexity and hence better combinatorial generalization given such few samples to begin with.
24
+
25
+ Given, the super-classes and the super-graph, we train our proposed GNN model for few-shot learning on graphs. Our GNN consists of a graph isomorphism network (GIN) Xu et al. (2019) as a feature extractor $F _ { \theta } ( . )$ to generate graph embeddings; on which subsequently acts our classifier $C ( . )$ comprising of two components: (i) $C ^ { s u p }$ : a MLP layer to learn and predict the super class associated to a graph, and (ii) $\Dot { C } ^ { G A T }$ : a graph attention network (GAT) to predict the actual class label of a graph. The overall loss function is a sum of the cross-entropy losses associated with $C ^ { s u p }$ and $C ^ { G A \breve { T } }$ . We follow initialization based strategy (Chen et al., 2019), with a training and fine-tuning phase, so that in the fine-tuning phase, the pre-trained parameters associated with $F _ { \theta } ( . )$ and $C ^ { s u p }$ are frozen, and the few novel labeled graph samples are used to update the weights and attention learned by CGAT .
26
+
27
+ Our contributions: To the best of our knowledge, we are the first to introduce few shot learning on graphs for graph classification. Next, we propose an architecture that makes use of the graph’s spectral measures to generate a set of super-classes and a super-graph to better model the latent relations between classes, followed by our GNN trained using an initialization method. Finally, we conduct extensive experiments to gain insight into our method. For example, in the 20-shot setting on the TRIANGLES dataset, our method shows a substantial improvement of nearly $7 \%$ and $2 0 \%$ over DL-based and unsupervised baselines, respectively.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ Few-shot learning in the computer vision community was first introduced by (Fei-Fei et al., 2006) with the intuition that learning the underlying properties of the base classes given abundant samples can help generalize better to unseen classes with few-labeled samples available. Various learning algorithms have been proposed in the image domain, among which a broad category of initialization based methods aim to learn transferable knowledge from training classes, so that the model can be adapted to unseen classes with limited labeled examples (Finn et al., 2017); (Rusu et al., 2018); (Nichol et al., 2018). Recently proposed and widely accepted Initialization based methods can broadly be classified into: (i) methods that learn good model parameters with limited labeled examples and a small number of gradient update steps (Finn et al., 2017) and (ii) methods that learn an optimizer (Ravi & Larochelle, 2017). We refer the interested reader to Chen et. al. (Chen et al., 2019) for more examples of few-shot learning methods in vision.
32
+
33
+ Graph neural networks (GNNs) were first introduced in (Gori et al., 2005); (Scarselli et al., 2009) as recurrent message passing algorithms. Subsequent work (Bruna et al., 2014); (Henaff et al., 2015) proposed to learn smooth spectral multipliers of the graph Laplacian, but incurred higher computational cost. This computational bottleneck was later resolved (Defferrard et al., 2016); (Kipf & Welling, 2016) by learning polynomials of the graph Laplacian. GNNs are a natural extension to Convolutional neural networks (CNNs) on non-Euclidean data. Recent work (Velikovi et al., 2018) introduced the concept of self-attention in GNNs, which allows each node to provide attention to the enclosing neighborhood resulting in improved learning. We refer the reader to (Bronstein et al., 2016) for detailed information on GNNs.
34
+
35
+ Despite all the success of GNNs, few-shot classification remains an under-addressed problem. Some recent attempts have focused on solving the few-shot learning on graph data where GNNs are either trained via co-training and self-training (Li et al., 2018a), or extended by stacking transposed graph convolutional layers imputing a structural regularizer (Zhang et al., 2019) - however, both these works focus only on the node classification task.
36
+
37
+ To the best of our knowledge, there does not exist any work pertaining few-shot learning on graphs focusing on the graph classification task, thus providing the motivation for this work.
38
+
39
+ Comparison to few-shot learning on images: Few shot learning (FSL) has gained wide-spread traction in the image domain in recent years. However the success of FSL in images is not easily translated to the graph domain for the following reasons: (a) Images are typically represented in Euclidean space and thus can easily be manipulated and handled using well-known metrics like cosine similarity, $L _ { p }$ norms etc. However, graphs come from non-Euclidean domains and exhibit much more complex relationships and interdependency between objects. Furthermore, the notion of a distance between graphs is also not straightforward and requires construction of graph kernels or the use of standard metrics on graph embeddings (Kriege et al., 2019). Additionally, such graph kernels dont capture higher order relations very well. (b) In the FSL setting on images, the number of training samples from various classes is also abundantly more than what is available for graph datasets. The image domain allows training generative models to learn the task distribution and can further be used to generate samples for data augmentation, which act as very good priors. In contrast, graph generative models are still in their infancy and work in very restricted settings. Furthermore, methods like cropping and rotation to improve the models can’t be used for graphs given the permutation invariant nature of graphs. Additionally, removal of any component from the graph can adversely affect its structural properties, such as in biological datasets. (c) The image domain has very well-known regularization methods (e.g. Tikhonov, Lasso) that help generalize much better to novel datasets. Although, they dont bring any extra supervised information and hence cannot fully address the problem of FSL in the image domain. To the best of our knowledge, this is still an open research problem in the image domain. On the other hand, in the graph domain, our work would be a first step towards graph classification in an FSL setting, which would then hopefully pave the path for better FSL graph regularizers. (d) Transfer learning has led to substantial improvements on various image related tasks due to the high degree of transferability of feature extractors. Thus, downstream tasks like few-shot learning can be performed well with high quality feature extractor models, such as Resnet variants trained on Imagenet. Transfer learning, or for that matter even good feature extractors, remains a daunting challenge in the graph domain. For graphs, there neither exists a dataset which can serve as a pivot for high quality feature learning, nor does there exist a Graph NN which can capture the higher order relations between various categories of graphs, thus making this a highly challenging problem.
40
+
41
+ # 3 PRELIMINARIES
42
+
43
+ In this section, we introduce our notation and provide the necessary background for our few-shot learning setup on graphs. We begin by describing the various data sample types, followed by our learning procedure, in order to formally define few-shot learning on graphs. Finally, we define the graph spectral distance between a pair of graphs.
44
+
45
+ Data sample sets: Let $\mathcal { G }$ denote a set of undirected unweighted graphs and $\mathcal { V }$ be the set of associated class labels. We consider two disjoint populations of labeled graphs consisting of i.i.d. graph samples, the set of base class labeled graphs $\mathbf { \bar { { G } } } _ { B } = \{ ( g _ { i } ^ { ( B ) } , y _ { i } ^ { ( B ) } ) \bar \} _ { i = 1 } ^ { n } \}$ and the set of novel class labeled graphs $G _ { N } = \{ ( g _ { i } ^ { ( N ) } , y _ { i } ^ { ( N ) } ) \} _ { i = 1 } ^ { m }$ y(N )i )}mi=1, where g(Bi $g _ { i } ^ { ( B ) } , g _ { i } ^ { ( N ) } \in \mathcal { G } , y _ { i } ^ { ( B ) } \in \mathcal { V } ^ { ( B ) }$ y(B)i ∈ Y (B), and y(Ni $y _ { i } ^ { ( N ) } \in \mathcal { y } ^ { ( N ) }$ . Here, the set of base and novel class labels are denoted by ${ \mathcal { V } } ^ { ( B ) } = \{ 1 , \ldots , K \}$ and $\mathcal { V } ^ { ( N ) } = \{ K + 1 , \ldots , K ^ { \prime } \}$ , respectively, where $K ^ { \prime } > K$ . Both $\mathcal { V } ^ { ( B ) }$ and $\mathcal { V } ^ { ( N ) }$ are disjoint subsets of $\mathcal { V }$ , so, $\mathcal { V } ^ { ( B ) } \cap \mathcal { V } ^ { ( N ) } = \emptyset$ .
46
+
47
+ Note that $m \ll n$ , i.e., there are far fewer novel class labeled graphs compared to the base class labeled ones. Besides $G _ { B }$ and $G _ { N }$ , we consider a set of $t$ unlabeled unseen graphs $\begin{array} { l l } { G _ { U } } & { : = } \end{array}$ $\{ g _ { 1 } ^ { ( U ) } , \ldots , g _ { t } ^ { ( U ) } \mid g _ { i } ^ { ( U ) } \in \pi _ { 1 } ( G _ { N } ) , i = 1 \ldots t \}$ , for testing1.
48
+
49
+ Learning procedure: Inspired by the initialization based methods, we similarly follow a two-stage approach of training followed by fine-tuning.
50
+
51
+ During training, we train a graph feature extractor $F _ { \theta } ( G _ { B } )$ with network parameters $\theta$ followed by a classifier $C ( G _ { B } )$ on graphs from $G _ { B }$ , where the loss function is the standard cross-entropy loss $\mathcal { L } _ { c }$ . In order to better recognize and generalize well on samples from novel classes, in the finetuning phase, the pre-trained feature extractor $F _ { \theta } ( . )$ along with its trained parameters is fixed and the classifier $C ( G _ { N } )$ is trained on the novel class labeled graph samples from $G _ { N }$ , with the same loss $\mathcal { L } _ { c }$ .
52
+
53
+ Now, given the classification of data samples and the two-stage learning method, our problem of few-shot classification on graphs can be defined as follows.
54
+
55
+ Problem definition: Given $n$ base-class labeled graphs from $G _ { B }$ during the training phase and $m$ novel-class labeled graphs from $G _ { N }$ during the fine-tuning phase, where $m \ll n$ , the objective of few-shot graph classification is to classify $t$ unseen test graph samples from $G _ { U }$ . Moreover, if $m = q T$ , where $T = K ^ { \prime } - K$ , i.e., each novel class label appears exactly $q$ times in $G _ { N }$ , then this setting is referred to as the $q$ -shot, $T$ -way learning.
56
+
57
+ Graph spectral distance: Let us consider the graphs in $\mathcal { G }$ . The normalized Laplacian of a graph $g \in { \mathcal { G } }$ is defined as $\Delta _ { g } = I - D ^ { - 1 / 2 } A D ^ { 1 / 2 }$ , where $A$ and $D$ are the adjacency and the degree matrices of graph $g$ , respectively. The set of eigenvalues of $\Delta _ { g }$ given by $\{ \lambda _ { i } \} _ { i = 1 } ^ { | V | }$ is called the spectrum of and is denoted by . It is well known that the spectrum $\sigma ( g )$ of a normalized Laplacian matrix is contained in interval $[ 0 , 2 ]$ . We assign a Dirac mass $\delta _ { \lambda _ { i } }$ concentrated on each $\lambda _ { i } \ \in \ \sigma ( g )$ , thus associating a probability measure to $\sigma ( g )$ supported on $[ 0 , 2 ]$ , called the graph spectral measure $\mu _ { \sigma ( g ) }$ . Furthermore, let $P ( [ 0 , 2 ] )$ be the set of probability measures on interval $[ 0 , 2 ]$ .
58
+
59
+ We now define the $p$ -th Wasserstein distance between probability measures, which we later use to define the spectral distance between a pair of graphs.
60
+
61
+ Definition 1 Let $p \in [ 1 , \infty )$ and let $c : [ 0 , 2 ] \times [ 0 , 2 ] [ 0 , + \infty ]$ be the cost function between the probability measures $\mu , \nu \in P ( [ 0 , 2 ] )$ . Then the $p$ -th Wasserstein distance between measures $\mu$ and $\nu$ is given by
62
+
63
+ $$
64
+ W _ { p } ( \mu , \nu ) = \left( \operatorname* { i n f } _ { \gamma } \int _ { [ 0 , 2 ] \times [ 0 , 2 ] } c ( x , y ) ^ { p } d \gamma \mid \gamma \in \Pi ( \mu , \nu ) \right) ^ { \frac { 1 } { p } }
65
+ $$
66
+
67
+ where $\Pi ( \mu , \nu )$ is the set of transport plans, i.e., the collection of all measures on $[ 0 , 2 ] \times [ 0 , 2 ]$ with marginals $\mu$ and $\nu$ .
68
+
69
+ Given the general definition of the $p$ -th Wasserstein distance between probability measures and the graph spectral measure, we can now define the spectral distance between a pair of graphs in $\mathcal { G }$ .
70
+
71
+ Definition 2 Given two graphs $g , g ^ { \prime } \in \mathcal { G }$ , the spectral distance between them is defined as
72
+
73
+ $$
74
+ W ^ { p } ( g , g ^ { \prime } ) : = W _ { p } \left( \mu _ { \sigma ( g ) } , \mu _ { \sigma ( g ^ { \prime } ) } \right)
75
+ $$
76
+
77
+ In words, $W ^ { p } ( g , g ^ { \prime } )$ is the optimal cost of moving mass from the graph spectral measure of graph $g$ to that of graph $g ^ { \prime }$ , where the cost of moving unit mass is proportional to the $p$ -th power of the difference of real-eigenvalues in interval $[ 0 , 2 ] ^ { 2 }$ .
78
+
79
+ # 4 OUR METHOD
80
+
81
+ We present our proposed approach here. First, given abundant base-class labels, we cluster them into super-classes by computing prototype graphs from each class, followed by clustering the prototype graphs based on their spectral properties. This clustering of prototype graphs induces a natural clustering on their corresponding class labels, resulting in super-classes (as outlined in Section 4.1).
82
+
83
+ ![](images/393d3119a11d19636ddb73ae543b4196b5496b3b1defea32cbff310a102d2d91.jpg)
84
+ Figure 1: The training (left) and fine-tuning (right) stages of our GNN.
85
+
86
+ These super-classes are then used in the creation of a super-graph used further down by our GNN. Note that the creation of super-classes, followed by building a super-graph are a once-off process. The prototype graphs as well as the super-classes for the base classes can be stored in memory for further use.
87
+
88
+ Next, we explain our graph neural network’s architecture which comprises of a feature extractor $F _ { \theta } ( . )$ and a classifier $C ( . )$ , described in Section 4.2. The classifier $C ( . )$ is further subdivided into a classifier $C ^ { s u p }$ that predicts the superclass of a graph feature vector and a graph attention network (GAT) $C ^ { G A T }$ to predict the graph’s class label. Figure 1 illustrates the training and fine-tuning phases of our GNN.
89
+
90
+ # 4.1 COMPUTING SUPER CLASSES
91
+
92
+ In order to exploit inter-class relationships between base-class labels, we cluster them in the following manner. First, we partition the set $G _ { B }$ into class-specific sets $G ^ { ( i ) }$ , for $i = 1 \dots K$ , where $G ^ { ( i ) }$ is the set of graphs with base-class label $i$ . Thus, $\begin{array} { r } { G _ { B } = \bigsqcup _ { i = 1 } ^ { K } G ^ { ( i ) } } \end{array}$ .
93
+
94
+ Then, we compute class prototype graphs for each class-specific set. The class prototype graph for class $i$ represented by $p _ { i }$ is given by
95
+
96
+ $$
97
+ p _ { i } = \operatorname * { a r g m i n } _ { g _ { i } \in \pi _ { 1 } ( G ^ { ( i ) } ) } \frac { 1 } { | G ^ { ( i ) } | } \sum _ { j = 1 } ^ { | G ^ { ( i ) } | } W ^ { p } ( g _ { i } , g _ { j } )
98
+ $$
99
+
100
+ Essentially, the class prototype graph $p _ { i }$ for the $i$ -th class is the graph with the least average spectral distance to the rest of the graphs in the same class. Given these $K$ prototypes, we cluster them using Lloyd’s method (also known as $k$ -means)3.
101
+
102
+ Clustering prototype graphs: Given $K$ unlabeled prototypes $p _ { 1 } , \dotsc , p _ { K } \in \pi _ { 1 } ( G _ { B } )$ and their associated spectral measures $ { \mu } _ { \sigma ( p _ { 1 } ) } , \ldots , { \mu } _ { \sigma ( p _ { K } ) } \in P ( [ 0 , 2 ] )$ . We rename the spectral measures as $s _ { 1 } , \ldots , s _ { K }$ to ease notation. Thus, our goal is to associate these spectral measures to at most $k$ clusters, where $k \geq 1$ is a user defined parameter.
103
+
104
+ The $k$ -means problem finds a $k$ -partition $C = \{ C _ { 1 } , \ldots , C _ { k } \}$ that minimizes the following objective that represents the overall distortion error of the clustering
105
+
106
+ $$
107
+ \underset { C } { \operatorname { a r g m i n } } \sum _ { i = 1 } ^ { k } \sum _ { s _ { i } \in C _ { i } } W _ { p } ( s _ { i } , B ( C _ { i } ) )
108
+ $$
109
+
110
+ where $s _ { i }$ is a prototype graph in cluster $C _ { i }$ and $B ( C _ { i } )$ is the Wasserstein barycenter of the cluster $C _ { i }$ . The barycenter is computed as
111
+
112
+ $$
113
+ B ( C _ { i } ) = \operatorname * { a r g m i n } _ { p \in P ( [ 0 , 2 ] ) } \sum _ { j = 1 } ^ { | C _ { i } | } W _ { p } ( p , s ( i , j ) )
114
+ $$
115
+
116
+ ![](images/0908b6d8353222c6cc3822778fc0d6149a35077983a3938dc8d0e1af7f456d8a.jpg)
117
+ Figure 2: An illustration of our proposed Wasserstein super-class clustering algorithm.
118
+
119
+ where $s ( i , j )$ denotes the $j$ -th spectral measure in the $i$ -th cluster $C _ { i }$ .
120
+
121
+ Lloyd’s algorithm: Given an initial set of Wasserstein barycenters $B ^ { ( 1 ) } ( C _ { 1 } ) , \ldots , B ^ { ( 1 ) } ( C _ { k } )$ of spectral measures at step $t = 1$ , one uses the standard Lloyd’s algorithm to find the solution by alternating between the assignment (Equation 4) and update (Equation 5) steps
122
+
123
+ $$
124
+ \begin{array} { r l } & { \quad C _ { i } ^ { ( t ) } = \left\{ s _ { p } : W _ { p } ( s _ { p } , B ^ { ( t ) } ( C _ { i } ) ) \leq W _ { p } ( s _ { p } , B ^ { ( t ) } ( C _ { j } ) ) , \forall j , 1 \leq j \leq k , 1 \leq p \leq K \right\} } \\ & { \quad C _ { i } ^ { ( t + 1 ) } = B ( C _ { i } ^ { ( t ) } ) } \end{array}
125
+ $$
126
+
127
+ Lloyd’s algorithm is known to converge to a local minimum (except in pathological cases, where it can oscillate between equivalent solutions). The final output is a grouping of the prototype graphs into $k$ groups, which also induces a grouping of the corresponding base classes. We denote these class groups as super-classes and denote the set of super-classes as $y ^ { s u p }$ .
128
+
129
+ # 4.2 OUR GRAPH NEURAL NETWORK
130
+
131
+ Feature extractor: To apply standard neural network architectures for downstream tasks we must embed the graphs in a finite dimensional vector space. We consider graph neural networks (GNNs) that employ the following message-passing architecture
132
+
133
+ $$
134
+ H ^ { ( j ) } = M ( A , H ^ { ( j - 1 ) } , \theta ^ { ( j ) } )
135
+ $$
136
+
137
+ where $H ^ { ( j ) } \in \mathbb { R } ^ { | V | \times d }$ are the node embeddings (i.e., messages) computed after $j$ steps of the GNN and $M$ is the message propagation function which depends on the adjacency matrix of the graph $A$ , the trainable parameters of the $j ^ { t h }$ layer $\theta ^ { ( j ) }$ , and node embeddings $H ^ { ( j - 1 ) }$ generated from the previous step.
138
+
139
+ A recently proposed GNN called the graph isomorphism network (GIN) by $\mathrm { X u }$ et al. (2019) was shown to be stronger than several popular GNN variants like GCN Kipf & Welling (2016) and GraphSAGE Hamilton et al. (2017). What makes GIN so powerful and sets it apart from the other GNN variants is its injective neighborhood aggregation scheme which allows it to be as powerful as the Weisfeiler-Lehman (WL) graph isomorphism test. Motivated by this finding, we chose GIN as our graph feature extractor. The message propagation scheme in GIN is given by
140
+
141
+ $$
142
+ H ^ { ( j ) } = M L P ( ( 1 + \epsilon ) ^ { j } \odot H ^ { ( j - 1 ) } + A ^ { T } H ^ { ( j - 1 ) } )
143
+ $$
144
+
145
+ Here, $\epsilon$ is a layer-wise learnable scalar parameter and $M L P$ represents a multi-layer perceptron with layer-wise non-linearities for more expressive representations. The full GIN model run $R$ iterations of Equation 6 to generate final node embeddings which we represent by $H ^ { ( R ) }$ . As features from earlier iterations can also be helpful in achieving higher discriminative power, embeddings $H ^ { ( j ) }$
146
+
147
+ from all $R$ iterations are concatenated as
148
+
149
+ $$
150
+ H _ { g } = \left\| _ { j = 1 } ^ { R } H ^ { ( j ) } , \right\|
151
+ $$
152
+
153
+ Here, $\begin{array} { r } { H ^ { ( j ) } = \sum _ { v \in V } H _ { v } ^ { ( j ) } } \end{array}$ , where $H _ { i } ^ { ( j ) }$ represents the $i$ -th node’s embedding in the $j$ -th iteration and $\parallel$ denotes a concatenation operator. $H _ { g }$ now contains the graph embedding of a graph $g$ and is passed on to the classifier.
154
+
155
+ Classifier: Here, our objective is to improve the class separation produced by the graph embeddings of the feature extractor $F _ { \theta } ( . )$ and we do this by building a “graph of graph embeddings”, called a super-graph $g ^ { s u p }$ , where each node is a graph feature vector. We then employ our classifier $C ( . )$ on this super-graph to achieve better separation among the graph classes in the embedding space.
156
+
157
+ During training, we first build the super-graph $g ^ { s u p }$ on a batch of base-labeled graphs as a collection of $k$ -NN graphs, where each constituent $k$ -NN graph is built on the graphs belonging to the same super-class. $g ^ { s u p }$ is then passed through a multi-layered graph attention network $C ^ { \forall G A \mathbf { \breve { T } } }$ to learn the associated class probabilities. The features extracted from $F _ { \theta } ( . )$ are passed into the MLP network $C ^ { s u p }$ to learn the associated super-class labels. $C ^ { s u p }$ and $C ^ { \widecheck { G } A T }$ combine to form our classifier $C ( . )$ . The cross-entropy losses associated with $C ^ { s u p }$ and $C ^ { G A T }$ are added to give the overall loss for $C ( . )$ . The intuition behind the construction of $g ^ { s u p }$ to train $C ^ { G A T }$ on was to further improve the existing cluster separation based on graph spectral measures by introducing a relational inductive bias (Battaglia et al., 2018) that is inherent to the GNN CGAT .
158
+
159
+ Recall that we adopt an initialization method (described in 3). In our fine-tuning stage, novel class labeled graphs from $G _ { N }$ are input to the network. The pre-trained parameters learned by the feature extractor $F _ { \theta } ( . )$ are fixed and $C ^ { s u p }$ is used to infer the novel graph’s super-class label, followed by creation of super-graph on the novel graph samples and finally updating the parameters in CGAT through the loss. Finally the evaluation is performed on the samples from the unseen test set $G _ { U }$ .
160
+
161
+ Discussion: We make the assumption that the novel test classes belong to the same set of super-classes from the training graphs. The reason being that the novel class labeled samples are so much fewer than the base class labeled samples, that the resulting super-graph ends up being extremely sparse and deviates a lot from the shape of the super-graph from the base classes; therefore it severely hinders $C ^ { G A T } \mathrm { s }$ ability to effectively aggregate information from the embeddings of the novel class labeled graphs. Instead, we pass the novel graph samples through our trained $C ^ { s u p }$ and infer its super-class label and this works very effectively for us, as is evidenced by our empirical results.
162
+
163
+ # 5 EXPERIMENTAL RESULTS
164
+
165
+ # 5.1 BASELINES AND DATASETS
166
+
167
+ The standard graph classification datasets do not adequately satisfy the requirements for few-shot learning due to the dearth of unique class labels. Hence, we pick four new classification datasets, namely, Letter-High, TRIANGLES, Reddit-12K, and ENZYMES. The details and statistics for these datasets are given in Appendix A.1. As there do not exist any standard state-of-the-art methods for few-shot graph classification, we chose existing baselines for standard graph classification from both supervised and unsupervised methods.
168
+
169
+ For supervised deep learning baselines, we chose - GIN (Xu et al. (2019)), CapsGNN (Xinyi & Chen (2019)), and Diffpool (Lee et al. (2019)). We ran these methods with similar settings as ours, i.e., by partitioning the main model into feature extraction and classifier sub-models to compare them in a fair and informative manner. From the unsupervised category, we consider 4 powerful SOTA methods - AWE (Ivanov & Burnaev (2018)), Graph2Vec (Narayanan et al. (2017)), WeisfeilerLehman subtree Kernel (Shervashidze et al. (2011)), and Graphlet count kernel (Shervashidze et al. (2009)). Since we want to analyze the few-shot classification abilities of these models, we essentially want to find out how well these algorithms can achieve class separation. We use $k$ -NN search on the output embeddings of these algorithms.
170
+
171
+ Table 1: Results for various few-shot scenarios on Letter-High and TRIANGLES datasets. The best results are highlighted in bold while the second best results are underlined.
172
+
173
+ <table><tr><td rowspan="2">Method</td><td colspan="3">Letter-High</td><td colspan="3">TRIANGLES</td></tr><tr><td>5-shot</td><td>10-shot</td><td>20-shot</td><td>5-shot</td><td>10-shot</td><td>20-shot</td></tr><tr><td>WL</td><td>65.27 ± 7.67</td><td>68.39± 4.69</td><td>72.69±3.02</td><td>51.25± 4.02</td><td>53.26 ± 2.95</td><td>57.74 ± 2.88</td></tr><tr><td>Graphlet</td><td>33.76 ± 6.94</td><td>37.59 ± 4.60</td><td>41.11 ± 3.71</td><td>40.17 ± 3.18</td><td>43.76 ± 3.09</td><td>45.90 ±2.65</td></tr><tr><td>AWE</td><td>40.60 ± 3.91</td><td>42.20 ±2.87</td><td>43.12 ± 1.00</td><td>39.36± 3.85</td><td>42.58 ± 3.11</td><td>44.98 ± 1.54</td></tr><tr><td>Graph2Vec</td><td>66.12 ± 5.21</td><td>68.17 ± 4.26</td><td>70.28 ± 2.81</td><td>48.38 ± 3.85</td><td>50.16 ± 4.15</td><td>54.90 ± 3.01</td></tr><tr><td>Diffpool</td><td>58.69 ± 6.39</td><td>61.59 ± 5.21</td><td>64.67 ± 3.21</td><td>64.17 ± 5.87</td><td>67.12 ± 4.29</td><td>73.27 ± 3.29</td></tr><tr><td>CapsGNN</td><td>56.60 ± 7.86</td><td>60.67 ± 5.24</td><td>63.97 ± 3.69</td><td>65.40 ± 6.13</td><td>68.37 ± 3.67</td><td>73.06 ± 3.64</td></tr><tr><td>GIN</td><td>65.83 ± 7.17</td><td>69.16 ± 5.14</td><td>73.28 ± 2.17</td><td>63.80 ± 5.61</td><td>67.30 ± 4.35</td><td>72.55 ± 1.97</td></tr><tr><td>GIN-k-NN</td><td>63.52 ± 7.27</td><td>65.66± 8.69</td><td>67.45± 8.76</td><td>58.34 ± 3.91</td><td>61.55± 3.19</td><td>63.45± 2.76</td></tr><tr><td>OurMethod-GCN</td><td>68.69 ± 6.50</td><td>72.80 ± 4.12</td><td>75.17 ± 3.11</td><td>69.37 ± 4.92</td><td>73.11 ± 3.94</td><td>77.86 ± 2.84</td></tr><tr><td>OurMethod-GAT</td><td>69.91 ± 5.90</td><td>73.28± 3.46</td><td>77.38 ± 1.58</td><td>71.40 ± 4.34</td><td>75.60± 3.67</td><td>80.04 ± 2.20</td></tr></table>
174
+
175
+ Further configuration and implementation details for the baselines can be found in Appendix A.2. We also emphasize the benefit of using a GNN as a classifier by showing the adaptation of our model to semi-supervised fine-tuning (in Appendix A.5) and active learning (in Appendix A.6) settings.
176
+
177
+ # 5.2 FEW-SHOT RESULTS
178
+
179
+ We consider two variants of our model as naive baselines. In the first variant, we replace our GAT classifier with GCN Kipf & Welling (2016). We call this model OurMethod-GCN. This variant is used to justify the choice of GAT over GCN.
180
+
181
+ In the second variant, we replace the entire classifier with the $k$ -NN algorithm over the features extracted from various layers of the feature extractor. We call this variant GIN- $k$ -NN and this is introduced to emphasize the significance of building a super-graph and using a GAT on it as a classifier to exploit the relational inductive bias.
182
+
183
+ The results for all the datasets in various $q$ -shot scenarios, where $q \in \{ 5 , 1 0 , 2 0 \}$ are given in Table 1. We run each model 50 times and report averaged results. In every run, we select a different novel labeled subset $G _ { N }$ for fine-tuning the classifiers of the models. The evaluation for all models is done by randomly selecting a subset of 500 samples from the testing set $G _ { U }$ for Letter-High and TRIANGLES, whereas over 150 for ENZYMES and 300 for Reddit dataset and averaging over 10 such random selections.
184
+
185
+ Table 2: Results for various few-shot scenarios on Reddit- $I 2 K$ and ENZYMES datasets. The best results are highlighted in bold while the second best results are underlined.
186
+
187
+ <table><tr><td rowspan="2">Method</td><td colspan="3">Reddit-12K</td><td colspan="3">ENZYMES</td></tr><tr><td>5-shot</td><td>10-shot</td><td>20-shot</td><td>5-shot</td><td>10-shot</td><td>20-shot</td></tr><tr><td>WL</td><td>40.26± 5.17</td><td>42.57±3.69</td><td>44.41±3.43</td><td>55.78± 4.72</td><td>58.47±3.84</td><td>60.1±3.18</td></tr><tr><td>Graphlet</td><td>33.76 ± 6.94</td><td>37.59 ± 4.60</td><td>41.11 ± 3.71</td><td>53.17 ± 5.92</td><td>55.30 ±3.78</td><td>56.90 ±3.79</td></tr><tr><td>AWE</td><td>30.24± 2.34</td><td>33.44 ±2.04</td><td>36.13 ± 1.89</td><td>43.75 ±1.85</td><td>45.58 ± 2.11</td><td>49.98 ± 1.54</td></tr><tr><td>Graph2Vec</td><td>27.85 ± 4.21</td><td>29.97 ± 3.17</td><td>32.75 ± 2.02</td><td>55.88 ± 4.86</td><td>58.22 ± 4.30</td><td>62.28 ± 4.14</td></tr><tr><td>Diffpool</td><td>35.24 ± 5.69</td><td>37.43 ± 3.94</td><td>39.11 ± 3.52</td><td>45.64 ± 4.56</td><td>49.64 ± 4.23</td><td>54.27 ± 3.94</td></tr><tr><td>CapsGNN</td><td>36.58 ±4.28</td><td>39.16 ± 3.73</td><td>41.27 ± 3.12</td><td>52.67 ± 5.51</td><td>55.31 ± 4.23</td><td>59.34 ± 4.02</td></tr><tr><td>GIN</td><td>40.36 ± 4.69</td><td>43.70 ± 3.98</td><td>46.28 ± 3.49</td><td>55.73 ± 5.80</td><td>58.83 ±5.32</td><td>61.12 ± 4.64</td></tr><tr><td>GIN-k-NN</td><td>41.31± 2.84</td><td>43.58±2.80</td><td>45.12 ± 2.19</td><td>57.24 ± 7.06</td><td>59.34± 5.24</td><td>60.49±3.48</td></tr><tr><td>OurMethod-GCN</td><td>40.77 ± 4.32</td><td>44.28 ± 3.86</td><td>48.67 ± 4.22</td><td>54.34 ± 5.64</td><td>58.16 ± 4.39</td><td>60.86 ± 3.74</td></tr><tr><td>OurMethod-GAT</td><td>41.59 ± 4.12</td><td>45.67± 3.68</td><td>50.34± 2.71</td><td>55.42 ± 5.74</td><td>60.64 ± 3.84</td><td>62.81 ± 3.56</td></tr></table>
188
+
189
+ The results clearly show that our proposed method and its GCN variant (i.e., OurMethod-GCN) outperform the baselines. GIN- $k$ -NN shows significant degradation in results on nearly all the three paradigms for all datasets with exceptions on 5-shot and 10-shot on ENZYMES dataset, thus strongly indicating that the improvements of our method can primarily be attributed to our GNN classifier fed with the super-graph constructed from our proposed method. The improvements in results are higher on TRIANGLES and Reddit datasets in contrast to Letter-High and ENZYMES, which can be attributed to the smaller size of the graphs in Letter-High making it difficult to distinguish based on graph spectra alone, whereas the complex and highly inter-related structure of enzymes makes it difficult for the DL based feature extractors as well as the graph kernel methods to segregate the classes in the feature and graph space respectively. GIN and WL show much better results as compared to other baselines for all the $q$ -shot scenarios, whereas AWE and Graphlet Kernel show significantly low results, unable to capture the properties of the graphs well. The DL baselines apart from GIN on the other hand show improvements on the TRIANGLES dataset performing close to GIN, where the unsupervised methods fails to capture the local node properties, however still perform poorly on other datasets. For the 20-shot scenario on TRIANGLES, our GAT variant shows an improvement of around $7 \%$ over DL baselines and more than $2 0 \%$ when compared to unsupervised methods. The substantial improvements of around $4 \%$ on Reddit dataset shows the superiority of our model for both the variants - GAT and GCN. Furthermore, the $t$ -SNE plots in Figure 3 show a substantial and interesting separation of class labels which strongly indicate that a good feature extractor in conjunction with a GNN perform well as a combination. The t-SNE plots for ENZYMES, Reddit, and Letter-High are shown in figures 4, 5 and 6 respectively.
190
+
191
+ ![](images/c52ff756e9f560ae3e4f1bc969a402fd9e4832578474fe3bc86a8e21779491da.jpg)
192
+ Figure 3: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT (left), GIN (middle) and WL Kernel (right) on TRIANGLES dataset. The embeddings for both our model and GIN are taken from the final layers of the respective models.
193
+
194
+ # 5.3 ABLATION STUDY ON NUMBER OF SUPER-CLASSES
195
+
196
+ Here, we study the behavior of our proposed network model without the super-class classifier $C ^ { s u p }$ . In Table 3 (10 and 20-shot setting), we observe a marked increase with the addition of our classifier which uses the super-class information and the super-graph based on spectral measures to guide $C ^ { G A T }$ towards improving the class separation of the graphs during both the training and fine-tuning stages. Using super-classes help in reducing the sample complexity of the large Hypothesis space and makes tuning of the model parameters easier during fine-tuning stage with less samples and few iterations. Negligible differences are observed on ENZYMES dataset since both the number of training classes as well as test classes are low, thus, the model performs equally well on removing super-classes. This is because of the latent inter-class representations can still be captured between few classes especially during the fine-tuning phase.
197
+
198
+ Table 3: Ablation Study: “No-SC” represents our classifier $C ( . )$ without $C ^ { s u p }$ and “With-SC” represents C(.) with both Csup and CGAT present.
199
+
200
+ <table><tr><td rowspan="2">Dataset</td><td colspan="2">10-shot</td><td colspan="2">20-shot</td></tr><tr><td>No-SC</td><td>With-SC</td><td>No-SC</td><td>With-SC</td></tr><tr><td>Letter-High</td><td>71.13 ± 3.64</td><td>73.61 ± 3.19</td><td>75.23 ± 2.48</td><td>77.42 ± 1.47</td></tr><tr><td>TRIANGLES</td><td>74.03 ± 3.89</td><td>76.49 ± 3.26</td><td>76.89 ± 2.63</td><td>80.14 ± 1.88</td></tr><tr><td>Reddit-12K</td><td>43.76 ± 4.34</td><td>45.35 ± 4.06</td><td>48.19 ± 4.01</td><td>50.36 ± 3.04</td></tr><tr><td>ENZYMES</td><td>59.97 ± 3.98</td><td>59.58 ± 4.32</td><td>62.7 ± 3.63</td><td>62.39 ± 3.48</td></tr></table>
201
+
202
+ # 5.4 SENSITIVITY ANALYSIS OF VARIOUS ATTRIBUTES
203
+
204
+ Our proposed method contains two crucial attributes. We analyze our model by varying: (i) the number of super-classes and (ii) the $k$ -value in super-graph construction. The effect of varying these attributes on model accuracy are shown in Tables 4 and 5, respectively. For TRIANGLES and Letter
205
+
206
+ Table 4: Model analysis over number of super-classes in 20-shot scenario. There is no evaluation for 5 super-classes on ENZYMES since the number of training classes is 4. Default value of parameter $k$ is fixed at 2.
207
+ Dataset
208
+ 20-shot
209
+ Table 5: Model analysis over number of neighbors $( k )$ in super-graph for 20-shot scenario. Default value for the number of super-classes is fixed at 3.
210
+
211
+ <table><tr><td></td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr><tr><td>Letter-High</td><td>74.43± 2.61</td><td>76.61 ± 1.67</td><td>77.51 ± 1.49</td><td>76.31 ± 1.98</td><td>75.05 ± 2.29</td></tr><tr><td>TRIANGLES</td><td>76.43 ± 2.87</td><td>79.55 ± 1.91</td><td>80.51 ± 1.72</td><td>78.91 ± 2.09</td><td>78.25 ± 2.40</td></tr><tr><td>Reddit-12K</td><td>48.32 ± 4.09</td><td>50.67 ± 2.94</td><td>50.10 ± 3.02</td><td>49.52 ± 4.02</td><td>48.33 ± 4.08</td></tr><tr><td>ENZYMES</td><td>62.34 ± 4.11</td><td>62.13 ± 4.01</td><td>60.16 ± 3.81</td><td>59.34 ± 3.98</td><td></td></tr></table>
212
+
213
+ Dataset
214
+ 20-shot
215
+
216
+ <table><tr><td></td><td>2</td><td></td><td>4</td><td>6</td><td>8</td><td>Heuristic</td></tr><tr><td>Letter-High</td><td>77.33 ± 1.71</td><td></td><td>76.61 ± 1.67</td><td>75.63 ± 2.49</td><td>74.66 ± 2.61</td><td>74.35 ± 2.48</td></tr><tr><td>TRIANGLES</td><td>80.77 ± 1.57</td><td></td><td>79.85 ± 1.59</td><td>79.45 ± 1.97</td><td>78.93 ± 2.04</td><td>79.42 ± 3.16</td></tr><tr><td>Reddit-12K</td><td>50.48 ± 3.02</td><td></td><td>46.37 ± 3.03</td><td>44.12 ± 2.98</td><td>43.88 ± 3.24</td><td>44.82 ± 2.83</td></tr><tr><td>ENZYMES</td><td>62.34 ± 4.11</td><td></td><td>61.42 ± 4.42</td><td>60.23 ± 5.10</td><td>59.67 ± 4.77</td><td>61.07 ± 4.68</td></tr></table>
217
+
218
+ High datasets, as we increase the number of super-classes, we observe the accuracy improving steadily up to 3 super-classes and then dropping from there onwards. For super-classes less than 3, we observe that the $k$ -NN graph does not respect the class boundaries that are already imposed by the graph spectral measures, thus connecting more arbitrary classes. For Reddit we observe the performance is slightly better on using 2 super-classes and for ENZYMES similar performances are observed for both 1 and 2 super-classes as described in the ablation study. On the other hand, increasing the number of super-classes past 3, makes each super-class cluster very sparse with few graph classes within, leading to an underflow of information between the graph classes. The same effect is observed for all datasets.
219
+
220
+ The $k$ -value or the number of neighbors of each node belonging to the same connected component in the super-graph (i.e., belonging to the same super-class) is another salient parameter upon which hinges the information flow (via message passing) between the graphs of the same super-class. We analyze our model with $k$ values in the set $\{ 2 , 4 , 6 , 8 \}$ and a commonly used heuristic method, whereby each graph is connected to $\sqrt { b _ { s } }$ nearest neighboring graphs based on the Euclidean similarity of their feature representations, where $b _ { s }$ is the number of samples in the mini-batch corresponding to super-classes $s$ . We achieve best results with 2-NN graphs per super-class and increasing $k$ beyond it leads to denser graphs with unnecessary connections between classes belonging to the same super-class.
221
+
222
+ # 6 CONCLUSION
223
+
224
+ In this paper, we investigated the problem of few-shot learning on graphs for the graph classification task. We explicitly created a super-graph on the base-labeled graphs and then grouped / clustered their associated class labels into super-classes, based on the graph spectral measures attributed to each graph and the $L ^ { p }$ -Wasserstein distances between them. We found that training our GNN on the super-graph along with the auxiliary super-classes resulted in a marked improvement over stateof-the-art GNNs. A promising future work is to propose new GNN models that break away from current neighborhood aggregation schemes to specifically overcome the obstacle posed by few-shot learning on graphs. Our source-code and dataset splits have been made public in an attempt to attract more attention to the context of few-shot learning on graphs.
225
+
226
+ # REFERENCES
227
+
228
+ Martial Agueh and Guillaume Carlier. Barycenters in the wasserstein space. SIAM J. Math. Analysis, 43(2):904–924, 2011.
229
+
230
+ David Arthur and Sergei Vassilvitskii. K-means $^ { + + }$ : The advantages of careful seeding. In Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’07, pp. 1027–1035, 2007.
231
+
232
+ Lars Backstrom and Jure Leskovec. Supervised random walks: Predicting and recommending links in social networks. CoRR, abs/1011.4071, 2010. URL http://arxiv.org/abs/1011. 4071.
233
+
234
+ Peter Battaglia, Jessica Blake Chandler Hamrick, Victor Bapst, Alvaro Sanchez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, Caglar Gulcehre, Francis Song, Andy Ballard, Justin Gilmer, George E. Dahl, Ashish Vaswani, Kelsey Allen, Charles Nash, Victoria Jayne Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matt Botvinick, Oriol Vinyals, Yujia Li, and Razvan Pascanu. Relational inductive biases, deep learning, and graph networks. arXiv, 2018. URL https: //arxiv.org/pdf/1806.01261.pdf.
235
+
236
+ Karsten M. Borgwardt, Cheng Soon Ong, Stefan Schonauer, S. V. N. Vishwanathan, Alex J. Smola, ¨ and Hans-Peter Kriegel. Protein function prediction via graph kernels. Bioinformatics, 21(1): 47–56, January 2005. ISSN 1367-4803. doi: 10.1093/bioinformatics/bti1007. URL http: //dx.doi.org/10.1093/bioinformatics/bti1007.
237
+
238
+ Michael M. Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. Geometric deep learning: going beyond euclidean data. CoRR, abs/1611.08097, 2016. URL http://arxiv.org/abs/1611.08097.
239
+
240
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann Lecun. Spectral networks and locally connected networks on graphs. In International Conference on Learning Representations (ICLR2014), CBLS, April 2014, 2014.
241
+
242
+ Duen Horng Chau, Carey Nachenberg, Jeffrey Wilhelm, Adam Wright, and Christos Faloutsos. Polonium: Tera-scale graph mining and inference for malware detection. In SIAM INTERNATIONAL CONFERENCE ON DATA MINING (SDM), pp. 131–142, 2011.
243
+
244
+ Wei-Yu Chen, Yen-Cheng Liu, Zsolt Kira, Yu-Chiang Frank Wang, and Jia-Bin Huang. A closer look at few-shot classification. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $=$ HkxLXnAcFQ.
245
+
246
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on ¨ graphs with fast localized spectral filtering. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 3844–3852. Curran Associates, Inc., 2016.
247
+
248
+ 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 C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 2224–2232. Curran Associates, Inc., 2015.
249
+
250
+ Li Fei-Fei, Rob Fergus, and Pietro Perona. One-shot learning of object categories. IEEE Trans. Pattern Anal. Mach. Intell., 28(4):594–611, April 2006. ISSN 0162-8828. doi: 10.1109/TPAMI. 2006.79. URL https://doi.org/10.1109/TPAMI.2006.79.
251
+
252
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. CoRR, abs/1703.03400, 2017. URL http://arxiv.org/abs/1703. 03400.
253
+
254
+ Aude Genevay, Marco Cuturi, Gabriel Peyre, and Francis Bach. Stochastic optimization for large- ´ scale optimal transport. In Advances in Neural Information Processing Systems 29, pp. 3440– 3448. 2016.
255
+
256
+ Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In Proceedings. 2005 IEEE International Joint Conference on Neural Networks, 2005., volume 2, pp. 729–734. IEEE, 2005.
257
+
258
+ Jiao Gu, Bobo Hua, and Shiping Liu. Spectral distances on graphs. Discrete Applied Mathematics, 190-191:56 – 74, 2015.
259
+
260
+ William L. Hamilton, Rex Ying, and Jure Leskovec. Inductive representation learning on large graphs. CoRR, abs/1706.02216, 2017. URL http://arxiv.org/abs/1706.02216.
261
+
262
+ Mikael Henaff, Joan Bruna, and Yann LeCun. Deep convolutional networks on graph-structured data. CoRR, abs/1506.05163, 2015. URL http://arxiv.org/abs/1506.05163.
263
+
264
+ Sergey Ivanov and Evgeny Burnaev. Anonymous walk embeddings. 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. 2186–2195, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/ v80/ivanov18a.html.
265
+
266
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization, 2014. URL http://arxiv.org/abs/1412.6980. cite arxiv:1412.6980Comment: Published as a conference paper at the 3rd International Conference for Learning Representations, San Diego, 2015.
267
+
268
+ Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. CoRR, abs/1609.02907, 2016. URL http://arxiv.org/abs/1609.02907.
269
+
270
+ Nils M. Kriege, Fredrik D. Johansson, and Christopher Morris. A survey on graph kernels. ArXiv, abs/1903.11835, 2019.
271
+
272
+ Junhyun Lee, Inyeop Lee, and Jaewoo Kang. Self-attention graph pooling. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 3734–3743, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr. press/v97/lee19c.html.
273
+
274
+ Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper insights into graph convolutional networks for semi-supervised learning. CoRR, abs/1801.07606, 2018a. URL http://arxiv.org/abs/ 1801.07606.
275
+
276
+ Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper insights into graph convolutional networks for semi-supervised learning. In AAAI, 2018b.
277
+
278
+ Annamalai Narayanan, Mahinthan Chandramohan, Rajasekar Venkatesan, Lihui Chen, Yang Liu, and Shantanu Jaiswal. graph2vec: Learning distributed representations of graphs. CoRR, abs/1707.05005, 2017. URL http://arxiv.org/abs/1707.05005.
279
+
280
+ Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms. CoRR, abs/1803.02999, 2018. URL http://arxiv.org/abs/1803.02999.
281
+
282
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. URL https://openreview.net/ forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rJY0-Kcll.
283
+
284
+ Andrei A. Rusu, Dushyant Rao, Jakub Sygnowski, Oriol Vinyals, Razvan Pascanu, Simon Osindero, and Raia Hadsell. Meta-learning with latent embedding optimization. CoRR, abs/1807.05960, 2018. URL http://arxiv.org/abs/1807.05960.
285
+
286
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. Trans. Neur. Netw., 20(1):61–80, January 2009. ISSN 1045- 9227. doi: 10.1109/TNN.2008.2005605. URL http://dx.doi.org/10.1109/TNN. 2008.2005605.
287
+
288
+ N. Shervashidze, SVN. Vishwanathan, TH. Petri, K. Mehlhorn, and KM. Borgwardt. Efficient graphlet kernels for large graph comparison. In JMLR Workshop and Conference Proceedings Volume 5: AISTATS 2009, pp. 488–495, Cambridge, MA, USA, April 2009. Max-PlanckGesellschaft, MIT Press.
289
+
290
+ Nino Shervashidze, Pascal Schweitzer, Erik Jan van Leeuwen, Kurt Mehlhorn, and Karsten M. Borgwardt. Weisfeiler-lehman graph kernels. J. Mach. Learn. Res., 12:2539–2561, November 2011. ISSN 1532-4435. URL http://dl.acm.org/citation.cfm?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 1953048. 2078187.
291
+
292
+ Petar Velikovi, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li, and Yoshua Bengio. Graph attention networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ rJXMpikCZ.
293
+
294
+ B. Yu. Weisfeiler and A. A. Leman. Reduction of a graph to a canonical form and an algebra arising during this reduction. 1968.
295
+
296
+ Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and Philip S. Yu. A comprehensive survey on graph neural networks. CoRR, abs/1901.00596, 2019.
297
+
298
+ Zhang Xinyi and Lihui Chen. Capsule graph neural network. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ Byl8BnRcYm.
299
+
300
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $=$ ryGs6iA5Km.
301
+
302
+ Shengzhong Zhang, Ziang Zhou, Zengfeng Huang, and Zhongyu Wei. Few-shot classification on graphs with structural regularized GCNs, 2019. URL https://openreview.net/forum? id=r1znKiAcY7.
303
+
304
+ # A APPENDIX
305
+
306
+ # A.1 DATASET DETAILS
307
+
308
+ We use 4 different datasets namely - Reddit-12K, ENZYMES, Letter-High and TRIANGLES to perform exhaustive empirical evaluation of our model on various real-world datasets varying from small average graph size on Letter-High to large graphs like Reddit-12K. These datasets can be downloaded here 4. The dataset statistics are provided in Table 6, while the split statistics are provided in Table 7
309
+
310
+ Table 6: Dataset Statistics
311
+
312
+ <table><tr><td>DatasetName</td><td># Classes</td><td># Graphs</td><td>Avg # Nodes</td><td>Avg #Edges</td></tr><tr><td>Reddit-12K</td><td></td><td>11929</td><td>391.41</td><td>456.89</td></tr><tr><td>ENZYMES</td><td>11 6</td><td>600</td><td>32.63</td><td>62.14</td></tr><tr><td>Letter-High</td><td>15</td><td>2250</td><td>4.67</td><td>4.50</td></tr><tr><td>TRIANGLES</td><td>10</td><td>45000</td><td>20.85</td><td>35.50</td></tr></table>
313
+
314
+ Dataset Description: Reddit-12K datasets contains 11929 graphs where each graph corresponds to a thread in which each node represents a user and each edge represents that one user has responded to a comment from some other user. There are 11 different types of discussion forums corresponding to each of the 11 classes.
315
+
316
+ ENZYMES is a dataset of protein tertiary structures consisting of 600 enzymes from the BRENDA enzyme database. The dataset contains 6 different graph categories corresponding to each different top-level EC enzyme.
317
+
318
+ TRIANGLES dataset contain 10 different classes where the classes are numbered from 1 to 10 corresponding to the number of triangles/3-cliques in each graph of the dataset.
319
+
320
+ Letter-High dataset contains graphs which represent distorted letter drawings from the english alphabets - $A , E , F , H , I , K , L , M , N , T , V , W , X , Y , Z$ . Each graph is a prototype manual construction of the alphabets.
321
+
322
+ Table 7: Dataset Splits
323
+
324
+ <table><tr><td>Dataset Name</td><td>#Train Classes</td><td>#Test Classes</td><td># Training Graphs</td><td># Validation Graphs</td><td>#Test Graphs</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Reddit-12K</td><td>7</td><td>4</td><td>566</td><td>141</td><td>404</td></tr><tr><td>ENZYMES</td><td>4 11</td><td>2 4</td><td>320 1330</td><td>80 320</td><td>200 600</td></tr><tr><td>Letter-High TRIANGLES</td><td>7</td><td>3</td><td>1126</td><td>271</td><td>603</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
325
+
326
+ The validation graphs are used to assess model performance on training classes itself to check overfitting as well as for grid-search over hyperparameters. The actual train-testing class splits used for this paper are provided with the code. Since the TRIANGLES dataset has a large number of samples, this makes it infeasible to run many baselines including DL and non-DL methods. Hence, we sample 200 graphs from each class, making the total sample size 2000. Similarly we downsample the number of graphs from 11929 to 1111 (nearly 101 graphs per class). Downsampling is performed for Reddit-12K given extremely large graph sizes which makes the graph kernels as well as some deep learning baselines extremely slow.
327
+
328
+ # A.2 BASELINE DETAILS
329
+
330
+ This section details the implementation of the baseline methods. Since, DL-based methods - GIN, CapsGNN and DIFFPOOL have not been previously run on these datasets, we select the crucial hyper-parameters - such as number of layers heuristically based on the results of standard graph classification datasets on the best performing variants of these models. For these three methods we take the novel layers proposed in the corresponding papers as their feature extractors, while downstream MLP layers are chosen as the classifier. The training and evaluation strategies are similar to our model, i.e., the models are first trained in an end-to-end fashion on the training dataset $G _ { B }$ until convergence with learning rate decay on loss plateau and then the classifier layers are fine-tuned over $G _ { N }$ , keeping the parameters of the feature extractor layers fixed.
331
+
332
+ For the unsupervised models - WL subtree kernel, Graphlet Count kernel, AWE and Graph2Vec, the evaluation is done using $k$ -NN search to assess the clustering quality of these models in our few-shot scenario. We refrain from using high-level classifier models such as SVM or MLPs, since training these classifiers on few-shot regime will not properly assess the abilities of these models to cluster together graphs of similar class labels. We empirically found that using high level classifiers resulted in higher deviations and lower mean accuracies. We choose the hyper-parameters for these models using grid-search, since they are significantly faster and each one of these models have few highly sensitive parameters which affect the model significantly. For these models, we perform a grid search for selection of $k$ in the $k$ -NN algorithm from the set $\{ 1 , 2 , 3 , 4 , 5 \}$ for the 5-shot scenario, of which $k = 1$ was found to perform the best. For higher shot scenario, the search was performed over the set $\{ 1 , 2 , 3 , 4 , 5 , 6 , 7 , \bar { 8 } , 9 , 1 0 \}$ , where we again found $k = 1$ to be the best. The validation set is used to check overfitting and hyper-parameter selection on the baseline methods.
333
+
334
+ # A.3 OUR MODEL DETAILS
335
+
336
+ This section provides the implementation details of our proposed model. Since, our feature extractor model is GIN, we maintain similar parameter settings as recommended by their paper. As mentioned in section 4.2, using embeddings from all iterations of the message passing network helps achieve better discriminative power and improved gradient flow, therefore we employ the same strategy in our feature extractor. The number of super-classes are selected from the set $\{ 1 , 2 , 3 , 4 , 5 \}$ using grid-search. The $k$ -value for construction of super-graph was selected from the set $\{ 2 , 4 , 6 , 8 \}$ . The feature extractor model uses batch-normalization between subsequent message passing layers. We use dropout of 0.5 in the $C ^ { s u p }$ layers. The $C ^ { G A T }$ layers undergo normalization of inputs between subsequent layers along with a dropout of 0.5, however, the normalization mechanism in classifier layers is different from batch-norm. We normalize each feature embedding to have Euclidean norm with value 1. Essentially,
337
+
338
+ $$
339
+ \mathbf { x } _ { i n p u t } ^ { j + 1 } = \frac { \mathbf { x } _ { o u t } ^ { j } } { | | \mathbf { x } _ { o u t } ^ { j } | | _ { 2 } }
340
+ $$
341
+
342
+ where $\mathbf { x } _ { i n p u t } ^ { j + 1 }$ is the input of $j + 1 ^ { t h }$ layer of classifier, $\mathbf { x } _ { o u t } ^ { j }$ is the output of the $j ^ { t h }$ layer. The inputs of the first layer of $C ^ { G A T }$ also undergo the same transformation over the outputs of the feature extractor model. We train our models with Adam (Kingma & Ba (2014)) with an initial learning rate of $1 0 ^ { - 3 }$ for 50 epochs. Each epoch has 10 iterations, where we randomly select a mini-batch from the training data $G _ { B }$ . The fine-tuning stage consists of 20 epochs with 10 iterations per epoch. We use a two-layer MLP over the final attention layer of $C ^ { G A T ^ { \bf 1 } }$ for classification. The attention layers use multi-head attention with 2 heads and leaky ReLU slope of 0.1 . The embeddings from both the attention heads are concatenated. For 20-shot, we set $k$ to 2, number of super-classes to 3 and batch size to 128 on the Letter-High dataset, while $k$ is set to 2 and batch size 64 on Reddit, ENZYMES and TRIANGLES datasets. The number of super-classes for Reddit are set to 2, for ENZYMES it is set to 1 and for TRIANGLES are 3. For ENZYMES, there are negligible differences on using 1 and 2 super-classes as shown in table 4. We used Python Optimal Transport (POT) library 5 for implementation of the $p$ -th Wasserstein distance.
343
+
344
+ ![](images/29fdd17a77c3e8e015beb1724b352f5089f6e6dae91756dba71ded23dab355b7.jpg)
345
+ Figure 4: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT (left), GIN (middle) and WL Kernel (right) on ENZYMES dataset.
346
+
347
+ ![](images/562f5e73ca715f0b27d1079b212c127e5869fabcb2d041d7a1dfb57df4883ff6.jpg)
348
+ Figure 5: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT (left), GIN (middle) and WL Kernel (right) on Reddit dataset.
349
+
350
+ ![](images/5cc4f83d20953c2ca1efcadb37047fc6947a35899155b9dcb5b918db26496726.jpg)
351
+ Figure 6: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT (left), GIN (middle) and WL Kernel (right) on Letter-High dataset.
352
+
353
+ # A.4 SILHOUETTE SCORES
354
+
355
+ To assess the clustering abilities of the models we analyze the silhouette scores of the test embeddings produced by the GAT variant of our method, GIN and WL Kernel. Silhouette coefficient essentially measures the ratio of intra-class versus inter-class distance. The Silhouette Coefficient is calculated using the mean intra-cluster distance (a) and the mean nearest-cluster distance (b) for each sample. The Silhouette Coefficient for a sample is given by $\frac { ( b - a ) } { m a x ( a , b ) }$ ,where $b$ is the distance between a sample and the nearest cluster that the sample is not a part of. The results for mean silhouette coefficient over the test samples averaged over multiple runs are shown in Table 8. We normalize the embeddings before calculating the silhouette coefficient. We can clearly see that our model creates better clusters with low intra-cluster distance as well as high inter-cluster distance. Note that the coefficient value for WL remains the same for all scenarios since it computes fixed embeddings attributed to absence of any DL component.
356
+
357
+ Table 8: Silhouette coefficients of the test classes for the three dominant models - GAT variant of Our Method, GIN and WL. The best scores are highlighted in bold.
358
+
359
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Reddit-12K</td><td colspan="2">ENZYMES</td><td colspan="2">Letter-High</td><td colspan="2">TRIANGLES</td></tr><tr><td>10-shot</td><td>20-shot</td><td>10-shot</td><td>20-shot</td><td>10-shot</td><td>20-shot</td><td>10-shot</td><td>20-shot</td></tr><tr><td>GIN</td><td>-0.0566</td><td>-0.0652</td><td>0.0168</td><td>0.0432</td><td>0.2157</td><td>0.2316</td><td>0.0373</td><td>0.1256</td></tr><tr><td>WLKernel</td><td>-0.0626</td><td>-0.0626</td><td>0.0366</td><td>0.0366</td><td>0.2490</td><td>0.2490</td><td>0.0186</td><td>0.0186</td></tr><tr><td>OurMethod-GAT</td><td>-0.0553</td><td>-0.0559</td><td>0.0296</td><td>0.1172</td><td>0.3494</td><td>0.3787</td><td>0.3824</td><td>0.4508</td></tr></table>
360
+
361
+ Table 9: Semi-supervised fine-tuning results for various $p$ values on 10-shot and 20-shot scenarios, where “No Semi-Sup” represents the fine-tuning stage without additional labeled samples.
362
+
363
+ <table><tr><td rowspan="2">Dataset</td><td colspan="3">10-shot</td><td colspan="3">20-shot</td></tr><tr><td>No Semi-Sup</td><td>25</td><td>50</td><td>No Semi-Sup</td><td>25</td><td>50</td></tr><tr><td>Letter-High</td><td>73.21± 3.19</td><td>74.18 ± 2.58</td><td>74.65 ± 2.16</td><td>76.95 ± 1.79</td><td>77.79 ± 1.52</td><td>78.31 ± 1.11</td></tr><tr><td>TRIANGLES</td><td>75.83 ± 2.97</td><td>76.36± 2.59</td><td>77.8 ± 2.04</td><td>80.09 ±1.78</td><td>81.29 ± 1.98</td><td>81.87 ± 1.45</td></tr><tr><td rowspan="2">Dataset</td><td></td><td>10-shot</td><td></td><td></td><td>20-shot</td><td></td></tr><tr><td>No Semi-Sup</td><td>10</td><td>20</td><td>No Semi-Sup</td><td>10</td><td>20</td></tr><tr><td>Reddit</td><td>45.41± 3.79</td><td>45.88±3.32</td><td>46.01± 2.99</td><td>50.34± 2.77</td><td>50.76±2.52</td><td>51.17 ± 2.21</td></tr><tr><td>ENZYMES</td><td>60.13 ± 3.98</td><td>60.87 ± 3.24</td><td>61.25 ± 3.17</td><td>62.74 ± 3.64</td><td>63.10± 3.47</td><td>63.67 ± 3.18</td></tr></table>
364
+
365
+ # A.5 SEMI-SUPERVISED FINE-TUNING
366
+
367
+ In many real-world learning scenarios, it is quite common to find abundant unlabelled data. Since our model uses a GNN classifier, this makes it possible to use unlabelled data while learning through message passing, where the fine tuning stage of our method is performed in semi-supervised settings.
368
+
369
+ Essentially, while fine tuning the model, i.e., only training the classifier $C ^ { G A T }$ on $G _ { N }$ , we additionally use $p$ more graphs along with $G _ { N }$ , whose labels are unknown. The learning objective for fine tuning stage doesn’t change since the gradients are back-propagated from the labeled samples only. In this setting, each node in the attention classifier can aggregate information from unlabelled samples as well, thus allowing improved learning of the graphs features in $C ^ { G A T }$ . We show the results for $p$ values 25 and 50 on Letter-High and TRIANGLES datasets, whereas for $p$ values 10 and 20 on Reddit and ENZYMES datasets. The results are shown in Table 9. We observe an increase in the accuracy with increase in number of unlabeled samples during fine-tuning phase.
370
+
371
+ # A.6 ADAPTATION TO ACTIVE-LEARNING
372
+
373
+ In this section, we show the adaptation of our model to highly practical active learning scenario. In many real world applications, we might start with few samples per class, however as the number of samples to classify from these classes increase over time, some of these samples can be used by the model to adaptively learn and improve with very less human intervention, since the number of number of samples to be queried for theirs label can always be controlled.
374
+
375
+ To perform active-learning, we first select a random subset of size 100 for Letter-High and TRIANGLES datasets as well as a random subset of size 40 for Reddit and ENZYMES datasets, which we term as $G _ { r a n d o m }$ , then fine tune the model on $G _ { N }$ and further evaluate the model on $G _ { r a n d o m }$ .
376
+
377
+ Table 10: Active Learning Results. The value below each shot represents the number samples $l$ , added to $G _ { N }$ for second fine-tuning step, where “No AL” represents the model evaluation without additional labeled samples.
378
+
379
+ <table><tr><td rowspan="2">Dataset</td><td colspan="3">10-shot</td><td colspan="3">20-shot</td></tr><tr><td>No AL</td><td>15</td><td>25</td><td>No AL</td><td>15</td><td>25</td></tr><tr><td>Letter-High</td><td>73.34± 3.37</td><td>75.03 ± 3.24</td><td>76.89 ± 2.16</td><td>77.06 ± 1.73</td><td>78.44 ± 1.52</td><td>79.28 ± 1.36</td></tr><tr><td>TRIANGLES</td><td>76.02 ± 2.54</td><td>78.44 ± 1.84</td><td>79.91 ± 1.28</td><td>80.27 ±1.84</td><td>81.74 ± 2.03</td><td>82.58 ± 1.57</td></tr><tr><td rowspan="2">Dataset</td><td colspan="3">10-shot</td><td colspan="3">20-shot</td></tr><tr><td>No AL</td><td>10</td><td>20</td><td>No AL</td><td>10</td><td>20</td></tr><tr><td>Reddit</td><td>45.41± 3.79</td><td>46.88±3.14</td><td>47.91± 2.99</td><td>50.43±2.66</td><td>51.76± 2.32</td><td>53.07± 2.21</td></tr><tr><td>ENZYMES</td><td>60.13 ± 3.98</td><td>61.57 ± 3.48</td><td>62.25 ± 3.06</td><td>62.74 ± 3.64</td><td>63.60±3.30</td><td>64.97 ± 3.11</td></tr></table>
380
+
381
+ Thereafter, l relatively important samples are chosen from $G _ { r a n d o m }$ and added to $G _ { N }$ for another step of fine-tuning. There can be multiple strategies for defining relative importance of a sample. For our purpose, we define a sample’s relative importance via its predicted class probability distribution. We sort these samples in increasing order of the difference between their highest and second highest predicted class probabilities and choose the first $l$ samples from this sorted ranking. We call this importance relative, since each sample is evaluated with respect to the set $G _ { N }$ and thus, there is transductive flow of information among the samples, hence defining the relative embeddings in the space. Intuitively speaking, we have chosen the samples lying closer to separation boundary with respect to $G _ { N }$ . The results for various values of $l$ are shown in Table 10. The evaluation is done as mentioned earlier on the unseen set $G _ { U }$ . We observe significant improvement for all the datasets. This shows our model is capable of selecting important samples with respect to the few existing samples and learn actively.
382
+
383
+ # A.7 PERFORMANCE OF MODEL WITH 1 SUPER-CLASS
384
+
385
+ From table 4 in correspondence to tables 1 and 2, one can observe that the results obtained by using only 1 super-class which is equivalent to removing the super-classes are still better in comparison with many GNN and graph kernel baselines. By removing the super-classes and thus forming the super-graph solely based on $\mathbf { k }$ -nearest neighbor heuristic the GAT still learns latent inter class connections via information flow better than the GNNs which use MLP as their classifier. The super graph constructed in such scenario will have arbitrary connections between classes in the beginning, however as the GIN feature extractor learns over time the segregation in the feature space increases leading to better inter as well intra-class connections. Despite this, the performance with superclasses is better as this inductive bias allows the model to initiate with a better alignment in the feature space. The silhouette score comparison for OurMethod-GAT with 1 super-class and with the best performing number of super-classes to GIN and WL clearly indicates the multifold benefits of using GNNs as a classifier via super-graph construction. The t-SNE plots for OurMethod-GAT with only 1 super-class, GIN and WL kernel on the datasets TRIANGLES, Reddit and Letter-High are provided in the figures 7, 8 and 9 respectively.
386
+
387
+ Table 11: Silhouette coefficients of the test classes for three models - GAT variant of Our Method for 1 super-class which is equivalent to not using any super-classes vs the best performing number of super-classes as well as GIN and WL on 20-shot scenario. For GIN and WL both the sub-columns contain the same values as they don’t have any concept of super-classes.
388
+
389
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Reddit-12K</td><td colspan="2">ENZYMES</td><td colspan="2">Letter-High</td><td colspan="2">TRIANGLES</td></tr><tr><td>1-SC</td><td>2-SC</td><td>1-SC</td><td>2-SC</td><td>1-SC</td><td>3-SC</td><td>1-SC</td><td>3-SC</td></tr><tr><td>GIN</td><td>-0.0652</td><td>-0.0652</td><td>0.0432</td><td>0.0432</td><td>0.2316</td><td>0.2316</td><td>0.1256</td><td>0.1256</td></tr><tr><td>WLKernel</td><td>-0.0626</td><td>-0.0626</td><td>0.0366</td><td>0.0366</td><td>0.2490</td><td>0.2490</td><td>0.0186</td><td>0.0186</td></tr><tr><td>OurMethod-GAT</td><td>-0.0593</td><td>-0.0559</td><td>0.1172</td><td>0.0989</td><td>0.3519</td><td>0.3787</td><td>0.3975</td><td>0.4508</td></tr></table>
390
+
391
+ ![](images/1bafd2a3349ea4e2fe9c394cca4ab791a2cd1f65cf071a516bbd1c14891f4fbb.jpg)
392
+ Figure 7: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT with only 1 super-class (left), GIN (middle) and WL Kernel (right) on TRIANGLES dataset.
393
+
394
+ ![](images/2c26d5078ecb3af998cfa6a0df81aaa3205653b35f692f0d5124b1eb6194c0bd.jpg)
395
+ Figure 8: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT with only 1 super-class (left), GIN (middle) and WL Kernel (right) on Reddit dataset.
396
+
397
+ ![](images/6612059db44bda00c40722071d4b3b857b74cec9b39a0f864e9338819d122eed.jpg)
398
+ Figure 9: Visualization: t-SNE plots of the computed embeddings of test graphs on 20-shot scenario from OurMethod-GAT with only 1 super-class (left), GIN (middle) and WL Kernel (right) on LetterHigh dataset.
md/train/CaKvIT5UMfd/CaKvIT5UMfd.md ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TöRF: Time-of-Flight Radiance Fields for Dynamic Scene View Synthesis
2
+
3
+ Benjamin Attal∗ Carnegie Mellon University
4
+
5
+ Eliot Laidlaw Brown University
6
+
7
+ Aaron Gokaslan Cornell University
8
+
9
+ Changil Kim Facebook
10
+
11
+ Christian Richardt University of Bath
12
+
13
+ James Tompkin Brown University
14
+
15
+ Matthew O’Toole Carnegie Mellon University
16
+
17
+ imaging.cs.cmu.edu/torf
18
+
19
+ # Abstract
20
+
21
+ Neural networks can represent and accurately reconstruct radiance fields for static 3D scenes (e.g., NeRF). Several works extend these to dynamic scenes captured with monocular video, with promising performance. However, the monocular setting is known to be an under-constrained problem, and so methods rely on data-driven priors for reconstructing dynamic content. We replace these priors with measurements from a time-of-flight (ToF) camera, and introduce a neural representation based on an image formation model for continuous-wave ToF cameras. Instead of working with processed depth maps, we model the raw ToF sensor measurements to improve reconstruction quality and avoid issues with low reflectance regions, multi-path interference, and a sensor’s limited unambiguous depth range. We show that this approach improves robustness of dynamic scene reconstruction to erroneous calibration and large motions, and discuss the benefits and limitations of integrating RGB $+$ ToF sensors that are now available on modern smartphones.
22
+
23
+ # 1 Introduction
24
+
25
+ Novel-view synthesis (NVS) is a long-standing problem in computer graphics and computer vision, where the objective is to photorealistically render images of a scene from novel viewpoints. Given a number of images taken from different viewpoints, it is possible to infer both the geometry and appearance of a scene, and then use this information to synthesize images at novel camera poses. One of the challenges associated with NVS is that it requires a diverse set of images from different perspectives to accurately represent the scene. This might involve moving a single camera around a static environment [4, 16, 31, 32, 36], or using a large multi-camera system to capture dynamic events from different perspectives [2, 7, 24, 38, 44, 56]. Techniques for dynamic NVS from a monocular video sequence have also demonstrated compelling results, though they suffer from various visual artifacts due to the ill-posed nature of this problem [26, 37, 42, 50, 52]. This requires introducing priors, often deep learned, on the dynamic scene’s depth and motion.
26
+
27
+ In parallel, mobile devices now have camera systems with both color and depth sensors, including Microsoft’s Kinect and HoloLens devices, and the front and rear RGBD camera systems in the iPhone and iPad Pro. Depth sensors can use stereo or structured light, or increasingly the more accurate time-of-flight principle for measurements. Although depth sensing technology is more common than ever, many NVS techniques currently do not exploit this additional source of visual information.
28
+
29
+ To improve NVS performance, we propose $\mathrm { T } \mathrm { \ddot { o } R F ^ { 1 } }$ , an implicit neural representation for scene appearance that leverages both color and time-of-flight (ToF) images, as depicted in Figure 1. This reduces the number of images required for static NVS problem settings, compared with just using a color camera. Further, the additional depth information makes the monocular dynamic NVS problem more tractable, as it directly encodes information about the geometry of the scene. Most importantly, rather than using depth directly, we show that using ‘raw’ ToF data—in the form of phasor images [12] that are normally used to derive depth—is more accurate as it allows the optimization to correctly handle geometry that exceeds the sensor’s unambiguous range, objects with low reflectance, and regions affected by multi-path interference, leading to better dynamic scene view synthesis. The contributions of our work include:
30
+
31
+ ![](images/069600ef8b91e8c922beba8f35647def13f9a11d7b5f99303e8dfe65ec2a2266.jpg)
32
+ Figure 1: Illustration of time-of-flight radiance fields. (a) We move a handheld imaging system around a dynamic scene, capturing (b) color images and (c) raw phasor images from a continuous-wave time-of-flight (C-ToF) camera. (d) Then, we optimize for a continuous neural radiance field of the scene that predicts the captured color and phasor images. This allows novel view synthesis.
33
+
34
+ • A physically-based neural volume rendering model for raw continuous-wave ToF images; • A method to optimize a neural radiance field of dynamic scenes with information from color and continuous-wave ToF sensors; • Quantitative and qualitative evaluation on synthetic and real scenes showing better view synthesis than NeRF [32] for few input views, and than two dynamic scene baselines [26, 52].
35
+
36
+ # 2 Related Work
37
+
38
+ While novel-view synthesis (NVS) is a long-standing problem in computer graphics and vision [8, 9, 11, 23], recent developments in neural scene representations for NVS have enabled state-of-theart results for a wide variety of settings [46, 49]. The common thread across many of these works is to bring learnable elements together with physics-based models and classical rendering processes.
39
+
40
+ The designs for neural scene representations often build on standard computer graphics data structures, including voxel grids [34, 47], multiplane images (MPIs) [31, 51, 53, 57], multi-sphere images (MSIs) [3, 7], point clouds [30], and implicit functions of scene geometry and appearance [32, 48, 54]. For example, DeepVoxels [47] represent a scene as a discrete volume of embedded features to encode view-dependent effects, and enable wide baselines that may not be possible with other representations; however, the cost associated with this volumetric representation is that the memory requirements scale cubically with resolution. Alternatively, MPIs can be used to encode appearance from a single stereo pair [57]; the key benefit of this representation is the fast rendering speeds (ideal for interactive VR applications), though it performs best for forward-facing scenes.
41
+
42
+ Implicit neural representations of a scene provide similar flexibility to voxel grids, but circumvent the high memory requirements. These implicit networks therefore have greater capacity to represent the appearance of a scene. For example, scene representation networks (SRNs) [48] encode the geometry in a single neural network, which takes 3D points as input and outputs a feature representation of local scene properties (e.g., surface color or reflectance); rendering an image requires a differentiable ray marching procedure that intersects rays with the implicit volume. Neural radiance fields (NeRFs) [32] encode 5D radiance fields (3D position with 2D viewing direction) to offer higher-fidelity geometry and visual appearance. While these implicit neural representations initially assumed a static scene, recent approaches also demonstrate the ability to perform dynamic NVS from monocular video [26, 37, 42, 50, 52], despite this being a highly ill-posed problem.
43
+
44
+ Including depth maps has proven beneficial to improve NVS results for a long time [41]. However, surprisingly few NVS methods exploit the availability of depth sensors. One reason is that explicitly reconstructing depth maps for NVS [28, 55] may prove problematic, e.g., for thin structures, depth edges, complex reflectance, or noisy depth. We circumvent these issues by proposing a neural representation that models raw ToF data for better view synthesis for both static and dynamic scenes.
45
+
46
+ Table 1: Mathematical symbol legend for the following equations and explanations.
47
+
48
+ <table><tr><td>Symbol</td><td>Units</td><td>Description</td></tr><tr><td>X</td><td></td><td>A point ∈ R3.</td></tr><tr><td>8</td><td></td><td>A direction; unit vector ∈ S².</td></tr><tr><td>n(x)</td><td></td><td>A normal; a direction perpendicular to a surface at point X.</td></tr><tr><td>Xt</td><td></td><td>A point t units along a direction ω,Xt = X +ωt.</td></tr><tr><td>Wi</td><td></td><td>A direction incoming to a point.</td></tr><tr><td>W</td><td></td><td>A direction outgoing from a point.</td></tr><tr><td>L(x, ω) or LRGB LToF(x,ω)</td><td>W.sr-1.m-2 W·sr-1.m-2</td><td>Radiance measured by a camera at point x in direction w.</td></tr><tr><td>Li(x,w)</td><td>W·sr-1.m-2</td><td>Phasor radiance measured by a C-ToF camera. Incident radiance to a point from a direction.</td></tr><tr><td>Ls(x,w)</td><td>W·sr-1.m-2</td><td></td></tr><tr><td>I</td><td>W·sr-1</td><td>Reflected radiance scattered from a point in a direction. Radiant intensity of a point light source.</td></tr><tr><td>Is(x,w)</td><td>W.sr-1</td><td>Reflected radiant intensity scattered from a point x in</td></tr><tr><td></td><td></td><td>direction ω due to a light source collocated with the camera.</td></tr><tr><td>(x)</td><td>m-1</td><td>Density function at a point.</td></tr><tr><td>T(x,xt)</td><td>unitless</td><td>Transmittance function, i.e., accumulated density.</td></tr><tr><td>T(x,xk)</td><td>unitless</td><td>Discrete approximation of the transmittance function.</td></tr><tr><td>fp(x,wi,w,n(x))</td><td>sr-1</td><td>Scattering phase function.</td></tr><tr><td>W(d)</td><td>unitless</td><td>Importance function for light path of length d.</td></tr></table>
49
+
50
+ # 3 Neural Volume Rendering of ToF images
51
+
52
+ A neural radiance field (NeRF) [32] is a neural network optimized to predict a set of input images. Assuming a static scene, the neural network $F _ { \pmb \theta } : ( \mathbf { x } _ { t } , \pmb \omega _ { \mathrm { o } } ) \overset { - } { } ( \sigma ( \mathbf { x } _ { t } ) , \overbar { \lambda _ { \mathrm { s } } } ( \mathbf { x } _ { t } , \pmb \omega _ { \mathrm { o } } ) )$ with parameters $\pmb \theta$ takes as input a position $\mathbf { x } _ { t }$ and a direction $\omega _ { \mathrm { o } }$ , and outputs both the density $\sigma ( \mathbf { x } _ { t } )$ at point $\mathbf { x } _ { t }$ and the radiance $L _ { \mathrm { s } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } )$ of a light ray passing through $\mathbf { x } _ { t }$ in direction $\omega _ { \mathrm { o } }$ . The volume density function $\sigma ( { \bf x } _ { t } )$ controls the opacity at every point—large values of $\sigma ( { \bf x } _ { t } )$ represent opaque regions and small values represent transparent ones, which allows representation of 3D structures. The radiance function $L _ { \mathrm { s } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } )$ represents the light scattered at a point $\mathbf { x } _ { t }$ in direction $\omega _ { 0 }$ , and characterizes the visual appearance of different materials (e.g., shiny or matte). Together, these two functions can be used to render images of a scene from any given camera pose. The key insight of our work is that NeRFs can be extended to model (and learn from) the raw images of a ToF camera.
53
+
54
+ NeRF optimization requires neural volume rendering: given the pose of a camera, the procedure generates an image by tracing rays through the volume and computing the radiance observed along each ray [32]:
55
+
56
+ $$
57
+ L ( \mathbf { x } , \omega _ { \mathrm { o } } ) = \int _ { t _ { \mathrm { n } } } ^ { t _ { \mathrm { f } } } T ( \mathbf { x } , \mathbf { x } _ { t } ) \sigma ( \mathbf { x } _ { t } ) L _ { \mathrm { s } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } ) d t , \quad \mathrm { w h e r e } \quad T ( \mathbf { x } , \mathbf { x } _ { t } ) = e ^ { - \int _ { t _ { \mathrm { n } } } ^ { t } \sigma ( \mathbf { x } - \omega _ { \mathrm { o } } s ) d s }
58
+ $$
59
+
60
+ describes the transmittance for light propagating from position $\mathbf { x }$ to ${ \bf x } _ { t } = { \bf x } - \omega _ { \mathrm { o } } t$ , for near and far bounds $t \in [ t _ { \mathrm { n } } , t _ { \mathrm { f } } ]$ .
61
+
62
+ In practice, this integral is evaluated using quadrature [32]:
63
+
64
+ $$
65
+ L ( \mathbf { x } , \omega _ { \mathrm { o } } ) \approx \sum _ { k = 1 } ^ { N } \hat { T } ( \mathbf { x } , \mathbf { x } _ { k } ) ( 1 - e ^ { - \sigma ( \mathbf { x } _ { k } ) \Delta \mathbf { x } _ { k } } ) L _ { \mathrm { s } } ( \mathbf { x } _ { k } , \omega _ { \mathrm { o } } ) , \mathrm { ~ w h e r e ~ } \hat { T } ( \mathbf { x } , \mathbf { x } _ { k } ) = \prod _ { j = 1 } ^ { k - 1 } e ^ { - \sigma ( \mathbf { x } _ { j } ) \Delta \mathbf { x } _ { j } } .
66
+ $$
67
+
68
+ The value for $\Delta \mathbf { x } _ { j } = \| \mathbf { x } _ { j + 1 } - \mathbf { x } _ { j } \|$ is the distance between two quadrature points.
69
+
70
+ Generalizing the neural volume rendering procedure for ToF cameras requires two changes. First, because ToF cameras use an active light source to illuminate the scene, we must consider the fact that the lighting conditions of the scene change with the position of the camera. In Section 3.1, we derive the scene’s appearance in response to collocating a point light source with a camera, which follows a similar derivation to that of Bi et al. [5]. Second, in Section 3.2, we extend the volume rendering integral to model images captured with a ToF camera. Similar to the approaches taken in transient rendering frameworks [17, 39] and by neural transient fields (NeTFs) [46], we incorporate a path length importance function into our integral that can model different types of ToF cameras.
71
+
72
+ For simplicity, we assume that the function $L ( \mathbf { x } , \omega _ { \mathrm { o } } )$ is monochromatic, i.e., it outputs radiance at a single wavelength. Later on, we will model output values for red, green, blue, and infrared light (IR). $L _ { \mathrm { R G B } }$ values correspond to radiance from ambient illumination scattering towards a color camera, whereas $L _ { \mathrm { T o F } }$ corresponds to the measurements made by a ToF camera with active illumination.
73
+
74
+ 3.1. Collocated Point Light Source. An ideal ToF camera responds only to the light from a collocated IR point source and not to any ambient illumination. With this assumption, we model radiance $L _ { \mathrm { s } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } )$ as a function of the source position [5]:
75
+
76
+ $$
77
+ L _ { \mathrm { s } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } ) = \int _ { \mathbb { S } ^ { 2 } } f _ { \mathrm { p } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { i } } , \omega _ { \mathrm { o } } , \mathbf { n } ( \mathbf { x } _ { t } ) ) L _ { \mathrm { i } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { i } } ) d \omega _ { \mathrm { i } } ,
78
+ $$
79
+
80
+ where the function $L _ { \mathrm { i } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { i } } )$ represents the incident illumination from direction $\omega _ { \mathrm { i } } , \mathbb { S } ^ { 2 }$ is the unit sphere of incident directions, and the scattering phase function $f _ { \mathrm { p } } ( \mathbf x _ { t } , \omega _ { \mathrm { i } } , \omega _ { \mathrm { o } } , \mathbf n ( \mathbf x _ { t } ) )$ describes how light is scattered at a point $\mathbf { x } _ { t }$ in the volume. Note that the scattering phase function also depends on the local surface shading normal $\mathbf { n } ( \mathbf { x } _ { t } )$ . For a point light source at $\mathbf { x }$ (i.e., collocated with the camera), each scene point is only lit from one direction. Thus, the incident radiance is given by
81
+
82
+ $$
83
+ L _ { \mathrm { i } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { i } } ) = \frac { I } { \left\| \mathbf { x } - \mathbf { x } _ { t } \right\| ^ { 2 } } \delta \bigg ( \frac { \mathbf { x } - \mathbf { x } _ { t } } { \left\| \mathbf { x } - \mathbf { x } _ { t } \right\| } - \omega _ { \mathrm { i } } \bigg ) T ( \mathbf { x } , \mathbf { x } _ { t } ) ,
84
+ $$
85
+
86
+ where the scalar $I$ represents the emitted radiant intensity of the light source, $1 \big / | | \mathbf { x } - \mathbf { x } _ { t } | | ^ { 2 }$ is the inverse square light fall-off, and $\delta ( \cdot )$ is the Dirac distribution used to describe only the light from a single direction. This model ignores forward scattering, which is reasonable if the scene consists mostly of completely opaque surfaces. When substituted into Equation 1 and Equation 3, the resulting forward model is
87
+
88
+ $$
89
+ L ( \mathbf { x } , \omega _ { \mathrm { o } } ) = \int _ { t _ { n } } ^ { t _ { t } } \frac { T ( \mathbf { x } , \mathbf { x } _ { t } ) ^ { 2 } } { \left\| \mathbf { x } - \mathbf { x } _ { t } \right\| ^ { 2 } } \sigma ( \mathbf { x } _ { t } ) I _ { s } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } ) d t \mathrm { w h e r e } I _ { s } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } ) = f _ { \mathrm { p } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } , \omega _ { \mathrm { o } } , \mathbf { n } ( \mathbf { x } _ { t } ) ) I .
90
+ $$
91
+
92
+ where $\omega _ { \mathrm { i } } = \omega _ { \mathrm { o } }$ in the scattering phase function $f _ { \mathfrak { p } }$ as emitted light is reflected along the same ray.
93
+
94
+ This expression is similar to Equation 1 with two key differences: the squared transmittance term, and the inverse square falloff induced by the point light source. Similar to NeRF [32], we can once again numerically approximate the above integral using quadrature, and recover the volume parameters $( \sigma ( { \bf x } _ { t } ) , I _ { \mathrm { s } } ( \bar { { \bf x } } _ { t } , \bar { \omega } _ { 0 } ) )$ by training a neural network that depends only on position and direction.
95
+
96
+ 3.2. Continuous-Wave ToF Model. ToF cameras use the travel time of light to compute distances [14]. The collocated point light source sends an artificial light signal into an environment, and a ToF sensor measures the time required for light to reflect back in response. Given the constant speed of light, ${ \mathrm { c } } \approx 3 \cdot 1 0 ^ { 8 } { \mathrm { m } } / { \mathrm { s } }$ , this temporal information determines the distance traveled. These devices have found widespread adoption from autonomous vehicles [25] to mobile AR applications [19, 21].
97
+
98
+ Photorealistic simulations of ToF cameras involve introducing a path length importance function to the rendering equation [17, 39], and can be just as easily applied to the integral in Equation 5:
99
+
100
+ $$
101
+ L _ { \mathrm { T o F } } ( \mathbf { x } , \omega _ { \mathrm { o } } ) = \int _ { t _ { \mathrm { n } } } ^ { t _ { \mathrm { f } } } \frac { T ( \mathbf { x } , \mathbf { x } _ { t } ) ^ { 2 } } { \left\| \mathbf { x } - \mathbf { x } _ { t } \right\| ^ { 2 } } \sigma ( \mathbf { x } _ { t } ) I _ { \mathrm { s } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } ) W ( 2 \left\| \mathbf { x } - \mathbf { x } _ { t } \right\| ) d t ,
102
+ $$
103
+
104
+ where the function $W ( d )$ weights the contribution of a light path of length $d$ . Note that light travels twice the distance between the camera’s origin $\mathbf { x }$ and the scene point $\mathbf { x } _ { t }$ . As described by Pediredla et al. [39], the function $W ( d )$ can be used to represent a wide variety of ToF cameras, including both pulsed ToF sensors [18] and continuous-wave ToF (C-ToF) sensors [12, 19, 35]. Here, as our proposed system uses a C-ToF sensor for imaging, the images are modeled using the phasor $\begin{array} { r } { W ( d ) \ : = \ : \exp \bigl ( \mathrm { i } \frac { 2 \pi d f } { \mathrm { c } } \bigr ) } \end{array}$ , where $f$ is the modulation frequency of the signal emitted by the C-ToF camera. Note that, because the function $W ( d )$ is complex-valued, the radiance $L _ { \mathrm { T o F } } ( \mathbf { x } , \omega _ { \mathrm { o } } )$ will also produce a complex-valued phasor image [12]. In practice, phasor images are created by capturing four real-valued images that are linearly combined (see supplemental document for additional details). In Figure 1(c), we show the real component of the phasor image, with positive pixel values as red, and negative values as blue.
105
+
106
+ ![](images/111aeaf774d51f17a43d62f009a706ba6a50ad4437defe6dd26b0d1b273b3665.jpg)
107
+ Figure 2: Neural volume rendering of C-ToF images. (a) We start with ray marching to evaluate the radiance and opacity at different points along the ray. (b) These samples represent the continuous integrand of Equation 5, which describes the contribution of every point $\mathbf { x } _ { t }$ along the ray. For example, ray 1 grazes both bunny ears, producing two distinct responses. (c) As described by Equation 6, we multiply the integrand with a complex exponential, with the result represented here in the complex plane. Integrating this result produces a single complex phasor, represented here by a vector with a magnitude corresponding to reflectance and a direction corresponding to the phase (or distance). (d) The loss function compares rendered phasors with the raw measurements of a C-ToF camera.
108
+
109
+ Contrasting with ToF-derived depth. ToF cameras typically recover depth by assuming only one point $\mathbf { x } _ { \mathrm { s } }$ reflects light for every ray, i.e., the integrand of Equation 6 is assumed to be zero for all other points ${ \bf x } \neq { \bf x } _ { \mathrm { s } }$ (points in front of $\mathbf { x } _ { \mathrm { s } }$ reflect no light, and points behind $\mathbf { x } _ { \mathrm { s } }$ are hidden). Under these assumptions, Equation 6 simplifies to the phasor:
110
+
111
+ $$
112
+ \begin{array} { r } { L _ { \mathrm { T o F } } ( \mathbf { x } , \omega _ { \mathrm { o } } ) = a \cdot W ( 2 \| \mathbf { x } - \mathbf { x } _ { \mathrm { s } } \| ) = a \cdot \exp \left( \mathrm { i } \frac { 4 \pi f } { \mathrm { c } } \| \mathbf { x } - \mathbf { x } _ { \mathrm { s } } \| \right) , } \end{array}
113
+ $$
114
+
115
+ where the phasor’s magnitsingle point, and the phase, $| L _ { \mathrm { T o F } } ( \mathbf { x } , \omega _ { \mathrm { o } } ) | = a$ nts thmod mount of light reflect, is related to distance $\begin{array} { r } { \angle L _ { \mathrm { T o F } } ( \mathbf { x } , \omega _ { \mathrm { o } } ) = \frac { 4 \pi f } { \mathrm { c } } \| \mathbf { x } - \mathbf { x } _ { \mathrm { s } } \| } \end{array}$ $2 \pi$ ${ \left\| { { \bf { x } } - { { \bf { x } } _ { \mathrm { { s } } } } } \right\| }$
116
+
117
+ In real-world scenarios, it is also possible for multiple points along a ray to contribute to the signal, resulting in a linear combination of phasor radiance values—known as multi-path interference. This can degrade the quality of depth measurements for a C-ToF camera. For example, around depth edges, a pixel integrates the signal from surfaces at two different distances from the camera (e.g., Figure 2), resulting in ‘flying pixel’ artifacts [43] (i.e., 3D points not corresponding to either distance). Similar artifacts occur when imaging semi-transparent or specular objects, where two or more surfaces contribute light to a pixel.
118
+
119
+ Optimizing NeRFs with phasor images via Equation 6 therefore has three distinct advantages over using derived depth maps via Equation 7. (i) For ranges that span values larger than $\frac { \mathrm { c } } { 2 f }$ , the true range is ambiguous, as there are multiple depth values that produce the same phase. For example, a typical modulation frequency of $f = 3 0 \mathrm { M H z }$ for a C-ToF camera corresponds to an unambigous range of $\frac { c } { 2 f } \approx 5 { \mathrm { m } }$ . By modeling the phasor images directly, we avoid the issues associated with recovering depth images for scenes that exceed this range (Figure 3). (ii) Depth values become unreliable (noisy) when the amount of light reflected to the camera is small. Modeling the phasor images directly makes the solution robust to sensor noise (Figure 4). (iii) For regions near depth edges (Figure 2) or for objects with complicated reflectance properties (e.g., transparent or specular surfaces), the light detected may not travel along a single path; this results in mixtures of phasors, producing phase values that do not correspond to a single depth. Equation 6 models the response from multiple single-scattering events along a ray, providing us with a better handle over such scenarios.
120
+
121
+ # 4 Optimizing Dynamic $\mathbf { T o F } + \mathbf { N e R F } = \mathbf { T } \Ddot { \mathbf { 0 } } \mathbf { R F }$
122
+
123
+ 4.1. Dynamic Neural Radiance Fields. One key advantage of working with phasor images is that the method can capture scene geometry from a single view, which enables higher-fidelity novel-view synthesis of dynamic scenes from a potentially moving color camera and C-ToF camera pair. To support dynamic neural radiance fields, we model the measurements with two neural networks. The first, static network $F _ { \theta } ^ { \mathrm { s t a t } } : ( \mathbf { x } _ { t } , \omega _ { 0 } ) ( \sigma ^ { \mathrm { s t a t } } ( \mathbf { x } _ { t } ) , L _ { s } ^ { \mathrm { s t a t } } ( \mathbf { x } _ { t } , \omega _ { 0 } ) , I _ { s } ^ { \mathrm { s t a t } } ( \mathbf { x } _ { t } , \omega _ { 0 } ) )$ is a 5D function of position and direction, while the second, dynamic network $F _ { \pmb \theta } ^ { \mathrm { d y n } } : ( { \bf x } _ { t } , \omega _ { \mathrm { o } } , \tau ) $ $\left( \sigma ^ { \mathrm { d y n } } ( \mathbf { x } _ { t } , \tau ) , L _ { \mathrm { s } } ^ { \mathrm { d y n } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } ) , I _ { \mathrm { s } } ^ { \mathrm { d y n } } ( \mathbf { x } _ { t } , \omega _ { \mathrm { o } } , \tau ) , b ( \mathbf { x } _ { t } , \tau ) \right)$ is a $^ { 6 \mathrm { D } }$ function of position, direction, and time $\tau$ . Instead of directly consuming a time $\tau$ , the dynamic network receives a latent code ${ \bf z } _ { \tau }$ which is optimized per frame, similar to Li et al. [24]. Following the approach of Li et al. [26], we blend the outputs of the static and dynamic networks using a position- and time-dependent blending weight $b ( \mathbf { x } _ { t } , \tau )$ that is predicted by the dynamic network $F _ { \theta } ^ { \mathrm { d y n } }$ , as in Gao et al. [10]. This produces density $\sigma ^ { \mathrm { b l e n d } }$ , radiance $L _ { \mathrm { s } } ^ { \mathrm { b l e n d } }$ , and radiant intensity $I _ { \mathrm { s } } ^ { \mathrm { b l e n d } }$ values to pass into our image formation models:
124
+
125
+ ![](images/a392c08c1f399778121d522a847b59c42fac89c54c3ef5cabe8009c6c8d088d4.jpg)
126
+ Figure 3: Raw phasor supervision avoids wrap-around errors. Wrap-around phase bounds the range of useful ToF measurements (left), causing errors when depth is used as supervision. Our approach of modeling raw phasor measurements within the neural volume alleviates this problem (right). This is because only one phase offset is consistent across multiple camera views.
127
+
128
+ ![](images/5e2e796abc6812ecef394b06bf70afc82c2597f0314359abd2a19644ecbed881.jpg)
129
+ Figure 4: Raw phasor supervision reduces noise in dark objects. The weak signal reflected back by dark objects (e.g., the computer monitor) results in noisy depth measurements. As TöRF does not rely on depth explicitly and instead models raw phasor images, our recovered depth map better captures the scene geometry in comparison to ToF-derived depth. This is because when phasor magnitudes are small, TöRF falls back on triangulation cues to recover geometry.
130
+
131
+ $$
132
+ \begin{array} { l } { { \displaystyle { \cal L } _ { \mathrm { R G B } } ( { \bf x } , \omega _ { 0 } , \tau ) = \int _ { t _ { n } } ^ { t _ { t } } T ^ { \mathrm { b l e n d } } ( { \bf x } , { \bf x } _ { t } , \tau ) \sigma ^ { \mathrm { b l e n d } } ( { \bf x } _ { t } , \tau ) L _ { s } ^ { \mathrm { b l e n d } } ( { \bf x } _ { t } , \omega _ { 0 } , \tau ) d t } \ ~ } \\ { { \displaystyle { \cal L } _ { \mathrm { T o F } } ( { \bf x } , \omega _ { 0 } , \tau ) = \int _ { t _ { n } } ^ { t _ { t } } \frac { T ^ { \mathrm { b l e n d } } ( { \bf x } , { \bf x } _ { t } , \tau ) ^ { 2 } } { \left\| { \bf x } - { \bf x } _ { t } \right\| ^ { 2 } } \sigma ^ { \mathrm { b l e n d } } ( { \bf x } _ { t } , \tau ) I _ { s } ^ { \mathrm { b l e n d } } ( { \bf x } _ { t } , \omega _ { 0 } , \tau ) W ( 2 \left\| { \bf x } - { \bf x } _ { t } \right\| ) d t } . } \end{array}
133
+ $$
134
+
135
+ See the supplemental document for an explicit definition of the blending terms.
136
+
137
+ 4.2. Loss Function. Given a set of color images and phasor images captured of a scene at different time instances, we sample a set of camera rays from the set of all pixels, and minimize the following total squared error between the rendered images and measured pixel values:
138
+
139
+ $$
140
+ \mathcal { L } = \sum _ { ( \mathbf { x } , \omega _ { \mathrm { o } } , \tau ) } \Vert L _ { \mathrm { R G B } } ( \mathbf { x } , \omega _ { \mathrm { o } } , \tau ) - \hat { L } _ { \mathrm { R G B } } ( \mathbf { x } , \omega _ { \mathrm { o } } , \tau ) \Vert ^ { 2 } + \lambda \Vert L _ { \mathrm { T o F } } ( \mathbf { x } , \omega _ { \mathrm { o } } , \tau ) - \hat { L } _ { \mathrm { T o F } } ( \mathbf { x } , \omega _ { \mathrm { o } } , \tau ) \Vert ^ { 2 } ,
141
+ $$
142
+
143
+ where the scalar $\lambda \geq 0$ controls the relative contribution of both loss terms, $\hat { L } _ { \mathrm { R G B } } ( \mathbf { x } , \omega _ { \mathrm { o } } , \tau )$ represents the measurements of a color camera, and $\hat { L } _ { \mathrm { T o F } } ( \mathbf { x } , \omega _ { \mathrm { o } } , \tau )$ represents the phasor measurements of a C-ToF camera. At training time, we reduce the weight $\lambda$ in later iterations to prioritize the color loss (halved every 125,000 iterations).
144
+
145
+ 4.3. Camera Pose Optimization. In past works, COLMAP [45] has been used to recover camera poses for NVS. However, COLMAP fails to recover accurate camera poses for many real scenes even if we masked dynamic regions [20]. Further, COLMAP only recovers camera poses up to unknown scale, whereas our ToF image formation model assumes a known scene scale. As such, for real-world scenes, we optimize camera poses from scratch within the training loop. First, we optimize the weights of the static neural network F statθ , as well as the camera poses for each video frame and the relative rotation and translation between the color and C-ToF sensor, with a learning rate of $1 0 ^ { - 3 }$ After 5000 iterations, we decrease the pose learning rate to $5 \cdot 1 0 ^ { - 4 } $ , and optimize our full model.
146
+
147
+ 4.4. Ray Sampling. Many physical camera systems do not have collocated color and ToF cameras. As such, to train our model, we trace separate rays through the volume for color and ToF measurements. We alternate using the color loss and the ToF loss for every iteration. Further, like NeRF [32], we use stratified random sampling when sampling points along a ray.
148
+
149
+ # 5 Experiments
150
+
151
+ 5.1. Hardware. We use an iDS UI-3070CP-C-HQ machine vision camera to provide RGB measurements $6 4 0 \times 4 8 0$ $@$ 30 fps; downsampled to $3 2 0 \times 2 4 0 )$ ), and a Texas Instruments OPT8241 sensor to provide phasor measurements $3 2 0 \times 2 4 0$ $@$ 30 fps) with an unambiguous range of $5 \mathrm { m }$ . Both cameras are mounted with a baseline of $4 1 \mathrm { m m }$ . We use OpenCV to calibrate intrinsics, extrinsics, and lens distortion. See the supplement for details.
152
+
153
+ For optimization, we use an NVIDIA GeForce RTX 2080 Ti with 11 GB RAM. Our model takes 12–24 hours to converge, and 3–5 seconds per frame to generate a novel view $( 2 5 6 \times 2 5 6 )$ .
154
+
155
+ 5.2. Data. We captured the PhoneBooth, Cupboard, Photocopier, DeskBox, and StudyBook sequences with our handheld camera setup. Each is indoors in an office with a person performing a dynamic action, and includes view dependence from real-world materials. PhoneBooth includes multi-path interference effects from a glass door, and Photocopier includes wrap-around phase effects in the distance. For comparison, we also captured the Dishwasher sequence on an iPhone $1 2 \mathrm { P r o }$ , which uses a ToF sensor to capture depth (raw measurements are not available). Finally, we create synthetic raw C-ToF sequences Bathroom, Bedroom, and DinoPear by adapting the physically-based path tracer PBRT [40] to generate phasor images with multi-bounce and scattering effects.
156
+
157
+ 5.3. Few-View Reconstruction of Static Scenes. We demonstrate that integrating raw ToF measurements in addition to RGB enables TöRF to reconstruct static scenes from fewer input views, and to achieve higher visual fidelity than standard NeRF [32] for the same number of input views. Table 2 contains a quantitative comparison on two synthetic sequences, Bathroom and Bedroom, for reconstructions from just 2 and 4 input views. To enable the comparison on 10 hold-out views, we use ground-truth camera poses for both methods. With just two input views, TöRF’s added phasor supervision better reproduces the scene than NeRF, as one might expect. This closely resembles a camera system that might exist on a smartphone, and shows the potential value of ToF supervision for dynamic scenes if we consider a static scene as one time step of a video sequence. For four views, NeRF and TöRF produce comparable RGB results, though our depth reconstructions are significantly more accurate (Figure 5).
158
+
159
+ 5.4. Dynamic Scenes. We compare reconstruction quality on the synthetic dynamic sequence DinoPear in Table 3 with 30 ground-truth hold-out views and depth maps. Compared to methods that use deep depth estimates (NSFF and VideoNeRF), TöRF produces better depth and RGB views. While TöRF PSNR is slightly lower than NSFF’s, the perceptual LPIPS metric is significantly lower for TöRF, which matches the findings from our qualitative results. TöRF also produces better depth and RGB reconstructions than the same methods modified to use ToF-derived depth (NSFF $+$ ToF, VideoNeRF+ToF).
160
+
161
+ For real-world scenes, we show results and comparisons in Figure 6. VideoNeRF+ToF shows stronger disocclusion artifacts and warped edges near depth boundaries, and cannot recover from depth maps with wrapped range. NSFF suffers from severe ghosting and stretching artifacts that negatively impact the quality of the results. Our results show the highest visual quality and most accurate depth maps. Please see the videos on our website for in-motion novel-view synthesis.
162
+
163
+ # 6 Discussion
164
+
165
+ 6.1. Limitations. Introducing ToF sensors into RGB neural radiance fields aims to improve quality by merging the benefits of both sensing modes; but, some limitations are also brought in through ToF sensing. C-ToF sensing can struggle on larger-scale scenes; however, using multiple different modulation frequencies can extend the unambiguous range [12]. Using different coding methods can also increase depth precision [13]. While C-ToF sensors typically struggle outdoors, EpiToF [1] has demonstrated the ability to perform $1 5 \mathrm { m }$ ranging under strong ambient illumination. Further, for each measurement, C-ToF sensors require capturing four or more images quickly at different times, which can cause artifacts for fast-moving objects.
166
+
167
+ Table 2: Phasor supervision aids few-view reconstruction. Each cell contains RGB image similarity measures, and metrics are computed on 10 hold-out views. TöRF significantly outperforms NeRF on both synthetic static scenes and produces more accurate depth estimates (Figure 5), particularly from just two input views. Note that the metric depth error ‘MSE (D)’ is affected by mirrors, particularly in the bathroom scene, whose depth is defined by the plane of the mirror and not the objects in its reflection.
168
+
169
+ <table><tr><td></td><td></td><td colspan="4">Bathroom</td><td colspan="4">Bedroom</td></tr><tr><td></td><td>Views Method</td><td>MSE (D) ?</td><td>PSNR ▲</td><td>SSIM ▲</td><td>LPIPS ?</td><td>MSE (D) ?</td><td>PSNR ▲</td><td>SSIM ▲</td><td>LPIPS ?</td></tr><tr><td>2</td><td>NeRF [32]</td><td>0.97</td><td>16.56</td><td>0.660</td><td>0.022</td><td>18.43</td><td>11.59</td><td>0.313</td><td>0.056</td></tr><tr><td></td><td>ToRF (ours)</td><td>2.12</td><td>19.21</td><td>0.739</td><td>0.015</td><td>0.31</td><td>22.09</td><td>0.840</td><td>0.010</td></tr><tr><td>4</td><td>NeRF[32]</td><td>0.70</td><td>24.17</td><td>0.864</td><td>0.008</td><td>0.94</td><td>28.29</td><td>0.936</td><td>0.003</td></tr><tr><td></td><td>ToRF (ours)</td><td>0.76</td><td>26.18</td><td>0.879</td><td>0.009</td><td>0.27</td><td>29.79</td><td>0.938</td><td>0.002</td></tr></table>
170
+
171
+ ![](images/857d242b824089eac25365f272a3bd82488a901730fdfb4f328434c739cdc944.jpg)
172
+ Figure 5: Adding ToF aids reconstruction for few views in static scenes. NeRF quality suffers as the number of views decreases, but adding ToF data makes view synthesis possible with two RGB views. Note the cleaner depth, sharper edges, and thin geometric details such as the lamps above the mirror.
173
+
174
+ ![](images/5383a5ba70f93be82b7cf032533b074dcd5057651e1e7d6f7725e2050862ea61.jpg)
175
+ Figure 6: Adding ToF supervision helps improve quality. Compared to two video baselines, VideoNeRF [52] (modified to use ToF-derived depth) and NSFF [26], our approach reduces errors in static scene components and some dynamic components. All models were trained for comparable times. Please see the videos on our website for additional comparisons in motion.
176
+
177
+ Table 3: Evaluation on ground-truth hold-out views for the dynamic DinoPear sequence shows improved depth and RGB results for our method. Note that NSFF and VideoNeRF are given manually unwrapped ToF depth produced by adding $2 \pi$ to all phase values below a certain threshold. The TöRF approach of using raw phasor images produces better depth reconstructions. While NSFF produces the highest PSNR, this does not match the perceived visual quality—please see our webpage.
178
+
179
+ <table><tr><td>Method</td><td>Depth MSE</td><td>PSNR</td><td>SSIM▲</td><td>LPIPS ?</td></tr><tr><td>NSFF[26]</td><td>0.021 ± 0.003</td><td>22.64 ± 1.46</td><td>0.554 ± 0.029</td><td>0.039 ± 0.010</td></tr><tr><td>+ ToF depth</td><td>0.010 ± 0.002</td><td>21.84 ± 0.72</td><td>0.382 ± 0.021</td><td>0.037 ± 0.014</td></tr><tr><td>+ ToF depth (unwrapped)</td><td>0.007 ± 0.002</td><td>21.70 ± 0.98</td><td>0.387 ± 0.028</td><td>0.040 ± 0.013</td></tr><tr><td>VideoNeRF[52]</td><td>0.008 ± 0.002</td><td>21.32 ± 1.03</td><td>0.358 ± 0.032</td><td>0.032 ± 0.017</td></tr><tr><td>+ ToF depth</td><td>0.011 ± 0.002</td><td>19.75 ± 1.07</td><td>0.275 ± 0.021</td><td>0.041 ± 0.016</td></tr><tr><td>+ ToF depth (unwrapped)</td><td>0.009 ± 0.002</td><td>20.72 ± 1.03</td><td>0.350 ± 0.033</td><td>0.032 ± 0.016</td></tr><tr><td>ToRF (ours)</td><td>0.005 ± 0.001</td><td>22.19 ± 1.75</td><td>0.561 ± 0.052</td><td>0.028 ± 0.011</td></tr></table>
180
+
181
+ öRF RGB TöRFEven with ToF data, objects imaged at grazing angles or objects that are both dark (low reflectance) and dynamic remain difficult to reconstruct, e.g., dark hair (Figure 7). Further, neural networks have limited capacity to model dynamic scenes, which limits the duration of dynamic sequences. This is a limitation of many current neural dynamic scene methods.
182
+
183
+ 6.2. Potential Social Impact. Scene reconstruction and view synthesis are core problems in visual computing for determining the shape and appearance of objects and scenes. Neural approaches to these tasks hold promise to increase accuracy and fidelity. At the methodological level, integrating ToF data improves accuracy, but restricts use to scenarios where active illumination is detectable. While the recovery of shape and appearance has many applications, negative impact may include synthesizing images from perspectives or time instances that were never captured (falsifying media), extending surveillance through higher-fidelity reconstructions (security), or copying physical objects to ‘rip off’ designs.
184
+
185
+ ![](images/5eadb3a11bd4e911b6aae39e34da8da1c88bc408aff80b101f42899f15ead378.jpg)
186
+ Figure 7: In the Photocopier (top) and StudyBook (bottom) scenes, RGB and depth NVS show that dark and dynamic objects pose difficulties. Dark hair incorrectly extends in front or to the side of the face due to failure to reconstruct dynamic motion.
187
+
188
+ Practically, current neural approaches are more computationally expensive in both optimization and rendering than classic image-based rendering. Our work required GPUs to optimize for many hours (12–24 h). Without renewable energy sources, this use will generate $\mathrm { C O } _ { 2 }$ emissions, requiring $1 . 5 { - } 3 \mathrm { k g } \mathrm { C O } _ { 2 }$ -equivalents per scene for optimization and $0 . 0 1 { - } 0 . 0 2 \mathrm { k g } \mathrm { C O } _ { 2 }$ -equivalents per sequence for rendering (numbers generated by ML $\mathrm { C O } _ { 2 }$ Impact [22]). Concurrent work in neural radiance fields reduces this cost using caching, spatial acceleration structures, and more efficient parameterizations, and real-world deployment should exploit these approaches to reduce the $\mathrm { C O } _ { 2 }$ emission impact.
189
+
190
+ # 7 Conclusion
191
+
192
+ Modern camera systems integrate multiple modes of sensing, and our reconstruction methods should exploit this information to improve quality. To this end, we formulate a neural model for time-offlight radiance fields based on physical $\mathrm { R G B + T o F }$ image formation. We demonstrate an optimization method to recover TöRF volumes, and show that it improves novel-view synthesis for few-view scenes and especially for dynamic scenes. Further, we demonstrate that using raw ToF phasor supervision leads to better performance than using derived depth directly, allowing both sensing modes to help resolve errors, limitations, and ambiguities. Future work may extend the combination of additional sensors into neural radiance fields, e.g., dynamic vision sensors [27] or event cameras may be used to measure scenes at higher speeds. Further, a collocated point light source has been shown to be able to render photos of scenes under non-collocated illumination conditions [5]. As a result, we believe ToF images may also serve to support relighting applications.
193
+
194
+ # Acknowledgments and Disclosure of Funding
195
+
196
+ Thank you to Kenan Deng for developing acquisition software for the time-of-flight camera. For our synthetic data, we thank the authors of assets from the McGuire Computer Graphics Archive [29], Benedikt Bitterli for Mitsuba scene files [6], Davide Tirindelli for Blender scene files, ‘Architectural Visualization’ demo Blender scene by Marek Moravec (CC-0 Public Domain) [33], ‘Rampaging T-Rex’ from the 3D library of Microsoft’s 3D Viewer, and ‘Indoor Pot Plant $2 ^ { \circ }$ by 3dhaupt from Free3D (non-commercial) [15].
197
+
198
+ For funding, Matthew O’Toole acknowledges support from NSF IIS-2008464, James Tompkin thanks an Amazon Research Award and NSF CNS-2038897, and Christian Richardt acknowledges funding from an EPSRC-UKRI Innovation Fellowship (EP/S001050/1) and RCUK grant CAMERA (EP/M023281/1, EP/T022523/1).
199
+
200
+ # References
201
+
202
+ [1] Supreeth Achar, Joseph R. Bartels, William L. ‘Red’ Whittaker, Kiriakos N. Kutulakos, and Srinivasa G. Narasimhan. Epipolar time-of-flight imaging. ACM Trans. Graph., 36(4):37:1–8, 2017. doi:10.1145/3072959.3073686.
203
+ [2] Robert Anderson, David Gallup, Jonathan T. Barron, Janne Kontkanen, Noah Snavely, Carlos Hernandez, Sameer Agarwal, and Steven M. Seitz. Jump: Virtual reality video. ACM Trans. Graph., 35(6):198:1–13, 2016. doi:10.1145/2980179.2980257.
204
+ [3] Benjamin Attal, Selena Ling, Aaron Gokaslan, Christian Richardt, and James Tompkin. MatryODShka: Real-time 6DoF video view synthesis using multi-sphere images. In ECCV, 2020. doi:10.1007/978-3-030- 58452-8_26.
205
+ [4] Tobias Bertel, Mingze Yuan, Reuben Lindroos, and Christian Richardt. OmniPhotos: Casual $3 6 0 ^ { \circ }$ VR photography. ACM Trans. Graph., 39(6):267:1–12, 2020. doi:10.1145/3414685.3417770.
206
+ [5] Sai Bi, Zexiang Xu, Pratul Srinivasan, Ben Mildenhall, Kalyan Sunkavalli, Miloš Hašan, Yannick HoldGeoffroy, David Kriegman, and Ravi Ramamoorthi. Neural reflectance fields for appearance acquisition. arXiv:2008.03824, 2020.
207
+ [6] Benedikt Bitterli. Rendering resources, 2016. URL https://benedikt-bitterli.me/resources/.
208
+ [7] Michael Broxton, John Flynn, Ryan Overbeck, Daniel Erickson, Peter Hedman, Matthew DuVall, Jason Dourgarian, Jay Busch, Matt Whalen, and Paul Debevec. Immersive light field video with a layered mesh representation. ACM Trans. Graph., 39(4):86:1–15, 2020. doi:10.1145/3386569.3392485.
209
+ [8] Chris Buehler, Michael Bosse, Leonard McMillan, Steven Gortler, and Michael Cohen. Unstructured lumigraph rendering. In SIGGRAPH, pages 425–432, 2001. doi:10.1145/383259.383309.
210
+ [9] Paul Debevec, Yizhou Yu, and George Borshukov. Efficient view-dependent image-based rendering with projective texture-mapping. In Proceedings of the Eurographics Workshop on Rendering, pages 105–116, 1998. doi:10.1007/978-3-7091-6453-2_10.
211
+ [10] Chen Gao, Ayush Saraf, Johannes Kopf, and Jia-Bin Huang. Dynamic view synthesis from dynamic monocular video. In ICCV, 2021.
212
+ [11] Steven J. Gortler, Radek Grzeszczuk, Richard Szeliski, and Michael F. Cohen. The lumigraph. In SIGGRAPH, pages 43–54, 1996. doi:10.1145/237170.237200.
213
+ [12] Mohit Gupta, Shree K. Nayar, Matthias B. Hullin, and Jaime Martin. Phasor imaging: A generalization of correlation-based time-of-flight imaging. ACM Trans. Graph., 34(5):156:1–18, 2015. doi:10.1145/2735702.
214
+ [13] Felipe Gutierrez-Barragan, Syed Azer Reza, Andreas Velten, and Mohit Gupta. Practical coding function design for time-of-flight imaging. In CVPR, pages 1566–1574, 2019.
215
+ [14] Miles Hansard, Seungkyu Lee, Ouk Choi, and Radu Patrice Horaud. Time-of-Flight Cameras: Principles, Methods and Applications. Springer, 2012. doi:10.1007/978-1-4471-4658-2.
216
+ [15] Dennis Haupt. Indoor Pot Plant 2, November 2019. URL https://free3d.com/3d-model/ indoor-pot-plant-77983.html. Non-commercial use only.
217
+ [16] Peter Hedman, Suhib Alsisan, Richard Szeliski, and Johannes Kopf. Casual 3D photography. ACM Trans. Graph., 36(6):234:1–15, 2017. doi:10.1145/3130800.3130828.
218
+ [17] Adrian Jarabo, Julio Marco, Adolfo Muñoz, Raul Buisan, Wojciech Jarosz, and Diego Gutierrez. A framework for transient rendering. ACM Trans. Graph., 33(6):177:1–10, 2014. doi:10.1145/2661229.2661251.
219
+ [18] Walter Koechner. Optical ranging system employing a high power injection laser diode. IEEE Transactions on Aerospace and Electronic Systems, 4(1):81–91, 1968. doi:10.1109/TAES.1968.5408936.
220
+ [19] Andreas Kolb, Erhardt Barth, Reinhard Koch, and Rasmus Larsen. Time-of-flight cameras in computer graphics. Comput. Graph. Forum, 29(1):141–159, 2010. doi:10.1111/j.1467-8659.2009.01583.x.
221
+ [20] Johannes Kopf, Xuejian Rong, and Jia-Bin Huang. Robust consistent video depth estimation. In CVPR, 2021.
222
+ [21] George Alex Koulieris, Kaan Ak¸sit, Michael Stengel, Rafał K. Mantiuk, Katerina Mania, and Christian Richardt. Near-eye display and tracking technologies for virtual and augmented reality. Comput. Graph. Forum, 38(2):493–519, 2019. doi:10.1111/cgf.13654.
223
+ [22] Alexandre Lacoste, Alexandra Luccioni, Victor Schmidt, and Thomas Dandres. Quantifying the carbon emissions of machine learning. arXiv:1910.09700, 2019.
224
+ [23] Marc Levoy and Pat Hanrahan. Light field rendering. In SIGGRAPH, pages 31–42, 1996. doi:10.1145/237170.237199.
225
+ [24] Tianye Li, Mira Slavcheva, Michael Zollhöfer, Simon Green, Christoph Lassner, Changil Kim, Tanner Schmidt, Steven Lovegrove, Michael Goesele, and Zhaoyang Lv. Neural 3D video synthesis. arXiv:2103.02597, 2021.
226
+ [25] You Li and Javier Ibanez-Guzman. Lidar for autonomous driving: The principles, challenges, and trends for automotive lidar and perception systems. IEEE Signal Processing Magazine, 37(4):50–61, 2020. doi:10.1109/MSP.2020.2973615.
227
+ [26] Zhengqi Li, Simon Niklaus, Noah Snavely, and Oliver Wang. Neural scene flow fields for space-time view synthesis of dynamic scenes. In CVPR, 2021.
228
+ [27] Patrick Lichtsteiner, Christoph Posch, and Tobi Delbruck. A $1 2 8 \times 1 2 8$ 120 db $1 5 \mu \mathrm { s }$ latency asynchronous temporal contrast vision sensor. IEEE Journal of Solid-State Circuits, 43(2):566–576, 2008. doi:10.1109/JSSC.2007.914337.
229
+ [28] Xuan Luo, Jia-Bin Huang, Richard Szeliski, Kevin Matzen, and Johannes Kopf. Consistent video depth estimation. ACM Trans. Graph., 39(4):71:1–13, 2020. doi:10.1145/3386569.3392377.
230
+ [29] Morgan McGuire. Computer Graphics Archive, July 2017. URL https://casual-effects.com/data.
231
+ [30] Moustafa Meshry, Dan B Goldman, Sameh Khamis, Hugues Hoppe, Rohit Pandey, Noah Snavely, and Ricardo Martin-Brualla. Neural rerendering in the wild. In CVPR, 2019. doi:10.1109/CVPR.2019.00704.
232
+ [31] Ben Mildenhall, Pratul P. Srinivasan, Rodrigo Ortiz-Cayon, Nima Khademi Kalantari, Ravi Ramamoorthi, Ren Ng, and Abhishek Kar. Local light field fusion: Practical view synthesis with prescriptive sampling guidelines. ACM Trans. Graph., 38(4):29:1–14, 2019. doi:10.1145/3306346.3322980.
233
+ [32] Ben Mildenhall, Pratul P. Srinivasan, Matthew Tancik, Jonathan T. Barron, Ravi Ramamoorthi, and Ren Ng. NeRF: Representing scenes as neural radiance fields for view synthesis. In ECCV, 2020. doi:10.1007/978- 3-030-58452-8_24.
234
+ [33] Marek Moravec. Architectural visualization—Blender demo scene, November 2019. URL https: //www.blender.org/download/demo-files/. CC-0 Public Domain.
235
+ [34] Thu Nguyen-Phuoc, Chuan Li, Lucas Theis, Christian Richardt, and Yong-Liang Yang. HoloGAN: Unsupervised learning of 3D representations from natural images. In ICCV, 2019. doi:10.1109/ICCV.2019.00768.
236
+ [35] Matthew O’Toole, Felix Heide, Lei Xiao, Matthias B. Hullin, Wolfgang Heidrich, and Kiriakos N. Kutulakos. Temporal frequency probing for 5D transient analysis of global light transport. ACM Trans. Graph., 33(4):87:1–11, 2014. doi:10.1145/2601097.2601103.
237
+ [36] Ryan Styles Overbeck, Daniel Erickson, Daniel Evangelakos, Matt Pharr, and Paul Debevec. A system for acquiring, compressing, and rendering panoramic light field stills for virtual reality. ACM Trans. Graph., 37(6):197:1–15, 2018. doi:10.1145/3272127.3275031.
238
+ [37] Keunhong Park, Utkarsh Sinha, Jonathan T. Barron, Sofien Bouaziz, Dan B Goldman, Steven M. Seitz, and Ricardo-Martin Brualla. Nerfies: Deformable neural radiance fields. In ICCV, 2021.
239
+ [38] Albert Parra Pozo, Michael Toksvig, Terry Filiba Schrager, Joyse Hsu, Uday Mathur, Alexander SorkineHornung, Rick Szeliski, and Brian Cabral. An integrated 6DoF video camera and system design. ACM Trans. Graph., 38(6):216:1–16, 2019. doi:10.1145/3355089.3356555.
240
+ [39] Adithya Pediredla, Ashok Veeraraghavan, and Ioannis Gkioulekas. Ellipsoidal path connections for time-gated rendering. ACM Trans. Graph., 38(4):38:1–12, 2019. doi:10.1145/3306346.3323016.
241
+ [40] Matt Pharr, Wenzel Jakob, and Greg Humphreys. Physically Based Rendering: From Theory to Implementation. Elsevier Science, 3rd edition, 2016. ISBN 9780128007099. URL https://www.pbr-book.org/.
242
+ [41] Kari Pulli, Michael F. Cohen, Tom Duchamp, Hugues Hoppe, Linda Shapiro, and Werner Stuetzle. Viewbased rendering: Visualizing real objects from scanned range and color data. In Proceedings of the Eurographics Workshop on Rendering, pages 23–34, 1997. doi:10.1007/978-3-7091-6858-5_3.
243
+ [42] Albert Pumarola, Enric Corona, Gerard Pons-Moll, and Francesc Moreno-Noguer. D-NeRF: Neural radiance fields for dynamic scenes. In CVPR, 2021.
244
+ [43] Malcolm Reynolds, Jozef Doboš, Leto Peel, Tim Weyrich, and Gabriel J Brostow. Capturing time-of-flight data with confidence. In CVPR, pages 945–952, 2011. doi:10.1109/CVPR.2011.5995550.
245
+ [44] Christopher Schroers, Jean-Charles Bazin, and Alexander Sorkine-Hornung. An omnistereoscopic video pipeline for capture and display of real-world VR. ACM Trans. Graph., 37(3):37:1–13, 2018. doi:10.1145/3225150.
246
+ [45] Johannes L. Schönberger and Jan-Michael Frahm. Structure-from-motion revisited. In CVPR, pages 4104–4113, 2016. doi:10.1109/CVPR.2016.445.
247
+ [46] Siyuan Shen, Zi Wang, Ping Liu, Zhengqing Pan, Ruiqian Li, Tian Gao, Shiying Li, and Jingyi Yu. Non-line-of-sight imaging via neural transient fields. TPAMI, 43(7):2257–2268, 2021. doi:10.1109/TPAMI.2021.3076062.
248
+ [47] Vincent Sitzmann, Justus Thies, Felix Heide, Matthias Nießner, Gordon Wetzstein, and Michael Zollhöfer. DeepVoxels: Learning persistent 3D feature embeddings. In CVPR, pages 2437–2446, 2019. doi:10.1109/CVPR.2019.00254.
249
+ [48] Vincent Sitzmann, Michael Zollhöfer, and Gordon Wetzstein. Scene representation networks: Continuous 3D-structure-aware neural scene representations. In NeurIPS, 2019.
250
+ [49] Ayush Tewari, Ohad Fried, Justus Thies, Vincent Sitzmann, Stephen Lombardi, Kalyan Sunkavalli, Ricardo Martin-Brualla, Tomas Simon, Jason Saragih, Matthias Nießner, Rohit Pandey, Sean Fanello, Gordon Wetzstein, Jun-Yan Zhu, Christian Theobalt, Maneesh Agrawala, Eli Shechtman, Dan B Goldman, and Michael Zollhöfer. State of the art on neural rendering. Comput. Graph. Forum, 39(2):701–727, 2020. doi:10.1111/cgf.14022.
251
+ [50] Edgar Tretschk, Ayush Tewari, Vladislav Golyanik, Michael Zollhöfer, Christoph Lassner, and Christian Theobalt. Non-rigid neural radiance fields: Reconstruction and novel view synthesis of a deforming scene from monocular video. In ICCV, 2021.
252
+ [51] Richard Tucker and Noah Snavely. Single-view view synthesis with multiplane images. In CVPR, 2020. doi:10.1109/CVPR42600.2020.00063.
253
+ [52] Wenqi Xian, Jia-Bin Huang, Johannes Kopf, and Changil Kim. Space-time neural irradiance fields for free-viewpoint video. In CVPR, 2021.
254
+ [53] Zexiang Xu, Sai Bi, Kalyan Sunkavalli, Sunil Hadap, Hao Su, and Ravi Ramamoorthi. Deep view synthesis from sparse photometric images. ACM Trans. Graph., 38(4):76:1–13, 2019. doi:10.1145/3306346.3323007.
255
+ [54] Lior Yariv, Yoni Kasten, Dror Moran, Meirav Galun, Matan Atzmon, Ronen Basri, and Yaron Lipman. Multiview neural surface reconstruction by disentangling geometry and appearance. In NeurIPS, 2020.
256
+ [55] Jae Shin Yoon, Kihwan Kim, Orazio Gallo, Hyun Soo Park, and Jan Kautz. Novel view synthesis of dynamic scenes with globally coherent depths from a monocular camera. In CVPR, 2020. doi:10.1109/CVPR42600.2020.00538.
257
+ [56] Jiakai Zhang, Xinhang Liu, Xinyi Ye, Fuqiang Zhao, Yanshun Zhang, Minye Wu, Yingliang Zhang, Lan Xu, and Jingyi Yu. Editable free-viewpoint video using a layered neural representation. ACM Trans. Graph., 2021. doi:10.1145/3450626.3459756.
258
+ [57] Tinghui Zhou, Richard Tucker, John Flynn, Graham Fyffe, and Noah Snavely. Stereo magnification: Learning view synthesis using multiplane images. ACM Trans. Graph., 37(4):65:1–12, 2018. doi:10.1145/3197517.3201323.
md/train/DILxQP08O3B/DILxQP08O3B.md ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VTNET: VISUAL TRANSFORMER NETWORK FOR OBJECT GOAL NAVIGATION
2
+
3
+ Heming $\mathbf { D } \mathbf { u } ^ { 1 , 3 }$ , Xin $\mathbf { Y } \mathbf { u } ^ { 2 * } \mathbf { \& }$ Liang Zheng1
4
+
5
+ 1Australian National University
6
+ 2University of Technology Sydney
7
+ 3CSIRO-DATA61
8
+ {heming.du, liang.zheng}@anu.edu.au, xin.yu@uts.edu.au
9
+
10
+ # ABSTRACT
11
+
12
+ Object goal navigation aims to steer an agent towards a target object based on observations of the agent. It is of pivotal importance to design effective visual representations of the observed scene in determining navigation actions. In this paper, we introduce a Visual Transformer Network (VTNet) for learning informative visual representation in navigation. VTNet is a highly effective structure that embodies two key properties for visual representations: First, the relationships among all the object instances in a scene are exploited; Second, the spatial locations of objects and image regions are emphasized so that directional navigation signals can be learned. Furthermore, we also develop a pre-training scheme to associate the visual representations with navigation signals, and thus facilitate navigation policy learning. In a nutshell, VTNet embeds object and region features with their location cues as spatial-aware descriptors and then incorporates all the encoded descriptors through attention operations to achieve informative representation for navigation. Given such visual representations, agents are able to explore the correlations between visual observations and navigation actions. For example, an agent would prioritize “turning right” over “turning left” when the visual representation emphasizes on the right side of activation map. Experiments in the artificial environment AI2-Thor demonstrate that VTNet significantly outperforms state-of-the-art methods in unseen testing environments.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ The goal of target-driven visual navigation is to guide an agent to reach instances of a given target category based on its monocular observations of an environment. Thus, it is highly desirable to achieve an informative visual representation of the observation, which is correlated to directional navigation signals. In this paper, we propose a Visual Transformer Network (VTNet) to achieve an expressive visual representation. In our VTNet, we develop a Visual Transformer (VT) to extract image descriptors from visual observations and then decode visual representations of the observed scenes. Then, we present a pre-training scheme to associate visual representations with directional navigation signals, thus making the representations informative for navigation. After pre-training, our visual representations are fed to a navigation policy network and we train our entire network in an end-to-end manner. In particular, our VT exploits two newly designed spatial-aware descriptors as the key and query, (i.e., a spatial-enhanced local descriptor and a positional global descriptor) and then encodes them to achieve an expressive visual representation.
17
+
18
+ Our spatial-enhanced local descriptor is developed to fully take advantage of all detected objects for the exploration of spatial and category relationships among instances. Unlike the prior work (Du et al., 2020) that only leverages one instance per class to mine the category relationship, our VT is able to exploit the relationship of all the detected instances. To this end, we employ an object detector DETR (Carion et al., 2020) since features extracted from DETR not only encode object appearance information, such as class labels and bounding boxes, but also contain the relations between instances and global contexts. Moreover, DETR features are scale-invariant (output from the same layer) in comparison to features used in ORG (Du et al., 2020). Considering that object positions cannot be explicitly decoded without the feed-forward layer of DETR, we therefore enhance all the detected instance features with their locations to obtain spatial-enhanced local descriptors. Then, we take all the spatial-enhanced local descriptors as the key of our VT encoder to model the relationships among detected instances, such as category concurrence and spatial correlations.1
19
+
20
+ ![](images/86a0fb60ac26762e8a9aaf49b2f709c2b1c688b7a2475712edb352c7ff230f70.jpg)
21
+ Figure 1: Motivation of the Visual Transformer Network (VTNet). A target class (cellphone) is highlighted by green bounding boxes. An agent first detects objects of interest from its observation. Then, the agent attends detected objects to the global observation by the visual transformer (VT). High attention scores are achieved on the left side of the observation, which correspond to the target (cellphone). Then, the agent will choose RotateLeft to reach targets.
22
+
23
+ Furthermore, we introduce a positional global descriptor as the query for our VT decoder. In particular, we associate the region features with image region positions (such as bottom and top) and thus facilitate exploring the correspondences between navigation actions and image regions. To do so, we divide a global observation into multiple regions based on spatial layouts and assign a positional embedding to each region feature as our spatial-enhanced global descriptor. After obtaining the global query descriptor, we attend the spatial-enhanced local descriptor to the positional global descriptor query to learn the relationship between instances and observation regions via our VT decoder.
24
+
25
+ However, we found directly training our VTNet with a navigation policy network fails to converge due to the training difficulty of the transformers (Vaswani et al., 2017). Therefore, we present a pretraining scheme to associate visual representations and directional navigation signals. We endow our VT with the capability of encoding directional navigation signals by imitating expert experience. After warming-up through human instructions, VT can learn instructional representations for navigation, as illustrated in Figure 1.
26
+
27
+ After pre-training our VT, we employ a standard Long Short Term Memory (LSTM) network to map the current visual representation and previous states to an agent action. We adopt A3C architecture (Mnih et al., 2016) to learn the navigation policy. Once our VTNet has been fully trained, our agent can exploit the correlations between observations and navigation actions to improve visual navigation efficiency. In the popular widely-used navigation environment AI2-Thor (Kolve et al., 2017), our method significantly outperforms the state-of-the-art. Our contributions are summarized as follows:
28
+
29
+ • We propose a novel Visual Transformer Network (VTNet) to extract informative feature representations for visual navigation. Our visual representations not only encode relationships among objects but also establish strong correlations with navigation signals. • We introduce a positional global descriptor and a spatial-enhanced local descriptor as the query and key for our visual transformer (VT), and then the visual representations decoded by our VT are attended to navigation actions via our presented pre-training scheme, thus providing a good initialization for our VT. Experimental results demonstrate that our learned visual representation significantly improves the efficiency of the state-of-the-art visual navigation systems in unseen environments by $1 4 . 0 \%$ relatively on Success Weighted by Path Length (SPL).
30
+
31
+ # 2 RELATED WORKS
32
+
33
+ Visual navigation, as a fundamental task in robotic and artificial intelligence, has attracted increasing attention recently. Traditional methods (Oriolo et al., 1995) often leverage environment maps for navigation and divide a navigation task into three steps: mapping, localization and path planning. Some approaches employ a given map to obviate obstructions (Borenstein & Koren, 1989; 1991). Dissanayake et al. (2001) infer robot positions by simultaneous localization and mapping (SLAM). However, maps are usually unavailable in unseen environments.
34
+
35
+ Recently, reinforcement learning (RL) has been applied in visual navigation. In general, it takes visual observations as inputs and predicts navigation actions directly. Mirowski et al. (2016) develop a navigation approach in 3D maze environments and introduce depth prediction and loop closure classification tasks to improve navigation performance. Parisotto & Salakhutdinov (2017) investigate a memory system to navigate in mazes. Some methods (Sepulveda et al., 2018; Chen et al., 2019; Savinov et al., 2018) use both visual features and the topological guidance of scenes for navigation, while natural-language instructions are employed to guide an agent to route among rooms (Anderson et al., 2018b; Wang et al., 2019; Deng et al., 2020; Hu et al., 2019; Majumdar et al., 2020; Hao et al., 2020). We notice that transformer architectures are also employed by Hao et al. (2020), named Prevalenet. However, Prevalenet is used to model languages and predict camera angles rather than encoding local and global visual features. Hence, Prevalenet is essentially different from our VT. Furthermore, Kahn et al. (2018) design a self-supervised approach to model environments by reinforcement learning. Tang et al. (2021) customize a specialized network for visual navigation via an Auto-Navigator. A Bayesian relational memory is introduced by Wu et al. (2019) to explore the spatial layout among rooms rather than steering an agent to desired objects with least steps. Meanwhile, Shen et al. (2019) employ multiple visual representations to generate multiple actions and then fuse those actions to produce an effective one. However, requesting such a large number of visual representations may restrict the transferring ability of a navigation system and increases the difficulty of data labeling. Note that Fang et al. (2019) propose a transformer to select the embedded scene memory slot, while our VT is designed to learn expressive visual representations correlated with directional signals.
36
+
37
+ Target-oriented visual navigation methods aim at steering an agent to object instances of a specified category in an unseen environment using least steps. Zhu et al. (2017) search a target object given in an image by employing RL to produce navigation actions based on visual observations. Mousavian et al. (2019) take semantic segmentation and detection masks as visual representations and also employ RL to learn navigation policies. Yang et al. (2018) exploit relationships among object categories for navigation, but they need an external knowledge database to construct such relationships. Wortsman et al. (2019) exploit word embedding (i.e., GloVe embedding) to represent the target category and introduce a meta network mimicking a reward function for navigation. Furthermore, Du et al. (2020) introduce an object relation graph, dubbed ORG, to encode visual observations and design a tentative policy for deadlock avoidance during navigation. In ORG, object features are extracted from the second layer of the backbone in Faster R-CNN (Ren et al., 2015) and thus not the most prominent ones across the feature pyramid. Additionally, ORG chooses one instance with the highest confidence per category from detection results, and it may be affected by the false positive.
38
+
39
+ # 3 VISUAL NAVIGATION REVISIT
40
+
41
+ In this section, we mainly revisit the definition of object goal navigation and its general pipeline.
42
+
43
+ # 3.1 TASK DEFINITION AND SETUP
44
+
45
+ In this object goal visual navigation task, prior knowledge about the environment, i.e. topological map and 3D meshes, and additional sensors, i.e. depth cameras, are not available to an agent. RGB images in an egocentric view are the only available source to an agent, and the agent predicts its actions based on the current view and previous states. Following the works (Wortsman et al., 2019; Du et al., 2020), an environment is divided into grids and agents move between grid points via 6 different actions, consist of MoveAhead, RotateLeft, RotateRight, LookUp, LookDown, Done. To be specific, the forward step size is 0.25 meters, and the angles of turningleft/right and looking-up/down are $4 5 ^ { \circ }$ and $3 0 ^ { \circ }$ , respectively. An episode is defined as a success when the following three requirements are met simultaneously: (i) the agent chooses the ending action Done within allowed steps; (ii) a target is in the view of the agent; (iii) the distance between the agent and the target is less than the threshold (i.e. 1.5 meters). Otherwise, the episode will be regarded as a failure.
46
+
47
+ ![](images/85dce5151b107d0a73f73d73188d5dda8fdfe1d2ab60e5268c317add7a8211f8.jpg)
48
+ Figure 2: Overview of our visual transformer navigation system. Our visual transformer navigation network (VTNet) involves a visual transformer (VT) and a navigation policy network. The agent first fuses instance features and spatial features into spatial-enhanced local descriptor. Meanwhile, the positional global descriptor is obtained by adding a positional embedding to the global feature. Then the visual representation is decoded from these two spatial-aware descriptors by our VT. Our VTNet is pre-trained with the supervision of optimal navigation actions. The navigation policy network adopts A3C architecture and is trained with navigation rewards after pre-training.
49
+
50
+ A target class $T \in \{ S i n k , \ldots , M i c r o w a v e \}$ and a start state $s = \{ x , y , \theta _ { r } , \theta _ { h } \}$ are set randomly at the beginning of each episode, where $x$ and $y$ represent the coordinates, $\theta _ { r }$ and $\theta _ { h }$ indicate the view of a monocular camera. At each timestamp $t$ , the agent records the observed RGB image $O _ { t }$ from its monocular camera. Given the observation $O _ { t }$ and the previous state $h _ { t }$ , the agent employs a visual navigation network to generate a policy $\pi ( a _ { t } | O _ { t } , h _ { t } )$ , where $a _ { t }$ represents the distribution of actions at time $t$ . The agent selects the action with the highest probability for navigation.
51
+
52
+ # 3.2 PIPELINE
53
+
54
+ A typical pipeline of visual navigation consists of two parts, visual representation learning and navigation policy learning. (i) Visual representation learning: To encode the current observation in a compact way, existing works extract visual features from an image and then transform them into a vector-based representation, where direct concatenation (Wortsman et al., 2019) or graph embedding (Du et al., 2020) are used. (ii) Navigation driven by visual features: Once visual features are extracted, a navigation policy network that generates an action in each step for an agent will be learned. There are several ways to learn policy networks, such as Q-learning (Watkins & Dayan, 1992), PPO (Schulman et al., 2017) and A3C (Mnih et al., 2016). As navigation policy learning is not our focus, we adopt the standard Asynchronous Advantage Actor-Critic (A3C) architecture (Mnih et al., 2016). The navigation policy network takes the combination of the current visual representation, the previous action and state embedding as input, and outputs the action distribution and value. The agent selects actions with the highest probability from the predicted policy and uses the predicted value to train the navigation policy network.
55
+
56
+ # 4 PROPOSED VISUAL TRANSFORMER NETWORK
57
+
58
+ As illustrated in Figure 2, our visual navigation system includes two parts: (i) learning visual representations from RGB observations; (ii) learning navigation policy from the visual representations and previous states. In our VTNet, we introduce a visual transformer (VT) in the first part to explore the relationship among all objects and their spatial correlations. In VT, we further design two spatial-aware descriptors, i.e., a spatial-enhanced local descriptor and a positional global descriptor, to allow us extract visual information effectively. Then, our VT fuses these two types of descriptors with a multi-head attention operation to produce final visual representations. Moreover, our VT enforces visual representations to be highly correlated to navigation signals via our developed pre-training scheme, thus easing the training difficulty of VT and facilitating navigation policy learning.
59
+
60
+ # 4.1 SPATIAL-ENHANCED LOCAL DESCRIPTOR
61
+
62
+ To learn the relationship among all the instances, we first perform object detection and locate all the object instances of interest by a detector DETR (Carion et al., 2020). DETR transforms $N$ encoded $d$ -dimension features $\mathbb { R } ^ { N \times d }$ from the same layer to $N$ detection results, including the bounding boxes, confidence and semantic labels by a feed forward network. Note that ORG (Du et al., 2020) extracts object features from the second layer of the backbone in Faster R-CNN based on the predicted bounding-boxes rather than the penultimate layer of the classifier in Faster R-CNN as in the work (Anderson et al., 2018a). Hence, ORG features are not the most prominent ones across the feature pyramid and scale-sensitive. In contrast, features extracted by DETR not only contain bounding-boxes and class labels but also are scale-robust as features are aligned by DETR decoder, i.e., output from the penultimate layer.
63
+
64
+ Remark. Benefiting from our VT, we leverage all the information of the detected objects while Du et al. (2020) only select the proposal with the highest confidence in each category. Therefore, the agents in ORG will miss important information from other objects of the same class or might be severely affected if selected proposals are false positive. In contrast, our VT preserves all the information, and thus our agents are able to exploit the relationship among instances. This makes our visual representation more comprehensive and essentially different from prior works.
65
+
66
+ Our local spatial feature is obtained by concatenating the normalized bounding box, confidence and top-rated semantic label for each object. To indicate the target class to an agent, we also concatenate a one-hot encoded target vector $\mathbb { R } ^ { N \times 1 }$ with our spatial feature $\mathbb { R } ^ { N \times 7 }$ . After obtaining the instance feature and spatial feature, we employ a multi-layer perceptron (MLP) (i.e., two fully-connected layers with ReLU) and fuse them to a spatial-enhanced local descriptor $\dot { L } \in \mathbb { R } ^ { N \times d }$ so as to act as the key of our VT encoder.
67
+
68
+ # 4.2 POSITIONAL GLOBAL DESCRIPTOR
69
+
70
+ In addition to the spatial-enhanced local descriptor, agents require a global feature to describe the surrounding environment. Similar to SAVN (Wortsman et al., 2019), we adopt ResNet18 (He et al., 2016) pretrained on ImageNet (Deng et al., 2009) to extract global features of the observations. Given a global feature $\mathbb { R } ^ { h \times w \times D }$ , we first employ $1 \times 1$ convolution to reduce the channel dimension of a high-level activation map from $D$ to a smaller dimension $d$ , where $h$ and $w$ represent the height and width of activation maps, respectively. This ensures that global descriptors have the same dimension as the key of our VT.
71
+
72
+ Unlike previous works that directly concatenate a global feature as a part of the visual representation, we introduce a positional global descriptor as the query in our VT decoder. A region feature only represents visual contents in each region. To emphasize the region position information, we incorporate a positional embedding to each region feature. Then we add positional encoding $\mathbb { R } ^ { h \times w \times d }$ to the global feature. Let $u$ and $v$ represent the row and column indexes of an image region respectively, and $i$ is the index along the dimension $d$ . Our positional embedding is expressed as:
73
+
74
+ $$
75
+ P E _ { 2 i } ( u , v ) = \left\{ \begin{array} { l l } { \sin ( \frac { u } { 1 0 0 0 0 ^ { 2 i / d } } ) , 0 < i \leq \frac { d } { 2 } } \\ { \sin ( \frac { v } { 1 0 0 0 0 ^ { 2 i / d } } ) , \frac { d } { 2 } < i \leq d } \end{array} \right. P E _ { 2 i + 1 } ( u , v ) = \left\{ \begin{array} { l l } { \cos ( \frac { u } { 1 0 0 0 0 ^ { 2 i / d } } ) , 0 < i \leq \frac { d } { 2 } } \\ { \cos ( \frac { v } { 1 0 0 0 0 ^ { 2 i / d } } ) , \frac { d } { 2 } < i \leq d } \end{array} \right.
76
+ $$
77
+
78
+ Therefore, each global feature represents one particular region of the observation. Finally, we reshape positional embedded global features into a matrix-based representation, namely positional global descriptor G ∈ Rhw×d.
79
+
80
+ # 4.3 VISUAL TRANSFORMER
81
+
82
+ After obtaining our extracted spatial-enhanced and positional global descriptors, we introduce our visual transformer.
83
+
84
+ Encoder. In order to exploit the spatial relationship between detected instances and observed regions, we attend spatial-enhanced local descriptors to positional global descriptors via a transformer. We first feed the spatial-enhanced local descriptors into the encoder as keys and values by employing multi-head self-attention. Following the transformer architecture (Vaswani et al., 2017; Fan et al., 2021), each encoder layer consists of a multi-head self-attention module and a feed-forward layer.
85
+
86
+ Decoder. Inspired by human navigation behaviors, we aim to explore the correspondences between observation regions and navigation actions. For example, once an agent notices a target lying on the right side of the field of view, it should prioritize to select RotateRight instead of RotateLeft. Since each positional global descriptor corresponds to a certain region of the observation, we refer to the positional global descriptor as the location query and feed the query into the decoder. Given positional global descriptor $G$ and encoded spatial-enhanced local descriptor $L ^ { \prime }$ , our attention function of visual transformer decoder is expressed as:
87
+
88
+ $$
89
+ A t t e n t i o n ( G , L ^ { \prime } ) = s o f t m a x ( \frac { G L ^ { \prime T } } { \sqrt { d } } L ^ { \prime } ) .
90
+ $$
91
+
92
+ # 4.4 PRE-TRAINING VISUAL TRANSFORMER
93
+
94
+ We observed that directly feeding the decoded representation from our VT to a navigation network, we fail to learn successful navigation policy. This is mainly because training a deep VT is very difficult especially when the supervision signals are provided by a weak reward from reinforcement learning. Therefore, the decoded features might be uninformative and confuse an agent. The agent would prefer to choose the termination action (often around 5 steps in our experiments) in order to reduce penalties from reinforcement learning.
95
+
96
+ To address the aforementioned issue, we propose a pre-training scheme for our VT. To be specific, we enforce the decoded features to be expressive by introducing an imitation learning task, as seen in Figure 2. Concretely, human navigation behaviors can be predicted from the decoded representations in a step-wise fashion. We use Dijkstra’s Shortest Path First algorithm to generate optimal action instructions as human expert experience. Under the supervision of optimal action instructions, our VT learns to imitate the optimal navigation action selection.
97
+
98
+ In the pre-training stage, we do not employ our navigation network (i.e., LSTM), and previous actions as well as states are not available. Note that, in our navigation network, previous actions, previous states and current visual representations are exploited, as seen in Figure 2. Thus, we replace our LSTM with an MLP and predict action distributions based on the current visual representation. A cross-entropy loss $\boldsymbol { L _ { v t } } = \boldsymbol { C E } ( \boldsymbol { a _ { t } } , \boldsymbol { \hat { a } } )$ is employed to train our VT and the MLP, where $a _ { t }$ is the predicted action, $\hat { a }$ represents the optimal action instruction and $C E$ indicates the cross-entropy function. After pre-training, features from our VT also exhibit strong association with directional navigation signals as only an MLP is employed on top of the features. Therefore, the decoded features will facilitate the navigation network training.
99
+
100
+ # 5 EXPERIMENTS
101
+
102
+ # 5.1 PROTOCOLS AND EXPERIMENTAL DETAILS
103
+
104
+ Dataset. We perform our experiments on AI2-Thor (Kolve et al., 2017), an artificial 3D environment with realistic photos. It contains 4 types of scenes, i.e., kitchen, living room, bedroom and bathroom. In each type of scenes, there are 30 different rooms with various furniture placements and items. Following Du et al. (2020), we choose 22 categories as the target classes and ensure that there are at least 4 potential targets in each room.
105
+
106
+ We use the same training and evaluation protocols as the works (Wortsman et al., 2019; Du et al., 2020). 80 rooms out of 120 are selected as the training set while each scene contains 20 rooms.
107
+
108
+ Table 1: Comparison with the state-of-the-art. We report the average success rate $( \% )$ and SPL as well as their variances in parentheses by repeating experiments five times. $L > 5$ represents the episodes which require at least 5 steps.
109
+
110
+ <table><tr><td rowspan="2">Method</td><td colspan="2">ALL</td><td colspan="2">L≥5</td></tr><tr><td>Success</td><td>SPL</td><td>Success</td><td>SPL</td></tr><tr><td>Random</td><td>8.0 (1.3)</td><td>0.036 (0.006)</td><td>0.3 (0.1)</td><td>0.001 (0.001)</td></tr><tr><td>WE</td><td>33.0 (3.5)</td><td>0.147( (0.018)</td><td>21.4 (3.0)</td><td>0.117 (0.019)</td></tr><tr><td>SP (Yang et al., 2018)</td><td>35.1 (1.3)</td><td>0.155 (0.011)</td><td>22.2 (2.7)</td><td>0.114 (0.016)</td></tr><tr><td>SAVN (Wortsman et al.,2019)</td><td>40.8 (1.2)</td><td>0.161 (0.005)</td><td>28.7 (1.5)</td><td>0.139 (0.005)</td></tr><tr><td>ORG (Du et al.,2020)</td><td>65.3 (0.7)</td><td>0.375 (0.008)</td><td>54.8 (1.0)</td><td>0.361 (0.009)</td></tr><tr><td>ORG+TPN (Du et al., 2020)</td><td>69.3 (1.2)</td><td>0.394 (0.010)</td><td>60.7 (1.3)</td><td>0.386 (0.011)</td></tr><tr><td>Baseline</td><td>62.6 (0.9)</td><td>0.364 (0.006)</td><td>51.5 (1.2)</td><td>0.345 (0.007)</td></tr><tr><td>VTNet</td><td>72.2 (1.0)</td><td>0.449 (0.007)</td><td>63.4 (1.1)</td><td>0.440 (0.009)</td></tr><tr><td>VTNet + TPN (Du et al., 2020)</td><td>73.5 (1.3)</td><td>0.440 (0.009)</td><td>63.9 (1.5)</td><td>0.440 (0.011)</td></tr></table>
111
+
112
+ We equally divide the remaining 40 rooms into validation and test sets. We report the results of the testing data by using the model with the highest success rate on the validation set.
113
+
114
+ Evaluation metrics. We evaluate our model performance by success rate and Success Weighted $\textstyle { \frac { 1 } { N } } \sum _ { n = 0 } ^ { N } S _ { n }$ gth (SP, where $N$ . The success rate measures is the number of episodes and $S _ { n }$ gation effectiveneis a success indica and isr of the $n$ o- d byode. We adopt SPL tits optimal path ure the navigation effic, SPL is formulated as $n$ -th episode $L e n _ { n }$ and $L e n _ { o p t }$ $\begin{array} { r } { \frac { 1 } { N } \sum _ { n = 0 } ^ { N } S _ { n } \frac { L e n _ { n } } { m a x ( L e n _ { n } , L e n _ { o p t } ) } } \end{array}$
115
+
116
+ Training details. We use a two-stage training strategy. In Stage 1, we train our visual transformer for 20 epochs with the supervision of optimal action instructions. In this fashion, we explicitly construct the association between visual representations and navigation actions. In Stage 2, we train the navigation policy for 6M episodes in total with 16 asynchronous agents. We set a penalization $- 0 . 0 0 1$ on each action step and a large reward 5 when an agent completes an episode successfully. We adopt DETR as the object detector and fine-tune DETR on the AI2-Thor training dataset. In training DETR, we applied data augmentation, such as resize and random crop. We use the Adam optimizer (Kingma & Ba, 2014) to update the policy network with a learning rate $1 0 ^ { - 4 }$ and the pre-trained VT with a learning rate $1 0 ^ { \div { 5 } }$ . Our codes and pre-trained model will be publicly released for reproducibility.
117
+
118
+ # 5.2 COMPETING METHODS
119
+
120
+ We compare our method with the following ones: Random policy. An agent chooses actions based on a uniform action probability. Thus, the agent will walk or stop in a scene randomly. Scene Prior (SP) (Yang et al., 2018) learns a graph neural network from the FastText database (Joulin et al., 2016) and leverages the scene prior knowledge and category relationships for navigation. Word Embedding (WE) uses GloVe embedding (Pennington et al., 2014) to indicate the target category rather than detection. The association between object appearances and GloVe embeddings is learned through trail and error. Self-adaptive Visual Navigation (SAVN) (Wortsman et al., 2019) introduces a meta reinforcement learning method that allows an agent to adapt to unseen environments. Object Relationship Graph (ORG) (Du et al., 2020) is a visual representation learning method to encode correlation among categories and employs a tentative policy network (TPN) to escape from deadlocks. Baseline is a vanilla version of VTNet. We feed the concatenation of the local instance features from DETR and the global feature to A3C for navigation. Note that, our baseline does not employ spatial-enhanced local and positional global descriptors as well as our visual transformer.
121
+
122
+ # 5.3 EVALUATION RESULTS
123
+
124
+ Improvement over Baseline. Table 1 indicates that VTNet surpasses the baseline by a large margin on both success rate $( + 9 . 6 \% )$ and SPL $( + 0 . 0 8 5 )$ . Baseline only resorts to the detection features and global feature for navigation. The relations among local instances and the association between the visual observations and actions are not exploited. This comparison suggests that our VT leads to informative visual representations for navigation, and thus significantly improves the effectiveness and efficiency of our navigation system.
125
+
126
+ Comparison with competing methods. As indicated in Table 1, we observe that VTNet significantly outperforms SP (Yang et al., 2018) and SAVN (Wortsman et al., 2019). Since SP and SAVN employ word embedding as a target indicator while VTNet replaces word embedding with our VT, our method achieves expressive object and image region representations for navigation. In addition, SP and SAVN concatenate features from various modalities directly to generate visual representations. The gap between different modalities may not facilitate navigation policy learning. In contrast, benefiting from our pre-training, features from our VT are more correlated to navigation actions, thus expediting navigation policy learning.
127
+
128
+ ![](images/71e6a48512317337dfb2274ccebf535ebeeeded09483fadd8a8db86293d96c41.jpg)
129
+ Figure 3: Visual results of four different models in testing environments. The target objects (i.e., RemoteControl) are highlighted by the blue boxes. Green and red curves represent success and failure cases, respectively. The episode produced by our VTNet is successful in reaching the target and use shortest steps. In comparison, ORG takes more steps to reach the target. SAVN and Baseline miss both targets.
130
+
131
+ Our method outperforms the state-of-the-art method ORG (Du et al., 2020) by $+ 2 . 9 \%$ in success rate and $+ 0 . 0 5 5$ in SPL. Moreover, when ORG does not employ TPN, the advantage of our method becomes more obvious $6 . 9 \%$ improvement), and this mainly comes from our superior visual presentations. Since ORG only chooses an object with the highest confidence in each class, the relationship among objects is not comprehensive. On the contrary, our method can exploit all the detected instances to deduce the relationships among objects due to our VT architecture. Moreover, since DETR infers the relations between object instances and the global image context, the local features output by the DETR are more informative compared to the object features used in ORG. This can be proved by the result when we use Faster R-CNN as our backbone, as indicated by Table 2. We also show a case study in Figure 3 (more visual results are provided in the appendix). Furthermore, we also try to employ TPN to improve our navigation policy. As seen in Table 1, VTNet+TPN improves the success rates but the improvement is not as much as $_ \mathrm { O R G + T P N }$ . This also implies that our visual representations significantly facilitate navigation action selections.
132
+
133
+ Case Study. As illustrated in Figure 3, SAVN and Baseline both issue the termination command after navigating a few steps (7 and 19 steps, respectively), but fail to reach the target. This indicates that the relationships among categories are not clear in SAVN and Baseline. In contrast, both ORG and VTNet find the target. Since our visual transformer provides clear directional signals, VTNet uses the least steps to find the object.
134
+
135
+ # 5.4 VARIANT AND ABLATION STUDY
136
+
137
+ In this section, we analyze the impact of each component in VTNet, including the spatial-enhanced local descriptor, positional global descriptor, visual transformer that fuses these two spatial-aware descriptors and pre-training scheme.
138
+
139
+ To illustrate the necessity of the spatial enhancement, we directly use the object features without spatial enhancement. In this case, our network fails to converge because the feed-forward layers that predict bounding-boxes and class labels in DETR are not used in VTNet and spatial information cannot be decoded by the navigation network. Thus, spatial enhancement allows an agent to exploit instance location information explicitly.
140
+
141
+ As indicated in Table 2, we achieve better navigation performance using instance features from DETR compared to employing Faster R-CNN features following the feature extraction of Du et al. (2020) (“Faster R-CNN”). Unlike Faster R-CNN, DETR infers the relations between object instances and the global image context via its transformer to output the final predictions (i.e., class labels and bounding boxes). Although DETR and Faster R-CNN achieve similar detection performance (Carion et al., 2020), features extracted by DETR are more informative and robust than those of Faster R-CNN used in ORG. Specifically, ORG extracts features from the second layer of the backbone in Faster R-CNN based on the predicted bounding-boxes to ensure the features are comparable, but the features are not the most prominent ones across the feature pyramid. Therefore, the object features “Faster R-CNN” extracted by ORG are inferior to DETR features, and our navigator employing DETR features outperforms ORG.
142
+
143
+ Table 2: Impacts of different components on navigation performances. Faster R-CNN and Faster R-CNN† represent instance features extracted by Faster R-CNN following Du et al. (2020) and Anderson et al. (2018a), respectively.
144
+
145
+ <table><tr><td rowspan="2" colspan="2">Method</td><td rowspan="2">w/o global decoder</td><td rowspan="2">w/o</td><td rowspan="2">w/o pe</td><td rowspan="2">VTNetg</td><td colspan="3">Baseline</td><td colspan="3">VTNet</td></tr><tr><td>Faster R-CNN R-CNN</td><td>Faster+</td><td>DETR</td><td>Faster R-CNN R-CNN</td><td>Faster+</td><td>DETR</td></tr><tr><td rowspan="3">ALL</td><td>Success</td><td>67.0</td><td>67.0</td><td>71.0</td><td>70.1</td><td>56.4</td><td>57.2</td><td>62.6</td><td>70.1</td><td>70.3</td><td>72.2</td></tr><tr><td></td><td>(2.8) 0.390</td><td>(1.4) 0.373</td><td>(0.7)</td><td>(1.3) 0.411</td><td>(0.9) 0.319</td><td>(1.1)</td><td>(0.8) 0.365</td><td>(1.0) 0.396</td><td>(1.2)</td><td>(1.0) 0.449</td></tr><tr><td>SPL</td><td>(0.021)</td><td>(0.013)</td><td>0.432 (0.009)</td><td>(0.009)</td><td>(0.007)</td><td>0.308 (0.008)</td><td>(0.010)</td><td>(0.010)</td><td>0.387 (0.012)</td><td>(0.007)</td></tr><tr><td rowspan="3">L≥5</td><td>Success</td><td>54.5</td><td>53.2</td><td>61.2</td><td>60.6</td><td>42.5</td><td>46.7</td><td>51.5</td><td>61.7</td><td>62.1</td><td>63.4</td></tr><tr><td></td><td>(3.1)</td><td>(1.6)</td><td>(0.9)</td><td>(1.5)</td><td>(1.2)</td><td>(1.3)</td><td>(1.0)</td><td>(1.2)</td><td>(1.4)</td><td>(1.1)</td></tr><tr><td>SPL</td><td>0.357</td><td>0.343</td><td>0.416 (0.010)</td><td>0.395</td><td>0.270</td><td>0.276</td><td>0.345</td><td>0.399</td><td>0.376</td><td>0.440</td></tr></table>
146
+
147
+ Moreover, we adopt the instance features from Faster R-CNN following the feature extraction fashion of Anderson et al. (2018a) (“Faster R-CNN†”). Thus, we obtain the instance features from the penultimate layer of the classifier in Faster R-CNN. We observe that instance features from DETR also improve the navigation performance compared to the Faster R-CNN† features. We speculate the improvements mainly come from the fact that the features output by DETR decoder have embedded global context information, and those features are more suitable for the feature fusion operations.
148
+
149
+ As seen in Table 2, we first remove the global feature from our system (“VTNet w/o global”), and the navigation performance degrades significantly. This validates the importance of global features, which provide contextual guidance to an agent. Moreover, when we remove the positional embedding from the global feature (“VTNet w/o pe”), we observe that both effectiveness and efficiency of the navigation decrease. This indicates that the position embeddings facilitate our VT to exploit the spatial information of observation regions. Furthermore, when we remove the VT decoder (“VTNet w/o decoder”) and concatenate the global and local descriptors directly, our method suffers performance degradation. This demonstrates that our VT plays a critical role in attending the global descriptors to local ones. Additionally, we feed the positional global features into the transformer encoder $( ^ { 6 6 } \nabla \mathrm { T N e t } _ { g } ^ { , 9 } )$ . The navigation performance of $\mathrm { V T N e t } _ { g }$ is superior to that of ORG but slightly inferior to the performance of our VTNet. This demonstrates the transformer architecture is effective to extract informative visual representations, and assigning different functions to different modules would further facilitate the establishment of mappings in our VT.
150
+
151
+ When the pre-training scheme is not applied to our VT, our agent fails to learn any effective navigation policy and thus we do not report the performance. This manifests that our VT pre-training procedure provides a good initialization to our transformer and prior knowledge on associating visual observations with navigation actions to agents.
152
+
153
+ # 6 CONCLUSION
154
+
155
+ In this paper, we proposed a powerful visual representation learning method for visual navigation, named Visual Transformer Network (VTNet). In our VTNet, a visual transformer (VT) has been developed to encode visual observations. Our VT leverages two newly designed spatial-aware descriptors, i.e., a spatial-enhanced local object descriptor and a positional global descriptor, and then fuses those two types of descriptors via multi-head attention to achieve our final visual representation. Thanks to our VT architecture, all the detected instances will be exploited for understanding the current observation. Therefore, our visual representation is more informative compared to that used in state-of-the-art navigation methods. Benefiting from our pre-training strategy, our VT is able to associate visual representations with navigation actions, thus significantly expediting navigation policy learning. Extensive results demonstrate that our VTNet outperforms the state-of-the-art in terms of effectiveness and efficiency.
156
+
157
+ # ACKNOWLEDGMENTS
158
+
159
+ This work was supported by the ARC Discovery Early Career Researcher Award (DE200101283), the ARC Discovery Project (DP210102801) and the Data61 Collaborative Research Project.
160
+
161
+ # REFERENCES
162
+
163
+ Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. Bottom-up and top-down attention for image captioning and visual question answering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 6077–6086, 2018a.
164
+
165
+ Peter Anderson, Qi Wu, Damien Teney, Jake Bruce, Mark Johnson, Niko Sunderhauf, Ian Reid, ¨ Stephen Gould, and Anton van den Hengel. Vision-and-language navigation: Interpreting visually-grounded navigation instructions in real environments. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3674–3683, 2018b.
166
+
167
+ Johann Borenstein and Yoram Koren. Real-time obstacle avoidance for fast mobile robots. IEEE Transactions on systems, Man, and Cybernetics, 19(5):1179–1187, 1989.
168
+
169
+ Johann Borenstein and Yoram Koren. The vector field histogram-fast obstacle avoidance for mobile robots. IEEE transactions on robotics and automation, 7(3):278–288, 1991.
170
+
171
+ Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. arXiv preprint arXiv:2005.12872, 2020.
172
+
173
+ Kevin Chen, Juan Pablo de Vicente, Gabriel Sepulveda, Fei Xia, Alvaro Soto, Marynel Vazquez, ´ and Silvio Savarese. A behavioral approach to visual navigation with graph localization networks. arXiv preprint arXiv:1903.00445, 2019.
174
+
175
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
176
+
177
+ Zhiwei Deng, Karthik Narasimhan, and Olga Russakovsky. Evolving graphical planner: Contextual global planning for vision-and-language navigation. Advances in Neural Information Processing Systems, 33, 2020.
178
+
179
+ MWM Gamini Dissanayake, Paul Newman, Steve Clark, Hugh F Durrant-Whyte, and Michael Csorba. A solution to the simultaneous localization and map building (slam) problem. IEEE Transactions on robotics and automation, 17(3):229–241, 2001.
180
+
181
+ Heming Du, Xin Yu, and Liang Zheng. Learning object relation graph and tentative policy for visual navigation. arXiv preprint arXiv:2007.11018, 2020.
182
+
183
+ Hehe Fan, Yi Yang, and Mohan Kankanhalli. Point 4d transformer networks for spatio-temporal modeling in point cloud videos. In 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2021, 2021.
184
+
185
+ Kuan Fang, Alexander Toshev, Li Fei-Fei, and Silvio Savarese. Scene memory transformer for embodied agents in long-horizon tasks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 538–547, 2019.
186
+
187
+ Weituo Hao, Chunyuan Li, Xiujun Li, Lawrence Carin, and Jianfeng Gao. Towards learning a generic agent for vision-and-language navigation via pre-training. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13137–13146, 2020.
188
+
189
+ 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.
190
+
191
+ Ronghang Hu, Daniel Fried, Anna Rohrbach, Dan Klein, Trevor Darrell, and Kate Saenko. Are you looking? grounding to multiple modalities in vision-and-language navigation. arXiv preprint arXiv:1906.00347, 2019.
192
+
193
+ Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. Bag of tricks for efficient text classification. arXiv preprint arXiv:1607.01759, 2016.
194
+
195
+ Gregory Kahn, Adam Villaflor, Bosen Ding, Pieter Abbeel, and Sergey Levine. Self-supervised deep reinforcement learning with generalized computation graphs for robot navigation. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 1–8. IEEE, 2018.
196
+
197
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
198
+
199
+ Eric Kolve, Roozbeh Mottaghi, Winson Han, Eli VanderBilt, Luca Weihs, Alvaro Herrasti, Daniel Gordon, Yuke Zhu, Abhinav Gupta, and Ali Farhadi. AI2-THOR: An Interactive 3D Environment for Visual AI. arXiv, 2017.
200
+
201
+ Liyuan Liu, Xiaodong Liu, Jianfeng Gao, Weizhu Chen, and Jiawei Han. Understanding the difficulty of training transformers. arXiv preprint arXiv:2004.08249, 2020.
202
+
203
+ Arjun Majumdar, Ayush Shrivastava, Stefan Lee, Peter Anderson, Devi Parikh, and Dhruv Batra. Improving vision-and-language navigation with image-text pairs from the web. arXiv preprint arXiv:2004.14973, 2020.
204
+
205
+ Piotr Mirowski, Razvan Pascanu, Fabio Viola, Hubert Soyer, Andrew J Ballard, Andrea Banino, Misha Denil, Ross Goroshin, Laurent Sifre, Koray Kavukcuoglu, et al. Learning to navigate in complex environments. arXiv preprint arXiv:1611.03673, 2016.
206
+
207
+ 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.
208
+
209
+ Arsalan Mousavian, Alexander Toshev, Marek Fiser, Jana Ko ˇ seck ˇ a, Ayzaan Wahid, and James ´ Davidson. Visual representations for semantic target driven navigation. In 2019 International Conference on Robotics and Automation (ICRA), pp. 8846–8852. IEEE, 2019.
210
+
211
+ Giuseppe Oriolo, Marilena Vendittelli, and Giovanni Ulivi. On-line map building and navigation for autonomous mobile robots. In Proceedings of 1995 IEEE International Conference on Robotics and Automation, volume 3, pp. 2900–2906. IEEE, 1995.
212
+
213
+ Emilio Parisotto and Ruslan Salakhutdinov. Neural map: Structured memory for deep reinforcement learning. arXiv preprint arXiv:1702.08360, 2017.
214
+
215
+ Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 1532–1543, 2014.
216
+
217
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in neural information processing systems, pp. 91–99, 2015.
218
+
219
+ Nikolay Savinov, Alexey Dosovitskiy, and Vladlen Koltun. Semi-parametric topological memory for navigation. arXiv preprint arXiv:1803.00653, 2018.
220
+
221
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
222
+
223
+ Gabriel Sepulveda, Juan Carlos Niebles, and Alvaro Soto. A deep learning based behavioral approach to indoor autonomous navigation. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 4646–4653. IEEE, 2018.
224
+
225
+ William B Shen, Danfei Xu, Yuke Zhu, Leonidas J Guibas, Li Fei-Fei, and Silvio Savarese. Situational fusion of visual representation for visual navigation. arXiv preprint arXiv:1908.09073, 2019.
226
+
227
+ Tianqi Tang, Xin Yu, Xuanyi Dong, and Yi Yang. Auto-navigator: Decoupled neural architecture search for visual navigation. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 3743–3752, 2021.
228
+
229
+ 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.
230
+
231
+ Xin Wang, Qiuyuan Huang, Asli Celikyilmaz, Jianfeng Gao, Dinghan Shen, Yuan-Fang Wang, William Yang Wang, and Lei Zhang. Reinforced cross-modal matching and self-supervised imitation learning for vision-language navigation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6629–6638, 2019.
232
+
233
+ Christopher JCH Watkins and Peter Dayan. Q-learning. Machine learning, 8(3-4):279–292, 1992.
234
+
235
+ Mitchell Wortsman, Kiana Ehsani, Mohammad Rastegari, Ali Farhadi, and Roozbeh Mottaghi. Learning to learn how to learn: Self-adaptive visual navigation using meta-learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6750–6759, 2019.
236
+
237
+ Yi Wu, Yuxin Wu, Aviv Tamar, Stuart Russell, Georgia Gkioxari, and Yuandong Tian. Bayesian relational memory for semantic visual navigation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2769–2779, 2019.
238
+
239
+ Wei Yang, Xiaolong Wang, Ali Farhadi, Abhinav Gupta, and Roozbeh Mottaghi. Visual semantic navigation using scene priors. arXiv preprint arXiv:1810.06543, 2018.
240
+
241
+ Yuke Zhu, Roozbeh Mottaghi, Eric Kolve, Joseph J Lim, Abhinav Gupta, Li Fei-Fei, and Ali Farhadi. Target-driven visual navigation in indoor scenes using deep reinforcement learning. In 2017 IEEE international conference on robotics and automation (ICRA), pp. 3357–3364. IEEE, 2017.
242
+
243
+ # A APPENDIX
244
+
245
+ # A.1 FEATURE DETAILS IN VTNET
246
+
247
+ ![](images/c4b951c34cf9d29c67a4a82b3f8c86e47d192f431c225717fe5be3c9131dd942.jpg)
248
+ Figure 4: Illustration feature flowchart in VTNet.
249
+
250
+ For reproducibility, we illustrate the detailed feature flowchart of our VTNet in Figure 4. We extract instance features $\mathbb { R } ^ { 1 0 0 \times 2 5 6 }$ and location features $\mathbb { R } ^ { 1 0 0 \times 2 4 9 }$ , and concatenate them into a spatialenhanced local descriptor $\mathbb { R } ^ { 1 0 0 \times 2 5 6 }$ . The local branch integrates semantic labels $\mathbb { R } ^ { 1 0 0 \times 1 }$ , bounding boxes $\mathbb { R } ^ { 1 0 0 \times 4 }$ , confidences $\mathbb { R } ^ { 1 0 0 \times 1 }$ and the target labels $\mathbf { \mathbb { R } } ^ { 1 0 0 \times 1 }$ for the current observation. In the global branch, the positional embedding $\mathbb { R } ^ { 7 \times 7 \times 2 5 6 }$ is added to the global feature $\mathbb { R } ^ { 7 \times 7 \times 2 5 6 }$ , leading to a positional global descriptor $\mathbb { R } ^ { 4 9 \times 2 5 6 }$ . The spatial-enhanced local and positional global descriptors are fused by VT encoder and then the visual representation $\mathbb { R } ^ { 4 9 \times 2 5 6 }$ is output by our VT decoder.
251
+
252
+ # A.2 FAILURE CASE STUDY
253
+
254
+ ![](images/34892dc23d9809566fab64e69ce37f1da19b576e5df5e9205f69aaa41b444733.jpg)
255
+ Figure 5: Visual results of failure cases in testing environments. The target objects (i.e., Bowl and Laptop) are highlighted by the blue boxes. Red lines indicate the distance between the agent and the target object. Gray curves represent trajectories of agents. Both episodes fail because distances (i.e., $1 . 5 3 0 \mathrm { m }$ and $1 . 5 7 2 \mathrm { m } )$ between the agent and the target in the field of view are larger than the threshold (i.e., $1 . 5 \mathrm { m } )$ .
256
+
257
+ As demonstrated in Figure 5, our VTNet fails to reach targets because the distances between agents and targets are larger than the threshold distance (i.e., $1 . 5 \mathrm { m } )$ . In these two failure cases, agents find targets but implement the termination action before reaching a position closer than the threshold. Due to the lack of depth information and variances of target object sizes, an agent may predict that it is within a 1.5 meter radius of the target by mistake and thus terminates current episode.
258
+
259
+ ![](images/3c315b24db0d4468cf765539de490160c68089eeadda004c75b54092ed51bbc0.jpg)
260
+ Figure 6: Visual results of four different models in testing environments. We compare VTNet with SAVN (Wortsman et al., 2019), Baseline and ORG (Du et al., 2020). The target objects are highlighted by the blue boxes. Green and red curves indicate success and failure cases, respectively. Our VTNet successfully reaches targets and uses the shortest steps.
261
+
262
+ Table 3: Comparison of visual transformer architectures. We report the pre-training accuracy on the validation dataset, navigation success rate and SPL on the test dataset.
263
+
264
+ <table><tr><td rowspan=1 colspan=6>Multi-head numbersEncoder layersDecoder layersAccuracy Success SPL</td></tr><tr><td rowspan=3 colspan=1>4</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.722</td><td rowspan=1 colspan=1>71.2</td><td rowspan=1 colspan=1>0.433</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>0.723</td><td rowspan=1 colspan=1>72.2</td><td rowspan=1 colspan=1>0.449</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>0.715</td><td rowspan=1 colspan=1>70.0</td><td rowspan=1 colspan=1>0.419</td></tr><tr><td rowspan=4 colspan=1>8</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.707</td><td rowspan=1 colspan=1>70.4</td><td rowspan=1 colspan=1>0.422</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>0.718</td><td rowspan=1 colspan=1>70.9</td><td rowspan=1 colspan=1>0.436</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>0.710</td><td rowspan=1 colspan=1>68.9</td><td rowspan=1 colspan=1>0.423</td></tr><tr><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>0.701</td><td rowspan=1 colspan=1>68.2</td><td rowspan=1 colspan=1>0.411</td></tr></table>
265
+
266
+ We construct different transformer architectures by varying the number of encoder and decoder layers. Table 3 summarizes the performance of these architectures. We observe that as a visual transformer becomes too deep, a transformer may fail to converge to an optimal policy. On the other hand, a transformer with a single encoder and decoder layer does not have sufficient network capability to produce representative features. The highest success rate is achieved when a VT contains four multi-head self-attention mechanism modules and two layers in the encoder and decoder.
267
+
268
+ # A.5 NECESSITY OF PRE-TRAINING SCHEME
269
+
270
+ ![](images/e385df76af0b53ccfbbae0079bba8b5e8e4972d6fa5992d3a5eee1c1ae8cd8d5.jpg)
271
+ Figure 7: Average episode lengths of VTNet and VTNet without pre-training during training. We compare VTNet with VTNet without pre-training scheme. Blue and orange curves represent VTNet and VTNet w/o pre-training, respectively.
272
+
273
+ As demonstrated in Figure 7, our VTNet spends nearly 10 steps per episode in training, while the navigator w/o pre-training scheme often fails to reach targets and stops around 5 steps after being trained tens of thousands of episodes. Due to the large parameters and complex architectures of transformers, it is often difficult to train our transformers from scratch (Liu et al., 2020). Without a good initialization for our VT, it is very difficult to learn our VT and policy network in an end-to-end fashion with RL rewards. This is because the visual representations from VT are not informative or even meaningless and the inferior visual representations would harm policy network learning. As a result, the navigation policy network may be trapped into a local minimum (i.e., terminating navigation early to avoid more penalties) and our VT cannot receive positive rewards from preceding trajectories.
274
+
275
+ ![](images/a7fdfb5658f2ce176303ab0573e5d96d1f2922a9f9a2a75666f92aed2e5cb5b3.jpg)
276
+ Figure 8: Visualizations of attention scores. The target classes (i.e., StoveBurner, GarbageCan, Kettle) are highlighted by green bounding boxes. Our agent detects the instances of interest and then attends the detected instances to the global image regions by our VT. We observe that high attention scores are obtained on the areas corresponding to the targets. Guided by the visual representations, the agent selects actions to approach the targets.
md/train/H1dh6Ax0Z/H1dh6Ax0Z.md ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TREEQN AND ATREEC: DIFFERENTIABLE TREE-STRUCTURED MODELS FOR DEEP REINFORCEMENT LEARNING
2
+
3
+ Gregory Farquhar1 gregory.farquhar@cs.ox.ac.uk
4
+
5
+ Tim Rocktaschel¨ 1 tim.rocktaschel@cs.ox.ac.uk
6
+
7
+ Maximilian Igl1 maximilian.igl@cs.ox.ac.uk
8
+
9
+ Shimon Whiteson1 shimon.whiteson@cs.ox.ac.uk
10
+
11
+ 1University of Oxford, United Kingdom
12
+
13
+ # ABSTRACT
14
+
15
+ Combining deep model-free reinforcement learning with on-line planning is a promising approach to building on the successes of deep RL. On-line planning with look-ahead trees has proven successful in environments where transition models are known a priori. However, in complex environments where transition models need to be learned from data, the deficiencies of learned models have limited their utility for planning. To address these challenges, we propose TreeQN, a differentiable, recursive, tree-structured model that serves as a drop-in replacement for any value function network in deep RL with discrete actions. TreeQN dynamically constructs a tree by recursively applying a transition model in a learned abstract state space and then aggregating predicted rewards and state-values using a tree backup to estimate $Q$ -values. We also propose ATreeC, an actor-critic variant that augments TreeQN with a softmax layer to form a stochastic policy network. Both approaches are trained end-to-end, such that the learned model is optimised for its actual use in the tree. We show that TreeQN and ATreeC outperform $n$ -step DQN and A2C on a box-pushing task, as well as $n$ -step DQN and value prediction networks (Oh et al., 2017) on multiple Atari games. Furthermore, we present ablation studies that demonstrate the effect of different auxiliary losses on learning transition models.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ A promising approach to improving model-free deep reinforcement learning (RL) is to combine it with on-line planning. The model-free value function can be viewed as a rough global estimate which is then locally refined on the fly for the current state by the on-line planner. Crucially, this does not require new samples from the environment but only additional computation, which is often available.
20
+
21
+ One strategy for on-line planning is to use look-ahead tree search (Knuth & Moore, 1975; Browne et al., 2012). Traditionally, such methods have been limited to domains where perfect environment simulators are available, such as board or card games (Coulom, 2006; Sturtevant, 2008). However, in general, models for complex environments with high dimensional observation spaces and complex dynamics must be learned from agent experience. Unfortunately, to date, it has proven difficult to learn models for such domains with sufficient fidelity to realise the benefits of look-ahead planning (Oh et al., 2015; Talvitie, 2017).
22
+
23
+ A simple approach to learning environment models is to maximise a similarity metric between model predictions and ground truth in the observation space. This approach has been applied with some success in cases where model fidelity is less important, e.g., for improving exploration (Chiappa et al., 2017; Oh et al., 2015). However, this objective causes significant model capacity to be devoted to predicting irrelevant aspects of the environment dynamics, such as noisy backgrounds, at the expense of value-critical features that may occupy only a small part of the observation space (Pathak et al.,
24
+
25
+ 2017). Consequently, current state-of-the-art models still accumulate errors too rapidly to be used for look-ahead planning in complex environments.
26
+
27
+ Another strategy is to train a model such that, when it is used to predict a value function, the error in those predictions is minimised. Doing so can encourage the model to focus on features of the observations that are relevant for the control task. An example is the predictron (Silver et al., 2017b), where the model is used to aid policy evaluation without addressing control. Value prediction networks (VPNs, Oh et al., 2017) take a similar approach but use the model to construct a look-ahead tree only when constructing bootstrap targets and selecting actions, similarly to TD-search (Silver et al., 2012). Crucially, the model is not embedded in a planning algorithm during optimisation.
28
+
29
+ We propose a new tree-structured neural network architecture to address the aforementioned problems. By formulating the tree look-ahead in a differentiable way and integrating it directly into the $Q$ - function or policy, we train the entire agent, including its learned transition model, end-to-end. This ensures that the model is optimised for the correct goal and is suitable for on-line planning during execution of the policy.
30
+
31
+ Since the transition model is only weakly grounded in the actual environment, our approach can alternatively be viewed as a model-free method in which the fully connected layers of DQN are replaced by a recursive network that applies transition functions with shared parameters at each tree node expansion.
32
+
33
+ The resulting architecture, which we call TreeQN, encodes an inductive bias based on the prior knowledge that the environment is a stationary Markov process, which facilitates faster learning of better policies. We also present an actor-critic variant, ATreeC, in which the tree is augmented with a softmax layer and used as a policy network.
34
+
35
+ We show that TreeQN and ATreeC outperform their DQN-based counterparts in a box-pushing domain and a suite of Atari games, with deeper trees often outperforming shallower trees, and TreeQN outperforming VPN (Oh et al., 2017) on most Atari games. We also present ablation studies investigating various auxiliary losses for grounding the transition model more strongly in the environment, which could improve performance as well as lead to interpretable internal plans. While we show that grounding the reward function is valuable, we conclude that how to learn strongly grounded transition models and generate reliably interpretable plans without compromising performance remains an open research question.
36
+
37
+ # 2 BACKGROUND
38
+
39
+ We consider an agent learning to act in a Markovimising its expected discounted sum of rewards $\begin{array} { r } { R _ { t } = \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { t } } \end{array}$ s (MDP), with the goa, by learning a policy $\pi ( \mathbf { s } )$ max-that maps states to actions . The state-action value function $Q$ -function) is defined as $\begin{array} { r } { Q ^ { \pi } ( \mathbf { s } , a ) = \mathbb { E } _ { \pi } \left[ R _ { t } | \mathbf { s } _ { t } = \mathbf { s } , a _ { t } = a \right] } \end{array}$ ; the optimal $Q$ -function is $Q ^ { * } ( \mathbf { s } , a ) = \operatorname* { m a x } _ { \pi } Q ^ { \pi } ( \mathbf { s } , a )$ .
40
+
41
+ The Bellman optimality equation writes $Q ^ { * }$ recursively as
42
+
43
+ $$
44
+ Q ^ { * } ( \mathbf { s } , a ) = T Q ^ { * } ( \mathbf { s } , a ) \equiv r ( \mathbf { s } , a ) + \gamma \sum _ { \mathbf { s ^ { \prime } } } P ( \mathbf { s } ^ { \prime } | \mathbf { s } , a ) \operatorname* { m a x } _ { a ^ { \prime } } Q ^ { * } ( \mathbf { s } ^ { \prime } , a ^ { \prime } ) ,
45
+ $$
46
+
47
+ where $P$ is the MDP state transition function and $r$ is a reward function, which for simplicity we assume to be deterministic. $Q$ -learning (Watkins $\&$ Dayan, 1992) uses a single-sample approximation of the contraction operator $\tau$ to iteratively improve an estimate of $Q ^ { * }$ .
48
+
49
+ In deep $Q$ -learning (Mnih et al., 2015), $Q$ is represented by a deep neural network with parameters $\theta$ , and is improved by regressing $Q ( \mathbf { s } , a )$ to a target $r + \bar { \gamma } \operatorname* { m a x } _ { a ^ { \prime } } Q ( \mathbf { s } ^ { \prime } , a ^ { \prime } ; \theta ^ { - } )$ , where $\theta ^ { - }$ are the parameters of a target network periodically copied from $\theta$ .
50
+
51
+ We use a version of $n$ -step $Q$ -learning (Mnih et al., 2016) with synchronous environment threads. In particular, starting at a timestep $t$ , we roll forward $n _ { \mathrm { e n v } } = 1 6$ threads for $n = 5$ timesteps each. We then bootstrap off the final states only and gather all $n _ { \mathrm { e n v } } \times n = 8 0$ transitions in a single batch for
52
+
53
+ the backward pass, minimising the loss:
54
+
55
+ $$
56
+ \mathcal { L } _ { \mathrm { n s t e p . Q } } = \sum _ { \mathrm { e n v s } } \sum _ { j = 1 } ^ { n } \left( \sum _ { k = 1 } ^ { j } \left[ \gamma ^ { j - k } r _ { t + n - k } \right] + \gamma ^ { j } \operatorname* { m a x } _ { a ^ { \prime } } Q \left( \mathbf { s } _ { t + n } , a ^ { \prime } , \theta ^ { - } \right) - Q \left( \mathbf { s } _ { t + n - j } , a _ { t + n - j } , \theta \right) \right) ^ { 2 } .
57
+ $$
58
+
59
+ If the episode terminates, we use the remaining episode return as the target, without bootstrapping.
60
+
61
+ This algorithm’s actor-critic counterpart is A2C, a synchronous variant of A3C (Mnih et al., 2016) in which a policy $\pi$ and state-value function $V ( s )$ are trained using the gradient:
62
+
63
+ $$
64
+ \Delta \theta = \sum _ { \mathrm { e n v s } } \sum _ { j = 1 } ^ { n } \nabla _ { \theta _ { \tau } } \log \pi ( a _ { t + n - j } | s _ { t + n - j } ) A _ { j } ( s _ { t + n - j } , a _ { t + n - j } ) + \beta \nabla _ { \theta _ { \tau } } H ( \pi ( s _ { t + n - j } ) )
65
+ $$
66
+
67
+ $$
68
+ + \alpha \nabla _ { \theta _ { V } } A _ { j } ( s _ { t + n - j } , a _ { t + n - j } ) ^ { 2 } ,
69
+ $$
70
+
71
+ where $A _ { j }$ is an advantage estimate given by $\begin{array} { r } { \sum _ { k = 1 } ^ { j } \gamma ^ { j - k } r _ { t + n - k } + \gamma ^ { j } V ( \mathbf { s } _ { t + n } ) - V ( \mathbf { s } _ { t + n - j } ) , . } \end{array}$ $H$ is the policy entropy, $\beta$ is a hyperparameter tuning the degree of entropy regularisation, and $\alpha$ is a hyperparameter controlling the relative learning rates of actor and critic.
72
+
73
+ These algorithms were chosen for their simplicity and reasonable wallclock speeds, but TreeQN can also be used in other algorithms, as described in Section 3. Our implementations are based on OpenAI Baselines (Hesse et al., 2017).
74
+
75
+ The canonical neural network architecture in deep RL with visual observations has a series of convolutional layers followed by two fully connected layers, where the final layer produces one output for each action-value. We can think of this network as first calculating an encoding $\mathbf { z } _ { t }$ of the state $\mathbf { s } _ { t }$ which is then evaluated by the final layer to estimate $Q ^ { * } ( \mathbf { s } _ { t } , a )$ (see Fig. 1).
76
+
77
+ ![](images/a1c8aa777b391aa8e4813f2342fedb38e83445bf81cda679495660e595151def.jpg)
78
+ Figure 1: High-level structure of DQN.
79
+
80
+ In tree-search on-line planning, a look-ahead tree of possible future states is constructed by recursively applying an environment model. These states are typically evaluated by a heuristic, a learned value function, or Monte-Carlo rollouts. Backups through the tree aggregate these values along with the immediate rewards accumulated along each path to estimate the value of taking an action in the current state. This paper focuses on a simple tree-search with a deterministic transition function and no value uncertainty estimates, but our approach can be extended to tree-search variants like UCT (Kocsis & Szepesvari´ , 2006; Silver et al., 2016) if the components remain differentiable.
81
+
82
+ # 3 TREEQN
83
+
84
+ In this section, we propose TreeQN, a novel end-to-end differentiable tree-structured architecture for deep reinforcement learning. We first give an overview of the architecture, followed by details of each model component and the training procedure.
85
+
86
+ TreeQN uses a recursive tree-structured neural network between the encoded state $\mathbf { z } _ { t }$ and the predicted state-action values $Q ( \mathbf { s } _ { t } , a )$ , instead of directly estimating the state-action value from the current encoded state $\mathbf { z } _ { t }$ using fully connected layers as in DQN (Mnih et al., 2015). Specifically, TreeQN uses a recursive model to refine its estimate of $Q ( \mathbf { s } _ { t } , a )$ via learned transition, reward, and value functions, and a tree backup (see Fig. 2). Because these learned components are shared throughout the tree, TreeQN implements an inductive bias, missing from DQN, that reflects the prior knowledge that the $Q$ -values are properties of a stationary Markov process. We also encode the inductive bias that $Q$ -values may be expressed as a sum of scalar rewards and values.
87
+
88
+ $\mathbf { z } _ { l \mid t }$ cifically, TreeQN learns an action-de, predicts the next state representation $\mathbf { z } _ { l + 1 | t } ^ { a _ { i } }$ t transitiofor action $a _ { i } \in { \mathcal { A } }$ n that, given a state representa, and the corresponding reward $\hat { r } _ { l | t } ^ { a _ { i } }$ To make the distinction between internal planning steps and steps taken in the environment explicit, we write $\mathbf { z } _ { l \mid t }$ to denote the encoded state at time $t$ after $l$ internal transitions, starting with ${ \bf z } _ { 0 \mid t }$ for the encoding of $\mathbf { s } _ { t }$ . TreeQN applies this transition function recursively to construct a tree containing the state representations and rewards received for all possible sequences of actions up to some predefined depth $d$ (“Tree Transitioning” in Fig. 2).
89
+
90
+ ![](images/e166e58c3a5bca1ad7d1969b9d7a51bd50882c1420e24550565fb81a4f0a5e82.jpg)
91
+ Figure 2: High-level structure of TreeQN with a tree depth of two and shared transition and evaluation functions (reward prediction and value mixing omitted for simplicity).
92
+
93
+ The value of each predicted state $V ( \mathbf { z } )$ is estimated with a value function module. Using these values and the predicted rewards, TreeQN then performs a tree backup, mixing the $k$ -step returns along each path in the tree using $\mathrm { T D } ( \lambda )$ (Sutton, 1988; Sutton & Barto, 1998). This corresponds to “Value Prediction & Backup” in Fig. 2 and can be formalized as
94
+
95
+ $$
96
+ \begin{array} { r l } & { Q ^ { l } ( \mathbf { z } _ { l \mid t } , a _ { i } ) = r ( \mathbf { z } _ { l \mid t } , a _ { i } ) + \gamma V ^ { ( \lambda ) } ( \mathbf { z } _ { l + 1 \mid t } ) } \\ & { V ^ { ( \lambda ) } ( \mathbf { z } _ { l \mid t } ) = \left\{ V ( \mathbf { z } _ { l \mid t } ^ { a _ { i } } ) \right. \ } & { l = d } \\ & { \left. ( 1 - \lambda ) V ( \mathbf { z } _ { l \mid t } ^ { a _ { i } } ) + \lambda \mathrm { b } ( Q ^ { l + 1 } ( \mathbf { z } _ { l + 1 \mid t } ^ { a _ { i } } , a _ { j } ) ) \right. \ l < d } \end{array}
97
+ $$
98
+
99
+ where $\mathrm { b }$ is a function to recursively perform the backup. For $0 < \lambda < 1$ , value estimates of the intermediate states are mixed into the final $Q$ -estimate, which encourages the intermediate nodes of the tree to correspond to meaningful states, and reduces the impact of outlier values.
100
+
101
+ When $\lambda = 1$ , and $\mathrm { b }$ is the standard hard max function, then Eq. 3 simplifies to a backup through the tree using the familiar Bellman equation:
102
+
103
+ $$
104
+ Q ( \mathbf { z } _ { l | t } , a _ { i } ) = r ( \mathbf { z } _ { l | t } , a _ { i } ) + \left\{ \begin{array} { l l } { \gamma V ( \mathbf { z } _ { d | t } ^ { a _ { i } } ) } & { l = d - 1 } \\ { \gamma \operatorname* { m a x } _ { a _ { j } } Q ( \mathbf { z } _ { l + 1 | t } ^ { a _ { i } } , a _ { j } ) } & { l < d - 1 . } \end{array} \right.
105
+ $$
106
+
107
+ We note that even for a tree depth of only one, TreeQN imposes a significant structure on the value function by decomposing it as a sum of action-conditional reward and next-state value, and using a shared value function to evaluate each next-state representation.
108
+
109
+ Crucially, during training we backpropagate all the way from the final $Q$ -estimate, through the value prediction, tree transitioning, and encoding layers of the tree, i.e., the entire network shown in Fig. 2. Learning these components jointly ensures that they are useful for planning on-line.
110
+
111
+ # 3.1 MODEL COMPONENTS
112
+
113
+ In this section, we describe each of TreeQN’s components in more detail.
114
+
115
+ Encoder function. As in DQN, a series of convolutional layers produces an embedding of the observed state, $\mathbf { z } _ { 0 \mid t } = \mathsf { e n c o d e } ( \mathbf { s } _ { t } )$ .
116
+
117
+ Transition function. We first apply a single fully connected layer to the current state embedding, shared by all actions. This generates an intermediate representation $( \mathbf z _ { l + 1 | t } ^ { \mathrm { e n v } } )$ that could carry information about action-agnostic changes to the environment. In addition, we use a fully connected layer per action, which is applied to the intermediate representation to calculate a next-state representation that carries information about the effect of taking action $a _ { i }$ . We use residual connections for these layers:
118
+
119
+ $$
120
+ \begin{array} { r l } & { \mathbf { z } _ { l + 1 \mid t } ^ { \mathrm { e n v } } = \mathbf { z } _ { l \mid t } + \operatorname { t a n h } ( W ^ { \mathrm { e n v } } \mathbf { z } _ { l \mid t } + \mathbf { b } ^ { \mathrm { e n v } } ) , } \\ & { \mathbf { z } _ { l + 1 \mid t } ^ { a _ { i } } = \mathbf { z } _ { l + 1 \mid t } ^ { \mathrm { e n v } } + \operatorname { t a n h } ( W ^ { a _ { i } } \mathbf { z } _ { l + 1 \mid t } ^ { \mathrm { e n v } } ) , } \end{array}
121
+ $$
122
+
123
+ where $W ^ { a _ { i } } , W ^ { \mathrm { e n v } } \in \mathbb R ^ { k \times k } , \mathbf { b } ^ { \mathrm { e n v } } \in \mathbb R ^ { k }$ are learnable parameters. Note that the next-state representation is calculated for every action $a _ { i }$ independently using the respective transition matrix $W ^ { a _ { i } }$ , but this transition function is shared for the same action throughout the tree.
124
+
125
+ A caveat is that the model can still learn to use different parts of the latent state space in different parts of the tree, which could undermine the intended parameter sharing in the model structure. To help TreeQN learn useful transition functions that maintain quality and diversity in their latent states, we introduce a unit-length projection of the state representations by simply dividing a state’s vector representation by its L2 norm before each application of the transition function, $\mathbf { z } _ { l | t } : = \mathbf { z } _ { l | t } / \left| \left| \mathbf { z } _ { l | t } \right| \right|$ This prevents the magnitude of the representation from growing or shrinking, which encourages the behaviour of the transition function to be more consistent throughout the tree.
126
+
127
+ Reward function. In addition to predicting the next state, we also predict the immediate reward for every action $a _ { i } \in { \mathcal { A } }$ in state $\mathbf { z } _ { l \mid t }$ using
128
+
129
+ $$
130
+ \hat { \mathbf { r } } ( \mathbf { z } _ { l \mid t } ) = W _ { 2 } ^ { r } \mathrm { R e L U } ( W _ { 1 } ^ { r } \mathbf { z } _ { l \mid t } + \mathbf { b } _ { 1 } ^ { r } ) + \mathbf { b } _ { 2 } ^ { r } ,
131
+ $$
132
+
133
+ where $W _ { 1 } ^ { r } \in \mathbb { R } ^ { m \times k }$ , $W _ { 2 } ^ { r } \in \mathbb { R } ^ { | \mathcal { A } | \times m }$ and ReLU is the rectified linear unit (Nair & Hinton, 2010), and the predicted reward for a particular action $\hat { r } _ { l | t } ^ { a _ { i } }$ is the $i$ -th element of the vector $\hat { \mathbf { r } } ( \mathbf { z } _ { l \mid t } )$ .
134
+
135
+ Value function. The value of a state representation $\mathbf { z }$ is estimated as
136
+
137
+ $$
138
+ V ( \mathbf { z } ) = \mathbf { w } ^ { \top } \mathbf { z } + b ,
139
+ $$
140
+
141
+ where $\mathbf { w } \in \mathbb { R } ^ { k }$
142
+
143
+ Backup function. We use the following function that can be recursively applied to calculate the tree backup:
144
+
145
+ $$
146
+ \mathrm { b } ( \mathbf { x } ) = \sum _ { i } x _ { i } \mathrm { s o f t m a x } ( \mathbf { x } ) _ { i } .
147
+ $$
148
+
149
+ Using a hard max for calculating the backup would result in gradient information only being used to update parameters along the maximal path in the tree. By contrast, the softmax allows us to use downstream gradient information to update parameters along all paths. Furthermore, it potentially reduces the impact of outlier value predictions. With a learned temperature for the softmax, this function could represent the hard max arbitrarily closely. However, we did not find an empirical difference so we left the temperature at 1.
150
+
151
+ # 3.2 GROUNDING THE MODEL COMPONENTS
152
+
153
+ The TreeQN architecture is fully differentiable, so we can directly use it in the place of a $Q$ -function in any deep RL algorithm with discrete actions. Differentiating through the entire tree ensures that the learned components are useful for planning on-line, as long as that planning is performed in the same way as during training.
154
+
155
+ However, it seems plausible that auxiliary objectives based on minimising the error in predicting rewards or observations could improve the performance by helping to ground the transition and reward functions to the environment. It could also encourage TreeQN to perform model-based planning in an interpretable manner. In principle, such objectives could give rise to a spectrum of methods from model-free to fully model-based. At one extreme, TreeQN without auxiliary objectives can be seen as a model-free approach that draws inspiration from tree-search planning to encode valuable inductive biases into the neural network architecture. At the other extreme, perfect, grounded reward and transition models could in principle be learned. Using them in our architecture would then correspond to standard model-based lookahead planning. The sweet spot could be an intermediate level of grounding that maintains the flexibility of end-to-end model-free learning while benefiting from the additional supervision of explicit model learning. To investigate this spectrum, we experiment with two auxiliary objectives.
156
+
157
+ Reward grounding. We experiment with an L2 loss regressing rˆat:t+l−1| , the predicted reward at level $l$ of the tree corresponding to the selected action sequence $\left\{ a _ { t } \ldots a _ { t + l - 1 } \right\}$ , to the true observed rewards. For each of the $n$ timesteps of $n$ -step Q-learning this gives:
158
+
159
+ $$
160
+ \mathcal { L } = \mathcal { L } _ { \mathrm { n s t e p } \cdot \mathrm { Q } } + \eta _ { r } \sum _ { \mathrm { e n v s } } \sum _ { j = 1 } ^ { n } \sum _ { l = 1 } ^ { \bar { d } } \left( \hat { r } _ { l \mid t + j } ^ { a _ { t + j : t + j + l - 1 } } - r _ { t + j + l - 1 } \right) ^ { 2 } ,
161
+ $$
162
+
163
+ where $\eta _ { r }$ is a hyperparameter weighting the loss, and $\bar { d } = \operatorname* { m i n } ( d , n - j + 1 )$ restricts the sum to rewards for which we have already observed the true value.
164
+
165
+ State grounding. We experiment with a grounding in the latent space, using an L2 loss to regress the predicted latent state $\mathbf { z } _ { l \mid t } ^ { a _ { t : t + l } }$ at level $l$ of the tree to $\mathbf { z } _ { 0 \mid t + l }$ , the initial encoding of the true state corresponding to the actions actually taken:
166
+
167
+ $$
168
+ \mathcal { L } = \mathcal { L } _ { \mathrm { n s t e p } \cdot \mathrm { Q } } + \eta _ { s } \sum _ { \mathrm { e n v s } } \sum _ { j = 1 } ^ { n } \sum _ { l = 1 } ^ { \bar { d } } \left( \mathbf { z } _ { l \mid t + j } ^ { a _ { t + j : t + j + l - 1 } } - \mathbf { z } _ { 0 \mid t + j + l } \right) ^ { 2 } .
169
+ $$
170
+
171
+ By employing an additional decoder module, we could use a similar loss to regress decoded observations to the true observations. In informal experiments, joint training with such a decoder loss did not yield good performance, as also found by Oh et al. (2017).
172
+
173
+ In Section 7.1, we present results on the use these objectives, showing that reward grounding gives better performance, but that our method for state grounding does not.
174
+
175
+ # 4 ATREEC
176
+
177
+ The intuitions guiding the design of TreeQN are as applicable to policy search as to valuebased RL, in that a policy can use a tree planner to improve its estimates of the optimal action probabilities (Gelly & Silver, 2007; Silver et al., 2017a). As our proposed architecture is trained end-to-end, it can be easily adapted for use as a policy network.
178
+
179
+ In particular, we propose ATreeC, an actor-critic extension of TreeQN. In this architecture, the policy network is identical to TreeQN, with an additional softmax layer that converts the $Q$ estimates into the probabilities of a stochastic policy.
180
+
181
+ ![](images/c25055870dfdd057fb07bebcc4851a33c1d3f8f989097e46a5424ba4be71f1b0.jpg)
182
+ Figure 3: High-level structure of ATreeC.
183
+
184
+ The critic shares the encoder parameters, and predicts a scalar state value with a single fully connected layer: $V _ { \mathrm { c r } } ( \mathbf { s } ) = \mathbf { w } _ { \mathrm { c r } } ^ { \top } \mathbf { z } + b _ { \mathrm { c r } }$ . We used different parameters for the critic value function and the actor’s tree-value-function module, but found that sharing these parameters had little effect on performance. The entire setup, shown in Fig. 3, is trained with A2C as described in Section 2, with the addition of the same auxiliary losses used for TreeQN. Note that TreeQN could also be used in the critic, but we leave this possibility to future work.
185
+
186
+ # 5 RELATED WORK
187
+
188
+ There is a long history of work combining model-based and model-free RL. An early example is Dyna-Q (Sutton, 1990) which trains a model-free algorithm with samples drawn from a learned model. Similarly, van Seijen et al. (2011) train a sparse model with some environment samples that can be used to refine a model-free $Q$ -function. Gu et al. (2016) use local linear models to generate additional samples for their model-free algorithm. However, these approaches do not attempt to use the model on-line to improve value estimates.
189
+
190
+ In deep RL, value iteration networks (Tamar et al., 2016) use a learned differentiable model to plan on the fly, but require planning over the full state space, which must also possess a spatial structure with local dynamics such that convolution operations can execute the planning algorithm.
191
+
192
+ The predictron (Silver et al., 2017b) instead learns abstract-state transition functions in order to predict values. However, it is restricted to policy evaluation without control. Value prediction networks (VPNs, Oh et al., 2017) take a similar approach but are more closely related to our work because the learned model components are used in a tree for planning. However, in their work this tree is only used to construct targets and choose actions, and not to compute the value estimates during training. Such estimates are instead produced from non-branching trajectories following on-policy action sequences. By contrast, TreeQN is a unified architecture that constructs the tree dynamically at every timestep and differentiates through it, eliminating any mismatch between the model at training and test time. Furthermore, we do not use convolutional transition functions, and hence do not impose spatial structure on the latent state representations. These differences simplify training, allow our model to be used more flexibly in other training regimes, and explain in part our substantially improved performance on the Atari benchmark.
193
+
194
+ Donti et al. (2017) propose differentiating through a stochastic programming optimisation using a probabilistic model to learn model parameters with respect to their true objective rather than a maximum likelihood surrogate. However, they do not tackle the full RL setting, and do not use the model to repeatedly or recursively refine predictions.
195
+
196
+ Imagination-augmented agents (Weber et al., 2017) learn to improve policies by aggregating rollouts predicted by a model. However, they rely on pretraining an observation-space model, which we argue will scale poorly to more complex environments. Further, their aggregation of rollout trajectories takes the form of a generic RNN rather than a value function and tree backup, so the inductive bias based on the structure of the MDP is not explicitly present.
197
+
198
+ A class of value gradient methods (Deisenroth & Rasmussen, 2011; Fairbank & Alonso, 2012; Heess et al., 2015) also differentiates through models to train a policy. However, this approach does not use the model during execution to refine the policy, and requires continuous action spaces.
199
+
200
+ Oh et al. (2015) and Chiappa et al. (2017) propose methods for learning observation-prediction models in the Atari domain, but use these models only to improve exploration. Variants of scheduled sampling (Bengio et al., 2015) may be used to improve robustness of these models, but scaling to complex domains has proven challenging (Talvitie, 2014).
201
+
202
+ # 6 EXPERIMENTS
203
+
204
+ We evaluate TreeQN and ATreeC in a simple box-pushing environment, as well as on the subset of nine Atari environments that Oh et al. (2017) use to evaluate VPN. The experiments are designed to determine whether or not TreeQN and ATreeC outperform DQN, A2C, and VPN, and whether they can scale to complex domains. We also investigate how to best ground the the transition function with auxiliary losses. Furthermore, we compare against alternative ways to increase the number of parameters and computations of a standard DQN architecture, and study the impact of tree depth. Full details of the experimental setup, as well as architecture and training hyperparameters, are given in the appendix.
205
+
206
+ Grounding. We perform a hyperparameter search over the coefficients $\eta _ { r }$ and $\eta _ { s }$ of the reward and state grounding auxiliary losses, on the Atari environment Seaquest. These experiments aim to determine the relevant trade-offs between the flexibility of a model-free approach and the potential benefits of a more model-based algorithm.
207
+
208
+ Box Pushing. We randomly place an agent, 12 boxes, 5 goals and 6 obstacles on the center $6 \times 6$ tiles of an $8 \times 8$ grid. The agent’s goal is to push boxes into goals in as few steps as possible while avoiding obstacles. Boxes may not be pushed into each other. The obstacles, however, are ‘soft’ in that they are do not block movement, but generate a negative reward if the agent or a box moves onto an obstacle. This rewards better planning without causing excessive gridlock. This environment is inspired by Sokoban, as used by Weber et al. (2017), in that poor actions can generate irreversibly bad configurations. However, the level generation process for Sokoban is challenging to reproduce exactly and has not been open-sourced. More details of the environment and rewards are given in Appendix A.1.
209
+
210
+ ![](images/97da6ea8c2b8e8eaa44c239e1def910645c5c0d4ba1ee593d6f68ab36d648d3a.jpg)
211
+ Figure 4: Grounding the reward and transition functions using auxiliary losses: final returns on Seaquest plotted against the coefficient of the auxiliary loss.
212
+
213
+ Atari. To demonstrate the general applicability of TreeQN and ATreeC to complex environments, we evaluate them on the Atari 2600 suite (Bellemare et al., 2013). Following Oh et al. (2017), we use their set of nine environments and a frameskip of 10 to facilitate planning over reasonable timescales.
214
+
215
+ TreeQN adds additional parameters to a standard DQN architecture. We compare TreeQN to two baseline architectures with increased computation and numbers of parameters to verify the benefit of the additional structure and grounding. DQN-Wide doubles the size of the embedding dimension (1024 instead of 512). DQN-Deep inserts two additional fully connected layers with shared parameters and residual connections between the two fully-connected layers of DQN. This is in effect a non-branching version of the TreeQN architecture that also lacks explicit reward prediction.
216
+
217
+ # 7 RESULTS & DISCUSSION
218
+
219
+ In this section, we present our experimental results for TreeQN and ATreeC.
220
+
221
+ # 7.1 GROUNDING
222
+
223
+ Fig. 4 shows the result of a hyperparameter search on $\eta _ { r }$ and $\eta _ { s }$ , the coefficients of the auxiliary losses on the predicted rewards and latent states. An intermediate value of $\eta _ { r }$ helps performance but there is no benefit to using the latent space loss. Subsequent experiments use $\eta _ { r } = 1$ and $\eta _ { s } = 0$ .
224
+
225
+ The predicted rewards that the reward-grounding objective encourages the model to learn appear both in its own $Q$ -value prediction and in the target for $n$ -step $Q$ -learning. Consequently, we expect this auxiliary loss to be well aligned with the true objective. By contrast, the state-grounding loss (and other potential auxiliary losses) might help representation learning but would not explicitly learn any part of the desired target. It is possible that this mismatch between the auxiliary and primary objective leads to degraded performance when using this form of state grounding. One potential route to overcoming this obstacle to joint training would be pre-training a model, as done by Weber et al. (2017). Inside TreeQN this model could then be fine-tuned to perform well inside the planner. We leave this possiblity to future work.
226
+
227
+ # 7.2 BOX PUSHING
228
+
229
+ Fig. 5a shows the results of TreeQN with tree depths 1, 2, and 3, compared to a DQN baseline. In this domain, there is a clear advantage for the TreeQN architecture over DQN. TreeQN learns policies that are substantially better at avoiding obstacles and lining boxes up with goals so they can be easily pushed in later. TreeQN also substantially speeds up learning. We believe that the greater structure brought by our architecture regularises the model, encouraging appropriate state representations to be learned quickly. Even a depth-1 tree improves performance significantly, as disentangling the estimation of rewards and next-state values makes them easier to learn. This is further facilitated by the sharing of value-function parameters across branches.
230
+
231
+ ![](images/bbb23d8d559767eabf733b8c2ecddefc93e437f2c2583281060880ce9d7b044a.jpg)
232
+ Figure 5: Box-pushing results: the $x$ -axis shows the number of transitions observed across all of the synchronous environment threads.
233
+
234
+ When trained with $n$ -step Q-learning, the deeper depth-2 and depth-3 trees learn faster and plateau higher than the shallow depth-1 tree. In the this domain, useful transition functions are relatively easy to learn, and the extra computation time with those transition modules can help refine value estimates, yielding advantages for additional depth.
235
+
236
+ Fig. 5b shows the results of ATreeC with tree depths 1, 2, and 3, compared to an A2C baseline. As with TreeQN, ATreeC substantially outperforms the baseline. Furthermore, thanks to its stochastic policy, it substantially outperforms TreeQN. Whereas TreeQN and DQN sometimes indecisively bounce back and forth between adjacent states, ATreeC captures this uncertainty in its policy probabilities and thus acts more decisively. However, unlike TreeQN, ATreeC shows no pronounced differences for different tree depths. This is in part due to a ceiling effect in this domain. However, ATreeC is also gated by the quality of the critic’s value function, which in these experiments was a single linear layer after the state encoding as described in Section 4. Nonetheless, this result demonstrates the ease with which TreeQN can be used as a drop-in replacement for any deep RL algorithm that learns policies or value functions for discrete actions.
237
+
238
+ # 7.3 ATARI
239
+
240
+ Table 1 summarises all our Atari results, while Fig. 6 shows learning curves in depth. TreeQN shows substantial benefits in many environments compared to our DQN baseline, which itself often outperforms VPN (Oh et al., 2017). ATreeC always matches or outperforms A2C. We present the mean performance of five random seeds, while the VPN results reported by Oh et al. (2017), shown as dashed lines in Fig. 6, are the mean of the best five seeds of an unspecified number of trials.
241
+
242
+ TreeQN. In all environments except Frostbite, TreeQN outperforms DQN on average, with the most significant gains in Alien, CrazyClimber, Enduro, Krull, and Seaquest. Many of these environments seem well suited to short horizon look-ahead planning, with simple dynamics that generalise well and tradeoffs between actions that become apparent only after several timesteps. For example, an incorrect action in Alien can trap the agent down a corridor with an alien. In Seaquest, looking ahead could help determine whether it is better to go deeper to collect more points or to surface for oxygen. However, even in a game with mostly reactive decisions like the racing game Enduro, TreeQN shows significant benefits.
243
+
244
+ TreeQN also outperforms the additional baselines of DQN-Wide and DQN-Deep, indicating that the additional structure and grounding of our architecture brings benefits beyond simply adding model capacity and computation. In particular, it is interesting that DQN-Deep is often outperformed by the vanilla DQN baseline, as optimisation difficulties grow with depth. In contrast, the additional structure and auxiliary loss employed by TreeQN turn its additional depth from a liability into a strength.
245
+
246
+ ![](images/8a8b0162732a2a7f45e78c6ce7220ef0c080f2a73238d623627d2ab9ddf1a446.jpg)
247
+ Figure 6: Results for the Atari domain. The y-axis shows the moving average over 100 episodes. Each of five random seeds is plotted faintly, with the mean in bold.
248
+
249
+ Table 1: Summary of Atari results. Each number is the best score throughout training, calculated as the mean of the last 100 episode rewards averaged over exactly five agents trained with different random seeds. Note that Oh et al. (2017) report the same statistic, but average instead over the best five of an unspecified number of agents.
250
+
251
+ <table><tr><td></td><td>Alien</td><td>Amidar</td><td>Crazy Climber</td><td>Enduro</td><td>Frostbite</td><td>Krull</td><td>Ms.Pacman</td><td>Q*Bert</td><td>Seaquest</td></tr><tr><td>DQN (Oh et al., 2017)</td><td>1804</td><td>535</td><td>41658</td><td>326</td><td>3058</td><td>12438</td><td>2804</td><td>12592</td><td>2951</td></tr><tr><td>VPN (Oh et al.,2017)</td><td>1429</td><td>641</td><td>54119</td><td>382</td><td>3811</td><td>15930</td><td>2689</td><td>14517</td><td>5628</td></tr><tr><td>n-step DQN</td><td>1969</td><td>1033</td><td>71623</td><td>625</td><td>3968</td><td>7860</td><td>2774</td><td>14468</td><td>3465</td></tr><tr><td>DQN-Deep</td><td>1906</td><td>825</td><td>53101</td><td>745</td><td>493</td><td>8605</td><td>2410</td><td>15094</td><td>3575</td></tr><tr><td>DQN-Wide</td><td>2187</td><td>1074</td><td>91380</td><td>682</td><td>3493</td><td>6603</td><td>3061</td><td>15794</td><td>3909</td></tr><tr><td>TreeQN-1</td><td>2321</td><td>1030</td><td>107983</td><td>800</td><td>2254</td><td>10836</td><td>3030</td><td>15688</td><td>9302</td></tr><tr><td>TreeQN-2</td><td>2497</td><td>1170</td><td>104932</td><td>825</td><td>581</td><td>11035</td><td>3277</td><td>15970</td><td>8241</td></tr><tr><td>A2C</td><td>2673</td><td>1525</td><td>102776</td><td>642</td><td>297</td><td>5784</td><td>4352</td><td>24451</td><td>1734</td></tr><tr><td>ATreeC-1</td><td>3448</td><td>1578</td><td>102546</td><td>678</td><td>1035</td><td>8227</td><td>4866</td><td>25159</td><td>1734</td></tr><tr><td>ATreeC-2</td><td>2813</td><td>1566</td><td>110712</td><td>649</td><td>281</td><td>8134</td><td>4450</td><td>25459</td><td>2176</td></tr></table>
252
+
253
+ ATreeC. ATreeC matches or outperforms its baseline (A2C) in all environments. Compared to TreeQN, ATreeC’s performance is better across most environments, particularly on Qbert, reflecting an overall advantage for actor-critic also found by Mnih et al. (2016) and in our box-pushing experiments. However, performance is much worse on Seaquest, revealing a deficiency in exploration as policy entropy collapses too rapidly and consequently the propensity of policy gradient methods to become trapped in a local optimum.
254
+
255
+ In Krull and Frostbite, most algorithms have poor performance, or high variance in returns from run to run, as agents are gated by their ability to explore. Both of these games require the completion of sub-levels in order to accumulate large scores, and none of our agents reliably explore beyond the initial stages of the game. Mean performance appears to favor TreeQN and ATreeC in Krull, and perhaps DQN in Frostbite, but the returns are too variable to draw conclusions from this number of random seeds. Combining TreeQN and ATreeC with smart exploration mechanisms is an interesting direction for future work to improve robustness of training in these types of environments.
256
+
257
+ Compared to the box-pushing domain, there is less of a clear performance difference between trees of different depths. In some environments (Amidar, MsPacman), greater depth does appear to be employed usefully by TreeQN to a small extent, resulting in the best-performing individual agents. However, for the Atari domain the embedding size for the transition function we use is much larger (512 compared to 128), and the dynamics are much more complex. Consequently, we expect that optimisation difficulties, and the challenge of learning abstract-state transition functions, impede the utility of deeper trees in some cases. We look to future work to further refine methods for learning to plan abstractly in complex domains. However, the decomposition of Q-value into reward and next-state value employed by the first tree expansion is clearly of utility in a broad range of tasks.
258
+
259
+ When inspecting the learned policies and trees, we find that the values sometimes correspond to intuitive reasoning about sensible policies, scoring superior action sequences above poorer ones. However, we find that the actions corresponding to branches of the tree that are scored most highly are frequently not taken in future timesteps. The flexibility of TreeQN and ATreeC allows our agents to find any useful way to exploit the computation in the tree to refine action-value estimates. As we found no effective way to strongly ground the model components without sacrificing performance, the interpretability of learned trees is limited.
260
+
261
+ # 8 CONCLUSIONS & FUTURE WORK
262
+
263
+ We presented TreeQN and ATreeC, new architectures for deep reinforcement learning in discreteaction domains that integrate differentiable on-line tree planning into the action-value function or policy. Experiments on a box-pushing domain and a set of Atari games show the benefit of these architectures over their counterparts, as well as over VPN. In future work, we intend to investigate enabling more efficient optimisation of deeper trees, encouraging the transition functions to produce interpretable plans, and integrating smart exploration.
264
+
265
+ # ACKNOWLEDGMENTS
266
+
267
+ We thank Sasha Salter, Luisa Zintgraf, and Wendelin Bohmer for their contributions and valuable ¨ comments on drafts of this paper. This work was supported by the UK EPSRC CDT in Autonomous Intelligent Machines and Systems. This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement #637713). The NVIDIA DGX-1 used for this research was donated by the NVIDIA Corporation.
268
+
269
+ # REFERENCES
270
+
271
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. J. Artif. Intell. Res.(JAIR), 47:253–279, 2013.
272
+
273
+ 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.
274
+
275
+ Cameron B Browne, Edward Powley, Daniel Whitehouse, Simon M Lucas, Peter I Cowling, Philipp Rohlfshagen, Stephen Tavener, Diego Perez, Spyridon Samothrakis, and Simon Colton. A survey of monte carlo tree search methods. IEEE Transactions on Computational Intelligence and AI in games, 4(1):1–43, 2012.
276
+
277
+ Silvia Chiappa, Sebastien Racaniere, Daan Wierstra, and Shakir Mohamed. Recurrent environment ´ simulators. arXiv preprint arXiv:1704.02254, 2017.
278
+
279
+ Remi Coulom. Efficient selectivity and backup operators in monte-carlo tree search. In ´ Computers and Games, 5th International Conference, CG 2006, Turin, Italy, May 29-31, 2006. Revised Papers, pp. 72–83, 2006. doi: 10.1007/978-3-540-75538-8 7.
280
+
281
+ Marc Deisenroth and Carl E Rasmussen. Pilco: A model-based and data-efficient approach to policy search. In Proceedings of the 28th International Conference on machine learning (ICML-11), pp. 465–472, 2011.
282
+
283
+ Priya L Donti, Brandon Amos, and J Zico Kolter. Task-based end-to-end model learning. arXiv preprint arXiv:1703.04529, 2017.
284
+
285
+ Michael Fairbank and Eduardo Alonso. Value-gradient learning. In Neural Networks (IJCNN), The 2012 International Joint Conference on, pp. 1–8. IEEE, 2012.
286
+
287
+ Sylvain Gelly and David Silver. Combining online and offline knowledge in uct. In Proceedings of the 24th international conference on Machine learning, pp. 273–280. ACM, 2007.
288
+
289
+ Shixiang Gu, Timothy Lillicrap, Ilya Sutskever, and Sergey Levine. Continuous deep q-learning with model-based acceleration. In International Conference on Machine Learning, pp. 2829–2838, 2016.
290
+
291
+ Nicolas Heess, Gregory Wayne, David Silver, Tim Lillicrap, Tom Erez, and Yuval Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems, pp. 2944–2952, 2015.
292
+
293
+ Christopher Hesse, Matthias Plappert, Alec Radford, John Schulman, Szymon Sidor, and Yuhuai Wu. Openai baselines. https://github.com/openai/baselines, 2017.
294
+
295
+ Donald E Knuth and Ronald W Moore. An analysis of alpha-beta pruning. Artificial intelligence, 6 (4):293–326, 1975.
296
+
297
+ Levente Kocsis and Csaba Szepesvari. Bandit based monte-carlo planning. In ´ Machine Learning: ECML 2006, 17th European Conference on Machine Learning, Berlin, Germany, September 18-22, 2006, Proceedings, pp. 282–293, 2006. doi: 10.1007/11871842 29.
298
+
299
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin A. Riedmiller, Andreas Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015. doi: 10.1038/nature14236.
300
+
301
+ Volodymyr Mnih, Adria Puigdom \` enech Badia, Mehdi Mirza, Alex Graves, Timothy P. Lillicrap, Tim \` Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, pp. 1928–1937, 2016.
302
+
303
+ Vinod Nair and Geoffrey E. Hinton. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th International Conference on Machine Learning (ICML-10), June 21-24, 2010, Haifa, Israel, pp. 807–814, 2010.
304
+
305
+ Junhyuk Oh, Xiaoxiao Guo, Honglak Lee, Richard L Lewis, and Satinder Singh. Action-conditional video prediction using deep networks in atari games. In Advances in Neural Information Processing Systems, pp. 2863–2871, 2015.
306
+
307
+ Junhyuk Oh, Satinder Singh, and Honglak Lee. Value prediction network. arXiv preprint arXiv:1707.03497, 2017.
308
+
309
+ Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. arXiv preprint arXiv:1705.05363, 2017.
310
+
311
+ David Silver, Richard S. Sutton, and Martin Muller. Temporal-difference search in computer go.¨ Machine Learning, 87(2):183–219, 2012. doi: 10.1007/s10994-012-5280-0.
312
+
313
+ David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Vedavyas Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy P. Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016. doi: 10.1038/nature16961.
314
+
315
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, et al. Mastering the game of go without human knowledge. Nature, 550(7676):354–359, 2017a.
316
+
317
+ David Silver, Hado van Hasselt, Matteo Hessel, Tom Schaul, Arthur Guez, Tim Harley, Gabriel Dulac-Arnold, David P. Reichert, Neil Rabinowitz, Andre Barreto, and Thomas Degris. The ´ predictron: End-to-end learning and planning. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, pp. 3191–3199, 2017b.
318
+
319
+ Nathan R Sturtevant. An analysis of uct in multi-player games. In International Conference on Computers and Games, pp. 37–49. Springer, 2008.
320
+
321
+ Richard S Sutton. Learning to predict by the methods of temporal differences. Machine learning, 3 (1):9–44, 1988.
322
+
323
+ Richard S. Sutton. Integrated architectures for learning, planning, and reacting based on approximating dynamic programming. In Machine Learning, Proceedings of the Seventh International Conference on Machine Learning, Austin, Texas, USA, June 21-23, 1990, pp. 216–224, 1990.
324
+
325
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction, volume 1. MIT press Cambridge, 1998.
326
+
327
+ Erik Talvitie. Model regularization for stable sample rollouts. In UAI, pp. 780–789, 2014.
328
+
329
+ Erik Talvitie. Self-correcting models for model-based reinforcement learning. In AAAI, pp. 2597– 2603, 2017.
330
+
331
+ Aviv Tamar, Sergey Levine, Pieter Abbeel, Yi Wu, and Garrett Thomas. Value iteration networks. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, pp. 2146–2154, 2016.
332
+
333
+ Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 4(2):26–31, 2012.
334
+
335
+ Harm van Seijen, Shimon Whiteson, Hado van Hasselt, and Marco Wiering. Exploiting best-match equations for efficient reinforcement learning. Journal of Machine Learning Research, 12(Jun): 2045–2094, 2011.
336
+
337
+ Christopher J. C. H. Watkins and Peter Dayan. Q-learning. Machine Learning, 8:279–292, 1992. doi: 10.1007/BF00992698.
338
+
339
+ Theophane Weber, Sebastien Racani ´ ere, David P. Reichert, Lars Buesing, Arthur Guez, \` Danilo Jimenez Rezende, Adria Puigdom \` enech Badia, Oriol Vinyals, Nicolas Heess, Yujia Li, \` Razvan Pascanu, Peter Battaglia, David Silver, and Daan Wierstra. Imagination-augmented agents for deep reinforcement learning. CoRR, abs/1707.06203, 2017.
340
+
341
+ # A APPENDIX
342
+
343
+ # A.1 BOX PUSHING
344
+
345
+ Environment. For each episode, a new level is generated by placing an agent, 12 boxes, 5 goals and 6 obstacles in the center $6 \times 6$ tiles of an $8 \times 8$ grid, sampling locations uniformly. The outer tiles are left empty to prevent initial situations where boxes cannot be recovered.
346
+
347
+ The agent may move in the four cardinal directions. If the agent steps off the grid, the episode ends and the agent receives a penalty of $- 1$ . If the agent moves into a box, it is pushed in the direction of movement. Moving a box out of the grid generates a penalty of $- 0 . 1$ . Moving a box into another box is not allowed and trying to do so generates a penalty of $- 0 . 1$ while leaving all positions unchanged. When a box is pushed into a goal, it is removed and the agent receives a reward of $+ 1$ .
348
+
349
+ Obstacles generate a penalty of $- 0 . 2$ when the agent or a box is moved onto them. Moving the agent over goals incurs no penalty. Lastly, at each timestep the agent receives a penalty of $- 0 . 0 1$ . Episodes terminate when 75 timesteps have elapsed, the agent has left the grid, or no boxes remain.
350
+
351
+ The observation is given to the model as a tensor of size $5 \times 8 \times 8$ . The first four channels are binary encodings of the position of the agent, goals, boxes, and obstacles respectively. The final channel is filled with the number of timesteps remaining (normalised by the total number of timesteps allowed).
352
+
353
+ Architecture. The encoder consists of (conv-3x3-1-24, conv-3x3-1-24, conv-4x4-1-48, fc-128), where conv-wxh-s-n denotes a convolution with $n$ filters of size $w \times h$ and stride $s$ , and fc-h denotes a fully connected layer with $h$ hidden units. All layers are separated with ReLU nonlinearities. The hidden layer of the reward function MLP has 64 hidden units.
354
+
355
+ # A.2 ATARI
356
+
357
+ Preprocessing of inputs follows the procedure of Mnih et al. (2015), including concatenation of the last four frames as input, although we use a frameskip of 10.
358
+
359
+ Architecture. The Atari experiments have the same architecture as for box-pushing, except for the encoder architecture which is as follows: (conv-8x8-4-16, conv-4x4-2-32, fc-512).
360
+
361
+ # A.3 OTHER HYPERPARAMETERS
362
+
363
+ All experiments use RMSProp (Tieleman & Hinton, 2012) with a learning rate of 1e-4, a decay of $\alpha = 0 . 9 9$ , and $\epsilon = 1 \mathrm { e } { - } 5$ .
364
+
365
+ The learning rate was tuned coarsely by running DQN on the Seaquest environment, and kept the same for all subsequent experiments (box-pushing and Atari).
366
+
367
+ For DQN and TreeQN, $\epsilon$ for $\epsilon$ -greedy exploration was decayed linearly from 1 to 0.05 over the first 4 million environment transitions observed (after frameskipping, so over 40 million atomic Atari timesteps).
368
+
369
+ For A2C and ATreeC, we use a value-function loss coefficient $\alpha = 0 . 5$ and an entropy regularisation $\beta = 0 . 0 1$ .
370
+
371
+ The reward prediction loss was scaled by $\eta _ { r } = 1$
372
+
373
+ We use $n _ { \mathrm { s t e p s } } = 5$ and $n _ { \mathrm { e n v s } } = 1 6$ , for a total batch size of 80.
374
+
375
+ The discount factor is $\gamma = 0 . 9 9$ and the target networks are updated every $4 0 , 0 0 0$ environment transitions.
md/train/HJgpugrKPS/HJgpugrKPS.md ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SCALE-EQUIVARIANT STEERABLE NETWORKS
2
+
3
+ Ivan Sosnovik∗, Michał Szmaja†, Arnold Smeulders
4
+ UvA-Bosch Delta Lab
5
+ University of Amsterdam
6
+
7
+ # ABSTRACT
8
+
9
+ The effectiveness of Convolutional Neural Networks (CNNs) has been substantially attributed to their built-in property of translation equivariance. However, CNNs do not have embedded mechanisms to handle other types of transformations. In this work, we pay attention to scale changes, which regularly appear in various tasks due to the changing distances between the objects and the camera. First, we introduce the general theory for building scale-equivariant convolutional networks with steerable filters. We develop scale-convolution and generalize other common blocks to be scale-equivariant. We demonstrate the computational efficiency and numerical stability of the proposed method. We compare the proposed models to the previously developed methods for scale equivariance and local scale invariance. We demonstrate state-of-the-art results on the MNIST-scale dataset and on the STL-10 dataset in the supervised learning setting.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Scale transformations occur in many image and video analysis tasks. They are a natural consequence of the variable distances among objects, or between objects and the camera. Such transformations result in significant changes in the input space which are often difficult for models to handle appropriately without careful consideration. At a high level, there are two modeling paradigms which allow a model to deal with scale changes: models can be endowed with an internal notion of scale and transform their predictions accordingly, or instead, models can be designed to be specifically invariant to scale changes. In image classification, when scale changes are commonly a factor of 2, it is often sufficient to make class prediction independent of scale. However, in tasks such as image segmentation, visual tracking, or object detection, scale changes can reach factors of 10 or more. In these cases, it is intuitive that the ideal prediction should scale proportionally to the input. For example, the segmentation map of a nearby pedestrian should be easily converted to that of a distant person simply by downscaling.
14
+
15
+ Convolutional Neural Networks (CNNs) demonstrate state-of-the-art performance in a wide range of tasks. Yet, despite their built-in translation equivariance, they do not have a particular mechanism for dealing with scale changes. One way to make CNNs account for scale is to train them with data augmentation Barnard & Casasent (1991). This is, however, suitable only for global transformations. As an alternative, Henriques & Vedaldi (2017) and Tai et al. (2019) use the canonical coordinates of scale transformations to reduce scaling to well-studied translations. While these approaches do allow for scale equivariance, they consequently break translation equivariance.
16
+
17
+ Several attempts have thus been made to extend CNNs to both scale and translation symmetry simultaneously. Some works use input or filter resizing to account for scaling in deep layers Xu et al. (2014); Kanazawa et al. (2014). Such methods are suboptimal due to the time complexity of tensor resizing and the need for interpolation. In Ghosh & Gupta (2019) the authors pre-calculate filters defined on several scales to build scale-invariant networks, while ignoring the important case of scale equivariance. In contrast, Worrall & Welling (2019) employ the theory of semigroup equivariant networks with scale-space as an example; however, this method is only suitable for integer downscale factors and therefore limited.
18
+
19
+ In this paper we develop a theory of scale-equivariant networks. We demonstrate the concept of steerable filter parametrization which allows for scaling without the need for tensor resizing. Then we derive scale-equivariant convolution and demonstrate a fast algorithm for its implementation. Furthermore, we experiment to determine to what degree the mathematical properties actually hold true. Finally, we conduct a set of experiments comparing our model with other methods for scale equivariance and local scale invariance.
20
+
21
+ The proposed model has the following advantages compared to other scale-equivariant models:
22
+
23
+ 1. It is equivariant to scale transformations with arbitrary discrete scale factors and is not limited to either integer scales or scales tailored by the image pixel grid.
24
+ 2. It does not rely on any image resampling techniques during training, and therefore, produces deep scale-equivariant representations free of any interpolation artifacts.
25
+ 3. The algorithm is based on the combination of tensor expansion and 2-dimensional convolution, and demonstrates the same computation time as the general CNN with a comparable filter bank.
26
+
27
+ # 2 PRELIMINARIES
28
+
29
+ Before we move into scale-equivariant mappings, we discuss some aspects of equivariance, scaling transformations, symmetry groups, and the functions defined on them. For simplicity, in this section, we consider only 1-dimensional functions. The generalization to higher-dimensional cases is straightforward.
30
+
31
+ Equivariance Let us consider some mapping $g$ . It is equivariant under $L _ { \theta }$ if and only if there exists $L _ { \theta } ^ { \prime }$ such that $g \circ L _ { \theta } = L _ { \theta } ^ { \prime } \circ g$ . In case $L _ { \theta } ^ { \prime }$ is the identity mapping, the function $g$ is invariant.
32
+
33
+ In this paper we consider scaling transformations. In order to guarantee the equivariance of the predictions to such transformations, and to improve the performance of the model, we seek to incorporate this property directly inside CNNs.
34
+
35
+ Scaling Given a function $f : \mathbb { R } \to \mathbb { R }$ , a scale transformation is defined as follows:
36
+
37
+ $$
38
+ L _ { s } [ f ] ( x ) = f ( s ^ { - 1 } x ) , \quad \forall s > 0
39
+ $$
40
+
41
+ We refer to cases with $s > 1$ as upscale and to cases with $s < 1$ as downscale. If we convolve the downscaled function with an arbitrary filter $\psi$ and perform a simple change of variables inside the integral, we get the following property:
42
+
43
+ $$
44
+ \begin{array} { l } { \displaystyle [ L _ { s } [ f ] \star \psi ] ( x ) = \int _ { \mathbb R } L _ { s } [ f ] ( x ^ { \prime } ) \psi ( x ^ { \prime } - x ) d x ^ { \prime } = \int _ { \mathbb R } f ( s ^ { - 1 } x ^ { \prime } ) \psi ( x ^ { \prime } - x ) d x ^ { \prime } } \\ { \displaystyle \qquad = s \int _ { \mathbb R } f ( s ^ { - 1 } x ^ { \prime } ) \psi ( s ( s ^ { - 1 } x ^ { \prime } - s ^ { - 1 } x ) ) d ( s ^ { - 1 } x ^ { \prime } ) = s L _ { s } [ f \star L _ { s ^ { - 1 } } [ \psi ] ] ( x ) } \end{array}
45
+ $$
46
+
47
+ In other words, convolution of the downscaled function with a filter can be expressed through a convolution of the function with the correspondingly upscaled filter where downscaling is performed afterwards. Equation 2 shows us that the standard convolution is not scale-equivariant.
48
+
49
+ Steerable Filters In order to make computations simpler, we reparametrize $\psi _ { \sigma } ( x ) = \sigma ^ { - 1 } \psi ( \sigma ^ { - 1 } x )$ , which has the following property:
50
+
51
+ $$
52
+ L _ { s ^ { - 1 } } [ \psi _ { \sigma } ] ( x ) = \psi _ { \sigma } ( s x ) = s ^ { - 1 } \psi _ { s ^ { - 1 } \sigma } ( x )
53
+ $$
54
+
55
+ It gives a shorter version of Equation 2:
56
+
57
+ $$
58
+ L _ { s } [ f ] \star \psi _ { \sigma } = L _ { s } [ f \star \psi _ { s ^ { - 1 } \sigma } ]
59
+ $$
60
+
61
+ We will refer to such a parameterization of filters as Steerable Filters because the scaling of these filters is the transformation of its parameters. Note that we may construct steerable filters from any function. This has the important consequence that it does not restrict our approach. Rather it will make the analysis easier for discrete data. Moreover, note that any linear combination of steerable filters is still steerable.
62
+
63
+ Scale-Translation Group All possible scales form the scaling group $S$ . Here we consider the discrete scale group, i.e. scales of the form $\dots a ^ { - 1 } , a ^ { - 1 } , 1 , a , a ^ { \tilde { 2 } } , \tilde { \dots } .$ with base $a$ as a parameter of our method. Analysis of this group by itself breaks the translation equivariance of CNNs. Thus we seek to incorporate scale and translation symmetries into CNNs, and, therefore consider the ScaleTranslation Group $H$ . It is a semidirect product of the scaling group $S$ and the group of translations $T \cong \mathbb { R }$ . In other words: $H = \{ ( s , t ) | s \in S , t \in T \}$ . For multiplication of group elements, we have $( s _ { 2 } , t _ { 2 } ) \cdot ( s _ { 1 } , t _ { 1 } ) = ( s _ { 2 } s _ { 1 } , s _ { 2 } t _ { 1 } + t _ { 2 } )$ and for the inverse $( s _ { 2 } , t _ { 2 } ) ^ { - 1 } \cdot ( s _ { 1 } , t _ { 1 } ) = ( s _ { 2 } ^ { - 1 } s _ { 1 } , s _ { 2 } ^ { - 1 } ( t _ { 1 } - t _ { 2 } ) )$ . Additionally, for the corresponding scaling and translation transformations, we have $L _ { s t } = L _ { s } L _ { t } \neq$ $L _ { t } L _ { s }$ , which means that the order of the operations matters.
64
+
65
+ From now on, we will work with functions defined on groups, i.e. mappings $H \to \mathbb { R }$ . Note, that simple function $f : \mathbb { R } \mathbb { R }$ may be considered as a function on $H$ with constant value along the $S$ axis. Therefore, Equation 4 holds true for functions on $H$ as well. One thing we should keep in mind is that when we apply $L _ { s }$ to functions on $H$ and $\mathbb { R }$ we use different notations. For example $L _ { s } [ f ] ( x ^ { \prime } ) = f ( s ^ { - 1 } x ^ { \prime } )$ and $\begin{array} { r } { \bar { L } _ { s } [ f ] ( s ^ { \prime } , t ^ { \prime } ) = f ( ( s , 0 ) ^ { - 1 } ( s ^ { \prime } , t ^ { \prime } ) ) = f ( s ^ { - 1 } s ^ { \prime } , s ^ { - 1 } t ^ { \prime } ) } \end{array}$
66
+
67
+ Group-Equivariant Convolution Given group $G$ and two functions $f$ and $\psi$ defined on it, $G$ - equivariant convolution is given by
68
+
69
+ $$
70
+ [ f \star _ { G } \psi ] ( g ) = \int _ { G } f ( g ^ { \prime } ) L _ { g } [ \psi ] ( g ^ { \prime } ) d \mu ( g ^ { \prime } ) = \int _ { G } f ( g ^ { \prime } ) \psi ( g ^ { - 1 } g ^ { \prime } ) d \mu ( g ^ { \prime } )
71
+ $$
72
+
73
+ Here $\mu ( g ^ { \prime } )$ is the Haar measure also known as invariant measure Folland (2016). For $T \cong \mathbb { R }$ we have $d \mu ( g ^ { \prime } ) = d g ^ { \prime }$ . For discrete groups, the Haar measure is the counting measure, and integration becomes a discrete sum. This formula tells us that the output of the convolution evaluated at point $g$ is the inner product between the function $f$ and the transformed filter $L _ { g } [ \psi ]$ .
74
+
75
+ # 3 SCALE-EQUIVARIANT MAPPINGS
76
+
77
+ Now we define the main building blocks of scale-equivariant models.
78
+
79
+ Scale Convolution In order to derive scale convolution, we start from group equivariant convolution with $G = H$ . We first use the property of semidirect product of groups which splits the integral, then choose the appropriate Haar measures, and finally use the properties of steerable filters. Given the function $f ( s , t )$ and a steerable filter $\psi _ { \sigma } ( s , t )$ defined on $H$ , a scale convolution is given by:
80
+
81
+ $$
82
+ \begin{array} { l } { { [ f \star _ { \cal H } \psi _ { \sigma } ] ( s , t ) = \displaystyle \int _ { \cal S } \int _ { \cal T } f ( s ^ { \prime } , t ^ { \prime } ) { \cal L } _ { s t } [ \psi _ { \sigma } ] ( s ^ { \prime } , t ^ { \prime } ) d \mu ( s ^ { \prime } ) d \mu ( t ^ { \prime } ) } } \\ { { { } } } \\ { { { } = \displaystyle \sum _ { s ^ { \prime } } \displaystyle \int _ { \cal T } f ( s ^ { \prime } , t ^ { \prime } ) \psi _ { s \sigma } ( s ^ { - 1 } s ^ { \prime } , t ^ { \prime } - t ) d t ^ { \prime } = \displaystyle \sum _ { s ^ { \prime } } [ f ( s ^ { \prime } , \cdot ) \star \psi _ { s \sigma } ( s ^ { - 1 } s ^ { \prime } , \cdot ) ] ( t ) } } \end{array}
83
+ $$
84
+
85
+ And for the case of $C _ { \mathrm { i n } }$ input and $C _ { \mathrm { o u t } }$ output channels we have:
86
+
87
+ $$
88
+ [ f \star _ { H } \psi _ { \sigma } ] _ { m } ( s , t ) = \sum _ { n = 1 } ^ { C _ { \mathrm { i n } } } \sum _ { s ^ { \prime } } [ f _ { n } ( s ^ { \prime } , \cdot ) \star \psi _ { n , m , s \sigma } ( s ^ { - 1 } s ^ { \prime } , \cdot ) ] ( t ) , \quad m = 1 \ldots C _ { \mathrm { o u t } }
89
+ $$
90
+
91
+ The proof of the equivariance of this convolution to transformations from $H$ is given in Appendix A.
92
+
93
+ Kondor & Trivedi (2018) prove that a feed-forward neural network is equivariant to transformations from $G$ if and only if it is constructed from $\mathbf { G }$ -equivariant convolutional layers. Thus Equation 7 shows the most general form of scale-equivariant layers which allows for building scale-equivariant convolutional networks with such choice of $S$ . We will refer to models using scale-equivariant layers with steerable filters as Scale-Equivariant Steerable Networks, or shortly $S \bar { E } S N ^ { 1 }$
94
+
95
+ Nonlinearities In order to guarantee the equivariance of the network to scale transformations, we use scale equivariant nonlinearities. We are free to use simple point-wise nonlinearities. Indeed, point-wise nonlinearities $\nu$ , like ReLU, commute with scaling transformations:
96
+
97
+ $$
98
+ \begin{array} { r } { [ \nu \circ L _ { s } [ f ] ] ( s ^ { \prime } , x ^ { \prime } ) = \nu ( L _ { s } [ f ] ( s ^ { \prime } , x ^ { \prime } ) ) = \nu ( f ( s ^ { - 1 } s ^ { \prime } , s ^ { - 1 } x ^ { \prime } ) ) } \\ { = \nu [ f ] ( s ^ { - 1 } s ^ { \prime } , s ^ { - 1 } x ^ { \prime } ) = [ L _ { s } \circ \nu [ f ] ] ( s ^ { \prime } , x ^ { \prime } ) } \end{array}
99
+ $$
100
+
101
+ Pooling Until now we did not discuss how to convert an equivariant mapping to invariant one. One way to do this is to calculate the invariant measure of the signal. In case of translation, such a measure could be the maximum value for example.
102
+
103
+ First, we propose the maximum scale projection defined as $f ( s , x ) \operatorname* { m a x } _ { s } f ( s , x )$ . This transformation projects the function $f$ from $H$ to $T$ . Therefore, the representation stays equivariant to scaling, but loses all information about the scale itself.
104
+
105
+ Second, we are free to use spatial max-pooling with a moving window or global max pooling. Transformation $f ( s , x ) \to \operatorname* { m a x } _ { x } { \overline { { f } } } ( s , x )$ projects the function $f$ from $H$ to $S$ . The obtained representation is invariant to scaling in spatial domain, however, it stores the information about scale.
106
+
107
+ Finally, we can combine both of these pooling mechanisms in any order. The obtained transformation produces a scale invariant function. It is useful to utilize this transformation closer to the end of the network, when the deep representation must be invariant to nuisance input variations, but already has very rich semantic meaning.
108
+
109
+ # 4 IMPLEMENTATION
110
+
111
+ In this paragraph we discuss an efficient implementation of Scale-Equivariant Steerable Networks. We illustrate all algorithms in Figure 1. For simplicity we assume that zero padding is applied when it is needed for both the spatial axes and the scale axis.
112
+
113
+ Filter Basis A direct implementation of Equation 7 is impossible due to several limitations. First, the infinite number of scales in $S$ calls for a discrete approximation. We truncate the scale group and limit ourselves to $N _ { S }$ scales and use discrete translations instead of continuous ones. Training of SESN involves searching for the optimal filter in functional space which is a problem by itself. Rather than solving it directly, we choose a complete basis of $N _ { b }$ steerable functions $\dot { \Psi } = \{ \psi _ { s ^ { - 1 } \sigma , i } \} _ { i = 1 } ^ { N _ { b } }$ and represent convolutional filter as a linear combination of basis functions with trainable parameters $w = \{ w _ { i } \} _ { i = 1 } ^ { N _ { b } }$ . In other words, we do the following substitution in Equation 7: $\begin{array} { r } { \psi _ { \sigma } \kappa \stackrel { - } { = } \sum _ { i } w _ { i } \Psi _ { i } } \end{array}$
114
+
115
+ In our experiments we use a basis of 2D Hermite polynomials with 2D Gaussian envelope, as it demonstrates good results. The basis is pre-calculated for all scales and fixed. For filters of size $V \times V$ , the basis is stored as an array of shape $[ N _ { b } , S , V , V ]$ . See Appendix C for more details.
116
+
117
+ Conv $T \to H$ If the input signal is just a function on $T$ with spatial size $U \times U$ , stored as an array of shape $[ C _ { \mathrm { i n } } , U , U ]$ , then Equation 7 can be simplified. The summation over $S$ degenerates, and the final result can be written in the following form:
118
+
119
+ $$
120
+ \mathtt { c o n v T H } ( f , w , \Psi ) = \mathtt { s q u e e } z \in \left( \mathtt { c o n v } 2 \mathrm { d } ( f , \mathtt { e x p a n d } ( w \times \Psi ) ) \right)
121
+ $$
122
+
123
+ Here $w$ is an array of shape $[ C _ { \mathrm { o u t } } , C _ { \mathrm { i n } } , N _ { b } ]$ . We compute filter $w \times \Psi$ of shape $[ C _ { \mathrm { o u t } } , C _ { \mathrm { i n } } , S , V , V ]$ and expand it to shape $[ C _ { \mathrm { o u t } } , C _ { \mathrm { i n } } S , V , V ]$ . Then we use standard 2D convolution to produce the output with $C _ { \mathrm { o u t } } S$ channels and squeeze it to shape $[ C _ { \mathrm { o u t } } , S , U , U ]$ . Note that the output can be viewed as a stack of feature maps, where all the features in each spatial position are vectors of $S$ components instead of being scalars as in standard CNNs.
124
+
125
+ Conv $H H$ The function on $H$ has a scale axis and therefore there are two options for choosing weights of the convolutional filter. The filter may have just one scale and, therefore, does not capture the correlations between different scales of the input function; or, it may have a non-unitary extent $K _ { S }$ in the scale axis and capture the correlation between $K _ { S }$ neighboring scales. We refer to the second case as interscale interaction.
126
+
127
+ It the first case $w$ has shape $[ C _ { \mathrm { o u t } } , C _ { \mathrm { i n } } , N _ { b } ]$ and Equation 7 degenerates in the same way as before
128
+
129
+ $$
130
+ \mathtt { c o n v H H } ( f , w , \Psi ) = \mathtt { s q u e e } z \in \left( \mathtt { c o n v } 2 \mathrm { d } ( \exp \mathsf { a n d } ( f ) , \mathtt { e x p a n d } ( w \times \Psi ) ) \right)
131
+ $$
132
+
133
+ We expand $f$ to an array of shape $[ C _ { \mathrm { i n } } S , U , U ]$ and expand $w \times \Psi$ to have shape $[ C _ { \mathrm { o u t } } S , C _ { \mathrm { i n } } S , V , V ]$ .
134
+ The result of the convolution is then squeezed in the same way as before.
135
+
136
+ In the case of interscale interaction, $w$ has shape $[ C _ { \mathrm { o u t } } , C _ { \mathrm { i n } } , K _ { S } , N _ { b } ]$ . We iterate over all scales in interaction, shift $f$ for each scale, choose a corresponding part of $w$ , and apply convHH to them. We sum the obtained $K _ { S }$ results afterwards.
137
+
138
+ ![](images/3a842654dbcbf77a7b84f924b43c512bc70871657b145e3b30693fa35d2dfeda.jpg)
139
+ Figure 1: Left: the way steerable filters are computed using steerable filter basis. Middle and right: a representation of scale-convolution using Equation 9 and Equation 10. As an example we use input signal $f$ with 3 channels. It has 1 scale on $T$ and 4 scales on $H$ . It is convolved with filter $\kappa = w \times \Psi$ without scale interaction, which produces the output with 2 channels and 4 scales as well. Here we represent only channels of the signals and the filter. Spatial components are hidden for simplicity.
140
+
141
+ # 5 RELATED WORK
142
+
143
+ Various works on group-equivariant convolutional networks have been published recently. These works have considered roto-translation groups in 2D Cohen & Welling (2016a); Hoogeboom et al. (2018); Worrall et al. (2017); Weiler & Cesa (2019) and 3D Worrall & Brostow (2018); Kondor (2018); Thomas et al. (2018) and rotation equivariant networks in 3D Cohen et al. (2017); Esteves et al. (2018); Cohen et al. (2019). In Freeman & Adelson (1991) authors describe the algorithm for designing steerable filters for rotations. Rotation steerable filters are used in Cohen & Welling (2016b); Weiler et al. (2018a;b) for building equivariant networks. In Jacobsen et al. (2017) the authors build convolutional blocks locally equivariant to arbitrary $k$ -parameter Lie group by using a steerable basis. And in Murugan et al. the authors discuss the approach for learning steerable filters from data. To date, the majority of papers on group equivariant networks have considered rotations in 2D and 3D, but have not payed attention to scale symmetry. As we have argued above, it is a fundamentally different case.
144
+
145
+ Many papers and even conferences have been dedicated to image scale-space — a concept where the image is analyzed together with all its downscaled versions. Initially introduced in Iijima (1959) and later developed by Witkin (1987); Perona & Malik (1990); Lindeberg (2013) scale space relies on the scale symmetry of images. The differential structure of the image Koenderink (1984) allows one to make a connection between image formation mechanisms and the space of solutions of the 2- dimensional heat equation, which significantly improved the image analysis models in the pre-deep learning era.
146
+
147
+ One of the first works on scale equivariance and local scale invariance in the framework of CNNs was proposed by Xu et al. (2014) named SiCNN. The authors describe the model with siamese CNNs, where the filters of each instance are rescaled using interpolation techniques. This is the simplest case of equivariance where no interaction between different scales is done in intermediate layers. In SI-ConvNet by Kanazawa et al. (2014) the original network is modified such that, in each layer, the input is first rescaled, then convolved and rescaled back to the original size. Finally, the response with the maximum values is chosen between the scales. Thus, the model is locally scale-invariant. In
148
+
149
+ Table 1: Comparing SESN to SiCNN $\mathrm { X u }$ et al. (2014), SI-ConvNet Kanazawa et al. (2014), SEVF Marcos et al. (2018), DSS Worrall & Welling (2019) and SS-CNN Ghosh & Gupta (2019). “Interscale” refers to the ability of capturing interscale interactions with kernels of non-unitary scale extent. “Grid” stands for the scales which generate images which lie exactly on the initial pixel grid.
150
+
151
+ <table><tr><td>Method</td><td>Equivariance</td><td>Admissible Scales</td><td>Approach</td><td>Interscale</td></tr><tr><td>SiCNN</td><td></td><td>Grid</td><td>Filter Rescaling</td><td></td></tr><tr><td>SI-ConvNet</td><td></td><td>Grid</td><td>Input Rescaling</td><td></td></tr><tr><td>SEVF</td><td></td><td>Grid</td><td>Input Rescaling</td><td></td></tr><tr><td>DSS</td><td>&lt;x&lt;/</td><td>Integer</td><td>Filter Dilation</td><td>xx&lt;&gt;</td></tr><tr><td>SS-CNN</td><td>X</td><td>Any</td><td>Steerable Filters</td><td>X</td></tr><tr><td>SESN, Ours</td><td>√</td><td>Any</td><td>Steerable Filters</td><td>√</td></tr></table>
152
+
153
+ Marcos et al. (2018), in the SEVF model, the input of the layers is rescaled and convolved multiple times to form vector features instead of scalar ones. The length of the vector in each position is the maximum magnitude of the convolution, while the direction of the angle encodes the scale of the image which gave this response. These scale-equivariant networks rely on image rescaling which is quite slow. Worrall & Welling (2019) (DSS) generalize the concept of scale-space to deep networks. They use filter dilation to analyze the images on different scales. While this approach is as fast as the standard CNN, it is restricted only to integer downscale factors $2 , 4 , 8 \dots$ In Ghosh & Gupta (2019), while discussing SS-CNN the authors use scale-steerable filters to deal with scale changes. The paper does not discuss equivariance, which is an important aspect for scale.
154
+
155
+ We summarize the information about these models in Table 1. In contrast to other scale-equivariant models, SESN uses steerable filters which allows for fast scale-convolution with no limitation of flexibility. With the framework of Scale-Equivariant Convolutional Networks we are free to build both equivariant and invariant models of different kinds.
156
+
157
+ ![](images/9d5081dc572954800739488564f5c9304a98127ff3d55fe8a82463473ff120dc.jpg)
158
+ Figure 2: Equivariance error $\Delta$ as a function of the number of layers (left), downscaling applied to the input image (middle), and as a function of number of scales in interscale interactions (right). The bars indicate standard deviation.
159
+
160
+ In this section we conduct the experiments and compare various methods for working with scale variations in input data. Alongside SESN, we test local scale invariant SI-ConvNet and SS-CNN, scale equivariant SiCNN, SEVF and DSS. For SEVF, DSS and SS-CNN we use the code provided by authors, while for others we reimplement the main buildings blocks.
161
+
162
+ We provide additional experimental results on time performance of all these methods in Appendix B. Due to the algorithm proposed in Section 4 SESN allows for training several times faster than other methods which rely on image rescaling.
163
+
164
+ <table><tr><td>Method</td><td>(28×28)</td><td>(28 × 28) +</td><td>(56 × 56)</td><td>(56 × 56) +</td><td># Params</td></tr><tr><td>CNN</td><td>2.56 ± 0.04</td><td>1.96 ± 0.07</td><td>2.02 ± 0.07</td><td>1.60 ± 0.09</td><td>495K</td></tr><tr><td>SiCNN</td><td>2.40 ± 0.03</td><td>1.86 ± 0.10</td><td>2.02 ± 0.14</td><td>1.59 ± 0.03</td><td>497K</td></tr><tr><td>SI-ConvNet</td><td>2.40± 0.12</td><td>1.94 ± 0.07</td><td>1.82 ± 0.11</td><td>1.59 ± 0.10</td><td>495K</td></tr><tr><td>SEVF Scalar</td><td>2.30 ± 0.06</td><td>1.96 ± 0.07</td><td>1.87 ± 0.09</td><td>1.62 ± 0.07</td><td>494 K</td></tr><tr><td>SEVF Vector</td><td>2.63 ± 0.09</td><td>2.23 ± 0.09</td><td>2.12 ± 0.13</td><td>1.81 ± 0.09</td><td>475 K</td></tr><tr><td>DSS Scalar</td><td>2.53 ± 0.10</td><td>2.04± 0.08</td><td>1.92 ± 0.08</td><td>1.57 ± 0.08</td><td>494 K</td></tr><tr><td>DSS Vector</td><td>2.58 ± 0.11</td><td>1.95 ± 0.07</td><td>1.97 ± 0.08</td><td>1.57 ± 0.09</td><td>494 K</td></tr><tr><td>SS-CNN</td><td>2.32 ± 0.15</td><td>2.10 ±0.15</td><td>1.84 ± 0.10</td><td>1.76 ± 0.07</td><td>494 K</td></tr><tr><td>SESN Scalar</td><td>2.10 ±0.10</td><td>1.79 ± 0.09</td><td>1.74 ± 0.09</td><td>1.50 ± 0.07</td><td>495K</td></tr><tr><td>SESN Vector</td><td>2.08 ±0.09</td><td>1.76 ± 0.08</td><td>1.68 ± 0.06</td><td>1.42 ± 0.07</td><td>495 K</td></tr></table>
165
+
166
+ Table 2: Classification error of different methods on MNIST-scale dataset, lower is better. In experiment we use image resolution of $2 8 \times 2 8$ and $5 6 \times 5 6$ . We test both the regime without data augmentation, and the regime with scaling data augmentation, denoted with $" + "$ . All results are reported as mean $\pm$ std over 6 different fixed realizations of the dataset. The best results are bold.
167
+
168
+ # 6.1 EQUIVARIANCE ERROR
169
+
170
+ We have presented scale-convolution which is equivariant to scale transformation and translation for continuous signals. While translation equivariance holds true even for discretized signals and filters, scale equivariance may not be exact. Therefore, before starting any experiments, we check to which degree the predicted properties of scale-convolution hold true. We do so by measuring the difference $\dot { \Delta } = \| [ L _ { s } \mathbf { \hat { \Phi } } ( f ) - \Phi \mathbf { \hat { L } } _ { s } ( f ) \| _ { 2 } ^ { 2 } / \| L _ { s } \Phi ( f ) \| _ { 2 } ^ { 2 }$ , where $\Phi$ is scale-convolution with randomly initialized weights.
171
+
172
+ In case of perfect equivariance the difference is equal to zero. We calculate the error on randomly sampled images from the STL-10 dataset Coates et al. (2011). The results are represented in Figure 2. The networks on the left and on the middle plots do not have interscale interactions. The networks on the middle and on the right plots consist of just one layer. We use $N _ { S } = 5 , 1 3 , 5$ scales for the networks on the left, the middle, and the right plots respectively. While discretization introduces some error, it stays very low, and is not much higher than $6 \%$ for the networks with 50 layers. The difference, however, increases if the input image is downscaled more than 16 times. Therefore, we are free to use deep networks. However, we should pay extra attention to extreme cases where scale changes are of very big magnitude. These are quite rare but still appear in practice. Finally, we see that using SESN with interscale interaction introduces extra equivariance error due to the truncation of $S$ . We will build the networks with either no scale interaction or interaction of 2 scales.
173
+
174
+ # 6.2 MNIST-SCALE
175
+
176
+ Following Kanazawa et al. (2014); Marcos et al. (2018); Ghosh & Gupta (2019) we conduct experiments on the MNIST-scale dataset. We rescale the images of the MNIST dataset LeCun et al. (1998) to $0 . 3 - 1 . 0$ of the original size and pad them with zeros to retain the initial resolution. The scaling factors are sampled uniformly and independently for each image. The obtained dataset is then split into 10,000 for training, 2,000 for evaluation and 50,000 for testing. We generate 6 different realizations and fix them for all experiments.
177
+
178
+ As a baseline model we use the model described in Ghosh & Gupta (2019), which currently holds the state-of-the-art result on this dataset. It consists of 3 convolutional and 2 fully-connected layers. Each layer has filters of size $7 \times 7$ . We keep the number of trainable parameters almost the same for all tested methods. This is achieved by varying the number of channels. For scale equivariant models we add scale projection at the end of the convolutional block.
179
+
180
+ For SiCNN, DSS, SEVF and our model, we additionally train counterparts where after each convolution, an extra projection layer is inserted. Projection layers transform vector features in each spatial position of each channel into scalar ones. All of the layers have now scalar inputs instead of vector inputs. Therefore, we denote these models with “Scalar”. The original models are denoted as “Vector”. The exact type of projection depends on the way the vector features are constructed. For SiCNN, DSS, and SESN, we use maximum pooling along the scale dimension, while for SEVF, it is a calculation of the $L _ { 2 }$ -norm of the vector.
181
+
182
+ All models are trained with the Adam optimizer Kingma & Ba (2014) for 60 epochs with a batch size of 128. Initial learning rate is set to 0.01 and divided by 10 after 20 and 40 epochs. We conduct the experiments with 4 different settings. Following the idea discussed in Ghosh & Gupta (2019), in addition to the standard setting we train the networks with input images upscaled to $5 6 \times 5 6$ using bilinear interpolation. This results in all image transformations performed by the network becoming more stable, which produces less interpolation artifacts. For both input sizes we conduct the experiments without data augmentation and with scaling augmentation, which results in 4 setups in total. We run the experiments on 6 different realizations of MNIST-scale and report mean $\pm$ std calculated over these runs.
183
+
184
+ The obtained results are summarized in Table 2. The reported errors may differ a bit from the ones in the original paper because of the variations in generated datasets and slightly different training procedure. Nevertheless, we try to keep our configuration as close as possible to Ghosh & Gupta (2019) which currently demonstrated the best classification accuracy on MNIST-scale. For example, SS-CNN reports error of $1 . 9 1 \pm 0 . 0 4$ in Ghosh & Gupta (2019) while it has $1 . 8 4 \pm 0 . 1 0$ in our experiments.
185
+
186
+ SESN significantly outperforms other methods in all 4 regimes. “Scalar” versions of it already outperform all previous methods, and “Vector” versions make the gain even more significant. The global architectures of all models are the same for all rows, which indicates that the way scale convolution is done plays an important role.
187
+
188
+ # 6.3 STL-10
189
+
190
+ In order to evaluate the role of scale equivariance in natural image classification, we conduct the experiments on STL-10 dataset Coates et al. (2011). This dataset consists of 8,000 training and 5,000 testing labeled images. Additionally, it includes 100,000 unlabeled images. The images have a resolution of $9 6 \times 9 6$ pixels and RGB channels. Labeled images belong to 10 classes such as bird, horse or car. We use only the labeled subset to demonstrate the performance of the models in the low data regime.
191
+
192
+ The dataset is normalized by subtracting the per-channel mean and dividing by the per-channel standard deviation. During training, we augment the dataset by applying 12 pixel zero padding and randomly cropping the images to size $9 6 \times 9 6$ . Additionally, random horizontal flips with probability $5 0 \%$ and Cutout DeVries & Taylor (2017) with 1 hole of 32 pixels are used.
193
+
194
+ As a baseline we choose WideResNet Zagoruyko & Komodakis (2016) with 16 layers and a widening factor of 8. We set dropout probability to 0.3 in all blocks. We train SESN-A with just vector features. For SESN-B we use maximum scalar projection several times in the intermediate layers, and for SESN-C we use interscale interaction.
195
+
196
+ Table 3: Classification error on STL-10. The best results are bold. We additionally report the current best result achieved by Harm WRN from Ulicny et al. (2019).
197
+
198
+ <table><tr><td>Method</td><td>Error, %</td><td>#Params</td></tr><tr><td>WRN</td><td>11.48</td><td>11.0 M</td></tr><tr><td>SiCNN</td><td>11.62</td><td>11.0 M</td></tr><tr><td>SI-ConvNet</td><td>12.48</td><td>11.0 M</td></tr><tr><td>DSS</td><td>11.28</td><td>11.0 M</td></tr><tr><td>SS-CNN</td><td>25.47</td><td>10.8 M</td></tr><tr><td>SESN-A</td><td>10.83</td><td>11.0 M</td></tr><tr><td>SESN-B</td><td>8.51</td><td>11.0 M</td></tr><tr><td>SESN-C</td><td>14.08</td><td>11.0 M</td></tr><tr><td>Harm WRN</td><td>9.55</td><td>11.0 M</td></tr></table>
199
+
200
+ All models are trained for 1000 epochs with a batch size of 128. We use SGD optimizer with Nesterov momentum of 0.9 and weight decay of $5 \cdot 1 0 ^ { - 4 } $ . The initial learning rate is set to 0.1 and divided by 5 after 300, 400, 600 and 800 epochs.
201
+
202
+ The results are summarized in Table 3. We found SEVF training unstable and therefore do not include it in the table. Pure scale-invariant SI-ConvNet and SS-CNN demonstrate significantly worse results than the baseline. We note the importance of equivariance for deep networks. We also find that SESN-C performs significantly worse than SESN-A and SESN-B due to high equivariance error caused by interscale interaction. SESN-B significantly improves the results of both WRN and DSS due to the projection between scales. The maximum scale projection makes the weights of the next layer to have a maximum receptive field in the space of scales. This is an easy yet effective method for capturing the correlations between different scales. This experiment shows that scale-equivariance is a very useful inductive bias for natural image classification with deep neural networks.
203
+
204
+ To the best of our knowledge, the proposed method achieves a new state-of-the-art result on the STL-10 dataset in the supervised learning setting. The previous lowest error is demonstrated in Ulicny et al. (2019). The authors propose Harm WRN — a network where the convolutional kernels are represented as a linear combination of Discrete Cosine Transform filters.
205
+
206
+ # 7 DISCUSSION
207
+
208
+ In this paper, we have presented the theory of Scale-Equivariant Steerable Networks. We started from the scaling transformation and its application to continuous functions. We have obtained the exact formula for scale-equivariant mappings and demonstrated how it can be implemented for discretized signals. We have demonstrated that this approach outperforms other methods for scale-equivariant and local scale-invariant CNNs. It demonstrated new state-of-the-art results on MNIST-scale and on the STL-10 dataset in the supervised learning setting.
209
+
210
+ We suppose that the most exciting possible application of SESN is in computer vision for autonomous vehicles. Rapidly changing distances between the objects cause significant scale variations which makes this well suited for our work. We especially highlight the direction of siamese visual tracking where the equivariance to principle transformations plays an important role.
211
+
212
+ # ACKNOWLEDGMENTS
213
+
214
+ We thank Daniel Worrall for insightful discussion, Thomas Andy Keller, Victor Garcia, Artem Moskalev and Konrad Groh for valuable comments and feedback.
215
+
216
+ # REFERENCES
217
+
218
+ Etienne Barnard and David Casasent. Invariance and neural nets. IEEE Transactions on neural networks, 2(5):498–508, 1991.
219
+
220
+ Adam Coates, Andrew Ng, and Honglak Lee. An analysis of single-layer networks in unsupervised feature learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp. 215–223, 2011.
221
+
222
+ Taco Cohen and Max Welling. Group equivariant convolutional networks. In International conference on machine learning, pp. 2990–2999, 2016a.
223
+
224
+ Taco Cohen, Mario Geiger, Jonas Kohler, and Max Welling. Convolutional networks for spherical ¨ signals. arXiv preprint arXiv:1709.04893, 2017.
225
+
226
+ Taco S Cohen and Max Welling. Steerable cnns. arXiv preprint arXiv:1612.08498, 2016b.
227
+
228
+ Taco S Cohen, Maurice Weiler, Berkay Kicanaoglu, and Max Welling. Gauge equivariant convolutional networks and the icosahedral cnn. arXiv preprint arXiv:1902.04615, 2019.
229
+
230
+ Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
231
+
232
+ Carlos Esteves, Christine Allen-Blanchette, Ameesh Makadia, and Kostas Daniilidis. Learning so (3) equivariant representations with spherical cnns. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 52–68, 2018.
233
+
234
+ Gerald B Folland. A course in abstract harmonic analysis. Chapman and Hall/CRC, 2016.
235
+
236
+ William T. Freeman and Edward H Adelson. The design and use of steerable filters. IEEE Transactions on Pattern Analysis & Machine Intelligence, (9):891–906, 1991.
237
+
238
+ Rohan Ghosh and Anupam K Gupta. Scale steerable filters for locally scale-invariant convolutional neural networks. arXiv preprint arXiv:1906.03861, 2019.
239
+
240
+ Joao F Henriques and Andrea Vedaldi. Warped convolutions: Efficient invariance to spatial transformations. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1461–1469. JMLR. org, 2017.
241
+
242
+ Emiel Hoogeboom, Jorn WT Peters, Taco S Cohen, and Max Welling. Hexaconv. arXiv preprint arXiv:1803.02108, 2018.
243
+
244
+ Taizo Iijima. Basic theory of pattern observation. Technical Group on Automata and Automatic Control, pp. 3–32, 1959.
245
+
246
+ Jorn-Henrik Jacobsen, Bert De Brabandere, and Arnold WM Smeulders. Dynamic steerable blocks ¨ in deep residual networks. arXiv preprint arXiv:1706.00598, 2017.
247
+
248
+ Angjoo Kanazawa, Abhishek Sharma, and David Jacobs. Locally scale-invariant convolutional neural networks. arXiv preprint arXiv:1412.5104, 2014.
249
+
250
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
251
+
252
+ Jan J Koenderink. The structure of images. Biological cybernetics, 50(5):363–370, 1984.
253
+
254
+ Risi Kondor. N-body networks: a covariant hierarchical neural network architecture for learning atomic potentials. arXiv preprint arXiv:1803.01588, 2018.
255
+
256
+ Risi Kondor and Shubhendu Trivedi. On the generalization of equivariance and convolution in neural networks to the action of compact groups. arXiv preprint arXiv:1802.03690, 2018.
257
+
258
+ Yann LeCun, Leon Bottou, Yoshua Bengio, Patrick Haffner, et al. Gradient-based learning applied ´ to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
259
+
260
+ Tony Lindeberg. Scale-space theory in computer vision, volume 256. Springer Science & Business Media, 2013.
261
+
262
+ Diego Marcos, Benjamin Kellenberger, Sylvain Lobry, and Devis Tuia. Scale equivariance in cnns with vector fields. arXiv preprint arXiv:1807.11783, 2018.
263
+
264
+ Muthuvel Murugan, KV Subrahmanyam, and Siruseri IT Park. So (2)-equivariance in neural networks using tensor nonlinearity.
265
+
266
+ Pietro Perona and Jitendra Malik. Scale-space and edge detection using anisotropic diffusion. IEEE Transactions on pattern analysis and machine intelligence, 12(7):629–639, 1990.
267
+
268
+ Kai Sheng Tai, Peter Bailis, and Gregory Valiant. Equivariant transformer networks. arXiv preprint arXiv:1901.11399, 2019.
269
+
270
+ Nathaniel Thomas, Tess Smidt, Steven Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation-and translation-equivariant neural networks for 3d point clouds. arXiv preprint arXiv:1802.08219, 2018.
271
+
272
+ Matej Ulicny, Vladimir A Krylov, and Rozenn Dahyot. Harmonic networks with limited training samples. arXiv preprint arXiv:1905.00135, 2019.
273
+
274
+ Maurice Weiler and Gabriele Cesa. General e (2)-equivariant steerable cnns. In Advances in Neural Information Processing Systems, pp. 14334–14345, 2019.
275
+
276
+ Maurice Weiler, Mario Geiger, Max Welling, Wouter Boomsma, and Taco Cohen. 3d steerable cnns: Learning rotationally equivariant features in volumetric data. In Advances in Neural Information Processing Systems, pp. 10381–10392, 2018a.
277
+
278
+ Maurice Weiler, Fred A Hamprecht, and Martin Storath. Learning steerable filters for rotation equivariant cnns. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 849–858, 2018b.
279
+
280
+ Andrew P Witkin. Scale-space filtering. In Readings in Computer Vision, pp. 329–332. Elsevier, 1987.
281
+ Daniel Worrall and Gabriel Brostow. Cubenet: Equivariance to 3d rotation and translation. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 567–584, 2018.
282
+ Daniel E Worrall and Max Welling. Deep scale-spaces: Equivariance over scale. arXiv preprint arXiv:1905.11697, 2019.
283
+ Daniel E Worrall, Stephan J Garbin, Daniyar Turmukhambetov, and Gabriel J Brostow. Harmonic networks: Deep translation and rotation equivariance. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5028–5037, 2017.
284
+ Yichong Xu, Tianjun Xiao, Jiaxing Zhang, Kuiyuan Yang, and Zheng Zhang. Scale-invariant convolutional neural networks. arXiv preprint arXiv:1411.6369, 2014.
285
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
286
+
287
+ # A PROOF OF EQUIVARIANCE
288
+
289
+ Let us first show that scale-convolution defined in Equation 6 is equivariant to translations.
290
+
291
+ $$
292
+ \begin{array} { l } { [ L _ { \hat { t } } [ f ] \star _ { H } \psi _ { \sigma } ] ( s , t ) = \displaystyle \sum _ { s ^ { \prime } } [ L _ { \hat { t } } [ f ] ( s ^ { \prime } , \cdot ) \star \psi _ { s \sigma } ( s ^ { - 1 } s ^ { \prime } , \cdot ) ] ( t ) } \\ { = \displaystyle \sum _ { s ^ { \prime } } L _ { \hat { t } } [ f ( s ^ { \prime } , \cdot ) \star \psi _ { s \sigma } ( s ^ { - 1 } s ^ { \prime } , \cdot ) ] ( t ) } \\ { = L _ { \hat { t } } \Big \{ \displaystyle \sum _ { s ^ { \prime } } [ f ( s ^ { \prime } , \cdot ) \star \psi _ { s \sigma } ( s ^ { - 1 } s ^ { \prime } , \cdot ) ] \Big \} ( t ) } \\ { = L _ { \hat { t } } [ f \star _ { H } \psi _ { \sigma } ] ( s , t ) } \end{array}
293
+ $$
294
+
295
+ Now we show that scale convolution is equivariant to scale transformations:
296
+
297
+ $$
298
+ \begin{array} { l } { [ L _ { \delta } [ f ] \star _ { H } \psi _ { \sigma } ] ( s , t ) = \displaystyle \sum _ { s ^ { \prime } } [ L _ { \delta } [ f ] ( s ^ { \prime } , \cdot ) \star \psi _ { s \sigma } ( s ^ { - 1 } s ^ { \prime } , \cdot ) ] ( t ) } \\ { = \displaystyle \sum _ { s ^ { \prime } } L _ { \delta } [ f ( \hat { s } ^ { - 1 } s ^ { \prime } , \cdot ) \star \psi _ { \hat { s } ^ { - 1 } s \sigma } ( s ^ { - 1 } s ^ { \prime } , \cdot ) ] ( t ) } \\ { = \displaystyle \sum _ { s ^ { \prime \prime } } [ f ( s ^ { \prime \prime } , \cdot ) \star \psi _ { \hat { s } ^ { - 1 } s \sigma } ( \hat { s } s ^ { - 1 } s ^ { \prime \prime } , \cdot ) ] ( \hat { s } ^ { - 1 } t ) } \\ { = [ f \star _ { H } \psi _ { \sigma } ] ( \hat { s } ^ { - 1 } s , \hat { s } ^ { - 1 } t ) } \\ { = L _ { \delta } [ f \star _ { H } \psi _ { \sigma } ] ( s , t ) } \end{array}
299
+ $$
300
+
301
+ Finally, we can use the property of semidirect product of groups
302
+
303
+ $$
304
+ L _ { \hat { s t } } [ f ] \star _ { H } \psi _ { \sigma } = L _ { \hat { s } } L _ { \hat { t } } [ f ] \star _ { H } \psi _ { \sigma } = L _ { \hat { s } } [ L _ { \hat { t } } [ f ] \star _ { H } \psi _ { \sigma } ] = L _ { \hat { s } } L _ { \hat { t } } [ f \star _ { H } \psi _ { \sigma } ] = L _ { \hat { s } \hat { t } } [ f \star _ { H } \psi _ { \sigma } ] = L _ { \hat { s t } } [ f \star _ { H } \psi _ { \sigma } ]
305
+ $$
306
+
307
+ # B TIME PERFORMANCE
308
+
309
+ We report the average time per epoch of different methods for scale equivariance and local scale invariance in Table 4. Experimental setups from Section 6.2 are used. We used 1 Nvidia GeForce GTX 1080Ti GPU for training the models.
310
+
311
+ The methods relying on image rescaling techniques during training (SiCNN, SI-ConvNet, SEVF) demonstrate significantly worse time performance that the ones, using either steerable filters or filter dilation. Additionally, we see that our method outperforms SS-CNN by a wide margin. Despite the similar filter sizes and comparable number of parameters between SS-CNN and SESN Scalar, the second one demonstrates significantly better results due to the algorithm proposed in Section 4. Finally, DSS performs slightly faster in some cases than our method as each convolution involves less FLOPs. Dilated filters are sparse, while steerable filters are dense.
312
+
313
+ <table><tr><td>Method</td><td>28×28,s</td><td>56 × 56,s</td></tr><tr><td>CNN</td><td>3.8</td><td>3.8</td></tr><tr><td>SiCNN Scalar</td><td>13.5</td><td>18.9</td></tr><tr><td>SiCNN Vector</td><td>15.3</td><td>22.8</td></tr><tr><td>SI-ConvNet</td><td>18.4</td><td>33.1</td></tr><tr><td>SEVF Scalar</td><td>21.0</td><td>38.4</td></tr><tr><td>SEVF Vector</td><td>25.4</td><td>46.0</td></tr><tr><td>DSS Scalar</td><td>3.9</td><td>5.0</td></tr><tr><td>DSS Vector</td><td>3.9</td><td>4.8</td></tr><tr><td>SS-CNN</td><td>14.8</td><td>16.6</td></tr><tr><td>SESN Scalar</td><td>3.8</td><td>5.1</td></tr><tr><td>SESN Vector</td><td>3.8</td><td>6.8</td></tr></table>
314
+
315
+ Table 4: Average time per epoch during training on input data with resolution $2 8 \times 2 8$ and $5 6 \times 5 6$ .
316
+
317
+ # C BASIS
318
+
319
+ Assuming that the center of the filter is point $( 0 , 0 )$ in coordinates $( x , y )$ , we use the filters of the following form:
320
+
321
+ $$
322
+ \psi _ { \sigma } ( x , y ) = A \frac { 1 } { \sigma ^ { 2 } } H _ { n } \Big ( \frac { x } { \sigma } \Big ) H _ { m } \Big ( \frac { y } { \sigma } \Big ) \exp \Big [ - \frac { x ^ { 2 } + y ^ { 2 } } { 2 \sigma ^ { 2 } } \Big ]
323
+ $$
324
+
325
+ Here $A$ is a constant independent on $\sigma$ , $H _ { n }$ — Hermite polynomial of the $n$ -th order. We iterate over increasing pairs of $n , m$ to generate the required number of functions.
326
+
327
+ # D MODEL CONFIGURATION
328
+
329
+ # D.1 MNIST-SCALE
330
+
331
+ Table 5: Number of channels in convolutional layers, number of units in fully-connected layers and number of scales used by different models in Section 6.2.
332
+
333
+ <table><tr><td>Method</td><td>Conv 1</td><td>Conv 2</td><td>Conv 3</td><td>FC1</td><td># Scales</td></tr><tr><td>CNN</td><td>32</td><td>63</td><td>95</td><td></td><td>1</td></tr><tr><td>SiCNN</td><td>32</td><td>63</td><td>95</td><td></td><td>7</td></tr><tr><td>SI-ConvNet</td><td>32</td><td>63</td><td>95</td><td></td><td>7</td></tr><tr><td>SEVF Scalar</td><td>32</td><td>63</td><td>95</td><td>256</td><td>8</td></tr><tr><td>SEVF Vector</td><td>23</td><td>45</td><td>68</td><td></td><td>8</td></tr><tr><td>DSS</td><td>32</td><td>63</td><td>95</td><td></td><td>4</td></tr><tr><td>SS-CNN</td><td>30</td><td>60</td><td>90</td><td></td><td>6</td></tr><tr><td>SESN</td><td>32</td><td>63</td><td>95</td><td></td><td>4</td></tr></table>
334
+
335
+ D.2 STL-10
336
+
337
+ <table><tr><td>Method</td><td>Block 1</td><td>Block 2</td><td>Block 3</td><td># Scales</td></tr><tr><td>CNN</td><td>16</td><td>32</td><td>64</td><td>1</td></tr><tr><td>SiCNN</td><td>16</td><td>32</td><td>64</td><td>3</td></tr><tr><td>SI-ConvNet</td><td>16</td><td>32</td><td>64</td><td>3</td></tr><tr><td>SEVF</td><td>11</td><td>23</td><td>45</td><td>3</td></tr><tr><td>DSS</td><td>16</td><td>32</td><td>64</td><td>4</td></tr><tr><td>SS-CNN</td><td>11</td><td>22</td><td>44</td><td>3</td></tr><tr><td>SESN</td><td>16</td><td>32</td><td>64</td><td>3</td></tr></table>
338
+
339
+ Table 6: Number of channels in convolutional blocks and number of scales used by different models in Section 6.2. We report the number of channels up to the widening factor.
md/train/HJlzxgBtwH/HJlzxgBtwH.md ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Minimally distorted Adversarial Examples with a Fast Adaptive Boundary Attack
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # Abstract
6
+
7
+ The evaluation of robustness against adversarial manipulations of neural networks-based classifiers is mainly tested with empirical attacks as the methods for the exact computation, even when available, do not scale to large networks. We propose in this paper a new white-box adversarial attack wrt the $l _ { p }$ -norms for $p \in \{ 1 , 2 , \infty \}$ aiming at finding the minimal perturbation necessary to change the class of a given input. It has an intuitive geometric meaning, yields quickly high quality results, minimizes the size of the perturbation (so that it returns the robust accuracy at every threshold with a single run). It performs better or similarly to state-of-the-art attacks which are partially specialized to one $l _ { p }$ -norm.
8
+
9
+ # 1 Introduction
10
+
11
+ The finding of the vulnerability of neural networks-based classifiers to adversarial examples, that is small perturbations of the input able to modify the decision of the models, started a fast development of a variety of attack algorithms. The high effectiveness of adversarial attacks reveals the fragility of these networks which questions their safe and reliable use in the real world, especially in safety critical applications. Many defenses have been proposed to fix this issue (Gu & Rigazio, 2015; Zheng et al., 2016; Papernot et al., 2016; Huang et al., 2016; Bastani et al., 2016; Madry et al., 2018), but with limited success, as new more powerful attacks showed (Carlini & Wagner, 2017b; Athalye et al., 2018; Mosbach et al., 2018). In order to trust the decision of a model, it is necessary to evaluate the exact adversarial robustness. Although this is possible for ReLU networks (Katz et al., 2017; Tjeng et al., 2019) these techniques do not scale to commonly used large networks. Thus, the robustness is evaluated approximating the solution of the minimal adversarial perturbation problem through adversarial attacks.
12
+
13
+ One can distinguish attacks into black-box (Narodytska & Kasiviswanathan, 2016; Brendel et al., 2018; Su et al., 2019), where one is only allowed to query the classifier, and white-box attacks, where one has full control over the network, according to the attack model used to create adversarial examples (typically some $l _ { p }$ -norm, but others have become popular as well, e.g. Brown et al. (2017); Engstrom et al. (2017); Wong et al.), whether they aim at the minimal adversarial perturbation (Carlini & Wagner, 2017a; Chen et al., 2018; Croce et al., 2019) or rather any perturbation below a threshold (Kurakin et al., 2017; Madry et al., 2018; Zheng et al., 2019), if they have lower (Moosavi-Dezfooli et al., 2016; Modas et al., 2019) or higher (Carlini & Wagner, 2017a; Croce et al., 2019) computational cost. Moreover, it is clear that due to the non-convexity of the problem there exists no universally best attack (apart from the exact methods), since this depends on runtime constraints, networks architecture, dataset, etc. However, our goal is to have an attack which performs well under a broad spectrum of conditions with minimal amount of hyperparameter tuning.
14
+
15
+ In this paper we propose a new white-box attacking scheme which performs comparably or better than established attacks and has the following features: first, it tries to produce adversarial samples with minimal distortion compared to the original point, measured wrt the $l _ { p }$ -norms with $p \in \{ 1 , 2 , \infty \}$ . Respect to the quite popular PGD-attack of Madry et al. (2018) this has the clear advantage that our method does not need to be restarted for every threshold $\epsilon$ if one wants to evaluate the success rate of the attack with perturbations constrained to be in $\{ \delta \in \mathbb { R } ^ { d } \mid \left\| \delta \right\| _ { p } \leq \epsilon \}$ . Thus it is particularly suitable to get a complete picture on the robustness of a classifier with low computational cost. Second, it achieves fast good quality in terms of average distortion or robust accuracy. At the same time we show that increasing the number of restarts keeps improving the results and makes it competitive with the strongest available attacks. Third, although it comes with a few parameters, these mostly generalize across datasets, architectures and norms considered, so that we have an almost off-the-shelf method. Most importantly, unlike PGD and other methods, there is no step size parameter which potentially has to be carefully adapted to every new network.
16
+
17
+ # 2 FAB: a Fast Adaptive Boundary Attack
18
+
19
+ We first introduce minimal adversarial perturbations, then we recall the definition and properties of the projection wrt the $l _ { p }$ -norms of a point on the intersection of a hyperplane and box constraints, as they are an essential part of our attack. Finally, we present our FAB-attack algorithm to generate minimally distorted adversarial examples.
20
+
21
+ # 2.1 Minimal adversarial examples
22
+
23
+ Let $f : \mathbb { R } ^ { d } \mathbb { R } ^ { K }$ be a classifier which assigns every input $x \in \mathbb { R } ^ { d }$ (with $d$ the dimension of the input space) to one of the $K$ classes according to arg max $f _ { r } ( x )$ . In many scenarios $r { = } 1 , { \ldots } , K$
24
+
25
+ the input of $f$ has to satisfy a specific set of constraints $C$ , e.g. images are represented as elements of $[ 0 , 1 ] ^ { d }$ . Then, given a point $x \in \mathbb { R } ^ { d }$ with true class $c$ , we define the minimal adversarial perturbation for $x$ wrt the $l _ { p }$ -norm as
26
+
27
+ $$
28
+ \delta _ { \operatorname* { m i n } , p } = \operatorname* { a r g m i n } _ { \delta \in \mathbb { R } ^ { d } } \ \| \delta \| _ { p } , \quad \mathrm { s . t h . } \quad \operatorname* { m a x } _ { l \neq c } \ f _ { l } ( x + \delta ) \geq f _ { c } ( x + \delta ) , \quad x + \delta \in C .
29
+ $$
30
+
31
+ The optimization problem (1) is non-convex and NP-hard for non-trivial classifiers (Katz et al. (2017)) and, although for some classes of networks it can be formulated as a mixed-integer program (see Tjeng et al. (2019)), the computational cost of solving it is prohibitive for large, normally trained networks. Thus, $\delta _ { \mathrm { m i n } , p }$ is usually approximated by an attack algorithm, which can be seen as a heuristic to solve (1). We will see in the experiments that current attacks sometimes drastically overestimate $\Vert \delta _ { \mathrm { m i n } , p } \Vert _ { p }$ and thus the robustness of the networks.
32
+
33
+ # 2.2 Projection on a hyperplane with box constraints
34
+
35
+ Let $w ~ \in ~ \mathbb { R } ^ { d }$ and $b \in \mathbb { R }$ be the normal vector and the offset defining the hyperplane $\pi : \langle w , x \rangle + b = 0$ . Let $x \in \mathbb { R } ^ { d }$ , we denote by the box-constrained projection wrt the $l _ { p }$ -norm of $x$ on $\pi$ (projection onto the intersection of the box $C = \{ z \in \mathbb { R } ^ { d } : l _ { i } \leq z _ { i } \leq u _ { i } \}$ and the hyperplane $\pi$ ) the following minimization problem:
36
+
37
+ $$
38
+ z ^ { * } = \underset { z \in \mathbb { R } ^ { d } } { \mathrm { a r g } \mathrm { m i n } } \ \lVert z - x \rVert _ { p } \quad \mathrm { s . t h . } \quad \langle w , z \rangle + b = 0 , \quad l _ { i } \leq z _ { i } \leq u _ { i } , \quad i = 1 , \ldots , d ,
39
+ $$
40
+
41
+ where $l _ { i } , u _ { i } \in \mathbb { R }$ are lower and upper bounds on each component of $z$ . For $p \geq 1$ the optimization problem (2) is convex. Hein $\&$ Andriushchenko (2017) proved that for $p \in$ $\{ 1 , 2 , \infty \}$ the solution can be obtained in ${ \mathcal { O } } ( d \log d )$ time, that is the complexity of sorting a vector of $d$ elements, as well as determining that it has no solution.
42
+
43
+ Since this projection is part of our iterative scheme, we need to handle specifically the case of (2) being infeasible. In this case, defining $\rho = \mathrm { s i g n } ( \langle w , x \rangle + b )$ , we instead compute
44
+
45
+ $$
46
+ z ^ { \prime } = \underset { z \in \mathbb { R } ^ { d } } { \arg \operatorname* { m i n } } \ \rho ( \langle w , z \rangle + b ) \quad \mathrm { s . t h . } \quad l _ { i } \leq z _ { i } \leq u _ { i } , \quad i = 1 , \ldots , d ,
47
+ $$
48
+
49
+ $z _ { i } = \left\{ { \begin{array} { l } { l _ { i } } \\ { u _ { i } } \\ { x _ { i } } \end{array} } \right.$ if $\rho w _ { i } > 0$ , whose solution is given componentwise, for every $i = 1 , \ldots , d$ , by if $\rho w _ { i } < 0 , .$ if $w _ { i } = 0$
50
+
51
+ Assuming that the point $x$ satisfies the box constraints (as it will be in our algorithm), this is equivalent to identifying the corner of the $d$ -dimensional box defined by the componentwise constraints on $z$ closest to the hyperplane $\pi$ . Notice that if (2) is infeasible then the objective
52
+
53
+ function of (3) stays positive and the points $x$ and $z$ are strictly contained in the same of the two halfspaces divided by $\pi$ . Finally, we define the operator
54
+
55
+ $$
56
+ \mathrm { p r o j } _ { p } : ( x , \pi , C ) \longmapsto { \left\{ \begin{array} { l l } { z ^ { * } } & { { \mathrm { i f ~ } } \mathrm { P r o b l e m ~ ( 2 ) ~ i s ~ f e a s i b l e } } \\ { z ^ { \prime } } & { { \mathrm { e l s e } } } \end{array} \right. }
57
+ $$
58
+
59
+ yielding the point which gets as close as possible to $\pi$ without violating the box constraints.
60
+
61
+ # 2.3 FAB Attack
62
+
63
+ We introduce now our algorithm to produce minimally distorted adversarial examples, wrt any $l _ { p }$ -norm for $p \in \{ 1 , 2 , \infty \}$ , for a given point $x _ { \mathrm { o r i g } }$ initially correctly classified by $f$ as class $c$ . The high-level idea is that we use the linearization of the classifier at the current iterate $\boldsymbol { x } ^ { ( i ) }$ , compute the box-constrained projections of $\boldsymbol { x } ^ { ( i ) }$ respectively $x _ { \mathrm { o r i g } }$ onto the approximated decision hyperplane and take a convex combinations of these projections depending on the distance of $\boldsymbol { x } ^ { ( i ) }$ and to the decision hyperplane, followed by some extrapolation step. $x _ { \mathrm { o r i g } }$
64
+ We explain below the geometric motivation behind these steps. The attack closest in spirit is DeepFool (Moosavi-Dezfooli et al. (2016)) which is known to be very fast but suffers from low quality. DeepFool just tries to find the decision boundary quickly but has no incentive to provide a solution close to $x _ { \mathrm { o r i g } }$ . Our scheme resolves this main problem and, together with the exact projection we use, leads to a principled way to track the decision boundary (the surface where the decision of $f$ changes) close to $x _ { \mathrm { o r i g } }$ .
65
+
66
+ If $f$ was a linear classifier then the closest point to $\boldsymbol { x } ^ { ( i ) }$ on the decision hyperplane could be found in closed form. Although neural networks are highly non-linear, ReLU networks (neural networks which use ReLU as activation function) are piecewise affine functions and thus locally a linearization of the network is an exact description of the classifier. Let $l \neq c$ , then the decision boundary between classes $\it l$ and $c$ can be locally approximated using a first order Taylor expansion at $\boldsymbol { x } ^ { ( i ) }$ by the hyperplane
67
+
68
+ $$
69
+ \pi \iota ( z ) : f _ { l } ( x ^ { ( i ) } ) - f _ { c } ( x ^ { ( i ) } ) + \left. \nabla f _ { l } ( x ^ { ( i ) } ) - \nabla f _ { c } ( x ^ { ( i ) } ) , z - x ^ { ( i ) } \right. = 0 .
70
+ $$
71
+
72
+ Moreover the $l _ { p }$ -distance $d _ { p } ( \pi , x ^ { ( i ) } )$ of $\boldsymbol { x } ^ { ( i ) }$ to $\pi _ { l }$ is given by
73
+
74
+ $$
75
+ d _ { p } ( \pi _ { l } , x ^ { ( i ) } ) = \frac { | f _ { l } ( x ^ { ( i ) } ) - f _ { c } ( x ^ { ( i ) } ) | } { \left\| \nabla f _ { l } ( x ^ { ( i ) } ) - \nabla f _ { c } ( x ^ { ( i ) } ) \right\| _ { q } } , \quad \mathrm { w i t h } \quad \frac { 1 } { p } + \frac { 1 } { q } = 1 .
76
+ $$
77
+
78
+ Note that if $d _ { p } ( \pi _ { l } , x ^ { ( i ) } ) = 0$ then $\boldsymbol { x } ^ { ( i ) }$ belongs to the true decision boundary. Moreover, if the local linear approximation of the network is correct then the class $s$ with the decision hyperplane closest to the point $\boldsymbol { x } ^ { ( i ) }$ can be computed as
79
+
80
+ $$
81
+ s = \underset { l \neq c } { \arg \operatorname* { m i n } } \frac { \lvert f _ { l } ( \boldsymbol { x } ^ { ( i ) } ) - f _ { c } ( \boldsymbol { x } ^ { ( i ) } ) \rvert } { \left. \nabla f _ { l } ( \boldsymbol { x } ^ { ( i ) } ) - \nabla f _ { c } ( \boldsymbol { x } ^ { ( i ) } ) \right. _ { q } } .
82
+ $$
83
+
84
+ Thus, given that the approximation holds in some large enough neighborhood, the projection $\mathrm { p r o j } _ { p } ( \boldsymbol { x } ^ { ( i ) } , \pi _ { s } , C )$ of $x ^ { ( i ) }$ onto $\pi _ { s }$ lies on the decision boundary (unless (2) is infeasible).
85
+
86
+ Biased gradient step: The iterative algorithm $\begin{array} { r } { \boldsymbol { x } _ { . } ^ { ( i + 1 ) } = \mathrm { p r o j } _ { p } ( \boldsymbol { x } ^ { ( i ) } , \pi _ { s } , C ) } \end{array}$ would be similar to DeepFool except that our projection operator is exact whereas they project onto the hyperplane and then clip to $[ 0 , 1 ] ^ { d }$ . This scheme is not biased towards the original target point $x _ { \mathrm { o r i g } }$ , thus it goes typically further than necessary to find a point on the decision boundary as basically the algorithm does not aim at the minimal adversarial perturbation. Thus we consider additionally $\mathrm { p r o j } _ { p } ( x _ { \mathrm { o r i g } } , \pi _ { s } , C )$ and use instead the iterative step, with $x ^ { ( 0 ) } = x _ { \mathrm { o r i g } }$ , defined as
87
+
88
+ $$
89
+ x ^ { ( i + 1 ) } = ( 1 - \alpha ) \cdot \mathrm { p r o j } _ { p } ( x ^ { ( i ) } , \pi _ { s } , C ) + \alpha \cdot \mathrm { p r o j } _ { p } ( x _ { \mathrm { o r i g } } , \pi _ { s } , C ) ,
90
+ $$
91
+
92
+ which biases the step towards $x _ { \mathrm { o r i g } }$ (see Figure 1). Note that this is a convex combination of two points on $\pi _ { s }$ and in $C$ and thus also $x ^ { ( i + 1 ) }$ lies on $\pi _ { s }$ and is contained in $C$ . As we wish
93
+
94
+ ![](images/61ed5aa11b8b88c56205a2e11f05df1d055acd5f0879cc50a81c5020bc1a1661.jpg)
95
+ Figure 1: Visualization of FAB-attack scheme, with on the left the case $\eta = 1$ , on the right $\eta > 1$ . In blue we represent the next iterate $x ^ { ( i + 1 ) }$ one would get without any bias toward the original point , in green the effect of the bias we introduce and in red the $x ^ { ( i + 1 ) }$ $x _ { \mathrm { o r i g } }$ obtained with our scheme in (10). We see that our algorithm tends to stay closer to the original point compared to the one with an unbiased gradient step.
96
+
97
+ a scheme with minimal amount of parameters, we want to have an automatic selection of $\alpha$ based on the available geometric quantities. Let
98
+
99
+ $$
100
+ \delta ^ { ( i ) } = \mathrm { p r o j } _ { p } ( x ^ { ( i ) } , \pi _ { s } , C ) - x ^ { ( i ) } \quad \mathrm { ~ a n d ~ } \quad \delta _ { \mathrm { o r i g } } ^ { ( i ) } = \mathrm { p r o j } _ { p } ( x _ { \mathrm { o r i g } } , \pi _ { s } , C ) - x _ { \mathrm { o r i g } } .
101
+ $$
102
+
103
+ Note that $\left. \delta ^ { ( i ) } \right. _ { p }$ and $\left\| \delta _ { \mathrm { o r i g } } ^ { ( i ) } \right\| _ { p }$ are the distances of $\boldsymbol { x } ^ { ( i ) }$ and to (inside $C$ ). We $x _ { \mathrm { o r i g } }$ $\pi _ { s }$ propose to use for the parameter $\alpha$ the relative magnitude of these two distances, that is
104
+
105
+ $$
106
+ \alpha = \operatorname* { m i n } \left\{ \frac { \left\| \delta ^ { ( i ) } \right\| _ { p } } { \left\| \delta ^ { ( i ) } \right\| _ { p } + \left\| \delta _ { \mathrm { o r i g } } ^ { ( i ) } \right\| _ { p } } , \alpha _ { \mathrm { m a x } } \right\} \in [ 0 , 1 ] .
107
+ $$
108
+
109
+ The motivation for doing so is that if $\boldsymbol { x } ^ { ( i ) }$ is close to the decision boundary, then we should stay close to this point (note that $\pi _ { s }$ is the approximation of $f$ computed at $\boldsymbol { x } ^ { ( i ) }$ and thus it is valid in a small neighborhood of $\boldsymbol { x } ^ { ( i ) }$ , whereas is farther away). On the other hand we want to have the bias towards $x _ { \mathrm { o r i g } }$ in order not to go too far away from $x _ { \mathrm { o r i g } }$ . This is why $\alpha$ depends on the distances of $\boldsymbol { x } ^ { ( i ) }$ and $x _ { \mathrm { o r i g } }$ to $\pi _ { s }$ but we limit it from above with $\alpha _ { \mathrm { m a x } }$ . Finally, we use a small extrapolation step as we noted empirically, similarly to Moosavi-Dezfooli et al. (2016), that this helps to cross faster the decision boundary and get an adversarial sample. This leads to the final scheme:
110
+
111
+ $$
112
+ x ^ { ( i + 1 ) } = \mathrm { p r o j } _ { C } \Big ( ( 1 - \alpha ) ( x ^ { ( i ) } + \eta \delta ^ { ( i ) } ) + \alpha ( x _ { \mathrm { o r i g } } + \eta \delta _ { \mathrm { o r i g } } ^ { ( i ) } ) \Big ) ,
113
+ $$
114
+
115
+ where $\alpha$ is chosen as in (9), $\eta \geq 1$ and proj is just the projection onto the box which can be $C$
116
+ done by clippinand the vectors Figuand we visualize the scheme: in black one can see the hyperplane , in blue the step we would make going to the decision bounda $\pi _ { s }$ $\delta _ { \mathrm { o r i g } } ^ { ( i ) }$ $\delta ^ { ( i ) }$
117
+ with the DeepFool variant, while in red the actual step we have in our method. The green
118
+ vector represents instead the bias towards the original point we introduce. On the left of
119
+ Figure 1 we use $\eta = 1$ , while on the right we use overshooting $\eta > 1$ .
120
+
121
+ Interpretation of $\mathbf { p r o j } _ { p } ( x _ { \mathbf { o r i g } } , \pi _ { s } , C )$ : The projection of the target point onto the intersection of $\pi _ { s }$ and $C$ is defined as
122
+
123
+ $$
124
+ \operatorname * { a r g m i n } _ { z \in \mathbb { R } ^ { d } } \left\| z - x _ { \mathrm { o r i g } } \right\| _ { p } \mathrm { \quad { s . t h . \quad } } \left. w , z \right. + b = 0 , \quad l _ { i } \leq z _ { i } \leq u _ { i } ,
125
+ $$
126
+
127
+ Note that replacing $z$ by $\boldsymbol { x } ^ { ( i ) } + \delta$ we can rewrite this as
128
+
129
+ $$
130
+ \underset { \delta \in \mathbb R ^ { d } } { \arg \operatorname* { m i n } } \left\| x ^ { ( i ) } + \delta - x _ { \mathrm { o r i g } } \right\| _ { p } \quad \mathrm { s . t h . } \quad \langle w , x + \delta \rangle + b = 0 , \quad l _ { i } \leq x _ { i } + \delta _ { i } \leq u _ { i } .
131
+ $$
132
+
133
+ This can be interpreted as the minimization of the distance of the next iterate $\boldsymbol { x } ^ { ( i ) } + \delta$ to the target point $x _ { \mathrm { o r i g } }$ so that $\boldsymbol { x } ^ { ( i ) } + \delta$ lies on the intersection of the (approximate) decision hyperplane and the box $C$ . This point of view on the projection $\mathrm { p r o j } _ { p } ( x _ { \mathrm { o r i g } } , \pi _ { s } , C )$ again justifies using a convex combination of the two projections in our iterative scheme in (10).
134
+
135
+ Backward step: The described scheme finds in a few iterations adversarial perturbations. However, we are interested in minimizing their norms. Thus, once we have a new point $x ^ { ( i + 1 ) }$ , we check whether it is assigned by $f$ to a class different from $c$ . In this case, we apply
136
+
137
+ $$
138
+ x ^ { ( i + 1 ) } = ( 1 - \beta ) x _ { \mathrm { o r i g } } + \beta x ^ { ( i + 1 ) } , \quad \beta \in ( 0 , 1 ) ,
139
+ $$
140
+
141
+ that is we go back towards $x _ { \mathrm { o r i g } }$ on the segment $[ x ^ { ( i + 1 ) } , x _ { \mathrm { o r i g } } ]$ , effectively starting again the algorithm at a point which is quite close to the decision boundary. In this way, due to the bias of the method towards $x _ { \mathrm { o r i g } }$ we successively find adversarial perturbations of smaller norm, meaning that the algorithm tracks the decision boundary while getting closer to $x _ { \mathrm { o r i g } }$
142
+
143
+ Final search: Our scheme finds points close to the decision boundary but often they are slightly off as the linear approximation is not exact and we apply the extrapolation step with $\eta > 1$ . Thus, after finishing $N _ { \mathrm { i t e r } }$ iterations of our algorithmic scheme, we perform a last, fast step to further improve the quality of the adversarial examples. Let $x _ { \mathrm { o u t } }$ be the closest point to $x _ { \mathrm { o r i g } }$ classified differently from $c$ , say $s \neq c$ , found with the iterative scheme. It holds that $f _ { s } ( x _ { \mathrm { o u t } } ) - f _ { c } ( x _ { \mathrm { o u t } } ) > 0$ and $f _ { s } ( x _ { \mathrm { o r i g } } ) - f _ { c } ( x _ { \mathrm { o r i g } } ) < 0$ . This means that, assuming $f$ continuous, there exists a point $x ^ { * }$ on the segment $[ x _ { \mathrm { o u t } } , x _ { \mathrm { o r i g } } ]$ such that $f _ { s } ( x ^ { * } ) - f _ { c } ( x ^ { * } ) = 0$ and $\left\| x ^ { * } - x _ { \mathrm { o r i g } } \right\| _ { p } < \left\| x _ { \mathrm { o u t } } - x _ { \mathrm { o r i g } } \right\| _ { p }$ . If $f$ is linear
144
+
145
+ $$
146
+ x ^ { * } = x _ { \mathrm { o u t } } - { \frac { f _ { s } ( x _ { \mathrm { o u t } } ) - f _ { c } ( x _ { \mathrm { o u t } } ) } { f _ { s } ( x _ { \mathrm { o u t } } ) - f _ { c } ( x _ { \mathrm { o u t } } ) + f _ { s } ( x _ { \mathrm { o r i g } } ) - f _ { c } ( x _ { \mathrm { o r i g } } ) } } ( x _ { \mathrm { o u t } } - x _ { \mathrm { o r i g } } ) .
147
+ $$
148
+
149
+ Since $f$ is typically non-linear, but close to linear, we compute iteratively for a few steps
150
+
151
+ $$
152
+ x _ { \mathrm { { t e m p } } } = x _ { \mathrm { { o u t } } } - { \frac { f _ { s } ( x _ { \mathrm { { o u t } } } ) - f _ { c } ( x _ { \mathrm { { o u t } } } ) } { f _ { s } ( x _ { \mathrm { { o u t } } } ) - f _ { c } ( x _ { \mathrm { { o u t } } } ) + f _ { s } ( x _ { \mathrm { { o r i g } } } ) - f _ { c } ( x _ { \mathrm { { o r i g } } } ) } } ( x _ { \mathrm { { o u t } } } - x _ { \mathrm { { o r i g } } } ) ,
153
+ $$
154
+
155
+ each time replacing in (13) $x _ { \mathrm { o u t } }$ with $x _ { \mathrm { t e m p } }$ if $f _ { s } ( x _ { \mathrm { t e m p } } ) - f _ { c } ( x _ { \mathrm { t e m p } } ) > 0$ or $x _ { \mathrm { o r i g } }$ with $x _ { \mathrm { t e m p } }$ if instead $f _ { s } ( x _ { \mathrm { t e m p } } ) - f _ { c } ( x _ { \mathrm { t e m p } } ) < 0$ . With this kind of modified binary search one can find a better adversarial sample with the cost of a few forward passes of the network.
156
+
157
+ Random restarts: So far all the steps are deterministic. To improve the results, we introduce the option of random restarts, that is $x ^ { ( 0 ) }$ is randomly sampled in proximity of $x _ { \mathrm { o r i g } }$ instead of being $x _ { \mathrm { o r i g } }$ itself. Most attacks benefit from random restarts, e.g. Madry et al. (2018); Zheng et al. (2019), especially dealing with gradient-masking defenses (Mosbach et al. (2018)), as it allows a wider exploration of the input space. We choose to sample from the $l _ { p }$ -sphere centered in the original point with radius half the $l _ { p }$ -norm of the current best adversarial perturbation (or a given threshold if no adversarial example has been found yet).
158
+
159
+ Computational cost: Our attack, in Algorithm 1, consists of two main operations: the computation of $f$ and its gradients and solving the projection (2). We perform, for each iteration, a forward and a backward pass of the network in the gradient step and a forward pass in the backward step. The projection can be efficiently implemented to run in batches on the GPU and its complexity depends only on the input dimension. Thus, except for shallow models, its cost is much smaller than the passes through the network. We can approximate the computational cost of our algorithm by the total number of calls of the classifier
160
+
161
+ $$
162
+ N _ { \mathrm { i t e r } } \times N _ { \mathrm { r e s t a r t s } } \times ( 2 \times \mathrm { f o r w a r d ~ p a s s e s } + 1 \times \mathrm { b a c k w a r d ~ p a s s } ) .
163
+ $$
164
+
165
+ One has to add the forward passes for the final search, fixed to 3, that happens just once.
166
+
167
+ # 2.4 Comparison to DeepFool
168
+
169
+ The idea of exploiting the first order local approximation of the decision boundary is not novel but the basis of one of the first white-box adversarial attacks, DeepFool (DF) from Moosavi-Dezfooli et al. (2016). While DF and our FAB-attack share the strategy of using a linear approximation of the classifier and projecting on the decision hyperplanes, we want to point out many key differences: first, DF does not solve the projection (2) but its simpler version without box constraints, clipping afterwards. Second, their gradient step does not have any bias towards the original point, that is equivalent to $\alpha = 0$ in (10). Third, DF does
170
+
171
+ # Algorithm 1: FAB-attack
172
+
173
+ Input : $x _ { \mathrm { o r i g } }$ original point, $c$ original class, $N _ { \mathrm { r e s t a r t s } } , N _ { \mathrm { i t e r } } , \alpha _ { \mathrm { m a x } } , \beta , \eta , \epsilon , p$
174
+ Output : $x _ { \mathrm { o u t } }$ adversarial example
175
+ 1 $u + \infty$
176
+ 2 for $j = 1 , \ldots , N _ { r e s t a r t s }$ do
177
+ 3 if $j = 1$ then $x ^ { ( 0 ) } x _ { \mathrm { o r i g } }$ ;
178
+ 4 else $x ^ { ( 0 ) } \gets$ randomly sampled s.th. $\left. x ^ { ( 0 ) } - x _ { \mathrm { o r i g } } \right. _ { p } = \operatorname* { m i n } \{ u , \epsilon \} / 2$ ;
179
+ 5 for $i = 0 , \ldots , N _ { i t e r } - 1$ do
180
+ 6 $\begin{array} { r } { s \gets \underset { l \neq c } { \arg \operatorname* { m i n } } \frac { | f _ { l } ( x ^ { ( i ) } ) - f _ { c } ( x ^ { ( i ) } ) | } { \left\| \nabla f _ { l } ( x ^ { ( i ) } ) - \nabla f _ { c } ( x ^ { ( i ) } ) \right\| _ { q } } } \end{array}$
181
+ 7 δ(i) ← projp(x(i), πs, C)
182
+ 8 δ(i)orig ← projp(xorig, πs, C)
183
+ 9 compute $\alpha$ as in Equation (9)
184
+ 10 $\begin{array} { r } { x ^ { ( i + 1 ) } \mathrm { p r o j } _ { C } \Big ( ( 1 - \alpha ) ( x ^ { ( i ) } + \eta \delta ^ { ( i ) } ) + \alpha \big ( x _ { \mathrm { o r i g } } + \eta \delta _ { \mathrm { o r i g } } ^ { ( i ) } \big ) \Big ) } \end{array}$
185
+ 11 if $x ^ { ( i + 1 ) }$ is not classified in $c$ then
186
+ 12 if $\left\| x ^ { ( i + 1 ) } - x _ { o r i g } \right\| _ { p } < u$ then
187
+ 13 xout ← x(i+1)
188
+ 14 u ←
189
+ 15 end
190
+ 16 $x ^ { ( i + 1 ) } \gets ( 1 - \beta ) x _ { \mathrm { o r i g } } + \beta x ^ { ( i + 1 ) }$
191
+ 17 end
192
+ 18 end
193
+ 19 end
194
+ 20 perform 3 steps of final search on $x _ { \mathrm { o u t } }$ as in (13)
195
+
196
+ ![](images/c36d6befcaeaf09f239f81e0fdfe2fc4bf7e25ae495c809b46c51d2545890baf.jpg)
197
+ Figure 2: Ablation study to DeepFool for $l _ { \infty }$ -attacks. The introduction of the convex combination ( $\alpha _ { \mathrm { m a x } } = 0 . 1$ , no backward step) already improves over DeepFool. Moreover, if one does our full approach, the case $\alpha _ { \mathrm { m a x } } = 0$ (can be seen as an improved iterative DeepFool) is worse than $\alpha _ { \mathrm { m a x } } = 0 . 1$ with the same number of restarts. In the plots we show the robust accuracy as a function of the threshold $\epsilon$ under the different attacks on the ${ \mathit { l } } _ { \infty }$ -AT model on MNIST.
198
+
199
+ not have any backward step, final search or restart, as it stops as soon as a misclassified point is found (its goal is to provide quickly an adversarial perturbation of average quality). We perform an ablation study of the differences to DF in Figure 2, where we show the curves of the robust accuracy as a function of the threshold $\epsilon$ (lower is better). We present the results of DeepFool (blue) and FAB-attack with the following variations: $\alpha _ { \mathrm { m a x } } = 0 . 1$ and no backward step (magenta), $\alpha _ { \mathrm { m a x } } = 0$ (that is no bias in the gradient step) and no restarts (light green), $\alpha _ { \mathrm { m a x } } = 0 . 1$ and no restarts (orange), $\alpha _ { \mathrm { m a x } } = 0$ and 100 restarts (dark green) and $\alpha _ { \mathrm { m a x } } = 0 . 1$ and 100 restarts, that is FAB-attack, (red). We can see how every addition we make to the original scheme of DeepFool contributes to the significantly improved performance of FAB-attack when compared to the original DeepFool.
200
+
201
+ # 3 Experiments
202
+
203
+ Models: We run experiments on MNIST, CIFAR-10 (Krizhevsky et al.) and Restricted ImageNet (Tsipras et al. (2019)). For each dataset we consider a naturally trained model (plain) and two adversarially trained ones as in Madry et al. (2018), one to achieve robustness wrt the ${ \mathit { l } } _ { \infty }$ -norm ( $\imath _ { \infty }$ -AT) and the other wrt the $l _ { 2 }$ -norm ( $l _ { 2 }$ -AT) (see A.1).
204
+
205
+ Attacks: We compare the performances of FAB-attack to those of attacks representing the state-of-the-art in each norm: DeepFool (DF) (Moosavi-Dezfooli et al. (2016)), CarliniWagner $l _ { 2 }$ -attack (CW) (Carlini & Wagner (2017a)), Linear Region $l _ { 2 }$ -Attack (LRA) (Croce et al. (2019)), Projected Gradient Descent on the cross-entropy function (PGD) (Kurakin et al., 2017; Madry et al., 2018; Tramèr & Boneh, 2019), Distributionally Adversarial Attack (DAA) (Zheng et al. (2019)), SparseFool (SF) (Modas et al. (2019)), Elastic-net Attack (EAD) (Chen et al. (2018)). We use DF from Rauber et al. (2017), CW and EAD as in Papernot et al. (2017), DAA and LRA with the code from the original papers, while we reimplemented SF and PGD. For MNIST and CIFAR-10 we used DAA with 50 restarts, PGD and FAB with 100 restarts. For Restricted ImageNet, we used DAA, PGD and FAB with 10 restarts (for $l _ { 1 }$ we used 5 restarts, since both methods benefit from more iterations). Moreover, we could not use LRA since it hardly scales to such models and CW and EAD for compatibility issues between the implementations of attacks and models. See A.2 for more details e.g. regarding number of iterations and other hyperparameters.
206
+
207
+ Evaluation metrics: The robust accuracy of a model at a threshold $\epsilon$ is defined as the classification accuracy (in percentage) the model achieves when an attack is allowed to change every input of the test set with perturbations of $l _ { p }$ -norm smaller than $\epsilon$ in order to change the decision. Thus stronger attacks produce lower robust accuracies. For each model and dataset we fix five thresholds at which we compute the robust accuracy for each attack (we choose the thresholds to have values of the robust accuracy that cover the range between clean accuracy and $0$ ). We evaluate the attacks through the following statistics: i) avg. rob. accuracy: the mean of all the values of robust accuracy given by the attack over all models and thresholds, ii) # best: how many times the attack achieves the lowest robust accuracy (it is the most effective), iii) avg. difference to best: for each model/threshold we compute the difference between the robust accuracy of the attack and the best one across all the attacks, then we average over all models/thresholds, iv) max difference to best: as "avg. difference to best", but with the maximum difference instead of the average one. In A.4 we report the average $l _ { p }$ -norm of the adversarial perturbations given by the attacks.
208
+
209
+ Results: We report the complete results in Tables 5 to 13 of the Appendix, while we summarize them in Tables 1 (MNIST and CIFAR-10 aggregated, as we used the same attacks) and 2 (Restricted ImageNet). Our FAB-attack achieves the best results in all statistics for every norm (with the only exception of "max diff. to best" in ${ \mathit { l } } _ { \infty }$ ) on MNIST $^ +$ CIFAR-10, meaning that it is the most effective attack. In particular, while on ${ \mathit { l } } _ { \infty }$ the "avg. robust accuracy" of PGD is not far from that of FAB, the gap is large when considering $l _ { 2 }$ and $l _ { 1 }$ . Interestingly, the second best attack, at least in terms of average robust accuracy, is different for every norm (PGD for ${ \mathit { l } } _ { \infty }$ , LRA for $l _ { 2 }$ , EAD for $l _ { 1 }$ ), which implies that FAB outperforms algorithms specialized in the individual norms.
210
+
211
+ We also report the results of FAB-10, that is our attack with only 10 restarts, to show that FAB yields high quality results already with a low budget in terms of time/computational cost. In fact, FAB-10 has "avg. robust accuracy" better than or very close to that of the strongest versions of the other methods (see below for a runtime analysis, where one observes that FAB-10 is the fastest attack excluding DF and SF which however give much worse results). On Restricted ImageNet, FAB-attack gets the best results in all statistics for $l _ { 1 }$ , while for ${ \mathit { l } } _ { \infty }$ and $l _ { 2 }$ , although PGD performs often better, the difference in "avg. robust accuracy" is small, meaning that FAB performs mostly similarly to PGD.
212
+
213
+ Table 1: Performance summary of all attacks on MNIST and CIFAR-10 (aggregated). We report, for each norm, "avg. rob. acc.", the mean of the values of robust accuracy across all the models and datasets, "# best", number of times the attack is the best one, "avg. diff. to best" and "max diff. to best", the mean and maximum differences between the robust accuracy of the attack and that of the best attack for each model/threshold (on the first 1000 points for $l _ { \infty }$ and $l _ { 1 }$ , 500 for $l _ { 2 }$ , of the test sets). The numbers after the name of the attacks indicates the number of restarts used. In total we consider 5 thresholds $\times \textup { 6 }$ models $= 3 0$ cases for each of the 3 norms. \*Note that for FAB-10 (i.e. with 10 restarts) the "# best" is computed excluding the results of FAB-100.
214
+
215
+ statistics on MNIST $^ +$ CIFAR-10
216
+
217
+ <table><tr><td rowspan=2 colspan=1>loo-norm</td><td rowspan=2 colspan=3></td><td rowspan=2 colspan=1>DF</td><td rowspan=2 colspan=1>DAA-50</td><td rowspan=2 colspan=1>PGD-100</td><td rowspan=2 colspan=1>FAB-10</td><td></td></tr><tr><td rowspan=1 colspan=1>FAB-100</td></tr><tr><td rowspan=1 colspan=1>avg.rob.acc.</td><td rowspan=1 colspan=3></td><td rowspan=1 colspan=1>58.81</td><td rowspan=1 colspan=1>60.67</td><td rowspan=1 colspan=1>46.07</td><td rowspan=1 colspan=1>46.18</td><td rowspan=2 colspan=1>45.4717</td></tr><tr><td rowspan=3 colspan=1>#bestavg. diff. to bestmax diff. to best</td><td rowspan=3 colspan=3></td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>13*</td></tr><tr><td rowspan=2 colspan=1>14.5878.10</td><td rowspan=1 colspan=1>16.45</td><td rowspan=1 colspan=1>1.85</td><td rowspan=2 colspan=1>1.9620.30</td><td rowspan=2 colspan=1>1.2517.10</td></tr><tr><td rowspan=1 colspan=1>49.00</td><td rowspan=1 colspan=1>10.70</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=2 colspan=1>FAB-10</td><td rowspan=2 colspan=1>FAB-100</td></tr><tr><td rowspan=1 colspan=1>l2-norm</td><td rowspan=1 colspan=3>CW</td><td rowspan=1 colspan=1>DF</td><td rowspan=1 colspan=1>LRA</td><td rowspan=1 colspan=1>PGD-100</td></tr><tr><td rowspan=1 colspan=1>avg.rob.acc.</td><td rowspan=1 colspan=3>45.09</td><td rowspan=1 colspan=1>56.10</td><td rowspan=1 colspan=1>36.97</td><td rowspan=1 colspan=1>44.94</td><td rowspan=1 colspan=1>36.41</td><td rowspan=4 colspan=1>35.57230.131.60</td></tr><tr><td rowspan=2 colspan=1>#bestavg. diff. to best</td><td rowspan=2 colspan=3>49.65</td><td rowspan=2 colspan=1>120.67</td><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>19*</td><td rowspan=3 colspan=1>19*0.988.40</td></tr><tr><td rowspan=1 colspan=1>1.54</td><td rowspan=1 colspan=1>9.51</td><td></td></tr><tr><td rowspan=1 colspan=1>max diff. to best</td><td rowspan=1 colspan=3>65.40</td><td rowspan=1 colspan=1>91.40</td><td rowspan=1 colspan=1>13.60</td><td rowspan=1 colspan=1>64.80</td><td></td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3></td><td rowspan=1 colspan=1></td><td rowspan=2 colspan=1>LRA</td><td rowspan=2 colspan=1>PGD-100</td><td rowspan=2 colspan=1>FAB-10</td><td rowspan=2 colspan=1>FAB-100</td></tr><tr><td rowspan=1 colspan=1>l2-norm wo/Madry&#x27;s model</td><td rowspan=1 colspan=3>CW</td><td rowspan=1 colspan=1>DF</td></tr><tr><td rowspan=1 colspan=1>avg.rob.acc.</td><td rowspan=1 colspan=3>40.85</td><td rowspan=1 colspan=1>49.18</td><td rowspan=1 colspan=1>40.25</td><td rowspan=1 colspan=1>42.95</td><td rowspan=1 colspan=1>39.98</td><td rowspan=4 colspan=1>39.57180.161.60</td></tr><tr><td rowspan=3 colspan=1># best avg. diff. to best max diff. to best</td><td rowspan=2 colspan=3>41.44</td><td rowspan=2 colspan=1>19.78</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>11</td><td rowspan=3 colspan=1>14*0.574.20</td></tr><tr><td rowspan=1 colspan=1>0.84</td><td rowspan=1 colspan=1>3.54</td></tr><tr><td rowspan=1 colspan=3>8.80</td><td rowspan=1 colspan=1>44.00</td><td rowspan=1 colspan=1>4.00</td><td rowspan=1 colspan=1>22.00</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3></td><td rowspan=1 colspan=1></td><td rowspan=2 colspan=1>EAD</td><td rowspan=2 colspan=1>PGD-100</td><td rowspan=2 colspan=1>FAB-10</td><td rowspan=2 colspan=1>FAB-100</td></tr><tr><td rowspan=1 colspan=1>l1-norm</td><td rowspan=1 colspan=3></td><td rowspan=1 colspan=1>SF</td></tr><tr><td rowspan=1 colspan=1>avg.rob. acc.</td><td rowspan=1 colspan=3></td><td rowspan=1 colspan=1>64.47</td><td rowspan=1 colspan=1>35.79</td><td rowspan=1 colspan=1>49.51</td><td rowspan=3 colspan=1>33.2610*4.1021.80</td><td rowspan=3 colspan=1>29.46170.301.60</td></tr><tr><td rowspan=2 colspan=1>#bestavg. diff. to bestmax diff. to best</td><td rowspan=2 colspan=3></td><td rowspan=2 colspan=1>035.3195.90</td><td rowspan=1 colspan=1>136.63</td><td rowspan=1 colspan=1>020.35</td></tr><tr><td rowspan=1 colspan=1>58.40</td><td rowspan=1 colspan=1>74.00</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3></td><td rowspan=2 colspan=1>SF</td><td rowspan=2 colspan=1>EAD</td><td rowspan=2 colspan=1>PGD-100</td><td rowspan=2 colspan=1>FAB-10</td><td rowspan=2 colspan=1>FAB-100</td></tr><tr><td rowspan=1 colspan=1>l1-norm wo/Madry&#x27;smodel</td><td rowspan=1 colspan=3></td></tr><tr><td rowspan=4 colspan=1>avg. rob. acc.# best avg. diff. to bestmax diff. to best</td><td rowspan=1 colspan=3></td><td rowspan=1 colspan=1>58.06</td><td rowspan=1 colspan=1>32.56</td><td rowspan=1 colspan=1>43.82</td><td rowspan=1 colspan=1>33.79</td><td rowspan=4 colspan=1>32.06120.361.60</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=2 colspan=2></td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>13</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>5*</td></tr><tr><td rowspan=2 colspan=3></td><td rowspan=1 colspan=1>26.36</td><td rowspan=1 colspan=1>0.87</td><td rowspan=1 colspan=1>12.12</td><td rowspan=1 colspan=1>2.10</td></tr><tr><td rowspan=1 colspan=1>53.10</td><td rowspan=1 colspan=1>4.80</td><td rowspan=1 colspan=1>31.90</td><td rowspan=1 colspan=1>3.90</td></tr></table>
218
+
219
+ In general, both average and maximum difference to best of FAB-attack are small for all the datasets and norms, implying that it does not suffer severe failures, which makes it an efficient, high quality technique to evaluate the robustness of classifiers for all $l _ { p }$ -norms. Finally, we show in Table 4 that FAB-attack outperforms or matches the competitors in 16 out of 18 cases when comparing the average $l _ { p }$ -norms of the generated adversarial perturbations.
220
+
221
+ Runtime comparison: DF and SF are definitely much faster than the others as their primary goal is to find as soon as possible adversarial examples, without emphasis on minimizing their norms, while LRA is rather expensive as noted in the original paper. Below we report the runtimes (for 1000 points on MNIST and CIFAR-10, 50 on R-ImageNet) for the attacks as used in the experiments (if not specified otherwise, it includes all the restarts). For PGD and DAA this is the time for evaluating the robust accuracy at 5 thresholds, while for the other methods a single run is sufficient to compute all the statistics.
222
+
223
+ MNIST: DAA-50 11736s, PGD-100 3825s for $l _ { \infty } / l _ { 2 }$ and PGD-100 14106s for $l _ { 1 }$ , CW 944s, EAD 606s, FAB-10 161s, FAB-100 1613s. CIFAR-10: DAA-50 11625s, PGD-100 31900s
224
+
225
+ Table 2: As in Table 1 statistics of the performance of different attacks on Restricted ImageNet (on the first 500 points of the validation set). In total we consider 5 thresholds $\times$ 3 models = 15 cases for each of the 3 norms.
226
+
227
+ statistics on Restricted ImageNet
228
+
229
+ <table><tr><td rowspan="3"></td><td colspan="4">lo-norm</td><td colspan="3"> l2-norm</td><td colspan="3">l1-norm</td></tr><tr><td>DF</td><td>DAA- 10</td><td>PGD- 10</td><td>FAB- 10</td><td>DF</td><td>PGD- 10</td><td>FAB- 10</td><td>EAD</td><td>PGD- 5</td><td>FAB- 5</td></tr><tr><td>avg.rob. acc.</td><td>35.61</td><td>38.44</td><td>26.91</td><td>27.83</td><td>45.69</td><td>31.75</td><td>33.24</td><td>71.31</td><td>40.64</td><td>38.12</td></tr><tr><td>#best</td><td>0</td><td>1</td><td>13</td><td>3</td><td>0</td><td>14</td><td>1</td><td>0</td><td>3</td><td>12</td></tr><tr><td>avg. diff. best</td><td>8.75</td><td>11.57</td><td>0.04</td><td>0.96</td><td>13.99</td><td>0.04</td><td>1.53</td><td>33.52</td><td>2.85</td><td>0.33</td></tr><tr><td>max diff. best</td><td>14.60</td><td>37.20</td><td>0.40</td><td>2.00</td><td>25.40</td><td>0.60</td><td>3.40</td><td>59.00</td><td>6.20</td><td>2.40</td></tr></table>
230
+
231
+ for $l _ { \infty } / l _ { 2 }$ and 70110s for $l _ { 1 }$ , CW 3691s, EAD 3398s, FAB-10 1209s, FAB-100 12093s. RImageNet: DAA-10 6890s, PGD-10 4738s for $l _ { \infty } / l _ { 2 }$ and PGD-5 24158s for $l _ { 1 }$ , FAB-10 2268s for $l _ { \infty } / l _ { 2 }$ and FAC-5 3146s for $l _ { 1 }$ (note that different numbers of restarts/iterations for $l _ { 1 }$ are used on R-ImageNet).
232
+
233
+ PGD needs a forward and a backward pass of the network for each iteration. Thus it is given 1.5 times more iterations than FAB, so that overall they have same budget of passes (we assume here that forward and backward passes take the same amount of time). In Appendix B.2 we compare PGD-1 versus FAB-1 as a function of the number of passes (2 passes are one iteration of PGD, 3 passes are one iteration of FAB - the plots show 300 passes meaning 150 iterations of PGD and 100 iterations of FAB) so that the comparison is fair concerning runtime in order to compare the performance of PGD-1 and FAB-1 as a function of runtime. If one considers just the performance up to 20 passes (10 iterations PGD, 7 iterations FAB) then FAB outperforms PGD in 18 out of 27 cases. However, one also observes that there is no general superiority of one method. For both PGD-1 and FAB-1 there are cases where the method requires the full amount of 300 passes to get to a good performance whereas the other method achieves it with significantly less iterations/passes.
234
+
235
+ # 4 Conclusion
236
+
237
+ In summary, our geometrically motivated FAB-attack outperforms in terms of runtime and on average in terms of quality all other high quality state-of-the-art attacks and can be used for all $p$ -norms in $p \in \{ 1 , 2 , \infty \}$ which is not the case for most other methods.
238
+
239
+ # References
240
+
241
+ A. Athalye, N. Carlini, and D. A. Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In ICML, 2018.
242
+ O. Bastani, Y. Ioannou, L. Lampropoulos, D. Vytiniotis, A. Nori, and A. Criminisi. Measuring neural net robustness with constraints. In NeurIPS, 2016.
243
+ W. Brendel, J. Rauber, and M. Bethge. Decision-based adversarial attacks: Reliable attacks against black-box machine learning models. In ICLR, 2018.
244
+ T. B. Brown, D. Mané, A. Roy, M. Abadi, and J. Gilmer. Adversarial patch. In NeurIPS 2017 Workshop on Machine Learning and Computer Security, 2017.
245
+ N. Carlini and D. Wagner. Towards evaluating the robustness of neural networks. In IEEE Symposium on Security and Privacy, 2017a.
246
+ N. Carlini and D. Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. In ACM Workshop on Artificial Intelligence and Security, 2017b.
247
+ P. Chen, Y. Sharma, H. Zhang, J. Yi, and C. Hsieh. Ead: Elastic-net attacks to deep neural networks via adversarial examples. In AAAI, 2018.
248
+ F. Croce, J. Rauber, and M. Hein. Scaling up the randomized gradient-free adversarial attack reveals overestimation of robustness using established attacks. preprint, arXiv:1903.11359, 2019.
249
+ L. Engstrom, B. Tran, D. Tsipras, L. Schmidt, and A. Madry. A rotation and a translation suffice: Fooling CNNs with simple transformations. In NeurIPS 2017 Workshop on Machine Learning and Computer Security, 2017.
250
+ S. Gu and L. Rigazio. Towards deep neural network architectures robust to adversarial examples. In ICLR Workshop, 2015.
251
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016.
252
+ M. Hein and M. Andriushchenko. Formal guarantees on the robustness of a classifier against adversarial manipulation. In NeurIPS, 2017.
253
+ R. Huang, B. Xu, D. Schuurmans, and C. Szepesvari. Learning with a strong adversary. In ICLR, 2016.
254
+ G. Katz, C. Barrett, D. Dill, K. Julian, and M. Kochenderfer. Reluplex: An efficient smt solver for verifying deep neural networks. In CAV, 2017.
255
+ A. Krizhevsky, V. Nair, and G. Hinton. Cifar-10 (canadian institute for advanced research). URL http://www.cs.toronto.edu/\~kriz/cifar.html.
256
+ A. Kurakin, I. J. Goodfellow, and S. Bengio. Adversarial examples in the physical world. In ICLR Workshop, 2017.
257
+ A. Madry, A. Makelov, L. Schmidt, D. Tsipras, and A. Valdu. Towards deep learning models resistant to adversarial attacks. In ICLR, 2018.
258
+ A. Modas, S. Moosavi-Dezfooli, and P. Frossard. Sparsefool: a few pixels make a big difference. In CVPR, 2019.
259
+ S.-M. Moosavi-Dezfooli, A. Fawzi, and P. Frossard. Deepfool: a simple and accurate method to fool deep neural networks. In CVPR, pp. 2574–2582, 2016.
260
+ M. Mosbach, M. Andriushchenko, T. Trost, M. Hein, and D. Klakow. Logit pairing methods can fool gradient-based attacks. In NeurIPS 2018 Workshop on Security in Machine Learning, 2018.
261
+ N. Narodytska and S. P. Kasiviswanathan. Simple black-box adversarial perturbations for deep networks. In CVPR 2017 Workshops, 2016.
262
+ N. Papernot, P. McDonald, X. Wu, S. Jha, and A. Swami. Distillation as a defense to adversarial perturbations against deep networks. In IEEE Symposium on Security & Privacy, 2016.
263
+ N. Papernot, N. Carlini, I. Goodfellow, R. Feinman, F. Faghri, A. Matyasko, K. Hambardzumyan, Y.-L. Juang, A. Kurakin, R. Sheatsley, A. Garg, and Y.-C. Lin. cleverhans v2.0.0: an adversarial machine learning library. preprint, arXiv:1610.00768, 2017.
264
+ J. Rauber, W. Brendel, and M. Bethge. Foolbox: A python toolbox to benchmark the robustness of machine learning models. In ICML Reliable Machine Learning in the Wild Workshop, 2017.
265
+ J. Su, D. V. Vargas, and S. Kouichi. One pixel attack for fooling deep neural networks. preprint, arXiv:1710.08864v5, 2019.
266
+ V. Tjeng, K. Xiao, and R. Tedrake. Evaluating robustness of neural networks with mixed integer programming. In ICLR, 2019.
267
+ F. Tramèr and D. Boneh. Adversarial training and robustness for multiple perturbations. preprint, arXiv:1904.13000, 2019.
268
+ D. Tsipras, S. Santurkar, L. Engstrom, A. Turner, and A. Madry. Robustness may be at odds with accuracy. In ICLR, 2019.
269
+ E. Wong, F. R. Schmidt, and J. Z. Kolter. Wasserstein adversarial examples via projected sinkhorn iterations. preprint, arXiv:1902.07906.
270
+ S. Zheng, Y. Song, T. Leung, and I. J. Goodfellow. Improving the robustness of deep neural networks via stability training. In CVPR, 2016.
271
+ T. Zheng, C. Chen, and K. Ren. Distributionally adversarial attack. In AAAI, 2019.
272
+
273
+ # A Experiments
274
+
275
+ # A.1 Models
276
+
277
+ The plain and $l _ { \infty }$ -AT models on MNIST are those available at https://github.com/ MadryLab/mnist_challenge and consist of two convolutional and two fully-connected layers. The architecture of the CIFAR-10 models has 8 convolutional layers (with number of filters increasing from 96 to 384) and 2 dense layers, while on Restricted ImageNet we use the models (ResNet-50 He et al. (2016)) from Tsipras et al. (2019) and available at https://github.com/MadryLab/robust-features-code.
278
+
279
+ The models on MNIST achieve the following clean accuracy: plain $9 8 . 7 \%$ , $l _ { \infty }$ -AT $9 8 . 5 \%$ , $l _ { 2 }$ -AT $9 8 . 6 \%$ . The models on CIFAR-10 achieve the following clean accuracy: plain $8 9 . 2 \%$ , $l _ { \infty }$ -AT $7 9 . 4 \%$ , $l _ { 2 }$ -AT $8 1 . 2 \%$ .
280
+
281
+ # A.2 Attacks
282
+
283
+ We use CW with 10000 iterations and confidence 0, EAD with 1000 iterations, $l _ { 1 }$ decision rule and $\beta \ : = \ : 0 . 0 5$ . In both cases we set the parameters to achieve minimally (wrt $l _ { 2 }$ for CW and $l _ { 1 }$ for EAD) distorted adversarial examples. We could not use these methods on Restricted ImageNet since, to be compatible with the attack from Papernot et al. (2017), it would be necessary to reimplement from scratch the models of Tsipras et al. (2019), as done in https://github.com/tensorflow/cleverhans/tree/master/ cleverhans/model_zoo/madry_lab_challenges for a similar situation.
284
+
285
+ For DAA we use 200 iterations for MNIST, 50 for the other datasets and, given a threshold , a step size of $\epsilon / 3 0$ for MNIST, $\epsilon / 1 0$ otherwise.
286
+
287
+ We perform PGD with 150 iterations, except for the case of $l _ { 1 }$ on Restricted ImageNet where we use 450 iterations. For PGD wrt ${ \mathit { l } } _ { \infty }$ we use, given a threshold $\epsilon$ , a step size of $\epsilon / 1 0$ in the direction of the sign of the gradient of the cross entropy loss, for PGD wrt $l _ { 2 }$ we perform at each iteration a step in the direction of the gradient of size $\epsilon / 4$ , for PGD wrt $l _ { 1 }$ we use the gradient step suggested in Tramèr & Boneh (2019) (with sparsity levels of $1 \%$ for MNIST and $1 0 \%$ for CIFAR-10 and Restricted ImageNet), with size $\epsilon / 2$ . The above stepsize parameters $\epsilon / { } _ { 4 }$ for $l _ { 2 }$ and $\epsilon / 1 0$ for $l _ { \infty }$ for PGD were obtained, by doing a grid search for each norm separately and using the values working best on average on MNIST and CIFAR-10. In Appendix we discuss the influence of the step-size and show that our chosen values perform best on average, see Figure 3.
288
+
289
+ For FAB-attack we set 100 iterations, except for the case of $l _ { 1 }$ on Restricted ImageNet where we use 300 iterations. Moreover, we use the following parameters for all the cases on MNIST and CIFAR-10: $\alpha _ { \mathrm { m a x } } = 0 . 1$ , $\eta = 1 . 0 5$ , $\beta = 0 . 9$ . On Restricted ImageNet we set $\alpha _ { \mathrm { m a x } } = 0 . 0 5$ , $\eta = 1 . 3$ , $\beta = 0 . 9$ . When using random restarts, FAB-attack needs a value for the parameters $\epsilon$ . It represents the radius of the $l _ { p }$ -ball around the original point inside which we sample the starting point of the algorithm, at least until a sufficiently small adversarial perturbation is found (see Algorithm 1). We use the values of $\epsilon$ reported in Table 3. Note however that the attack usually finds at the first run an adversarial perturbation small enough so that $\epsilon$ in practice rarely comes into play.
290
+
291
+ Table 3: We report the values of $\epsilon$ used for sampling in case our FAB-attack uses random restarts.
292
+
293
+ values of $\epsilon$ used for random restarts
294
+
295
+ <table><tr><td></td><td colspan="3">MNIST</td><td colspan="3">CIFAR-10</td><td colspan="3">Restricted ImageNet</td></tr><tr><td></td><td>plain</td><td>lo-AT</td><td>l2-AT</td><td>plain</td><td>lo-AT</td><td>l2-AT</td><td>plain</td><td>loo-AT</td><td>l2-AT</td></tr><tr><td>1</td><td>0.15</td><td>0.3</td><td>0.3</td><td>0.0</td><td>0.02</td><td>0.02</td><td>0.02</td><td>0.08</td><td>0.08</td></tr><tr><td>12</td><td>2.0</td><td>2.0</td><td>2.0</td><td>0.5</td><td>4.0</td><td>4.0</td><td>5.0</td><td>5.0</td><td>5.0</td></tr><tr><td>l</td><td>40.0</td><td>40.0</td><td>40.0</td><td>10.0</td><td>10.0</td><td>10.0</td><td>100.0</td><td>250.0</td><td>250.0</td></tr></table>
296
+
297
+ # A.3 Complete results
298
+
299
+ In Tables 5 to 13 we report the complete values of the robust accuracy, wrt either ${ \mathit { l } } _ { \infty }$ , $l _ { 2 }$ or $l _ { 1 }$ , computed by every attack, for 3 datasets, 3 models for each dataset, 5 thresholds for each model (135 evaluations overall).
300
+
301
+ # A.4 Further results
302
+
303
+ In Table 4 we report the average $l _ { p }$ -norm of the adversarial perturbations found by the different attacks, computed on the originally correctly classified points on which the attack is successful. Note that we cannot show this statistic for the attacks which do not minimize the distance of the adversarial example to the clean input (PGD and DAA). FAB-attack produces also in this metric the best results in most of the cases, being the best for every model when considering ${ \mathit { l } } _ { \infty }$ and $l _ { 2 }$ , and the best in 4 out of 6 cases in $l _ { 1 }$ (lower values mean a stronger attack).
304
+
305
+ Table 4: We report mean $l _ { p }$ -norm of the adversarial perturbations found by the attacks (when successful, excluding the already misclassified points) for every model.
306
+ average norm of adversarial perturbations
307
+
308
+ <table><tr><td>lo-norm</td><td></td><td></td><td>DF</td><td>FAB</td></tr><tr><td rowspan="3">MNIST</td><td>plain</td><td rowspan="3"></td><td>0.078</td><td>0.066</td></tr><tr><td>lo-at</td><td>0.508</td><td>0.326</td></tr><tr><td>l2-at</td><td>0.249 0.008</td><td>0.170</td></tr><tr><td rowspan="3">CIFAR-10</td><td>plain lo-at</td><td colspan="2">0.032</td><td>0.006</td></tr><tr><td>l2-at</td><td colspan="2"></td><td>0.024</td></tr><tr><td></td><td></td><td>0.026</td><td>0.019</td></tr><tr><td> l2-norm</td><td colspan="4">DF CW</td></tr><tr><td rowspan="3">MNIST</td><td>plain</td><td>1.13 1.01</td><td>LRA</td><td>FAB</td></tr><tr><td></td><td>1.76</td><td>1.00</td><td>1.00</td></tr><tr><td>loo-at l2-at</td><td>4.95 3.10 2.35</td><td>1.25</td><td>1.12</td></tr><tr><td rowspan="3">CIFAR-10</td><td>plain</td><td>0.28 0.21</td><td>2.25</td><td>2.24</td></tr><tr><td>loo-at</td><td>0.96 0.74</td><td>0.22</td><td>0.21</td></tr><tr><td>l2-at</td><td>0.91 0.71</td><td>0.74</td><td>0.73</td></tr><tr><td></td><td></td><td></td><td>0.72</td><td>0.70</td></tr><tr><td> l1-norm</td><td></td><td colspan="2">EAD</td><td>FAB</td></tr><tr><td rowspan="3">MNIST</td><td>plain</td><td colspan="2">6.38</td><td>6.04</td></tr><tr><td>lo-at</td><td colspan="2">8.26</td><td>3.36</td></tr><tr><td>l2-at</td><td colspan="2">12.18</td><td>12.16</td></tr><tr><td rowspan="3">CIFAR-10</td><td>plain</td><td colspan="2"></td><td>2.87</td></tr><tr><td>loo-at</td><td></td><td>3.01 5.79</td><td>6.03</td></tr><tr><td>l2-at</td><td colspan="2">7.94</td><td>8.05</td></tr><tr><td></td><td></td><td colspan="2"></td><td></td></tr></table>
309
+
310
+ Table 5: Comparison of $l _ { \infty }$ -, $l _ { 2 }$ - and $l _ { 1 }$ -attacks on a naturally trained model on MNIST. We report the accuracy in percentage of the classifier on the test set if the attack is allowed to perturb the test points of $\epsilon$ in $l _ { p }$ -distance. The statistics are computed on the first 1000 points on the test set for ${ \mathit { l } } _ { \infty }$ and $l _ { 1 }$ , on 500 points for $l _ { 2 }$ .
311
+
312
+ Robust accuracy of MNIST plain model
313
+
314
+ <table><tr><td>metric</td><td>E</td><td>DF</td><td>DAA- 1</td><td>DAA- 50</td><td>PGD- 1</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB- 1</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td rowspan="5">18</td><td>0.03 0.05</td><td>93.2</td><td>91.9</td><td>91.9</td><td>92.0</td><td>91.9</td><td>91.9</td><td>92.0</td><td>92.0</td><td>92.0</td></tr><tr><td></td><td>83.4</td><td>78.2</td><td>76.7</td><td>76.0</td><td>74.9</td><td>74.6</td><td>77.2</td><td>76.8</td><td>76.1</td></tr><tr><td>0.07</td><td>61.5</td><td>59.8</td><td>56.3</td><td>43.8</td><td>41.8</td><td>40.4</td><td>44.3</td><td>43.1</td><td>42.6</td></tr><tr><td>0.09</td><td>33.2</td><td>46.7</td><td>41.0</td><td>16.5</td><td>14.2</td><td>12.8</td><td>16.2</td><td>14.8</td><td>14.4</td></tr><tr><td>0.11</td><td>13.1</td><td>34.4</td><td>26.2</td><td>4.0</td><td>2.8</td><td>2.4</td><td>3.3</td><td>3.1</td><td>2.4</td></tr><tr><td></td><td></td><td>CW</td><td>DF</td><td>LRA</td><td>PGD- 1</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB- 1</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td rowspan="5">12</td><td>0.5</td><td>92.6</td><td>93.6</td><td>92.6</td><td>92.6</td><td>92.6</td><td>92.6</td><td>92.6</td><td>92.6</td><td>92.6</td></tr><tr><td>1</td><td>47.4</td><td>58.6</td><td>47.4</td><td>48.4</td><td>47.4</td><td>46.2</td><td>47.0</td><td>46.8</td><td>46.2</td></tr><tr><td>1.5</td><td>8.8</td><td>19.8</td><td>7.8</td><td>9.8</td><td>8.8</td><td>8.2</td><td>7.8</td><td>7.2</td><td>7.0</td></tr><tr><td>2</td><td>0.6</td><td>1.8</td><td>0.2</td><td>1.2</td><td>0.6</td><td>0.6</td><td>0.2</td><td>0.2</td><td>0.2</td></tr><tr><td>2.5</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.6</td><td>0.2</td><td>0.2</td><td>0.0</td><td>0.0</td><td>0.0</td></tr><tr><td colspan="2"></td><td colspan="2">SparseFool</td><td>EAD</td><td>PGD-</td><td>PGD-</td><td>PGD-</td><td>FAB-</td><td>FAB-</td><td>FAB-</td></tr><tr><td rowspan="5">l</td><td></td><td colspan="2"></td><td></td><td>1</td><td>10</td><td>100</td><td>1</td><td>10</td><td>100</td></tr><tr><td>2 4</td><td colspan="2">95.5</td><td>93.6 76.7</td><td>94.4</td><td>93.9</td><td>93.7</td><td>94.2</td><td>93.7</td><td>93.5</td></tr><tr><td>6</td><td colspan="2">88.9 75.8</td><td>48.1</td><td>79.8</td><td>77.5</td><td>76.9</td><td>80.2</td><td>76.6</td><td>75.2</td></tr><tr><td></td><td colspan="2"></td><td></td><td>57.4</td><td>52.2 36.3</td><td>49.3</td><td>54.5</td><td>47.2</td><td>43.3</td></tr><tr><td>8 10</td><td colspan="2">60.3 43.8</td><td>26.6 11.2</td><td>46.7 40.0</td><td>27.4</td><td>31.6 22.1</td><td>31.3 15.2</td><td>25.3 9.8</td><td>22.4 8.4</td></tr></table>
315
+
316
+ Table 6: Comparison of ${ \mathit { l } } _ { \infty }$ -, $l _ { 2 }$ - and $l _ { 1 }$ -attacks on an $l _ { \infty }$ -robust model on MNIST. We report the accuracy on the test set if the attack is allowed to perturb the test points of $\epsilon$ in $l _ { p }$ -distance. The statistics are computed on the first 1000 points on the test set for $l _ { \infty }$ and $l _ { 1 }$ , on 500 points for $l _ { 2 }$ .
317
+
318
+ Robust accuracy of MNIST $l _ { \infty }$ -robust model
319
+
320
+ <table><tr><td>metric</td><td>E</td><td>DF</td><td>DAA- 1</td><td>DAA- 50</td><td>PGD- 1</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB- 1</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td rowspan="5">1</td><td>0.2 0.25</td><td>95.2 94.7</td><td>94.6 92.7</td><td>93.7 91.1</td><td>95.0 93.1</td><td>94.2 91.8</td><td>93.7 91.4</td><td>94.6</td><td>94.4</td><td>93.9</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>93.3</td><td>92.1</td><td>91.7</td></tr><tr><td>0.3</td><td>93.9</td><td>89.5</td><td>87.2</td><td>91.3</td><td>88.3</td><td>87.6</td><td>91.2</td><td>89.2</td><td>88.5</td></tr><tr><td>0.325</td><td>92.5</td><td>72.1</td><td>64.2</td><td>74.9</td><td>68.4</td><td>64.7</td><td>86.2</td><td>83.1</td><td>81.3</td></tr><tr><td>0.35</td><td>89.8</td><td>19.7</td><td>11.7</td><td>32.1</td><td>19.3</td><td>13.8</td><td>48.7</td><td>32.0</td><td>23.8</td></tr><tr><td colspan="9"></td></tr><tr><td rowspan="5"></td><td></td><td>CW</td><td>DF</td><td>LRA</td><td>PGD- 1</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB- 1</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td>1</td><td>88.8</td><td>94.6</td><td>73.6</td><td>92.2</td><td>90.8</td><td>89.8</td><td>84.2</td><td>70.6</td><td>65.4</td></tr><tr><td>1.5</td><td>77.6</td><td>93.0</td><td>25.8</td><td>86.0</td><td>81.2</td><td>77.0</td><td>47.0</td><td>20.6</td><td>12.2</td></tr><tr><td>2</td><td>64.4</td><td>91.6</td><td>3.2</td><td>77.8</td><td>67.0</td><td>57.8</td><td>15.6</td><td>1.8</td><td>0.2</td></tr><tr><td>2.5 3</td><td>53.8 46.8</td><td>89.6 84.6</td><td>0.4</td><td>68.2</td><td>49.6</td><td>36.4</td><td>3.8</td><td>0.0</td><td>0.0</td></tr><tr><td colspan="9"></td></tr><tr><td rowspan="5"></td><td></td><td rowspan="5">SparseFool</td><td></td><td>0.0</td><td>59.8</td><td>29.6</td><td>13.4</td><td>1.4</td><td>0.0</td><td>0.0</td></tr><tr><td></td><td></td><td>EAD</td><td>PGD- 1</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB- 1</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td>2.5</td><td>96.8</td><td>92.2</td><td>94.1</td><td>93.7</td><td>93.6</td><td>90.1</td><td>74.3</td><td>56.9</td></tr><tr><td>5</td><td>96.5</td><td>76.0</td><td>90.9 85.2</td><td>88.9 81.4</td><td>88.2 79.0</td><td>85.8 82.6</td><td>39.4 19.8</td><td>17.6 5.0</td></tr><tr><td>7.5 10</td><td colspan="2">96.4 96.4</td><td>49.5 27.4</td><td>80.2</td><td>73.5</td><td>70.3</td><td>78.4</td><td>11.9</td></tr></table>
321
+
322
+ Table 7: Comparison of ${ \mathit { l } } _ { \infty }$ -, $l _ { 2 }$ - and $l _ { 1 }$ -attacks on an $l _ { 2 }$ -robust model on MNIST. We report the accuracy in percentage of the classifier on the test set if the attack is allowed to perturb the test points of $\epsilon$ in $l _ { p }$ -distance. The statistics are computed on the first 1000 points on the test set for ${ \mathit { l } } _ { \infty }$ and $l _ { 1 }$ , on 500 points for $l _ { 2 }$ .
323
+
324
+ Robust accuracy of MNIST $l _ { 2 }$ -robust model
325
+
326
+ <table><tr><td>metric</td><td>E</td><td>DF</td><td>DAA- 1</td><td>DAA- 50</td><td>PGD- 1</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB- 1</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td rowspan="5">18</td><td>0.05 0.1</td><td>96.7</td><td>96.4</td><td>96.3</td><td>96.4</td><td>96.3</td><td>96.3</td><td>96.4</td><td>96.3</td><td>96.3</td></tr><tr><td></td><td>93.4</td><td>91.0</td><td>90.2</td><td>90.7</td><td>90.4</td><td>90.2</td><td>90.8</td><td>90.4</td><td>90.4</td></tr><tr><td>0.15</td><td>86.4</td><td>74.3</td><td>72.3</td><td>74.6</td><td>73.2</td><td>72.4</td><td>74.0</td><td>72.3</td><td>72.0</td></tr><tr><td>0.2</td><td>73.8</td><td>34.5</td><td>27.2</td><td>36.2</td><td>29.8</td><td>26.5</td><td>34.1</td><td>28.2</td><td>24.4</td></tr><tr><td>0.25</td><td>55.1</td><td>1.5</td><td>0.9</td><td>2.6</td><td>1.5</td><td>1.0</td><td>1.9</td><td>0.9</td><td>0.8</td></tr><tr><td colspan="9"></td></tr><tr><td rowspan="5"></td><td></td><td>CW</td><td>DF</td><td>LRA</td><td>PGD-</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB-</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td>1</td><td>92.6</td><td>93.8</td><td>92.6</td><td>1 93.0</td><td>93.0</td><td>93.0</td><td>1 92.6</td><td>92.6</td><td>92.6</td></tr><tr><td>1.5</td><td>84.8</td><td>87.2</td><td>83.4</td><td>83.8</td><td>83.4</td><td>83.4</td><td>83.8</td><td>83.6</td><td>83.6</td></tr><tr><td>2</td><td>70.6</td><td>79.0</td><td>68.0</td><td>68.8</td><td>68.0</td><td>67.6</td><td>69.8</td><td>69.0</td><td>67.8</td></tr><tr><td>2.5 3</td><td>46.4 17.2</td><td>67.4 54.2</td><td>41.6</td><td>45.6</td><td>40.4</td><td>37.6</td><td>45.6</td><td>41.8</td><td>39.2 11.0</td></tr><tr><td colspan="9"></td></tr><tr><td colspan="2"></td><td colspan="2">SparseFool</td><td>11.2 EAD</td><td>17.4 PGD-</td><td>12.4 PGD-</td><td>10.2 PGD-</td><td>18.6 FAB-</td><td>13.4 FAB-</td><td>FAB-</td></tr><tr><td rowspan="5"></td><td colspan="10"></td></tr><tr><td>5</td><td colspan="2">94.9</td><td>89.8</td><td>1 90.3</td><td>10 90.2</td><td>100 90.2</td><td>1 90.5</td><td>10 90.2</td><td>100 90.0</td></tr><tr><td>8.75</td><td colspan="2">89.1</td><td>71.2</td><td>75.5</td><td>74.0</td><td>72.7</td><td>75.3</td><td>73.7</td><td>72.2</td></tr><tr><td>12.5</td><td colspan="2">81.0</td><td>45.9</td><td>61.1</td><td>57.5</td><td>54.9</td><td>55.6</td><td>49.2</td><td>45.7</td></tr><tr><td>16.25 20</td><td colspan="2">72.8 60.8</td><td>20.6 8.3</td><td>49.2 41.4</td><td>42.3 29.6</td><td>38.4 23.2</td><td>32.2 15.2</td><td>24.1 9.4</td><td>20.8 7.7</td></tr></table>
327
+
328
+ Table 8: Comparison of $l _ { \infty } .$ -, $l _ { 2 ^ { - } }$ and $l _ { 1 } .$ -attacks on a naturally trained model on CIFAR-10. We report the accuracy in percentage of the classifier on the test set if the attack is allowed to perturb the test points of $\epsilon$ in $l _ { p }$ -distance. The statistics are computed on the first 1000 points on the test set for $l _ { \infty }$ and $l _ { 1 }$ , on 500 points for $l _ { 2 }$ .
329
+
330
+ Robust accuracy of CIFAR-10 plain model
331
+
332
+ <table><tr><td>metric</td><td>E</td><td>DF</td><td>DAA- 1</td><td>DAA- 50</td><td>PGD- 1</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB- 1</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td rowspan="5">18</td><td rowspan="5">1/255 1.5/255 2/255</td><td>62.6</td><td>65.7</td><td>64.1</td><td>56.1</td><td>55.8</td><td>55.6</td><td>56.5</td><td>55.9</td><td>55.7</td></tr><tr><td>49.3</td><td>63.2</td><td>60.8</td><td>38.9</td><td>37.9</td><td>37.4</td><td>38.5</td><td>37.7</td><td>37.4</td></tr><tr><td>37.3</td><td>62.4</td><td>58.5</td><td>24.3</td><td>23.3</td><td>22.9</td><td>23.4</td><td>21.9</td><td>21.2</td></tr><tr><td>26.4</td><td>61.2</td><td>56.3</td><td>16.2</td><td>14.8</td><td>14.0</td><td>13.2</td><td>12.0</td><td>11.8</td></tr><tr><td>19.0</td><td>60.2</td><td>54.4</td><td>10.7</td><td>9.2</td><td>8.6</td><td>7.4</td><td>5.8</td><td>5.4</td></tr><tr><td rowspan="2"></td><td></td><td>CW</td><td>DF</td><td>LRA</td><td>PGD-</td><td>PGD-</td><td>PGD-</td><td>FAB-</td><td>FAB-</td><td>FAB-</td></tr><tr><td>0.1</td><td>69.4</td><td>72.2</td><td>69.0</td><td>1 68.4</td><td>10 67.6</td><td>100 67.6</td><td>1 68.4</td><td>10 68.4</td><td>100 68.4</td></tr><tr><td rowspan="4">l2</td><td>0.15</td><td>55.4</td><td>62.6</td><td>55.0</td><td>54.6</td><td>53.8</td><td>53.8</td><td>54.6</td><td>54.0</td><td>53.8</td></tr><tr><td>0.2</td><td>43.4</td><td>51.2</td><td>43.4</td><td>43.8</td><td>42.8</td><td>42.0</td><td>42.4</td><td>42.0</td><td>41.8</td></tr><tr><td>0.3</td><td>21.6</td><td>33.8</td><td>22.0</td><td>24.8</td><td>24.2</td><td>23.6</td><td>21.6</td><td>20.8</td><td>20.6</td></tr><tr><td>0.4</td><td>9.4</td><td>20.8</td><td>9.8</td><td>18.2</td><td>16.2</td><td>15.4</td><td>9.6</td><td>8.2</td><td>8.0</td></tr><tr><td rowspan="2"></td><td></td><td colspan="2">SparseFool</td><td>EAD</td><td>PGD-</td><td>PGD-</td><td>PGD-</td><td>FAB-</td><td>FAB-</td><td>FAB-</td></tr><tr><td></td><td colspan="2"></td><td></td><td>1</td><td>10</td><td>100</td><td>1</td><td>10</td><td>100</td></tr><tr><td rowspan="4">l</td><td>2 4</td><td colspan="2">72.1</td><td>54.7</td><td>54.9</td><td>54.4</td><td>53.9</td><td>55.5</td><td>52.2</td><td>50.8</td></tr><tr><td></td><td colspan="2">58.6 45.6</td><td>24.1</td><td>30.0</td><td>29.1</td><td>28.9</td><td>30.7</td><td>25.1</td><td>22.4</td></tr><tr><td>6</td><td colspan="2"></td><td>8.9</td><td>18.8</td><td>18.6</td><td>18.4</td><td>17.0</td><td>10.5</td><td>8.1</td></tr><tr><td>8 10</td><td colspan="2">34.3 27.2</td><td>3.0 0.7</td><td>14.2 12.9</td><td>14.1 12.5</td><td>14.0 12.3</td><td>7.8 4.7</td><td>3.8 1.5</td><td>2.5 1.0</td></tr></table>
333
+
334
+ Table 9: Comparison of $l _ { \infty }$ -, $l _ { 2 }$ - and $l _ { 1 }$ -attacks on an ${ \mathit { l } } _ { \infty }$ -robust model on CIFAR-10. We report the accuracy in percentage of the classifier on the test set if the attack is allowed to perturb the test points of $\epsilon$ in $l _ { p }$ -distance. The statistics are computed on the first 1000 points on the test set for ${ \mathit { l } } _ { \infty }$ and $l _ { 1 }$ , on 500 points for $l _ { 2 }$ .
335
+
336
+ Robust accuracy of CIFAR-10 $l _ { \infty }$ -robust model
337
+
338
+ <table><tr><td>metric</td><td>E</td><td>DF</td><td>DAA- 1</td><td>DAA- 50</td><td>PGD- 1</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB- 1</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td rowspan="5">18</td><td>2/255 4/255</td><td>66.8</td><td>66.9</td><td>66.3</td><td>65.5</td><td>65.5</td><td>65.5</td><td>65.8</td><td>65.8</td><td>65.7</td></tr><tr><td></td><td>53.2</td><td>63.8</td><td>61.4</td><td>49.8</td><td>49.3</td><td>49.0</td><td>49.2</td><td>49.1</td><td>48.9</td></tr><tr><td>6/255</td><td>42.9</td><td>63.1</td><td>58.4</td><td>38.0</td><td>36.9</td><td>36.6</td><td>35.4</td><td>34.7</td><td>34.6</td></tr><tr><td>8/255</td><td>32.9</td><td>61.2</td><td>56.3</td><td>30.5</td><td>30.0</td><td>29.6</td><td>23.8</td><td>23.5</td><td>23.3</td></tr><tr><td>10/255</td><td>24.5</td><td>59.8</td><td>54.1</td><td>25.8</td><td>23.7</td><td>22.4</td><td>15.4</td><td>14.7</td><td>14.4</td></tr><tr><td></td><td></td><td>CW</td><td>DF</td><td>LRA</td><td>PGD-</td><td>PGD-</td><td>PGD- 100</td><td>FAB-</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td rowspan="5">12</td><td>0.25</td><td>64.6</td><td>67.0</td><td>64.4</td><td>1 64.4</td><td>10 64.4</td><td>64.4</td><td>1 64.8</td><td>64.6</td><td>64.4</td></tr><tr><td>0.5</td><td>48.4</td><td>53.0</td><td>48.8</td><td></td><td></td><td>48.0</td><td></td><td>48.4</td><td>48.2</td></tr><tr><td>0.75</td><td>33.4</td><td>41.4</td><td>33.4</td><td>49.0</td><td>48.4 38.2</td><td></td><td>48.4</td><td>33.2</td><td>33.0</td></tr><tr><td>1</td><td>22.8</td><td></td><td></td><td>39.0</td><td></td><td>37.4</td><td>33.6</td><td></td><td>21.4</td></tr><tr><td>1.25</td><td>12.0</td><td>32.6 24.2</td><td>22.8 13.0</td><td>35.0 34.6</td><td>34.4 34.2</td><td>33.8 33.2</td><td>22.2 12.2</td><td>21.6 11.2</td><td>11.2</td></tr><tr><td colspan="2"></td><td colspan="2">SparseFool</td><td>EAD</td><td>PGD-</td><td>PGD-</td><td>PGD-</td><td>FAB-</td><td>FAB-</td><td>FAB-</td></tr><tr><td rowspan="5">l</td><td></td><td colspan="2"></td><td></td><td>1</td><td>10</td><td>100</td><td>1</td><td>10</td><td>100</td></tr><tr><td>5 8.75</td><td colspan="2">57.8</td><td>36.8</td><td>47.3</td><td>46.6</td><td>46.2</td><td>43.1</td><td>39.9</td><td>37.9</td></tr><tr><td>12.5</td><td colspan="2">44.7 34.9</td><td>19.2</td><td>37.4</td><td>37.0</td><td>36.8</td><td>25.7</td><td>22.5</td><td>20.2</td></tr><tr><td></td><td colspan="2"></td><td>7.1</td><td>34.0</td><td>33.9</td><td>33.9</td><td>13.7</td><td>10.9</td><td>8.7</td></tr><tr><td>16.25 20</td><td colspan="2">27.6 20.2</td><td>3.0 0.9</td><td>33.3 32.9</td><td>33.2 32.8</td><td>33.1 32.8</td><td>7.1 3.8</td><td>4.3 1.7</td><td>3.5 1.3</td></tr></table>
339
+
340
+ Table 10: Comparison of $l _ { \infty } -$ , $l _ { 2 ^ { - } }$ and $l _ { 1 }$ -attacks on an $l _ { 2 }$ -robust model on CIFAR-10. We report the accuracy in percentage of the classifier on the test set if the attack is allowed to perturb the test points of $\epsilon$ in $l _ { p }$ -distance. The statistics are computed on the first 1000 points on the test set for $l _ { \infty }$ and $l _ { 1 }$ , on 500 points for $l _ { 2 }$ .
341
+
342
+ Robust accuracy of CIFAR-10 $l _ { 2 }$ -robust model
343
+
344
+ <table><tr><td>metric</td><td>E</td><td>DF</td><td>DAA- 1</td><td>DAA- 50</td><td>PGD- 1</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB- 1</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td rowspan="5">18</td><td>2/255 4/255</td><td>64.1</td><td>67.2</td><td>66.3</td><td>62.6</td><td>62.5</td><td>62.4</td><td>62.7</td><td>62.6</td><td>62.6</td></tr><tr><td></td><td>49.0</td><td>65.0</td><td>62.8</td><td>45.3</td><td>45.0</td><td>44.9</td><td>44.4</td><td>44.2</td><td>44.2</td></tr><tr><td>6/255</td><td>36.9</td><td>64.2</td><td>60.8</td><td>32.9</td><td>31.6</td><td>31.1</td><td>27.2</td><td>26.8</td><td>26.7</td></tr><tr><td>8/255</td><td>25.8</td><td>62.3</td><td>58.0</td><td>25.7</td><td>24.9</td><td>23.9</td><td>14.8</td><td>14.1</td><td>13.8</td></tr><tr><td>10/255</td><td>17.6</td><td>61.9</td><td>54.8</td><td>21.9</td><td>19.8</td><td>18.6</td><td>8.6</td><td>8.0</td><td>7.9</td></tr><tr><td colspan="9"></td><td></td></tr><tr><td rowspan="5">l2</td><td></td><td>CW</td><td>DF</td><td>LRA</td><td>PGD- 1</td><td>PGD- 10</td><td>PGD- 100</td><td>FAB- 1</td><td>FAB- 10</td><td>FAB- 100</td></tr><tr><td>0.25</td><td>66.0</td><td>67.0</td><td>65.6</td><td>65.8</td><td>65.6</td><td>65.6</td><td>65.6</td><td>65.6</td><td>65.6</td></tr><tr><td>0.5</td><td>48.2</td><td>53.8</td><td>47.8</td><td>49.6</td><td>48.8</td><td>48.8</td><td>48.4</td><td>48.2</td><td>48.0</td></tr><tr><td>0.75</td><td>32.6</td><td>42.2</td><td>32.4</td><td>38.4</td><td>37.2</td><td>36.4</td><td>32.8</td><td>32.4</td><td>32.2</td></tr><tr><td>1 1.25</td><td>21.6 11.4</td><td>30.0</td><td>21.6</td><td>35.4</td><td>33.6</td><td>33.0</td><td>21.8</td><td>21.4</td><td>21.0</td></tr><tr><td colspan="9"></td></tr><tr><td rowspan="5"></td><td></td><td rowspan="5"></td><td>22.4</td><td>12.4</td><td>34.2</td><td>31.6</td><td>31.2</td><td>12.2</td><td>12.2</td><td>11.4</td></tr><tr><td></td><td>SparseFool</td><td>EAD</td><td>PGD- 1</td><td>PGD-</td><td>PGD-</td><td>FAB-</td><td>FAB-</td><td>FAB-</td></tr><tr><td>3</td><td>69.5</td><td>62.2</td><td>64.5</td><td>10 64.4</td><td>100 64.4</td><td>1 63.4</td><td>10 63.2</td><td>100 63.0</td></tr><tr><td>6</td><td>61.6</td><td>45.5</td><td>51.9</td><td>51.9</td><td>51.8</td><td>48.6</td><td>47.2</td><td>45.6</td></tr><tr><td>9</td><td colspan="2">53.1</td><td>27.7</td><td>42.8</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="3">l1</td><td rowspan="2">12</td><td colspan="2"></td><td>17.9</td><td>38.5</td><td>42.5</td><td>42.5 38.0</td><td>33.9</td><td>30.6</td><td>28.8</td></tr><tr><td></td><td>44.4 37.0</td><td>10.4</td><td>35.8</td><td>38.3 35.8</td><td></td><td>23.8</td><td>19.8</td><td>17.3</td></tr><tr><td>15</td><td colspan="2"></td><td></td><td></td><td></td><td>35.4</td><td>16.0</td><td>12.4</td><td>11.2</td></tr></table>
345
+
346
+ Table 11: Comparison of ${ \mathit { l } } _ { \infty }$ -, $l _ { 2 }$ - and $l _ { 1 }$ -attacks on a naturally trained model on Restricted ImageNet. We report the accuracy in percentage of the classifier on the test set if the attack is allowed to perturb the test points of $\epsilon$ in $l _ { p }$ -distance. The statistics are computed on the first 500 points of the test set.
347
+
348
+ Robust accuracy of Restricted ImageNet plain model
349
+
350
+ <table><tr><td>metric</td><td>E</td><td>DF</td><td>DAA- 1</td><td>DAA- 10</td><td>PGD- 1</td><td>PGD- 10</td><td>FAB- 1</td><td>FAB- 10</td></tr><tr><td rowspan="5">1</td><td>0.25/ /255 0.5/255</td><td>76.6 52.0</td><td>74.8 51.8</td><td>74.8 48.2</td><td>74.8 38.2</td><td>74.6 37.8</td><td>75.2 39.6</td><td>75.2 39.6</td></tr><tr><td>0.75/255</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>26.8</td><td>46.0</td><td>41.0</td><td>12.2</td><td>12.2</td><td>14.2</td><td>14.2</td></tr><tr><td>1/255</td><td>11.2</td><td>43.2</td><td>39.4</td><td>3.8</td><td>3.8</td><td>3.6</td><td>3.6</td></tr><tr><td>1.25/255</td><td>5.0</td><td>41.2</td><td>38.2</td><td>1.0</td><td>1.0</td><td>1.2</td><td>1.0</td></tr><tr><td></td><td></td><td></td><td></td><td>DF</td><td>PGD- 1</td><td>PGD-</td><td>FAB-</td><td>FAB-</td></tr><tr><td rowspan="5">l2</td><td>0.2</td><td></td><td></td><td></td><td></td><td>10</td><td>1</td><td>10</td></tr><tr><td>0.4</td><td></td><td></td><td>80.2 58.4</td><td>76.0</td><td>76.0</td><td>77.0</td><td>76.8</td></tr><tr><td>0.6</td><td></td><td></td><td>33.8</td><td>40.8 15.4</td><td>40.6 14.8</td><td>43.0 19.0</td><td>42.2 18.2</td></tr><tr><td>0.8</td><td></td><td></td><td></td><td>4.0</td><td>4.0</td><td></td><td></td></tr><tr><td>1</td><td></td><td></td><td>18.8 8.6</td><td>1.6</td><td>1.6</td><td>4.6 1.2</td><td>4.4 1.0</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="5">1</td><td></td><td></td><td>SparseFool</td><td>PGD-</td><td>1</td><td>PGD- 5</td><td>FAB- 1</td><td>FAB- 5</td></tr><tr><td>5</td><td></td><td></td><td>88.6</td><td>81.8</td><td>81.8</td><td>79.6</td><td>78.0</td></tr><tr><td>16</td><td></td><td></td><td>80.0</td><td>45.2</td><td>45.2</td><td>46.8</td><td>40.0</td></tr><tr><td>27</td><td></td><td></td><td>70.6</td><td>17.8</td><td>17.4</td><td>25.6</td><td>19.8</td></tr><tr><td>38 49</td><td></td><td></td><td>65.0 55.4</td><td>6.2 2.2</td><td>6.0 2.2</td><td>13.6 6.8</td><td>7.0 3.8</td></tr></table>
351
+
352
+ Table 12: Comparison of $l _ { \infty }$ -, $l _ { 2 ^ { - } }$ and $l _ { 1 }$ -attacks on an $l _ { \infty }$ -robust model on Restricted ImageNet. We report the accuracy in percentage of the classifier on the test set if the attack is allowed to perturb the test points of $\epsilon$ in $l _ { p }$ -distance. The statistics are computed on the first 500 points of the test set.
353
+
354
+ Robust accuracy of Restricted ImageNet $l _ { \infty }$ -robust model
355
+
356
+ <table><tr><td>metric</td><td>E</td><td>DF</td><td>DAA- 1</td><td>DAA- 10</td><td>PGD- 1</td><td>PGD- 10</td><td>FAB- 1</td><td>FAB- 10</td></tr><tr><td rowspan="5">18</td><td>2/255</td><td>75.8</td><td>75.0</td><td>75.0</td><td>74.6</td><td>74.6</td><td>75.2</td><td>75.2</td></tr><tr><td>4/255</td><td>53.0</td><td>46.2</td><td>46.2</td><td>45.4</td><td>45.4</td><td>47.4</td><td>47.4</td></tr><tr><td>6/255</td><td>32.4</td><td>24.6</td><td>23.8</td><td>19.4</td><td>19.4</td><td>21.2</td><td>21.0</td></tr><tr><td>8/255</td><td>19.4</td><td>17.0</td><td>14.6</td><td>6.2</td><td>6.2</td><td>6.8</td><td>6.8</td></tr><tr><td>10/255</td><td>10.8</td><td>12.8</td><td>11.6</td><td>1.0</td><td>0.8</td><td>1.2</td><td>1.2</td></tr><tr><td></td><td></td><td></td><td></td><td>DF</td><td>PGD-</td><td>PGD-</td><td>FAB-</td><td>FAB-</td></tr><tr><td rowspan="5">l2</td><td>1</td><td></td><td></td><td>79.4</td><td>1 76.6</td><td>10 76.6</td><td>1 77.0</td><td>10 76.8</td></tr><tr><td>2</td><td></td><td></td><td>65.0</td><td>46.8</td><td>46.2</td><td>49.8</td><td>49.2</td></tr><tr><td>3</td><td></td><td></td><td>46.8</td><td>22.4</td><td>21.4</td><td>24.4</td><td>23.8</td></tr><tr><td>4</td><td></td><td></td><td>32.8</td><td>9.0</td><td>8.6</td><td>10.8</td><td>10.6</td></tr><tr><td>5</td><td></td><td></td><td>20.4</td><td>3.0</td><td>2.8</td><td>3.2</td><td>3.2</td></tr><tr><td></td><td></td><td></td><td>SparseFool</td><td></td><td>PGD-</td><td>PGD-</td><td>FAB-</td><td>FAB-</td></tr><tr><td rowspan="5">l</td><td></td><td></td><td></td><td></td><td>1</td><td>5</td><td>1</td><td>5</td></tr><tr><td>15</td><td></td><td></td><td>81.8</td><td>69.8</td><td>69.8</td><td>69.6</td><td>68.2</td></tr><tr><td>25</td><td></td><td></td><td>76.4</td><td>58.6</td><td>58.2</td><td>56.2</td><td>53.6</td></tr><tr><td>40</td><td></td><td></td><td>71.4</td><td>41.0</td><td>41.0</td><td>41.2</td><td>37.6</td></tr><tr><td>60 100</td><td></td><td></td><td>63.2 49.2</td><td>28.8 12.0</td><td>28.8 11.6</td><td>28.2 14.6</td><td>23.8 11.2</td></tr></table>
357
+
358
+ Table 13: Comparison of ${ \mathit { l } } _ { \infty }$ -, $l _ { 2 }$ - and $l _ { 1 }$ -attacks on an $l _ { 2 }$ -robust model on Restricted ImageNet. We report the accuracy in percentage of the classifier on the test set if the attack is allowed to perturb the test points of $\epsilon$ in $l _ { p }$ -distance. The statistics are computed on the first 500 points of the test set.
359
+
360
+ Robust accuracy of Restricted ImageNet $l _ { 2 }$ -robust model
361
+
362
+ <table><tr><td>metric</td><td>E</td><td>DF</td><td>DAA- 1</td><td>DAA- 10</td><td>PGD- 1</td><td>PGD- 10</td><td>FAB- 1</td><td>FAB- 10</td></tr><tr><td rowspan="5">18</td><td>2/255</td><td>74.4</td><td>73.0</td><td>73.0</td><td>73.0</td><td>73.0</td><td>73.8</td><td>73.8</td></tr><tr><td>4/255</td><td>49.0</td><td>39.6</td><td>39.2</td><td>37.6</td><td>37.6</td><td>39.6</td><td>39.4</td></tr><tr><td>6/255</td><td>27.4</td><td>22.6</td><td>21.0</td><td>13.2</td><td>13.2</td><td>15.0</td><td>15.0</td></tr><tr><td>8/255</td><td>13.8</td><td>18.6</td><td>16.8</td><td>3.6</td><td>3.6</td><td>3.6</td><td>3.2</td></tr><tr><td>10/255</td><td>6.6</td><td>15.6</td><td>13.8</td><td>0.4</td><td>0.4</td><td>0.8</td><td>0.8</td></tr><tr><td></td><td></td><td></td><td></td><td>DF</td><td>PGD-</td><td>PGD-</td><td>FAB-</td><td>FAB-</td></tr><tr><td rowspan="5">12</td><td>2</td><td></td><td></td><td></td><td>1</td><td>50</td><td>1</td><td>10 72.8</td></tr><tr><td>3</td><td></td><td></td><td>74.2 61.6</td><td>71.8 51.4</td><td>71.8 51.0</td><td>72.8 52.4</td><td>52.4</td></tr><tr><td>4</td><td></td><td></td><td>45.6</td><td>31.0</td><td>30.8</td><td>34.4</td><td>33.8</td></tr><tr><td>5</td><td></td><td></td><td>34.6</td><td>20.4</td><td>20.4</td><td>22.6</td><td>21.8</td></tr><tr><td>6</td><td></td><td></td><td>25.2</td><td>9.6</td><td>9.6</td><td>11.8</td><td>11.6</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>PGD-</td><td></td><td></td><td>FAB-</td></tr><tr><td rowspan="5">l1</td><td></td><td></td><td>SparseFool</td><td></td><td>1</td><td>PGD- 5</td><td>FAB- 1</td><td>5</td></tr><tr><td>50</td><td></td><td></td><td>85.4</td><td>81.0</td><td>81.0</td><td>78.6</td><td>78.4</td></tr><tr><td>100</td><td></td><td></td><td>79.6</td><td>63.8</td><td>63.6</td><td>60.8</td><td>59.0</td></tr><tr><td>150</td><td></td><td></td><td>74.4</td><td>48.4</td><td>48.4</td><td>45.2</td><td>42.2</td></tr><tr><td>200 250</td><td></td><td></td><td>68.6 60.0</td><td>32.2 23.0</td><td>32.2 22.4</td><td>31.0 22.8</td><td>29.0 20.2</td></tr></table>
363
+
364
+ ![](images/0be78c0b205f94556f564bff0531004766b5d68fd7f6ceb6b6ef3b91fe2e6bc9.jpg)
365
+ Figure 3: We plot for different step sizes of PGD robust accuracy over iterations. In red the step size we used in the experiments of Section 3. We clearly see that our chosen step-size is on average the best one. The models used are those trained on MNIST (top row) and CIFAR-10 (bottom row).
366
+
367
+ # B Analysis of the attacks
368
+
369
+ # B.1 Choice of the step size of PGD
370
+
371
+ We here show the performance of PGD wrt $l _ { 2 }$ on MNIST and CIFAR-10 under different choices of the step size. In particular we focus here on the largest $\epsilon$ and the middle $\epsilon$ values chosen in the evaluation where the different stepsize choices have the largest impact. We report the robust accuracy for at each of the 150 iterations. We test step sizes $\epsilon / t$ for $t \in \{ 1 , 2 , 4 , 1 0 , 2 5 , 7 5 \}$ . For each step size we run the attack 10 times with random initialization and show the run which achieves the lowest robust accuracy after 150 iterations. Note however that the behaviour of different runs varies minimally. In Figure 3 we show the results for the three models for MNIST and CIFAR-10 for two different choices of $\epsilon$ used in Section 3, with step size decreasing the blue becoming darker, while our chosen step size, that is $\epsilon / 4$ , is highlighted in red. We see that it achieves in all the models best or close to best robust accuracy and is clearly the best on average.
372
+
373
+ # B.2 Evolution across iteration
374
+
375
+ We here want to compare the evolution of the robust accuracy across the iterations of a single run of PGD and FAB, that is PGD-1 and FAB-1 from Tables 5 to 13. Since PGD performs 1 forward and 1 backward pass for each iteration and FAB 2 forward passes and 1 backward pass, we rescale the robust accuracy so to compare the two methods when they have exploited the same number of passes of the network. Then 300 passes correspond to 150 iterations of PGD and to 100 of FAB. In Figures 4, 5 and 6 we show the evolution of robust accuracy for the different dataset, models and threat models ( ${ \mathit { l } } _ { \infty }$ , $l _ { 2 }$ and $l _ { 1 }$ ), computed at the threshold $\epsilon$ median among the five used in Tables 5 to 13.
376
+
377
+ ![](images/394080302f40b08a5199f7f3435e273bccfdbce94e40a64e3c6d2627f1248542.jpg)
378
+ Figure 4: Evolution of accuracy across iterations on MNIST. We compare the robust accuracy of PGD-1 (magenta) and FAB-1 (black) as a function of the employed forward/backward passes in the algorithm (one iteration of PGD corresponds to 2 passes, one iteration of FAB corresponds to 3 passes). Models: plain in the first column, $l _ { \infty }$ -at in the second and $l _ { 2 }$ -at in the third. Threat models: ${ \mathit { l } } _ { \infty }$ in the first row, $l _ { 2 }$ in the second and $l _ { 1 }$ in the third. The thresholds $\epsilon$ used can be read above the plots. Note that the result of FAB-1 on ${ \mathit { l } } _ { \infty }$ -at wrt $l _ { 1 }$ does not match that in Table 6 due to a typo in the statistics in the table.
379
+
380
+ ![](images/e5545fdce41d433a09a74a6c59602e331c782191c55f6c6c75d988a99d575142.jpg)
381
+ Figure 5: Evolution of accuracy across iterations on CIFAR-10. We compare the robust accuracy of PGD-1 (magenta) and FAB-1 (black) as a function of the employed forward/backward passes in the algorithm (one iteration of PGD corresponds to 2 passes, one iteration of FAB corresponds to 3 passes). Models: plain in the first column, $l _ { \infty }$ -at in the second and $l _ { 2 }$ -at in the third. Threat models: ${ \mathit { l } } _ { \infty }$ in the first row, $l _ { 2 }$ in the second and $l _ { 1 }$ in the third. The thresholds $\epsilon$ used can be read above the plots.
382
+
383
+ ![](images/f662f60af47b70ef9e9be2d11736c4a60d3e7a49f05574d06c79cbdcac04334b.jpg)
384
+ Figure 6: Evolution of robust accuracy across iterations on Restricted ImageNet. We compare the robust accuracy of PGD-1 (magenta) and FAB-1 (black) as a function of the employed forward/backward passes in the algorithm (one iteration of PGD corresponds to 2 passes, one iteration of FAB corresponds to 3 passes). Models: plain in the first column, ${ \mathit { l } } _ { \infty }$ -at in the second and $l _ { 2 }$ -at in the third. Threat models: ${ \mathit { l } } _ { \infty }$ in the first row, $l _ { 2 }$ in the second and $l _ { 1 }$ in the third. The thresholds $\epsilon$ used can be read above the plots.
md/train/HJx7uJStPH/HJx7uJStPH.md ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MUSIC SOURCE SEPARATION IN THE WAVEFORM DOMAIN
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Source separation for music is the task of isolating contributions, or stems, from different instruments recorded individually and arranged together to form a song. Such components include voice, bass, drums and any other accompaniments. Contrarily to many audio synthesis tasks where the best performances are achieved by models that directly generate the waveform, the state-of-the-art in source separation for music is to compute masks on the magnitude spectrum. In this paper, we first show that an adaptation of Conv-Tasnet (Luo & Mesgarani, 2019), a waveform-to-waveform model for source separation for speech, significantly beats the state-of-the-art on the MusDB dataset, the standard benchmark of multi-instrument source separation. Second, we observe that Conv-Tasnet follows a masking approach on the input signal, which has the potential drawback of removing parts of the relevant source without the capacity to reconstruct it. We propose Demucs, a new waveform-towaveform model, which has an architecture closer to models for audio generation with more capacity on the decoder. Experiments on the MusDB dataset show that Demucs beats previously reported results in terms of signal to distortion ratio (SDR), but lower than Conv-Tasnet. Human evaluations show that Demucs has significantly higher quality (as assessed by mean opinion score) than Conv-Tasnet, but slightly more contamination from other sources, which explains the difference in SDR. Additional experiments with a larger dataset suggest that the gap in SDR between Demucs and Conv-Tasnet shrinks, showing that our approach is promising.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Cherry first noticed the “cocktail party effect” (Cherry, 1953): how the human brain is able to separate a single conversation out of a surrounding noise from a room full of people chatting. Bregman later tried to understand how the brain was able to analyse a complex auditory signal and segment it into higher level streams. His framework for auditory scene analysis (Bregman, 1990) spawned its computational counterpart, trying to reproduce or model accomplishments of the brains with algorithmic means (Wang & Brown, 2006), in particular regarding source separation capabilities.
12
+
13
+ When producing music, recordings of individual instruments called stems are arranged together and mastered into the final song. The goal of source separation is to recover those individual stems from the mixed signal. Unlike the cocktail party problem, there is not a single source of interest to differentiate from an unrelated background noise, but instead a wide variety of tones and timbres playing in a coordinated way. In the SiSec Mus evaluation campaign for music separation (Stöter et al., 2018), those individual stems were grouped into 4 broad categories: (1) drums, (2) bass, (3) other, (4) vocals. Given a music track which is a mixture of these four sources, also called the mix, the goal is to generate four waveforms that correspond to each of the original sources. We consider here the case of supervised source separation, where the training data contain music tracks (i.e., mixtures), together with the ground truth waveform for each of the sources.
14
+
15
+ State-of-the-art approaches in music source separation still operate on the spectrograms generated by the short-time Fourier transform (STFT). They produce a mask on the magnitude spectrums for each frame and each source, and the output audio is generated by running an inverse STFT on the masked spectrograms reusing the input mixture phase (Takahashi & Mitsufuji, 2017; Takahashi et al., 2018). Several architectures trained end-to-end to directly synthesize the waveforms have been proposed (Lluís et al., 2018; Jansson et al., 2017), but their performances are far below the state-of-the-art: in the last SiSec Mus evaluation campaign (Stöter et al., 2018), the best model that directly predicts waveforms achieves an average signal-to-noise ratio (SDR) over all four sources of 3.2, against 5.3 for the best approach that predicts spectrograms masks (also see Table 1 in Section 6). An upper bound on the performance of all methods relying on masking spectrograms is given by the SDR obtained when using a mask computed using the ground truth sources spectrograms, for instance the Ideal Ratio Mask (IRM) or the Ideal Binary Mask (IBM) oracles. For speech source separation, Luo & Mesgarani (2019) proposed Conv-Tasnet, a model that reuses the masking approach of spectrogram methods but learns the masks jointly with a convolutional front-end, operating directly in the waveform domain for both the inputs and outputs. Conv-Tasnet surpasses both the IRM and IBM oracles.
16
+
17
+ ![](images/c2f8e55ae4154f11a407c116da4b5d8c85e335af72c6f86d64361b47526aad64.jpg)
18
+ Figure 1: Mel-spectrogram for a 0.8 seconds extract of the bass source from the track “Stich Up” of the MusDB test. From left to right: ground truth, Conv-Tasnet estimate and Demucs estimate. We observe that Conv-Tasnet missed one note entirely.
19
+
20
+ Our first contribution is to adapt the Conv-Tasnet architecture, originally designed for monophonic speech separation and audio sampled at $8 \mathrm { k H z }$ , to the task of sterephonic music source separation for audio sampled at $4 4 . 1 \mathrm { k H z }$ . Our experiments show that Conv-Tasnet outperforms all previous methods by a large margin, with an SDR of 5.7, but still under the SDR of the IRM oracle at 8.2 (Stöter et al., 2018). However, while Conv-Tasnet separates with a high accuracy the different sources, we observed artifacts when listening to the generated audio: a constant broadband noise, hollow instruments attacks or even missing parts. They are especially noticeable on the drums and bass sources and we give one such example on Figure 1. Conv-Tasnet uses an over-complete linear representation on which it applies a mask obtained from a deep convolutional network. Because both the encoder and decoder are linear, the masking operation cannot synthesize new sounds. We conjecture that the overlap of multiples instruments sometimes lead to a loss of information that is not reversible by a masking operation.
21
+
22
+ To overcome the limitations of Conv-Tasnet, our second contribution is to propose Demucs, a new architecture for music source separation. Similarly to Conv-Tasnet, Demucs is a deep learning model that directly operates on the raw input waveform and generates a waveform for each source. Demucs is inspired by models for music synthesis rather than masking approaches. It is a U-net architecture with a convolutional encoder and a decoder based on wide transposed convolutions with large strides inspired by recent work on music synthesis (Défossez et al., 2018). The other critical features of the approach are a bidirectional LSTM between the encoder and the decoder, increasing the number of channels exponentially with depth, gated linear units as activation function (Dauphin et al., 2017) which also allow for masking, and a new initialization scheme.
23
+
24
+ We present experiments on the MusDB benchmark, which first show that both Conv-Tasnet and Demucs achieve performances significantly better than the best methods that operate on the spectrogram, with Conv-Tasnet being better than Demucs in terms of SDR. We also perform human evaluations that compare Conv-Tasnet and our Demucs, which show that Demucs has significantly better perceived quality. The smaller SDR of Demucs is explained by more contamination from other sources. We also conduct an in-depth ablation study of the Demucs architecture to demonstrate the impact of the various design decisions. Finally, we carry out additional experiments by adding 150 songs to the training set. In this experiment, Demucs and TasNet both achieve an SDR of 6.3, suggesting that the gap in terms of SDR between the two models diminishes with more data, making the Demucs approach promising. The 6.3 points of SDR also set a new state-of-the-art, since it improves on the best previous result of 6.0 on the MusDB test set obtained by training with 800 additional songs.
25
+
26
+ We discuss in more detail the related work in the next Section. We then describe the original ConvTasnet model of Luo & Mesgarani (2018) and its adaptation to music source separation. Our Demucs architecture is detailed in Section 4. We present the experimental protocol in Section 5, and the experimental results compared to the state-of-the-art in Section 6. Finally, we describe the results of the human evaluation and the ablation study.
27
+
28
+ # 2 RELATED WORK
29
+
30
+ A first category of methods for supervised music source separation work on time-frequency representations. They predict a power spectrogram for each source and reuse the phase from the input mixture to synthesise individual waveforms. Traditional methods have mostly focused on blind (unsupervised) source separation. Non-negative matrix factorization techniques (Smaragdis et al., 2014) model the power spectrum as a weighted sum of a learnt spectral dictionary, whose elements are grouped into individual sources. Independent component analysis (Hyvärinen et al., 2004) relies on independence assumptions and multiple microphones to separate the sources. Learning a soft/binary mask over power spectrograms has been done using either HMM-based prediction (Roweis, 2001) or segmentation techniques (Bach & Jordan, 2005).
31
+
32
+ With the development of deep learning, fully supervised methods have gained momentum. Initial work was performed on speech source separation (Grais et al., 2014), followed by works on music using simple fully connected networks over few spectrogram frames (Uhlich et al., 2015), LSTMs (Uhlich et al., 2017), or multi scale convolutional/recurrent networks (Liu & Yang, 2018; Takahashi & Mitsufuji, 2017). Nugraha et al. (2016) showed that Wiener filtering is an efficient post-processing step for spectrogram-based models and it is now used by all top performing models in this category. Those methods have performed the best during the last SiSec 2018 evaluation (Stöter et al., 2018) for source separation on the MusDB (Rafii et al., 2017) dataset. After the evaluation, a reproducible baseline called Open Unmix has been released by Stöter et al. (2019) and matches the top submissions trained only on MusDB. MMDenseLSTM, a model proposed by Takahashi et al. (2018) and trained on 807 unreleased songs currently holds the absolute record of SDR in the SiSec campaign. Both Demucs and Conv-Tasnet obtain significantly higher SDR.
33
+
34
+ More recently, models operating in the waveform domain have been developed, so far with worse performance than those operating in the spectrogram domain. A convolutional network with a U-Net structure called Wave-U-Net was used first on spectrograms (Jansson et al., 2017) and then adapted to the waveform domain (Stoller et al., 2018). Wave-U-Net was submitted to the SiSec 2018 evaluation campaign with a performance inferior to that of most spectrogram domain models by a large margin. A Wavenet-inspired, although using a regression loss and not auto-regressive, was first used for speech denoising (Rethage et al., 2018) and then adapted to source separation (Lluís et al., 2018). Our model significantly outperforms Wave-U-Net.Given that the Wavenet inspired model performed worse than Wave-U-Net, we did not consider it for comparison.
35
+
36
+ In the field of monophonic speech source separation, spectrogram masking methods have enjoyed good performance (Kolbæk et al., 2017; Isik et al., 2016). Luo & Mesgarani (2018) developed a waveform domain methods using masking over a learnable front-end obtained from a LSTM that reached the same accuracy. Improvements were obtained by Wang et al. (2018) for spectrogram methods using the unfolding of a few iterations of a phase reconstruction algorithm in the training loss. In the mean time, Luo & Mesgarani (2019) refined their approach, replacing the LSTM with a superposition of dilated convolutions, which improved the SDR and definitely surpassed spectrogram based approaches, including oracles that use the ground truth sources such as the ideal ratio mask (IRM) or the ideal binary mask (IBM). We show in this paper that Conv-Tasnet also outperforms all known methods for music source separation. However it suffers from significantly more artifacts than the Demucs architecture we introduce in this paper, as measured by mean opinion score.
37
+
38
+ # 3 ADAPTING CONV-TASNET FOR MUSIC SOURCE SEPARATION
39
+
40
+ We describe in this section the Conv-Tasnet architecture of Luo & Mesgarani (2018) and give the details of how we adapted the architecture to fit the setting of the MusDB dataset.
41
+
42
+ Overall framework Each source $s$ is represented by a waveform $x _ { s } \in \mathbb { R } ^ { C , T }$ where $C$ is the number of channels (1 for mono, 2 for stereo) and $T$ the number of samples of the waveform. The mixture (i.e., music track) is the sum of all sources $x : = \textstyle \sum _ { s = 1 } ^ { S } x _ { s }$ . We aim at training a model $g$
43
+
44
+ parameterized by $\theta$ , such that $g ( x ) = ( g _ { s } ( x ; \theta ) ) _ { s = 1 } ^ { S }$ , where $g _ { s } ( x ; \theta )$ is the predicted waveform for source $s$ given $x$ , that minimizes
45
+
46
+ $$
47
+ \operatorname* { m i n } _ { \theta } \sum _ { x \in \mathcal { D } } \sum _ { s = 1 } ^ { S } L ( g _ { s } ( x ; \theta ) , x _ { s } )
48
+ $$
49
+
50
+ for some dataset $\mathcal { D }$ and reconstruction error $L$ . The original Conv-Tasnet was trained using a loss called scale-invariant source-to-noise ratio (SI-SNR), similar to the SDR loss described in Section 5. We instead use a simple L1 loss between the estimated and ground truth sources. We discuss in more details regression losses in the context of our Demucs architecture in Section 4.2.
51
+
52
+ The original Conv-Tasnet architecture Conv-Tasnet (Luo & Mesgarani, 2018) is composed of a learnt front-end that transforms back and forth between the input monophonic mixture waveform sampled at $8 \ \mathrm { k H z }$ and a 128 channels over-complete representation sampled at $1 \ \mathrm { k H z }$ using a convolution as the encoder and a transposed convolution as the decoder, both with a kernel size of 16 and stride of 8. The high dimensional representation is masked through a separation network composed of stacked residual blocks. Each block is composed of a a 1x1 convolution, a PReLU (He et al., 2015b) non linearity, a layer wise normalization over all channels jointly (Ba et al., 2016), a depth-wise separable convolution (Chollet, 2017; Howard et al., 2017) with a kernel size of 3, a stride of 1 and a dilation of $2 ^ { n \bmod N }$ , with $n$ the 0-based index of the block and $N$ an hyper-parameter, and another PReLU and normalization. The output of each block participates to the final mask estimation through a skip connection, preceded by a 1x1 convolution. The original Conv-Tasnet counted $3 \times N$ blocks with $N = 8$ . The mask is obtained summing the output of all blocks and then applying ReLU. The output of the encoder is multiplied by the mask and before going through the decoder.
53
+
54
+ Conv-Tasnet for music source separation We adapted their architecture to the task of stereophonic music source separation: the original Conv-Tasnet has a receptive field of 1.5 seconds for audio sampled at $8 \ \mathrm { k H z }$ , we take $N = 1 0$ and increased the kernel size (resp. stride) of the encoder/decoder from 16 (resp. 8) to 20 (resp. 10), leading to the same receptive field at $4 4 . 1 \mathrm { k H z }$ . We observed better results using $4 \times N$ blocks instead of $3 \times N$ and 256 channels for the encoder/decoder instead of 128. With those changes, Conv-Tasnet obtained state-of-the-art performance on the MusDB dataset, surpassing all known spectrogram based methods by a large margin as shown in Section 6.
55
+
56
+ Separating entire songs The original Conv-Tasnet model was designed for short sentences of a few seconds at most. When evaluating it on an entire track, we obtained the best performance by first splitting the input track into chunks of 8 seconds each. We believe this is because of the global layer normalization. During training, only small audio extracts are given, so that a quiet part or a loud part would be scaled back to an average volume. However, when using entire songs as input, it will most likely contain both quiet and loud parts. The normalization will not map both to the same volume, leading to a difference between training and evaluation. We did not observe any side effects when going from one chunk to the next, so we did not look into fancier overlap-add methods.
57
+
58
+ # 4 THE DEMUCS ARCHITECTURE
59
+
60
+ The architecture we propose, which we call Demucs, is described in the next few subsections, and the reconstruction loss is discussed in Section 4.2. Demucs takes a stereo mixture as input and outputs a stereo estimate for each source $C = 2$ ). It is an encoder/decoder architecture composed of a convolutional encoder, a bidirectional LSTM, and a convolutional decoder, with the encoder and decoder linked with skip U-Net connections. Similarly to other work in generation in both image (Karras et al., 2018; 2017) and sound (Défossez et al., 2018), we do not use batch normalization (Ioffe & Szegedy, 2015) as our early experiments showed that it was detrimental to the model performance. The overall architecture is depicted in Figure 2a.
61
+
62
+ # 4.1 CONVOLUTIONAL AUTO-ENCODER
63
+
64
+ Encoder The encoder is composed of $L : = 6$ stacked convolutional blocks numbered from 1 to $L$ . Each block $i$ is composed of a convolution with kernel size $K : = 8$ , stride $S : = 4$ , $C _ { i - 1 }$ input channels, $C _ { i }$ output channels and ReLU activation, followed by a convolution with kernel size 1, $2 C _ { i }$
65
+
66
+ (a) Demucs architecture with the mixture waveform as input and the four sources estimates as output. Arrows represents U-Net connections.
67
+
68
+ ![](images/46ac1683040c59307835e69e568b432199f9c653098c5708f11fddff45ad9e98.jpg)
69
+ Figure 2: Demucs complete architecture on the left, with detailed representation of the encoder and decoder layers on the right.
70
+
71
+ ![](images/0972f1a383778ee80b10f18a7c8accb8a379d028dfd8c7f0012935194dc27c07.jpg)
72
+
73
+ (b) Detailed view of the layers Decoderi on the top and Encoderi on the bottom. Arrows represent connections to other parts of the model. For convolutions, $C _ { i } n$ (resp $C _ { o } u t )$ is the number of input channels (resp output), $K$ the kernel size and $S$ the stride.
74
+
75
+ output channels and gated linear units (GLU) as activation function (Dauphin et al., 2017). Since GLUs halve the number of channels, the final output of block $i$ has $C _ { i }$ output channels. A block is described in Figure 2b. Convolutions with kernel width 1 increase the depth and expressivity of the model at low computational cost. As we show in our ablation study 6.2, the usage of GLU activations after these convolutions significantly boost performance. The number of channels in the input mixture is $C _ { 0 } = C = 2$ , while we use $C _ { 1 } : = 1 0 0$ as the number of output channels for the first encoder block. The number of channels is then doubled at each subsequent block, i.e., $C _ { i } : = 2 C _ { i - 1 }$ for $i = 2 . . L$ , so the final number of channels is $C _ { L } = 3 2 0 0$ . We then use a bidirectional LSTM with 2 layers and a hidden size $C _ { L }$ . The LSTM outputs $2 C _ { L }$ channels per time position. We use a linear layer to take that number down to $C _ { L }$ .
76
+
77
+ Decoder The decoder is mostly the inverse of the encoder. It is composed of $L$ blocks numbered in reverse order from $L$ to 1. The $i$ -th blocks starts with a convolution with stride 1 and kernel width 3 to provide context about adjacent time steps, input/output channels $C _ { i }$ and a ReLU activation. Finally, we use a transposed convolution with kernel width 8 and stride 4, $C _ { i - 1 }$ outputs and ReLU activation. The $S$ sources are synthesized at the final layer only, after all decoder blocks. The final layer is linear with $S \cdot C _ { 0 }$ output channels, one for each source (4 stereo channels in our case), without any additional activation function. Each of these channels directly generate the corresponding waveform.
78
+
79
+ U-network structure Similarly to Wave-U-Net (Jansson et al., 2017), there are skip connections between the encoder and decoder blocks with the same index, as originally proposed in U-networks (Ronneberger et al., 2015). While the main motivation comes from empirical performances, an advantage of the skip connections is to give a direct access to the original signal, and in particular allows to directly transfers the phase of the input signal to the output, as discussed in Section 4.2. Unlike Wave-U-Net, we use transposed convolutions rather than linear interpolation followed by a convolution with a stride of 1. For the same increase in the receptive field, transposed convolutions require 4 times less operations and memory. This limits the overall number of channels that can be used before running out of memory. As we observed that a large number of channels was key to obtaining good results, we favored the use of transposed convolutions, as explained in Section 6.
80
+
81
+ Motivation: synthesis vs masking The approach we follow uses the U-Network architecture (Ronneberger et al., 2015; Stoller et al., 2018; Jansson et al., 2017), and builds on transposed convolutions with large number of channels and large strides (4) inspired by the approach to the synthesis of music notes of Défossez et al. (2018). The U-Net skip connections and the gating performed by GLUs imply that this architecture is expressive enough to represent masks on a learnt representation of the input signal, in a similar fashion to Conv-Tasnet. The Demucs approach is then more expressive than Conv-Tasnet, and its main advantages are the multi-scale representations of the input and the non-linear transformations to and from the waveform domain.
82
+
83
+ # 4.2 LOSS FUNCTION
84
+
85
+ For the reconstruction loss $L ( g _ { s } ( x ; \theta ) , x _ { s } )$ in equation 1, we either use the average mean square error or average absolute error between waveforms: for a waveform $x _ { s }$ containing $T$ samples and corresponding to source $s$ , a predicted waveform $\hat { x } _ { s }$ and denoting with a subscript $t$ the $t$ -th sample of a waveform, we use one of $L _ { 1 }$ or $L _ { 2 }$ :
86
+
87
+ $$
88
+ L _ { 1 } ( \boldsymbol { \hat { x } _ { s } } , \boldsymbol { x _ { s } } ) = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } | \hat { x } _ { s , t } - x _ { s , t } | \qquad L _ { 2 } ( \boldsymbol { \hat { x } _ { s } } , \boldsymbol { x _ { s } } ) = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } ( \hat { x } _ { s , t } - x _ { s , t } ) ^ { 2 } .
89
+ $$
90
+
91
+ In generative models for audio, direct reconstruction losses on waveforms can pose difficulties because they are sensitive to the initial phases of the signals: two signals whose only difference is a shift in the initial phase are perceptually the same, but can have arbitrarily high $L _ { 1 }$ or $L _ { 2 }$ losses. It can be a problem in pure generation tasks because the initial phase of the signal is unknown, and losses on power/magnitude spectrograms are alternative that do not suffer from this lack of specification of the output. Approaches that follow this line either generate spectrograms (e.g., Wang et al., 2017), or use a loss that compares power spectrograms of target/generated waveforms (Défossez et al., 2018).
92
+
93
+ The problem of invariance to a shift of phase is not as severe in source separation as it is in unconditional generation, because the model has access to the original phase of the signal. The pase can easily be recovered from the skip connections in U-net-style architectures for separation, and is directly used as input of the inverse STFT for methods that generate masks on power spectrograms. As such, losses such as $L 1 / L 2$ are totally valid for source separation. Early experiments with an additional term including the loss of Défossez et al. (2018) did not suggest that it boosts performance, so we did not pursue this direction any further. Most our experiments use $L 1$ loss, and the ablation study presented in Section 6.2 suggests that there is no significant difference between $L 1$ and $L 2$ .
94
+
95
+ # 4.3 WEIGHT RESCALING AT INITIALIZATION
96
+
97
+ The initialization of deep neural networks is known to have a critical impact on the overall performances (Glorot & Bengio, 2010; He et al., 2015a), up to the point that Zhang et al. (2019) showed that with a different initialization called fixup, very deep residual networks and transformers can be trained without batch normalization. While Fixup is not designed for U-Net-style skip connections, we observed that the following different initialisation scheme had great positive impact on performances compared to the standard initialization of He et al. (2015a) used in U-Networks.
98
+
99
+ Considering the so-called Kaiming initialization (He et al., 2015a) as a baseline, let us look at a single convolution layer for which we denote $w$ the weights after the first initialization. We take $\alpha : = \operatorname { s t d } ( w ) / a$ , where $a$ is a reference scale, and replace $w$ by $w ^ { \prime } = w / \sqrt { \alpha }$ . Since the original weights have element-wise order of magnitude $( K C _ { \mathrm { i n } } ) ^ { - 1 / 2 }$ where $K$ is the kernel width and $C _ { \mathrm { i n } }$ the number of output channels, it means that our initialization scheme produces weights of order of magnitude $( K C _ { \mathrm { i n } } ) ^ { - 1 / 4 }$ , together with a non-trivial scale. Based a search over the values [0.01, 0.05, 0.1], we select $a = 0 . 1$ for all the regular and transposed convolutions, see Section 6 for more details. We experimentally observed that on a randomly initialized model applied to an audio extract, it kept the standard deviation of the features along the layers of the same order of magnitude. Without initial rescaling, the output the last layer has a magnitude 20 times smaller than the first.
100
+
101
+ # 4.4 RANDOMIZED EQUIVARIANT STABILIZATION
102
+
103
+ A perfect source separation model is time equivariant, i.e. shifting the input mixture by X samples will shift the output Y by the exact same amount. Thanks to its dilated convolutions with a stride of 1, the mask predictor of Conv-Tasnet is naturally time equivariant and even if the encoder/decoder is not strictly equivariant, Conv-Tasnet still verifies this property experimentally (Luo & Mesgarani, 2019). Spectrogram based method will also verify approximately this property. Shifting the input by a small amount will only reflect in the phase of the spectrogram. As the mask is computed only from the magnitude, and the input mixture phase is reused, the output will naturally be shifted by the same amount. On the other hand, we noticed that our architecture did not naturally satisfy this property. We propose a simple workaround called randomized equivariant stabilization, where we sample $S$ random shifts of an input mixture $x$ and average the predictions of our model for each, after having applied the opposite shift. This technique does not require changing the training procedure or network architecture. Using $S = 1 0$ , we obtained a 0.3 SDR gain, see Section 6.2 for more details. It does make evaluation of the model $S$ times slower, however, on a V100 GPU, separating 1 minute of audio at $4 4 . 1 \mathrm { k H z }$ with Demucs takes only 0.8 second. With this technique, separation of 1 minute takes 8 seconds which is still more than 7 times faster than real time.
104
+
105
+ # 5 EXPERIMENTAL SETUP
106
+
107
+ # 5.1 EVALUATION FRAMEWORK
108
+
109
+ MusDB and additional data We use the MusDB dataset (Rafii et al., 2017) , which is composed of 150 songs with full supervision in stereo and sampled at 44100Hz. For each song, we have the exact waveform of the drums, bass, other and vocals parts, i.e. each of the sources. The actual song, the mixture, is the sum of those four parts. The first 84 songs form the train set, the next 16 songs form the valid set (the exact split is defined in the musdb python package) while the remaining 50 are kept for the test set. We collected raw stems for 150 tracks, i.e., individual instrument recordings used in music production software to make a song. We manually assigned each instrument to one of the sources in MusDB. We call this extra supervised data the stem set. We also report the performances of Tasnet and Demucs trained using these 150 songs in addition to the 84 from MusDB, to anaylze the effect of adding more training data.
110
+
111
+ Source separation metrics Measurements of the performance of source separation models was developed by Vincent et al. for blind source separation (Vincent et al., 2006) and reused for supervised source separation in the SiSec Mus evaluation campaign (Stöter et al., 2018). Similarly to previous work (Stoller et al., 2018; Takahashi & Mitsufuji, 2017; Takahashi et al., 2018), we focus on the SDR (Signal to Distortion Ratio) which measures the log ratio between the volume of the estimated source projection onto the ground truth, and the volume of what is left out of this projection, typically contamination by other sources or artifacts. Other metrics can be defined (SIR and SAR) and we present them in the supplementary material. We used the python package museval which provide a reference implementation for the SiSec Mus 2018 evaluation campaign. As done in the SiSec Mus competition, we report the median over all tracks of the median of the metric over each track computed using the museval package.
112
+
113
+ # 5.2 BASELINES
114
+
115
+ As baselines, we selected Open Unmix (Stöter et al., 2019), a 3-layer BiLSTM model with encoding and decoding fully connected layers on spectrogram frames. It was released by the organizers of the SiSec 2018 to act as a strong reproducible baseline and matches the performances of the best candidates trained only on MusDB. We also selected MMDenseLSTM (Takahashi et al., 2018), a multi-band dense net with LSTMs at different scales of the encoder and decoder. This model was submitted as TAK2 and trained with 804 extra labeled songs1. Both MMDenseLSTM and Open Unmix use Wiener filtering (Nugraha et al., 2016) as a last post processing step. The only waveform based method submitted to the evaluation campaign is Wave-U-Net (Stoller et al., 2018) with the identifier STL2. Metrics were downloaded from the SiSec submission repository. for Wave-U-Net and MMDenseLSTM. For Open Unmix they were provided by their authors2. We also provide the metrics for the Ideal Ratio Mask oracle (IRM), which computes the best possible mask using the ground truth sources and is the topline of spectrogram based method (Stöter et al., 2018).
116
+
117
+ Table 1: Comparison of Conv-Tasnet and Demucs to state-of-the-art models that operate on the waveform (Wave-U-Net) and on spectrograms (Open-Unmix without extra data, MMDenseLSTM with extra data) as well as the IRM oracle on the MusDB test set. The Extra? indicates the number of extra training songs used. We report the median over all tracks of the median SDR over each track, as done in the SiSec Mus evaluation campaign (Stöter et al., 2018). The All column reports the average over all sources. Demucs metrics are averaged over 5 runs, the confidence interval is the standard deviation over $\sqrt { 5 }$ . In bold are the values that are statistically state-of-the-art either with or without extra training data.
118
+
119
+ <table><tr><td></td><td></td><td></td><td colspan="5">Test SDR in dB</td></tr><tr><td>Architecture</td><td>Wav?</td><td>Extra?</td><td>All</td><td>Drums</td><td>Bass</td><td>Other</td><td>Vocals</td></tr><tr><td>IRM oracle</td><td>×</td><td>N/A</td><td>8.22</td><td>8.45</td><td>7.12</td><td>7.85</td><td>9.43</td></tr><tr><td>Open-Unmix</td><td>X</td><td>X</td><td>5.33</td><td>5.73</td><td>5.23</td><td>4.02</td><td>6.32</td></tr><tr><td>Wave-U-Net</td><td>√</td><td>X</td><td>3.23</td><td>4.22</td><td>3.21</td><td>2.25</td><td>3.25</td></tr><tr><td>Demucs</td><td>√</td><td>X</td><td>5.58 ±.03</td><td>6.08 ±.06</td><td>5.83 ±.07</td><td>4.12 ±.04</td><td>6.29 ±.07</td></tr><tr><td>Conv-Tasnet</td><td>√</td><td>X</td><td>5.73 ±.03</td><td>6.08 ±.06</td><td>5.66 ±.16</td><td>4.37 ±.02</td><td>6.81 ±.04</td></tr><tr><td>Demucs</td><td></td><td>150</td><td>6.33 ±.02</td><td>7.08 ±.07</td><td>6.70 ±.06</td><td>4.47±.03</td><td>7.05 ±.04</td></tr><tr><td>Conv-Tasnet</td><td>·</td><td>150</td><td>6.32 ±.04</td><td>7.11 ±.13</td><td>7.00 ±.05</td><td>4.44±.03</td><td>6.74 ±.06</td></tr><tr><td>MMDenseLSTM</td><td>X</td><td>804</td><td>6.04</td><td>6.81</td><td>5.40</td><td>4.80</td><td>7.16</td></tr></table>
120
+
121
+ # 5.3 TRAINING PROCEDURE
122
+
123
+ Epoch definition and augmentation We define one epoch over the dataset as a pass over all 11-second extracts with a stride of 1 second. We use a random audio shift between 0 and 1 second and keep 10 seconds of audio from there as a training example. We perform the following data augmentation (Uhlich et al., 2017), also used by Open Unmix and MMDenseLSTM: shuffling sources within one batch to generate one new mix, randomly swapping channels. We additionally multiply each source by $\pm 1$ (Nachmani & Wolf, 2019). All Demucs models were trained over 240 epochs. Conv-Tasnet was trained for 360 epochs when trained only on MusDB and 240 when trained with extra data and using only 2-seconds audio extracts.
124
+
125
+ Training setup and hyper-parameters All models are trained with 16 V100 GPUs with 32GB of RAM. We use a batch size of 64, the Adam (Kingma & Ba, 2015) optimizer with a learning rate was chosen among [3e-4, 5e-4] and the initial number of channels was chosen in [64, 80, 100] based on the L1 loss on the validation set. We obtained best performance with a learning rate of $3 e - 4$ and 100 channels. We then tried 3 different values for the initial weight rescaling reference level described in Section 4.3, [0.01, 0.05, 0.1] and selected 0.1. We computed confidence intervals using 5 random seeds in Table 1. For the ablation study on Table 4, we provide metrics for a single run.
126
+
127
+ # 6 EXPERIMENTAL RESULTS
128
+
129
+ In this section, we first provide experimental results on the MusDB dataset for Conv-Tasnet and Demucs compared with state-of-the-art baselines. We then dive into the ablation study of Demucs.
130
+
131
+ # 6.1 COMPARISON WITH BASELINES
132
+
133
+ We provide a comparison the state-of-the-art baselines on Table 1. The models on the top half were trained without any extra data while the lower half used unreleased training songs. As no previous work included confidence intervals, we considered the single metric provided by for the baselines as the exact estimate of their mean performance.
134
+
135
+ Quality of the separation We first observe that Demucs and Conv-Tasnet outperforms all previous methods for music source separation. Conv-Tasnet has significantly higher SDR with 5.73, improving by 0.4 over Open-Unmix. Our proposed Demucs architecture has worse overall performance but matches Conv-Tasnet for the drums source and surpasses it for the bass. When training on 150 extra songs, the two methods have the same overall performance of 6.3 SDR, beating MMDenseLSTM by nearly 0.3 SDR, despite MMDenseLSTM being tained on 804 extra songs. Unlike for speech separation (Luo & Mesgarani, 2019), all methods are still far below the IRM oracle, leaving room for future improvements. We provide results for the other metrics (SIR and SAR) as well as box plots with quantiles over the test set tracks in Appendix B. Audio samples for Demucs, Conv-Tasnet and all baselines are provided in the ICLR link code, with more details given in Appendix A.
136
+
137
+ Table 2: Mean Opinion Scores (MOS) evaluating the quality and absence of artifacts of the separated audio. 38 people rated 20 samples each, randomly sample from one of the 3 models or the ground truth. There is one sample per track in the MusDB test set and each is 8 seconds long. Ratings of 5 means that the quality is perfect (no artifacts).
138
+
139
+ <table><tr><td rowspan="2">Architecture</td><td colspan="5">Quality Mean Opinion Score</td></tr><tr><td>All</td><td>Drums</td><td>Bass</td><td>Other</td><td>Vocals</td></tr><tr><td>Ground truth</td><td>4.46 ±.07</td><td>4.56 ±.13</td><td>4.25 ±.15</td><td>4.45 ±.13</td><td>4.64 ±.13</td></tr><tr><td>Open-Unmix</td><td>3.03 ±.09</td><td>3.10 ±.17</td><td>2.93 ±.20</td><td>3.09 ±0.16</td><td>3.00±.17</td></tr><tr><td>Demucs</td><td>3.22 ±.09</td><td>3.77 ±.15</td><td>3.26 ±.18</td><td>3.32 ±.15</td><td>2.55 ±.20</td></tr><tr><td>Conv-Tasnet</td><td>2.85 ±.08</td><td>3.39 ±.14</td><td>2.29 ±.15</td><td>3.18 ±.14</td><td>2.45 ±.16</td></tr></table>
140
+
141
+ Table 3: Mean Opinion Scores (MOS) evaluating contamination by other sources. 38 people rated 20 samples each, randomly sampled from one of the 3 models or the ground truth. There is one sample per track in the MusDB test set and each is 8 seconds long. Ratings of 5 means no contamination by other sources.
142
+
143
+ <table><tr><td></td><td colspan="5">Contamination Mean Opinion Score</td></tr><tr><td>Architecture</td><td>All</td><td>Drums</td><td>Bass</td><td>Other</td><td>Vocals</td></tr><tr><td>Ground truth</td><td>4.59 ±.07</td><td>4.44 ±.18</td><td>4.69 ±.09</td><td>4.46 ±.13</td><td>4.81 ±.11</td></tr><tr><td>Open-Unmix</td><td>3.27 ±.11</td><td>3.02 ±.19</td><td>4.00 ±.20</td><td>3.11 ±.21</td><td>2.91 ±.20</td></tr><tr><td>Demucs</td><td>3.30 ±.10</td><td>3.08 ±.21</td><td>3.93 ±.18</td><td>3.15 ±.19</td><td>3.02 ±.20</td></tr><tr><td>Conv-Tasnet</td><td>3.42 ±.09</td><td>3.37 ±.17</td><td>3.73 ±.18</td><td>3.46 ±.17</td><td>3.10 ±.17</td></tr></table>
144
+
145
+ Human evaluations We noticed strong artifacts on the audio separated by Conv-Tasnet, especially for the drums and bass sources: static noise between 1 and $2 \ \mathrm { k H z }$ , hollow instrument attacks or missing notes as illustrated on Figure 1. In order to confirm this observation, we organized a mean opinion score survey. We separated 8 seconds extracts from all of the 50 test set tracks for Conv-Tasnet, Demucs and Open-Unmix. We asked 38 participants to rate 20 samples each, randomly taken from one of the 3 models or the ground truth. For each one, they were required to provide 2 ratings on a scale of 1 to 5. The first one evaluated the quality and absence of artifacts (1: many artifacts and distortion, content is hardly recognizable, 5: perfect quality, no artifacts) and the second one evaluated contamination by other sources (1: contamination if frequent and loud, 5: no contamination). We show the results on Tables 2 and 3. We confirmed that the presence of artifacts in the output of Conv-Tasnet degrades the user experience, with a rating of $2 . 8 5 { \pm } . 0 8 $ against $3 . 2 2 \pm . 0 9$ for Demucs. On the other hand, Conv-Tasnet samples had less contamination by other sources than Open-Unmix or Demucs, although by a small margin, with a rating of $3 . 4 2 \pm . 0 9$ against $3 . 3 0 \pm . 1 0$ for Demucs and $3 . 2 7 \pm . 1 1$ for Open-Unmix.
146
+
147
+ Training speed We measured the time taken to process a single batch of size 16 with 10 seconds of audio at $4 4 . 1 \mathrm { k H z }$ (the original Wave-U-Net being only trained on $2 2 \mathrm { k H z }$ audio, we double the time for fairness), ignoring data loading and using torch.cuda.synchronize to wait on all kernels to be completed. MMDenseLSTM does not provide a reference implementation. Wave-U-Net takes 1.2 seconds per batch, Open Unmix 0.2 seconds per batch and Demucs 1.6 seconds per batch.
148
+
149
+ Table 4: Ablation study for the novel elements in our architecture described in Section 4. We use only the train set from MusDB and report best L1 loss over the valid set throughout training as well the SDR on the test set for the epoch that achieved this loss.
150
+
151
+ <table><tr><td>Difference</td><td>Valid set L1 loss</td><td>Test set SDR</td></tr><tr><td>no initial weight rescaling</td><td>0.172</td><td>4.94</td></tr><tr><td>no BiLSTM</td><td>0.175</td><td>5.12</td></tr><tr><td>ReLU instead ofGLU</td><td>0.177</td><td>5.19</td></tr><tr><td>no lx1 convolutions in encoder</td><td>0.176</td><td>5.30</td></tr><tr><td>no randomized equivariant stabilization</td><td>N/A</td><td>5.34</td></tr><tr><td>kernel size of 1 in decoder convolutions</td><td>0.166</td><td>5.51</td></tr><tr><td>MSE loss</td><td>N/A</td><td>5.55</td></tr><tr><td>Reference</td><td>0.164</td><td>5.58</td></tr></table>
152
+
153
+ Conv-Tasnet cannot be trained with such a large sample size, however a single iteration over 2 seconds of audio with a batch size of 4 takes 0.7 seconds.
154
+
155
+ # 6.2 ABLATION STUDY FOR DEMUCS
156
+
157
+ We provide an ablation study of the main design decisions for Demucs in Table 4. Given the cost of training a single model, we did not compute confidence intervals for each variation. Yet, any difference inferior to .06, which is the standard deviation observed over 5 repetitions of the Reference model, could be attributed to noise.
158
+
159
+ We observe a small but not significant improvement when using the L1 loss instead of the MSE loss. Adding a BiLSTM and using the initial weight rescaling described in Section 4.3 provides significant gain, with an extra 0.48 SDR for the first and 0.64 for the second. We observe that using randomized equivariant stabilization as described in Section 4 gives a gain of almost 0.3 SDR. We did not report the validation loss as we only use the stabilization when computing the SDR over the test set. We applied the randomized stabilization to Open-Unmix and Conv-Tasnet with no gain, since, as explained in Section 4.4, both are naturally equivariant with respect to initial time shifts.
160
+
161
+ We introduced extra convolutions in the encoder and decoder, as described in Sections 4.1. The two proved useful, improving the expressivity of the model, especially when combined with GLU activation. Using a kernel size of 3 instead of 1 in the decoder further improves performance. We conjecture that the context from adjacent time steps helps the output of the transposed convolutions to be consistent through time and reduces potential artifacts arising from using a stride of 4.
162
+
163
+ # CONCLUSION
164
+
165
+ We showed that Conv-Tasnet, a state-of-the-art architecture for speech source separation that predicts masks on a learnt front-end over the waveform domain, achieves state-of-the-art performance for music source separation, improving over all previous spectrogram or waveform domain methods by 0.4 SDR. While Conv-Tasnet has excellent performance to separate sources, it suffers from noticeable artifacts as confirmed by human evaluations. We developed an alternative approach, Demucs, that combines the ability to mask over a learnt representation with stronger decoder capacity that allows for audio synthesis. We conjecture that this can be useful when information is lost in the mix of instruments and cannot simply be recovered by masking. We show that our approach produces audio of significantly higher quality as measures by mean opinion scores and matches the SDR of Conv-Tasnet when trained with 150 extra tracks. We believe those results make it a promising alternative to methods based on masking only.
166
+
167
+ # REFERENCES
168
+
169
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. Technical Report 1607.06450, arXiv, 2016.
170
+
171
+ Francis Bach and Michael I. Jordan. Blind one-microphone speech separation: A spectral learning approach. In Advances in neural information processing systems, 2005.
172
+
173
+ A. S. Bregman. Auditory Scene Analysis. MIT Press, Cambridge, MA, 1990.
174
+
175
+ E. Colin Cherry. Some experiments on the recognition of speech, with one and with two ears. The Journal of the Acoustic Society of America, 1953.
176
+
177
+ François Chollet. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2017.
178
+
179
+ Yann N. Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In Proceedings of the International Conference on Machine Learning, 2017.
180
+
181
+ Alexandre Défossez, Neil Zeghidour, Usunier Nicolas, Leon Bottou, and Francis Bach. Sing: Symbol-to-instrument neural generator. In Advances in Neural Information Processing Systems 32, 2018.
182
+
183
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, 2010.
184
+
185
+ Emad M. Grais, Mehmet Umut Sen, and Hakan Erdogan. Deep neural networks for single channel source separation. In International Conference on Acoustic, Speech and Signal Processing (ICASSP), 2014.
186
+
187
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, 2015a.
188
+
189
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, 2015b.
190
+
191
+ Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. Technical Report 1704.04861, arXiv, 2017.
192
+
193
+ Aapo Hyvärinen, Juha Karhunen, and Erkki Oja. Independent component analysis. John Wiley & Sons, 2004.
194
+
195
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. Technical Report 1502.03167, arXiv, 2015.
196
+
197
+ Yusuf Isik, Jonathan Le Roux, Zhuo Chen, Shinji Watanabe, and John R Hershey. Single-channel multi-speaker separation using deep clustering. Technical Report 1607.02173, arXiv, 2016.
198
+
199
+ Andreas Jansson, Eric Humphrey, Nicola Montecchio, Rachel Bittner, Aparna Kumar, and Tillman Weyde. Singing voice separation with deep u-net convolutional networks. In ISMIR 2018, 2017.
200
+
201
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. Technical Report 1710.10196, arXiv, 2017.
202
+
203
+ Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. Technical Report 1812.04948, arXiv, 2018.
204
+
205
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
206
+
207
+ Morten Kolbæk, Dong Yu, Zheng-Hua Tan, Jesper Jensen, Morten Kolbaek, Dong Yu, Zheng-Hua Tan, and Jesper Jensen. Multitalker speech separation with utterance-level permutation invariant training of deep recurrent neural networks. IEEE/ACM Transactions on Audio, Speech and Language Processing (TASLP), 2017.
208
+
209
+ Jen-Yu Liu and Yi-Hsuan Yang. Denoising auto-encoder with recurrent skip connections and residual regression for music source separation. In 2018 17th IEEE International Conference on Machine Learning and Applications (ICMLA), 2018.
210
+
211
+ Francesc Lluís, Jordi Pons, and Xavier Serra. End-to-end music source separation: is it possible in the waveform domain? Technical Report 1810.12187, arXiv, 2018.
212
+
213
+ Yi Luo and Nima Mesgarani. Tasnet: time-domain audio separation network for real-time, singlechannel speech separation. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2018.
214
+
215
+ Yi Luo and Nima Mesgarani. Conv-tasnet: Surpassing ideal time–frequency magnitude masking for speech separation. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 2019.
216
+
217
+ Eliya Nachmani and Lior Wolf. Unsupervised singing voice conversion. Technical Report 1904.06590, arXiv, 2019.
218
+
219
+ Aditya Arie Nugraha, Antoine Liutkus, and Emmanuel Vincent. Multichannel music separation with deep neural networks. In Signal Processing Conference (EUSIPCO), 2016 24th European. IEEE, 2016.
220
+
221
+ Zafar Rafii, Antoine Liutkus, Fabian-Robert Stöter, Stylianos Ioannis Mimilakis, and Rachel Bittner. The musdb18 corpus for music separation, 2017.
222
+
223
+ Dario Rethage, Jordi Pons, and Xavier Serra. A wavenet for speech denoising. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2018.
224
+
225
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, 2015.
226
+
227
+ Sam T. Roweis. One microphone source separation. In Advances in Neural Information Processing Systems, 2001.
228
+
229
+ P. Smaragdis, C. Fevotte, G. J. Mysore, N. Mohammadiha, and M. Hoffman. Static and dynamic source separation using nonnegative factorizations: A unified view. IEEE Signal Processing Magazine, 31(3), 2014.
230
+
231
+ Daniel Stoller, Sebastian Ewert, and Simon Dixon. Wave-u-net: A multi-scale neural network for end-to-end audio source separation. Technical Report 1806.03185, arXiv, 2018.
232
+
233
+ F.-R. Stöter, S. Uhlich, A. Liutkus, and Y. Mitsufuji. Open-unmix - a reference implementation for music source separation. Journal of Open Source Software, 2019.
234
+
235
+ Fabian-Robert Stöter, Antoine Liutkus, and Nobutaka Ito. The 2018 signal separation evaluation campaign. In 14th International Conference on Latent Variable Analysis and Signal Separation, 2018.
236
+
237
+ Naoya Takahashi and Yuki Mitsufuji. Multi-scale multi-band densenets for audio source separation. In Workshop on Applications of Signal Processing to Audio and Acoustics (WASPAA). IEEE, 2017.
238
+
239
+ Naoya Takahashi, Nabarun Goswami, and Yuki Mitsufuji. Mmdenselstm: An efficient combination of convolutional and recurrent neural networks for audio source separation. Technical Report 1805.02410, arXiv, 2018.
240
+
241
+ Stefan Uhlich, Franck Giron, and Yuki Mitsufuji. Deep neural network based instrument extraction from music. In International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2015.
242
+
243
+ Stefan Uhlich, Marcello Porcu, Franck Giron, Michael Enenkl, Thomas Kemp, Naoya Takahashi, and Yuki Mitsufuji. Improving music source separation based on deep neural networks through data augmentation and network blending. In 2017 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2017.
244
+
245
+ Emmanuel Vincent, Rémi Gribonval, and Cédric Févotte. Performance measurement in blind audio source separation. IEEE Transactions on Audio, Speech and Language Processing, 2006.
246
+
247
+ DeLiang Wang and Guy J. Brown (eds.). Computational Auditory Scene Analysis. IEEE Press, Piscataway, NJ, 2006.
248
+
249
+ Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, et al. Tacotron: Towards end-to-end speech synthesis. Technical Report 1703.10135, arXiv, 2017.
250
+
251
+ Zhong-Qiu Wang, Jonathan Le Roux, DeLiang Wang, and John R Hershey. End-to-end speech separation with unfolded iterative phase reconstruction. Technical Report 1804.10204, arXiv, 2018.
252
+
253
+ Hongyi Zhang, Yann N Dauphin, and Tengyu Ma. Fixup initialization: Residual learning without normalization. arXiv preprint arXiv:1901.09321, 2019.
254
+
255
+ # APPENDIX
256
+
257
+ # A AUDIO SAMPLES
258
+
259
+ We provide audio samples taken from the test set of MusDB. They are available through the ICLR code sharing $\mathrm { \ u r l } ^ { 3 }$ along with all the source code to reproduce our experiments. The audio files for the Wave-U-Net and MMDenseLSTM have been obtained from the SiSec Mus 2018 evaluation campaign results website4. For Open Unmix, we generated them from the pretrained UMX model using the reference PyTorch implementation5. We recommend listening to the audio samples with headphones, while being careful with the volume. An HTML page index.html is provided for easier comparison. The following folders are provided:
260
+
261
+ • Reference: ground truth,
262
+ • Open Unmix,
263
+ • WaveUNet,
264
+ • Demucs: trained only on MusDB,
265
+ • DemucsExtra: trained on MusDB and an extra 150 songs,
266
+ • ConvTasnet: trained only on MusDB,
267
+ • ConvTasnetExtra: trained on MusDB and an extra 150 songs, • MMDenseNetLSTM, trained on MusDB and an extra 804 songs.
268
+
269
+ # B RESULTS FOR ALL METRICS WITH BOX PLOTS
270
+
271
+ Reusing the notations from Vincent et al. (2006), let us take a source $j \in { 1 , 2 , 3 , 4 }$ and introduce $P _ { s _ { j } }$ (resp $P _ { \mathbf { s } }$ ) the orthogonal projection on $s _ { j }$ (resp on $\mathrm { S p a n } ( s _ { 1 } , \ldots , s _ { 4 } ) )$ ). We then take with $\hat { s } _ { j }$ the estimate of source $s _ { j }$
272
+
273
+ $$
274
+ s _ { \mathrm { t a r g e t } } : = P _ { s _ { j } } \big ( \hat { s } _ { j } \big ) \qquad e _ { \mathrm { i n t e r f } } : = P _ { { \tt s } } \big ( \hat { s } _ { j } \big ) - P _ { s _ { j } } \big ( \hat { s } _ { j } \big ) \qquad e _ { \mathrm { a r t i f } } : = \hat { s } _ { j } - P _ { { \tt s } } \big ( \hat { s } _ { j } \big )
275
+ $$
276
+
277
+ We can now define various signal to noise ratio, expressed in decibels (dB): the source to distortion ratio
278
+
279
+ $$
280
+ \mathrm { S D R } : = 1 0 \log _ { 1 0 } \frac { \left. s _ { \mathrm { t a r g e t } } \right. ^ { 2 } } { \left. e _ { \mathrm { i n t e r f } } + e _ { \mathrm { a r t i f } } \right. ^ { 2 } } ,
281
+ $$
282
+
283
+ the source to interference ratio
284
+
285
+ $$
286
+ \mathrm { S I R } : = 1 0 \log _ { 1 0 } \frac { \left\| s _ { \mathrm { t a r g e t } } \right\| ^ { 2 } } { \left\| e _ { \mathrm { i n t e r f } } \right\| ^ { 2 } }
287
+ $$
288
+
289
+ and the sources to artifacts ratio
290
+
291
+ $$
292
+ \mathrm { S A R } : = 1 0 \log _ { 1 0 } \frac { \left\| s _ { \mathrm { t a r g e t } } + e _ { \mathrm { i n t e r f } } \right\| ^ { 2 } } { \left\| e _ { \mathrm { a r t i f } } \right\| ^ { 2 } } .
293
+ $$
294
+
295
+ As explained in the main paper, extra invariants are added when using the museval package. We refer the reader to Vincent et al. (2006) for more details. We provide box plots for each metric and each target on Figure 3, generated using the notebook provided specifically by the organizers of the SiSec Mus evaluation campaign6. Hereafter, we provide the equivalent of Table 1 in the main paper for both SIR and SAR.
296
+
297
+ <table><tr><td rowspan="2">Architecture</td><td rowspan="2">Wav?</td><td rowspan="2">Extra?</td><td colspan="6">Test SIR in dB</td></tr><tr><td>All</td><td>Drums</td><td>Bass</td><td>Other</td><td></td><td>Vocals</td></tr><tr><td>IRM oracle</td><td>×</td><td>N/A</td><td>15.53</td><td>15.61</td><td>12.88</td><td>12.84</td><td></td><td>20.78</td></tr><tr><td>Open-Unmix</td><td>X</td><td>X</td><td>10.49</td><td>11.12</td><td>10.93</td><td>6.59</td><td></td><td>13.33</td></tr><tr><td>Wave-U-Net</td><td>√</td><td>X</td><td>6.26</td><td>8.83</td><td>5.78</td><td></td><td>2.37</td><td>8.06</td></tr><tr><td>Demucs</td><td>√</td><td>X</td><td>10.39 ±.07</td><td>11.81 ±.27</td><td>10.55 ±.20</td><td></td><td>5.90 ±.04</td><td>13.31 ±.21</td></tr><tr><td>Conv-Tasnet</td><td>√</td><td>X</td><td>11.47 ±.09</td><td>12.31 ±.09</td><td>11.52 ±.15</td><td></td><td>7.76 ±.07</td><td>14.30 ±.32</td></tr><tr><td>Demucs</td><td></td><td>150</td><td>11.95 ±.09</td><td>13.74 ±.25</td><td>13.03 ±.22</td><td></td><td>7.11 ±.10</td><td>13.94 ±.10</td></tr><tr><td>Conv-Tasnet</td><td>:</td><td>150</td><td>12.24 ±.09</td><td>13.66 ±.14</td><td>13.18 ±.13</td><td></td><td>8.40 ±.08</td><td>13.70 ±.22</td></tr><tr><td>MMDenseLSTM</td><td>×</td><td>804</td><td>12.24</td><td>11.94</td><td>11.59</td><td>8.94</td><td></td><td>16.48</td></tr><tr><td></td><td></td><td colspan="7">Test SAR in dB</td></tr><tr><td>Architecture</td><td>Wav?</td><td>Extra?</td><td>All</td><td>Drums</td><td>Bass</td><td>Other</td><td>Vocals</td><td></td></tr><tr><td>IRM oracle</td><td>×</td><td>N/A</td><td>8.31</td><td>8.40</td><td>7.40</td><td>7.93</td><td>9.51</td><td></td></tr><tr><td>Open-Unmix</td><td></td><td></td><td></td><td></td><td>6.34</td><td>4.74</td><td></td><td></td></tr><tr><td>Wave-U-Net</td><td>X</td><td>X</td><td>5.90 4.49</td><td>6.02 5.29</td><td>4.64</td><td>3.99</td><td>6.52 4.05</td><td></td></tr><tr><td>Demucs</td><td>√</td><td>X</td><td>6.08 ±.01</td><td>6.18 ±.03</td><td>6.41 ±.05</td><td>5.18 ±.06</td><td></td><td>6.54 ±.04</td></tr><tr><td>Conv-Tasnet</td><td>√</td><td>X X</td><td>6.13 ±.04</td><td>6.19 ±.05</td><td>6.60 ±.07</td><td>4.88 ±.02</td><td></td><td>6.87 ±.05</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Demucs</td><td>√</td><td>150</td><td>6.50 ±.02</td><td>7.04 ±.07</td><td>6.68±.04</td><td>5.26 ±.03</td><td></td><td>7.00 ±.05</td></tr><tr><td>Conv-Tasnet</td><td>√</td><td>150</td><td>6.57 ±.02</td><td>7.35 ±.05</td><td>6.96 ±.08</td><td></td><td>4.76 ±.05</td><td>7.20 ±.05</td></tr><tr><td>MMDenseLSTM</td><td>X</td><td>804</td><td>6.50</td><td>6.96</td><td>6.00</td><td>5.55</td><td></td><td>7.48</td></tr></table>
298
+
299
+ ![](images/11355d5566cd6d8a0916a4bfa24cd707a136a1e90497963e4c25c544923500f0.jpg)
300
+ Figure 3: Boxplot showing the distribution of SDR, SIR and SAR over the tracks of the MusDB test. 16
md/train/Hk99zCeAb/Hk99zCeAb.md ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PROGRESSIVE GROWING OF GANS FOR IMPROVEDQUALITY, STABILITY, AND VARIATION
2
+
3
+ Tero Karras Timo Aila Samuli Laine Jaakko Lehtinen NVIDIA NVIDIA NVIDIA NVIDIA and Aalto University {tkarras,taila,slaine,jlehtinen}@nvidia.com
4
+
5
+ # ABSTRACT
6
+
7
+ We describe a new training methodology for generative adversarial networks. The key idea is to grow both the generator and discriminator progressively: starting from a low resolution, we add new layers that model increasingly fine details as training progresses. This both speeds the training up and greatly stabilizes it, allowing us to produce images of unprecedented quality, e.g., CELEBA images at $1 0 2 4 ^ { 2 }$ . We also propose a simple way to increase the variation in generated images, and achieve a record inception score of 8.80 in unsupervised CIFAR10. Additionally, we describe several implementation details that are important for discouraging unhealthy competition between the generator and discriminator. Finally, we suggest a new metric for evaluating GAN results, both in terms of image quality and variation. As an additional contribution, we construct a higher-quality version of the CELEBA dataset.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Generative methods that produce novel samples from high-dimensional data distributions, such as images, are finding widespread use, for example in speech synthesis (van den Oord et al., 2016a), image-to-image translation (Zhu et al., 2017; Liu et al., 2017; Wang et al., 2017), and image inpainting (Iizuka et al., 2017). Currently the most prominent approaches are autoregressive models (van den Oord et al., 2016b;c), variational autoencoders (VAE) (Kingma & Welling, 2014), and generative adversarial networks (GAN) (Goodfellow et al., 2014). Currently they all have significant strengths and weaknesses. Autoregressive models – such as PixelCNN – produce sharp images but are slow to evaluate and do not have a latent representation as they directly model the conditional distribution over pixels, potentially limiting their applicability. VAEs are easy to train but tend to produce blurry results due to restrictions in the model, although recent work is improving this (Kingma et al., 2016). GANs produce sharp images, albeit only in fairly small resolutions and with somewhat limited variation, and the training continues to be unstable despite recent progress (Salimans et al., 2016; Gulrajani et al., 2017; Berthelot et al., 2017; Kodali et al., 2017). Hybrid methods combine various strengths of the three, but so far lag behind GANs in image quality (Makhzani & Frey, 2017; Ulyanov et al., 2017; Dumoulin et al., 2016).
12
+
13
+ Typically, a GAN consists of two networks: generator and discriminator (aka critic). The generator produces a sample, e.g., an image, from a latent code, and the distribution of these images should ideally be indistinguishable from the training distribution. Since it is generally infeasible to engineer a function that tells whether that is the case, a discriminator network is trained to do the assessment, and since networks are differentiable, we also get a gradient we can use to steer both networks to the right direction. Typically, the generator is of main interest – the discriminator is an adaptive loss function that gets discarded once the generator has been trained.
14
+
15
+ There are multiple potential problems with this formulation. When we measure the distance between the training distribution and the generated distribution, the gradients can point to more or less random directions if the distributions do not have substantial overlap, i.e., are too easy to tell apart (Arjovsky & Bottou, 2017). Originally, Jensen-Shannon divergence was used as a distance metric (Goodfellow et al., 2014), and recently that formulation has been improved (Hjelm et al., 2017) and a number of more stable alternatives have been proposed, including least squares (Mao et al., 2016b), absolute deviation with margin (Zhao et al., 2017), and Wasserstein distance (Arjovsky et al., 2017; Gulrajani et al., 2017). Our contributions are largely orthogonal to this ongoing discussion, and we primarily use the improved Wasserstein loss, but also experiment with least-squares loss.
16
+
17
+ The generation of high-resolution images is difficult because higher resolution makes it easier to tell the generated images apart from training images (Odena et al., 2017), thus drastically amplifying the gradient problem. Large resolutions also necessitate using smaller minibatches due to memory constraints, further compromising training stability. Our key insight is that we can grow both the generator and discriminator progressively, starting from easier low-resolution images, and add new layers that introduce higher-resolution details as the training progresses. This greatly speeds up training and improves stability in high resolutions, as we will discuss in Section 2.
18
+
19
+ The GAN formulation does not explicitly require the entire training data distribution to be represented by the resulting generative model. The conventional wisdom has been that there is a tradeoff between image quality and variation, but that view has been recently challenged (Odena et al., 2017). The degree of preserved variation is currently receiving attention and various methods have been suggested for measuring it, including inception score (Salimans et al., 2016), multi-scale structural similarity (MS-SSIM) (Odena et al., 2017; Wang et al., 2003), birthday paradox (Arora & Zhang, 2017), and explicit tests for the number of discrete modes discovered (Metz et al., 2016). We will describe our method for encouraging variation in Section 3, and propose a new metric for evaluating the quality and variation in Section 5.
20
+
21
+ Section 4.1 discusses a subtle modification to the initialization of networks, leading to a more balanced learning speed for different layers. Furthermore, we observe that mode collapses traditionally plaguing GANs tend to happen very quickly, over the course of a dozen minibatches. Commonly they start when the discriminator overshoots, leading to exaggerated gradients, and an unhealthy competition follows where the signal magnitudes escalate in both networks. We propose a mechanism to stop the generator from participating in such escalation, overcoming the issue (Section 4.2).
22
+
23
+ We evaluate our contributions using the CELEBA, LSUN, CIFAR10 datasets. We improve the best published inception score for CIFAR10. Since the datasets commonly used in benchmarking generative methods are limited to a fairly low resolution, we have also created a higher quality version of the CELEBA dataset that allows experimentation with output resolutions up to $1 0 2 4 \times 1 0 2 4$ pixels. This dataset and our full implementation are available at https://github.com/tkarras/progressive_growing_of_gans, trained networks can be found at https://drive.google.com/open?id $\equiv$ 0B4qLcYyJmiz0NHFULTdYc05lX0U along with result images, and a supplementary video illustrating the datasets, additional results, and latent space interpolations is at https://youtu.be/G06dEcZ-QTg.
24
+
25
+ # 2 PROGRESSIVE GROWING OF GANS
26
+
27
+ Our primary contribution is a training methodology for GANs where we start with low-resolution images, and then progressively increase the resolution by adding layers to the networks as visualized in Figure 1. This incremental nature allows the training to first discover large-scale structure of the image distribution and then shift attention to increasingly finer scale detail, instead of having to learn all scales simultaneously.
28
+
29
+ We use generator and discriminator networks that are mirror images of each other and always grow in synchrony. All existing layers in both networks remain trainable throughout the training process. When new layers are added to the networks, we fade them in smoothly, as illustrated in Figure 2. This avoids sudden shocks to the already well-trained, smaller-resolution layers. Appendix A describes structure of the generator and discriminator in detail, along with other training parameters.
30
+
31
+ We observe that the progressive training has several benefits. Early on, the generation of smaller images is substantially more stable because there is less class information and fewer modes (Odena et al., 2017). By increasing the resolution little by little we are continuously asking a much simpler question compared to the end goal of discovering a mapping from latent vectors to e.g. $1 0 \dot { 2 } 4 ^ { 2 }$ images. This approach has conceptual similarity to recent work by Chen & Koltun (2017). In practice it stabilizes the training sufficiently for us to reliably synthesize megapixel-scale images using WGAN-GP loss (Gulrajani et al., 2017) and even LSGAN loss (Mao et al., 2016b).
32
+
33
+ ![](images/835f03a64eb30d1dfccd4ac8cf4eb0a5e5c982b7917c03388fb7e6e6c1bb8855.jpg)
34
+ Figure 1: Our training starts with both the generator (G) and discriminator (D) having a low spatial resolution of $4 \times 4$ pixels. As the training advances, we incrementally add layers to G and D, thus increasing the spatial resolution of the generated images. All existing layers remain trainable throughout the process. Here $\boxed { N \times N }$ refers to convolutional layers operating on $N \times N$ spatial resolution. This allows stable synthesis in high resolutions and also speeds up training considerably. One the right we show six example images generated using progressive growing at $1 0 2 4 \times 1 0 2 4$ .
35
+
36
+ Another benefit is the reduced training time. With progressively growing GANs most of the iterations are done at lower resolutions, and comparable result quality is often obtained up to 2–6 times faster, depending on the final output resolution.
37
+
38
+ The idea of growing GANs progressively is related to the work of Wang et al. (2017), who use multiple discriminators that operate on different spatial resolutions. That work in turn is motivated by Durugkar et al. (2016) who use one generator and multiple discriminators concurrently, and Ghosh et al. (2017) who do the opposite with multiple generators and one discriminator. Hierarchical GANs (Denton et al., 2015; Huang et al., 2016; Zhang et al., 2017) define a generator and discriminator for each level of an image pyramid. These methods build on the same observation as our work – that the complex mapping from latents to high-resolution images is easier to learn in steps – but the crucial difference is that we have only a single GAN instead of a hierarchy of them. In contrast to early work on adaptively growing networks, e.g., growing neural gas (Fritzke, 1995) and neuro evolution of augmenting topologies (Stanley & Miikkulainen, 2002) that grow networks greedily, we simply defer the introduction of pre-configured layers. In that sense our approach resembles layer-wise training of autoencoders (Bengio et al., 2007).
39
+
40
+ # 3 INCREASING VARIATION USING MINIBATCH STANDARD DEVIATION
41
+
42
+ GANs have a tendency to capture only a subset of the variation found in training data, and Salimans et al. (2016) suggest “minibatch discrimination” as a solution. They compute feature statistics not only from individual images but also across the minibatch, thus encouraging the minibatches of generated and training images to show similar statistics. This is implemented by adding a minibatch layer towards the end of the discriminator, where the layer learns a large tensor that projects the input activation to an array of statistics. A separate set of statistics is produced for each example in a minibatch and it is concatenated to the layer’s output, so that the discriminator can use the statistics internally. We simplify this approach drastically while also improving the variation.
43
+
44
+ Our simplified solution has neither learnable parameters nor new hyperparameters. We first compute the standard deviation for each feature in each spatial location over the minibatch. We then average these estimates over all features and spatial locations to arrive at a single value. We replicate the value and concatenate it to all spatial locations and over the minibatch, yielding one additional (constant) feature map. This layer could be inserted anywhere in the discriminator, but we have found it best to insert it towards the end (see Appendix A.1 for details). We experimented with a richer set of statistics, but were not able to improve the variation further. In parallel work, Lin et al. (2017) provide theoretical insights about the benefits of showing multiple images to the discriminator.
45
+
46
+ ![](images/6f893c16afe22719b2ae5dc4de1070cb01874ea472b7b6b7fae1661611100f43.jpg)
47
+ Figure 2: When doubling the resolution of the generator (G) and discriminator (D) we fade in the new layers smoothly. This example illustrates the transition from $1 6 \times 1 6$ images (a) to $3 2 \times 3 2$ images (c). During the transition (b) we treat the layers that operate on the higher resolution like a residual block, whose weight $\alpha$ increases linearly from 0 to 1. Here $\boxed { 2 \times }$ and $\left\lceil 0 . 5 \times \right\rceil$ refer to doubling and halving the image resolution using nearest neighbor filtering and average pooling, respectively. The toRGB represents a layer that projects feature vectors to RGB colors and $\boxed { \mathrm { f r o m R G B } }$ does the reverse; both use $1 \times 1$ convolutions. When training the discriminator, we feed in real images that are downscaled to match the current resolution of the network. During a resolution transition, we interpolate between two resolutions of the real images, similarly to how the generator output combines two resolutions.
48
+
49
+ Alternative solutions to the variation problem include unrolling the discriminator (Metz et al., 2016) to regularize its updates, and a “repelling regularizer” (Zhao et al., 2017) that adds a new loss term to the generator, trying to encourage it to orthogonalize the feature vectors in a minibatch. The multiple generators of Ghosh et al. (2017) also serve a similar goal. We acknowledge that these solutions may increase the variation even more than our solution – or possibly be orthogonal to it – but leave a detailed comparison to a later time.
50
+
51
+ # 4 NORMALIZATION IN GENERATOR AND DISCRIMINATOR
52
+
53
+ GANs are prone to the escalation of signal magnitudes as a result of unhealthy competition between the two networks. Most if not all earlier solutions discourage this by using a variant of batch normalization (Ioffe & Szegedy, 2015; Salimans & Kingma, 2016; Ba et al., 2016) in the generator, and often also in the discriminator. These normalization methods were originally introduced to eliminate covariate shift. However, we have not observed that to be an issue in GANs, and thus believe that the actual need in GANs is constraining signal magnitudes and competition. We use a different approach that consists of two ingredients, neither of which include learnable parameters.
54
+
55
+ # 4.1 EQUALIZED LEARNING RATE
56
+
57
+ We deviate from the current trend of careful weight initialization, and instead use a trivial $\mathcal { N } ( 0 , 1 )$ initialization and then explicitly scale the weights at runtime. To be precise, we set $\hat { w } _ { i } = w _ { i } / c$ , where $w _ { i }$ are the weights and $c$ is the per-layer normalization constant from He’s initializer (He et al., 2015). The benefit of doing this dynamically instead of during initialization is somewhat subtle, and relates to the scale-invariance in commonly used adaptive stochastic gradient descent methods such as RMSProp (Tieleman & Hinton, 2012) and Adam (Kingma & Ba, 2015). These methods normalize a gradient update by its estimated standard deviation, thus making the update independent of the scale of the parameter. As a result, if some parameters have a larger dynamic range than others, they will take longer to adjust. This is a scenario modern initializers cause, and thus it is possible that a learning rate is both too large and too small at the same time. Our approach ensures that the dynamic range, and thus the learning speed, is the same for all weights. A similar reasoning was independently used by van Laarhoven (2017).
58
+
59
+ # .2 PIXELWISE FEATURE VECTOR NORMALIZATION IN GENERATOR
60
+
61
+ To disallow the scenario where the magnitudes in the generator and discriminator spiral out of control as a result of competition, we normalize the feature vector in each pixel to unit length in the generator after each convolutional layer. We do this using a variant of “local response normalization” (Krizhevsky et al., 2012), configured as $\begin{array} { r } { b _ { x , y } = a _ { x , y } / \sqrt { \frac { 1 } { N } \sum _ { j = 0 } ^ { N - 1 } ( a _ { x , y } ^ { j } ) ^ { 2 } + \epsilon } } \end{array}$ q 1N PN−1j=0 (ajx,y)2 + , where  = 10−8, $N$ is the number of feature maps, and $\boldsymbol { a } _ { x , y }$ and $b _ { x , y }$ are the original and normalized feature vector in pixel $( x , y )$ , respectively. We find it surprising that this heavy-handed constraint does not seem to harm the generator in any way, and indeed with most datasets it does not change the results much, but it prevents the escalation of signal magnitudes very effectively when needed.
62
+
63
+ # 5 MULTI-SCALE STATISTICAL SIMILARITY FOR ASSESSING GAN RESULTS
64
+
65
+ In order to compare the results of one GAN to another, one needs to investigate a large number of images, which can be tedious, difficult, and subjective. Thus it is desirable to rely on automated methods that compute some indicative metric from large image collections. We noticed that existing methods such as MS-SSIM (Odena et al., 2017) find large-scale mode collapses reliably but fail to react to smaller effects such as loss of variation in colors or textures, and they also do not directly assess image quality in terms of similarity to the training set.
66
+
67
+ We build on the intuition that a successful generator will produce samples whose local image structure is similar to the training set over all scales. We propose to study this by considering the multiscale statistical similarity between distributions of local image patches drawn from Laplacian pyramid (Burt & Adelson, 1987) representations of generated and target images, starting at a low-pass resolution of $1 6 \times 1 6$ pixels. As per standard practice, the pyramid progressively doubles until the full resolution is reached, each successive level encoding the difference to an up-sampled version of the previous level.
68
+
69
+ A single Laplacian pyramid level corresponds to a specific spatial frequency band. We randomly sample 16384 images and extract 128 descriptors from each level in the Laplacian pyramid, giving us $2 ^ { \hat { 2 } 1 }$ (2.1M) descriptors per level. Each descriptor is a $7 \times 7$ pixel neighborhood with 3 color channels, denoted by $\pmb { x } \in \dot { \mathbb { R } } ^ { 7 \times 7 \times 3 } = \mathbb { R } ^ { 1 4 7 }$ . We denote the patches from level $l$ of the training set and generated set as $\{ \pmb { x } _ { i } ^ { l } \} _ { i = 1 } ^ { 2 ^ { 2 1 } }$ and $\{ \pmb { y } _ { i } ^ { l } \} _ { i = 1 } ^ { 2 ^ { 2 1 } }$ , respectively. We first normalize $\{ x _ { i } ^ { l } \}$ and $\{ \pmb { y } _ { i } ^ { l } \}$ w.r.t. the mean and standard deviation of each color channel, and then estimate the statistical similarity by computing their sliced Wasserstein distance $\mathrm { S W D } ( \{ \pmb { x } _ { i } ^ { l } \} , \{ \pmb { y } _ { i } ^ { l } \} )$ , an efficiently computable randomized approximation to earthmovers distance, using 512 projections (Rabin et al., 2011).
70
+
71
+ Intuitively a small Wasserstein distance indicates that the distribution of the patches is similar, meaning that the training images and generator samples appear similar in both appearance and variation at this spatial resolution. In particular, the distance between the patch sets extracted from the lowestresolution $1 6 \times 1 6$ images indicate similarity in large-scale image structures, while the finest-level patches encode information about pixel-level attributes such as sharpness of edges and noise.
72
+
73
+ # 6 EXPERIMENTS
74
+
75
+ In this section we discuss a set of experiments that we conducted to evaluate the quality of our results. Please refer to Appendix A for detailed description of our network structures and training configurations. We also invite the reader to consult the accompanying video (https://youtu.be/G06dEcZ-QTg) for additional result images and latent space interpolations. In this section we will distinguish between the network structure (e.g., convolutional layers, resizing), training configuration (various normalization layers, minibatch-related operations), and training loss (WGAN-GP, LSGAN).
76
+
77
+ # 6.1 IMPORTANCE OF INDIVIDUAL CONTRIBUTIONS IN TERMS OF STATISTICAL SIMILARITY
78
+
79
+ We will first use the sliced Wasserstein distance (SWD) and multi-scale structural similarity (MSSSIM) (Odena et al., 2017) to evaluate the importance our individual contributions, and also perceptually validate the metrics themselves. We will do this by building on top of a previous state-of-theart loss function (WGAN-GP) and training configuration (Gulrajani et al., 2017) in an unsupervised setting using CELEBA (Liu et al., 2015) and LSUN BEDROOM (Yu et al., 2015) datasets in $1 2 8 ^ { 2 }$
80
+
81
+ <table><tr><td rowspan="3" colspan="2">Training configuration</td><td colspan="6">CELEBA</td><td colspan="6">LSUN BEDROOM</td></tr><tr><td colspan="5">Sliced Wasserstein distance ×103</td><td rowspan="2">MS-SSIM</td><td colspan="5">Sliced Wasserstein distance ×103</td><td rowspan="2">MS-SSIM</td></tr><tr><td>128</td><td>64</td><td>32</td><td>16</td><td>Avg</td><td>128</td><td>64</td><td>32</td><td>16</td><td>Avg</td></tr><tr><td>(a)Gulrajani et al. (2017)</td><td></td><td>12.99</td><td>7.79</td><td>7.62</td><td>8.73</td><td>9.28</td><td>0.2854</td><td>11.97</td><td>10.51</td><td>8.03</td><td>14.48</td><td>11.25</td><td>0.0587</td></tr><tr><td></td><td>(b)+Progressive growing</td><td>4.62</td><td>2.64</td><td>3.78</td><td>6.06</td><td>4.28</td><td>0.2838</td><td>7.09</td><td>6.27</td><td>7.40</td><td>9.64</td><td>7.60</td><td>0.0615</td></tr><tr><td></td><td>(c)+ Small minibatch</td><td>75.42</td><td>41.33</td><td>41.62</td><td>26.57</td><td>46.23</td><td>0.4065</td><td>72.73</td><td>40.16</td><td>42.75</td><td>42.46</td><td>49.52</td><td>0.1061</td></tr><tr><td></td><td>(d)+ Revised training parameters</td><td>9.20</td><td>6.53</td><td>4.71</td><td>11.84</td><td>8.07</td><td>0.3027</td><td>7.39</td><td>5.51</td><td>3.65</td><td>9.63</td><td>6.54</td><td>0.0662</td></tr><tr><td></td><td>(e*))+Minibatch discrimination</td><td>10.76</td><td>6.28</td><td>6.04</td><td>16.29</td><td>9.84</td><td>0.3057</td><td>10.29</td><td>6.22</td><td>5.32</td><td>11.88</td><td>8.43</td><td>0.0648</td></tr><tr><td></td><td>(e)Minibatch stddev</td><td>13.94</td><td>5.67</td><td>2.82</td><td>5.71</td><td>7.04</td><td>0.2950</td><td>7.77</td><td>5.23</td><td>3.27</td><td>9.64</td><td>6.48</td><td>0.0671</td></tr><tr><td></td><td>(f)+ Equalized learning rate</td><td>4.42</td><td>3.28</td><td>2.32</td><td>7.52</td><td>4.39</td><td>0.2902</td><td>3.61</td><td>3.32</td><td>2.71</td><td>6.44</td><td>4.02</td><td>0.0668</td></tr><tr><td></td><td>(g)+Pixelwise normalization</td><td>4.06</td><td>3.04</td><td>2.02</td><td>5.13</td><td>3.56</td><td>0.2845</td><td>3.89</td><td>3.05</td><td>3.24</td><td>5.87</td><td>4.01</td><td>0.0640</td></tr><tr><td>(h)Converged</td><td></td><td>2.42</td><td>2.17</td><td>2.24</td><td>4.99</td><td>2.96</td><td>0.2828</td><td>3.47</td><td>2.60</td><td>2.30</td><td>4.87</td><td>3.31</td><td>0.0636</td></tr></table>
82
+
83
+ Table 1: Sliced Wasserstein distance (SWD) between the generated and training images (Section 5) and multi-scale structural similarity (MS-SSIM) among the generated images for several training setups at $1 2 8 \times 1 2 8$ . For SWD, each column represents one level of the Laplacian pyramid, and the last one gives an average of the four distances.
84
+
85
+ ![](images/77d70f0e12d98ed94b4371704395ba02bf8bb1b91da804a2bbb2ecac22ba54e8.jpg)
86
+ Figure 3: (a) – (g) CELEBA examples corresponding to rows in Table 1. These are intentionally non-converged. (h) Our converged result. Notice that some images show aliasing and some are not sharp – this is a flaw of the dataset, which the model learns to replicate faithfully.
87
+
88
+ resolution. CELEBA is particularly well suited for such comparison because the training images contain noticeable artifacts (aliasing, compression, blur) that are difficult for the generator to reproduce faithfully. In this test we amplify the differences between training configurations by choosing a relatively low-capacity network structure (Appendix A.2) and terminating the training once the discriminator has been shown a total of 10M real images. As such the results are not fully converged.
89
+
90
+ Table 1 lists the numerical values for SWD and MS-SSIM in several training configurations, where our individual contributions are cumulatively enabled one by one on top of the baseline (Gulrajani et al., 2017). The MS-SSIM numbers were averaged from 10000 pairs of generated images, and SWD was calculated as described in Section 5. Generated CELEBA images from these configurations are shown in Figure 3. Due to space constraints, the figure shows only a small number of examples for each row of the table, but a significantly broader set is available in Appendix H. Intuitively, a good evaluation metric should reward plausible images that exhibit plenty of variation in colors, textures, and viewpoints. However, this is not captured by MS-SSIM: we can immediately see that configuration (h) generates significantly better images than configuration (a), but MS-SSIM remains approximately unchanged because it measures only the variation between outputs, not similarity to the training set. SWD, on the other hand, does indicate a clear improvement.
91
+
92
+ The first training configuration (a) corresponds to Gulrajani et al. (2017), featuring batch normalization in the generator, layer normalization in the discriminator, and minibatch size of 64. (b) enables progressive growing of the networks, which results in sharper and more believable output images. SWD correctly finds the distribution of generated images to be more similar to the training set.
93
+
94
+ Our primary goal is to enable high output resolutions, and this requires reducing the size of minibatches in order to stay within the available memory budget. We illustrate the ensuing challenges in (c) where we decrease the minibatch size from 64 to 16. The generated images are unnatural, which is clearly visible in both metrics. In (d), we stabilize the training process by adjusting the hyperparameters as well as by removing batch normalization and layer normalization (Appendix A.2). As an intermediate test $^ { ( \mathrm { e * } ) }$ , we enable minibatch discrimination (Salimans et al., 2016), which somewhat surprisingly fails to improve any of the metrics, including MS-SSIM that measures output variation. In contrast, our minibatch standard deviation (e) improves the average SWD scores and images. We then enable our remaining contributions in (f) and (g), leading to an overall improvement in SWD and subjective visual quality. Finally, in (h) we use a non-crippled network and longer training – we feel the quality of the generated images is at least comparable to the best published results so far.
95
+
96
+ ![](images/619ee0bad50d274f81adb6bd65448e9f41e9425289b01e760f99173c20831c08.jpg)
97
+ Figure 4: Effect of progressive growing on training speed and convergence. The timings were measured on a single-GPU setup using NVIDIA Tesla P100. (a) Statistical similarity with respect to wall clock time for Gulrajani et al. (2017) using CELEBA at $1 2 8 \times 1 2 8$ resolution. Each graph represents sliced Wasserstein distance on one level of the Laplacian pyramid, and the vertical line indicates the point where we stop the training in Table 1. (b) Same graph with progressive growing enabled. The dashed vertical lines indicate points where we double the resolution of G and D. (c) Effect of progressive growing on the raw training speed in $1 0 2 4 \times 1 0 2 4$ resolution.
98
+
99
+ # 6.2 CONVERGENCE AND TRAINING SPEED
100
+
101
+ Figure 4 illustrates the effect of progressive growing in terms of the SWD metric and raw image throughput. The first two plots correspond to the training configuration of Gulrajani et al. (2017) without and with progressive growing. We observe that the progressive variant offers two main benefits: it converges to a considerably better optimum and also reduces the total training time by about a factor of two. The improved convergence is explained by an implicit form of curriculum learning that is imposed by the gradually increasing network capacity. Without progressive growing, all layers of the generator and discriminator are tasked with simultaneously finding succinct intermediate representations for both the large-scale variation and the small-scale detail. With progressive growing, however, the existing low-resolution layers are likely to have already converged early on, so the networks are only tasked with refining the representations by increasingly smaller-scale effects as new layers are introduced. Indeed, we see in Figure 4(b) that the largest-scale statistical similarity curve (16) reaches its optimal value very quickly and remains consistent throughout the rest of the training. The smaller-scale curves (32, 64, 128) level off one by one as the resolution is increased, but the convergence of each curve is equally consistent. With non-progressive training in Figure 4(a), each scale of the SWD metric converges roughly in unison, as could be expected.
102
+
103
+ The speedup from progressive growing increases as the output resolution grows. Figure 4(c) shows training progress, measured in number of real images shown to the discriminator, as a function of training time when the training progresses all the way to $1 0 2 4 ^ { 2 }$ resolution. We see that progressive growing gains a significant head start because the networks are shallow and quick to evaluate at the beginning. Once the full resolution is reached, the image throughput is equal between the two methods. The plot shows that the progressive variant reaches approximately 6.4 million images in 96 hours, whereas it can be extrapolated that the non-progressive variant would take about 520 hours to reach the same point. In this case, the progressive growing offers roughly a $5 . 4 \times$ speedup.
104
+
105
+ # 6.3 HIGH-RESOLUTION IMAGE GENERATION USING CELEBA-HQ DATASET
106
+
107
+ To meaningfully demonstrate our results at high output resolutions, we need a sufficiently varied high-quality dataset. However, virtually all publicly available datasets previously used in GAN literature are limited to relatively low resolutions ranging from $3 2 ^ { 2 }$ to $4 8 0 ^ { \hat { 2 } }$ . To this end, we created a high-quality version of the CELEBA dataset consisting of 30000 of the images at $1 0 2 4 \times 1 0 2 4$ resolution. We refer to Appendix C for further details about the generation of this dataset.
108
+
109
+ ![](images/1d191234797235014e46cca141d7ecf5d4b05afd75bd97eefb4961824e988592.jpg)
110
+ Figure 5: $1 0 2 4 \times 1 0 2 4$ images generated using the CELEBA-HQ dataset. See Appendix F for a larger set of results, and the accompanying video for latent space interpolations.
111
+
112
+ ![](images/d08ba27eed16c21e657cec4ac12311c8b0677c34c67f1995354008c0c7ac831e.jpg)
113
+ Figure 6: Visual quality comparison in LSUN BEDROOM; pictures copied from the cited articles.
114
+
115
+ Our contributions allow us to deal with high output resolutions in a robust and efficient fashion. Figure 5 shows selected $1 0 2 4 \times 1 0 2 4$ images produced by our network. While megapixel GAN results have been shown before in another dataset (Marchesi, 2017), our results are vastly more varied and of higher perceptual quality. Please refer to Appendix F for a larger set of result images as well as the nearest neighbors found from the training data. The accompanying video shows latent space interpolations and visualizes the progressive training. The interpolation works so that we first randomize a latent code for each frame (512 components sampled individually from $\mathcal { N } ( 0 , 1 ) )$ ), then blur the latents across time with a Gaussian $\sigma = 4 5$ frames $ @ ~ 6 0 \mathrm { H z }$ ), and finally normalize each vector to lie on a hypersphere.
116
+
117
+ We trained the network on 8 Tesla V100 GPUs for 4 days, after which we no longer observed qualitative differences between the results of consecutive training iterations. Our implementation used an adaptive minibatch size depending on the current output resolution so that the available memory budget was optimally utilized.
118
+
119
+ In order to demonstrate that our contributions are largely orthogonal to the choice of a loss function, we also trained the same network using LSGAN loss instead of WGAN-GP loss. Figure 1 shows six examples of $1 0 2 4 ^ { 2 }$ images produced using our method using LSGAN. Further details of this setup are given in Appendix B.
120
+
121
+ ![](images/84676225ba4ca550ba3a3307e9c6c5d0bf4d19621741f8b31c505b95402cc322.jpg)
122
+ Figure 7: Selection of $2 5 6 \times 2 5 6$ images generated from different LSUN categories.
123
+
124
+ # 6.4 LSUN RESULTS
125
+
126
+ Figure 6 shows a purely visual comparison between our solution and earlier results in LSUN BEDROOM. Figure 7 gives selected examples from seven very different LSUN categories at $2 5 6 ^ { 2 }$ . A larger, non-curated set of results from all 30 LSUN categories is available in Appendix G, and the video demonstrates interpolations. We are not aware of earlier results in most of these categories, and while some categories work better than others, we feel that the overall quality is high.
127
+
128
+ # 6.5 CIFAR10 INCEPTION SCORES
129
+
130
+ The best inception scores for CIFAR10 (10 categories of $3 2 \times 3 2$ RGB images) we are aware of are 7.90 for unsupervised and 8.87 for label conditioned setups (Grinblat et al., 2017). The large difference between the two numbers is primarily caused by “ghosts” that necessarily appear between classes in the unsupervised setting, while label conditioning can remove many such transitions.
131
+
132
+ When all of our contributions are enabled, we get 8.80 in the unsupervised setting. Appendix D shows a representative set of generated images along with a more comprehensive list of results from earlier methods. The network and training setup were the same as for CELEBA, progression limited to $3 2 \times 3 2$ of course. The only customization was to the WGAN-GP’s regularization term $\mathbb { E } _ { \hat { \mathbf { x } } \sim \mathbb { P } _ { \hat { \mathbf { x } } } } [ ( | | \nabla _ { \hat { \mathbf { x } } } D ( \hat { \mathbf { x } } ) | | _ { 2 } - \gamma ) ^ { 2 } / \gamma ^ { 2 } ]$ . Gulrajani et al. (2017) used $\gamma = 1 . 0$ , which corresponds to 1-Lipschitz, but we noticed that it is in fact significantly better to prefer fast transitions $( \gamma = 7 5 0 )$ ) to minimize the ghosts. We have not tried this trick with other datasets.
133
+
134
+ # 7 DISCUSSION
135
+
136
+ While the quality of our results is generally high compared to earlier work on GANs, and the training is stable in large resolutions, there is a long way to true photorealism. Semantic sensibility and understanding dataset-dependent constraints, such as certain objects being straight rather than curved, leaves a lot to be desired. There is also room for improvement in the micro-structure of the images. That said, we feel that convincing realism may now be within reach, especially in CELEBA-HQ.
137
+
138
+ # 8 ACKNOWLEDGEMENTS
139
+
140
+ We would like to thank Mikael Honkavaara, Tero Kuosmanen, and Timi Hietanen for the compute infrastructure. Dmitry Korobchenko and Richard Calderwood for efforts related to the CELEBA-HQ dataset. Oskar Elek, Jacob Munkberg, and Jon Hasselgren for useful comments.
141
+
142
+ # REFERENCES
143
+
144
+ Martin Arjovsky and Leon Bottou. Towards principled methods for training generative adversarial ´ networks. In ICLR, 2017.
145
+
146
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein GAN. ´ CoRR, abs/1701.07875, 2017.
147
+
148
+ Sanjeev Arora and Yi Zhang. Do GANs actually learn the distribution? an empirical study. CoRR, abs/1706.08224, 2017.
149
+
150
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016.
151
+
152
+ Yoshua Bengio, Pascal Lamblin, Dan Popovici, and Hugo Larochelle. Greedy layer-wise training of deep networks. In P. B. Scholkopf, J. C. Platt, and T. Hoffman (eds.), ¨ NIPS, pp. 153–160. 2007.
153
+
154
+ David Berthelot, Tom Schumm, and Luke Metz. BEGAN: Boundary equilibrium generative adversarial networks. CoRR, abs/1703.10717, 2017.
155
+
156
+ Peter J. Burt and Edward H. Adelson. Readings in computer vision: Issues, problems, principles, and paradigms. chapter The Laplacian Pyramid As a Compact Image Code, pp. 671–679. 1987.
157
+
158
+ Qifeng Chen and Vladlen Koltun. Photographic image synthesis with cascaded refinement networks. CoRR, abs/1707.09405, 2017.
159
+
160
+ Zihang Dai, Amjad Almahairi, Philip Bachman, Eduard H. Hovy, and Aaron C. Courville. Calibrating energy-based generative adversarial networks. In ICLR, 2017.
161
+
162
+ Emily L. Denton, Soumith Chintala, Arthur Szlam, and Robert Fergus. Deep generative image models using a Laplacian pyramid of adversarial networks. CoRR, abs/1506.05751, 2015.
163
+
164
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. CoRR, abs/1606.00704, 2016.
165
+
166
+ Ishan P. Durugkar, Ian Gemp, and Sridhar Mahadevan. Generative multi-adversarial networks. CoRR, abs/1611.01673, 2016.
167
+
168
+ Bernd Fritzke. A growing neural gas network learns topologies. In G. Tesauro, D. S. Touretzky, and T. K. Leen (eds.), Advances in Neural Information Processing Systems 7, pp. 625–632. 1995.
169
+
170
+ Arnab Ghosh, Viveka Kulharia, Vinay P. Namboodiri, Philip H. S. Torr, and Puneet Kumar Dokania. Multi-agent diverse generative adversarial networks. CoRR, abs/1704.02906, 2017.
171
+
172
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative Adversarial Networks. In NIPS, 2014.
173
+
174
+ Guillermo L. Grinblat, Lucas C. Uzal, and Pablo M. Granitto. Class-splitting generative adversarial networks. CoRR, abs/1709.07359, 2017.
175
+
176
+ Ishaan Gulrajani, Faruk Ahmed, Mart´ın Arjovsky, Vincent Dumoulin, and Aaron C. Courville. Improved training of Wasserstein GANs. CoRR, abs/1704.00028, 2017.
177
+
178
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. CoRR, abs/1502.01852, 2015.
179
+
180
+ 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 NIPS, pp. 6626–6637. 2017.
181
+
182
+ R Devon Hjelm, Athul Paul Jacob, Tong Che, Kyunghyun Cho, and Yoshua Bengio. BoundarySeeking Generative Adversarial Networks. CoRR, abs/1702.08431, 2017.
183
+
184
+ Xun Huang, Yixuan Li, Omid Poursaeed, John E. Hopcroft, and Serge J. Belongie. Stacked generative adversarial networks. CoRR, abs/1612.04357, 2016.
185
+
186
+ Satoshi Iizuka, Edgar Simo-Serra, and Hiroshi Ishikawa. Globally and locally consistent image completion. ACM Trans. Graph., 36(4):107:1–107:14, 2017.
187
+
188
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. CoRR, abs/1502.03167, 2015.
189
+
190
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
191
+
192
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2014.
193
+
194
+ Diederik P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. In NIPS, volume 29, pp. 4743– 4751. 2016.
195
+
196
+ Naveen Kodali, Jacob D. Abernethy, James Hays, and Zsolt Kira. How to train your DRAGAN. CoRR, abs/1705.07215, 2017.
197
+
198
+ Dmitry Korobchenko and Marco Foco. Single image super-resolution using deep learning, 2017. URL https://gwmt.nvidia.com/super-res/about. Machines Can See summit.
199
+
200
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, pp. 1097–1105. 2012.
201
+
202
+ Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew P. Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, and Wenzhe Shi. Photo-realistic single image super-resolution using a generative adversarial network. CoRR, abs/1609.04802, 2016.
203
+
204
+ Zinan Lin, Ashish Khetan, Giulia Fanti, and Sewoong Oh. PacGAN: The power of two samples in generative adversarial networks. CoRR, abs/1712.04086, 2017.
205
+
206
+ Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. CoRR, abs/1703.00848, 2017.
207
+
208
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In ICCV, 2015.
209
+
210
+ Alireza Makhzani and Brendan J. Frey. PixelGAN autoencoders. CoRR, abs/1706.00531, 2017.
211
+
212
+ Xiao-Jiao Mao, Chunhua Shen, and Yu-Bin Yang. Image restoration using convolutional autoencoders with symmetric skip connections. CoRR, abs/1606.08921, 2016a.
213
+
214
+ Xudong Mao, Qing Li, Haoran Xie, Raymond Y. K. Lau, and Zhen Wang. Least squares generative adversarial networks. CoRR, abs/1611.04076, 2016b.
215
+
216
+ Marco Marchesi. Megapixel size image creation using generative adversarial networks. CoRR, abs/1706.00082, 2017.
217
+
218
+ Luke Metz, Ben Poole, David Pfau, and Jascha Sohl-Dickstein. Unrolled generative adversarial networks. CoRR, abs/1611.02163, 2016.
219
+
220
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier GANs. In ICML, 2017.
221
+
222
+ Julien Rabin, Gabriel Peyr, Julie Delon, and Marc Bernot. Wasserstein barycenter and its application to texture mixing. In Scale Space and Variational Methods in Computer Vision (SSVM), pp. 435– 446, 2011.
223
+
224
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. CoRR, abs/1511.06434, 2015.
225
+
226
+ Tim Salimans and Diederik P. Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. CoRR, abs/1602.07868, 2016.
227
+
228
+ Tim Salimans, Ian J. Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. In NIPS, 2016.
229
+
230
+ Kenneth O. Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary Computation, 10(2):99–127, 2002.
231
+
232
+ Tijmen Tieleman and Geoffrey E. Hinton. Lecture 6.5 - RMSProp. Technical report, COURSERA: Neural Networks for Machine Learning, 2012.
233
+
234
+ Dmitry Ulyanov, Andrea Vedaldi, and Victor S. Lempitsky. Adversarial generator-encoder networks. CoRR, abs/1704.02304, 2017.
235
+
236
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, ¨ Nal Kalchbrenner, Andrew W. Senior, and Koray Kavukcuoglu. WaveNet: A generative model for raw audio. CoRR, abs/1609.03499, 2016a.
237
+
238
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks.¨ In ICML, pp. 1747–1756, 2016b.
239
+
240
+ Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt, Alex Graves, and Koray ¨ Kavukcuoglu. Conditional image generation with PixelCNN decoders. CoRR, abs/1606.05328, 2016c.
241
+
242
+ Twan van Laarhoven. L2 regularization versus batch and weight normalization. CoRR, abs/1706.05350, 2017.
243
+
244
+ Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. High-resolution image synthesis and semantic manipulation with conditional GANs. CoRR, abs/1711.11585, 2017.
245
+
246
+ Zhou Wang, Eero P. Simoncelli, and Alan C. Bovik. Multi-scale structural similarity for image quality assessment. In Proc. IEEE Asilomar Conf. on Signals, Systems, and Computers, pp. 1398–1402, 2003.
247
+
248
+ David Warde-Farley and Yoshua Bengio. Improving generative adversarial networks with denoising feature matching. In ICLR, 2017.
249
+
250
+ Jianwei Yang, Anitha Kannan, Dhruv Batra, and Devi Parikh. LR-GAN: layered recursive generative adversarial networks for image generation. In ICLR, 2017.
251
+
252
+ Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. LSUN: Construction of a large-scale image dataset using deep learning with humans in the loop. CoRR, abs/1506.03365, 2015.
253
+
254
+ Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaolei Huang, Xiaogang Wang, and Dimitris N. Metaxas. StackGAN: text to photo-realistic image synthesis with stacked generative adversarial networks. In ICCV, 2017.
255
+
256
+ Junbo Jake Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. ¨ In ICLR, 2017.
257
+
258
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A. Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. CoRR, abs/1703.10593, 2017.
259
+
260
+ <table><tr><td>Generator</td><td>Act.</td><td></td><td>Output shape</td><td></td><td>Params</td></tr><tr><td>Latent vector</td><td>1</td><td>512×</td><td>1</td><td>× 1</td><td></td></tr><tr><td>Conv4×4</td><td>LReLU</td><td>512×</td><td>4</td><td>× 4</td><td>4.2M</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>512×</td><td>4</td><td>× 4</td><td>2.4M</td></tr><tr><td>Upsample</td><td>1</td><td>512×</td><td>8</td><td>× 8</td><td>1</td></tr><tr><td>Conv3×3</td><td>LReLU</td><td>512×</td><td>8</td><td>× 8</td><td>2.4M</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>512×</td><td>8</td><td>× 8</td><td>2.4M</td></tr><tr><td>Upsample</td><td>1</td><td>512×</td><td>16</td><td>× 16</td><td>1</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>512×</td><td>16</td><td>× 16</td><td>2.4M</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>512×</td><td>16</td><td>× 16</td><td>2.4M</td></tr><tr><td>Upsample</td><td>1</td><td>512×</td><td>32</td><td>× 32</td><td>1</td></tr><tr><td>Conv3×3</td><td>LReLU</td><td>512×</td><td>32</td><td>× 32</td><td>2.4M</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>512×</td><td>32</td><td>× 32</td><td>2.4M</td></tr><tr><td>Upsample</td><td>1</td><td>512×</td><td>64</td><td></td><td>1</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>256×</td><td>64</td><td>× 64</td><td>1.2M</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>256×</td><td>64</td><td>× 64</td><td>590k</td></tr><tr><td>Upsample</td><td>1</td><td>256×</td><td>128</td><td>× 64</td><td>1</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>128×</td><td></td><td>× 128</td><td>295k</td></tr><tr><td>Conv3×3</td><td>LReLU</td><td>128×</td><td>128</td><td>× 128</td><td>148k</td></tr><tr><td>Upsample</td><td>1</td><td>128×</td><td>128</td><td>× 128</td><td>1</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td></td><td>256</td><td>× 256</td><td>74k</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>64×</td><td>256</td><td>× 256</td><td>37k</td></tr><tr><td>Upsample</td><td></td><td>64 ×</td><td>256</td><td>× 256</td><td></td></tr><tr><td>Conv3×3</td><td>1</td><td>64</td><td>× 512</td><td>× 512</td><td>1 18k</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>32×</td><td>512</td><td>× 512</td><td>9.2k</td></tr><tr><td>Upsample</td><td>LReLU</td><td>32 ×</td><td>512</td><td>× 512</td><td>1</td></tr><tr><td>Conv 3×3</td><td>1 LReLU</td><td>32</td><td>×1024×</td><td>1024</td><td>4.6k</td></tr><tr><td>Conv 3×3</td><td></td><td></td><td>16 ×1024×1024</td><td></td><td>2.3k</td></tr><tr><td></td><td>LReLU</td><td></td><td>16 ×1024×1024</td><td></td><td></td></tr><tr><td>Conv 1 ×1</td><td>linear</td><td></td><td>×1024×1024</td><td></td><td>51</td></tr><tr><td>Total trainable parameters</td><td></td><td></td><td></td><td></td><td>23.1M</td></tr></table>
261
+
262
+ <table><tr><td>Discriminator</td><td>Act.</td><td colspan="4">Output shape</td><td>Params</td></tr><tr><td>Input image</td><td>1</td><td></td><td></td><td>3×1024×1024</td><td></td><td>1</td></tr><tr><td>Conv 1 ×1</td><td>LReLU</td><td></td><td></td><td>16 ×1024×1024</td><td></td><td>64</td></tr><tr><td>Conv3×3</td><td>LReLU</td><td></td><td></td><td>16×1024×1024</td><td></td><td>2.3k</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td></td><td></td><td>32 ×1024×1024</td><td></td><td>4.6k</td></tr><tr><td>Downsample</td><td>1</td><td>32 ×</td><td>512</td><td>×</td><td>512</td><td>1</td></tr><tr><td>Conv3×3</td><td>LReLU</td><td>32</td><td>× 512</td><td>×</td><td>512</td><td>9.2k</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>64×</td><td>512</td><td>×</td><td>512</td><td>18k</td></tr><tr><td>Downsample</td><td>1</td><td>64×</td><td>256</td><td>×</td><td>256</td><td>1</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>64×</td><td>256</td><td>×</td><td>256</td><td>37k</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>128×</td><td>256</td><td>×</td><td>256</td><td>74k</td></tr><tr><td>Downsample</td><td>1</td><td>128×</td><td>128</td><td>×</td><td>128</td><td>1</td></tr><tr><td>Conv3×3</td><td>LReLU</td><td>128×</td><td>128</td><td>×</td><td>128</td><td>148k</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>256×</td><td>128</td><td>×</td><td>128</td><td>295k</td></tr><tr><td>Downsample</td><td>1</td><td>256×</td><td>64</td><td>×</td><td>64</td><td>1</td></tr><tr><td>Conv3×3</td><td>LReLU</td><td>256×</td><td>64</td><td>×</td><td>64</td><td>590k</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>512×</td><td>64</td><td>×</td><td>64</td><td>1.2M</td></tr><tr><td>Downsample</td><td>二</td><td>512×</td><td>32</td><td>×</td><td>32</td><td>二</td></tr><tr><td>Conv3×3</td><td>LReLU</td><td>512×</td><td>32</td><td>×</td><td>32</td><td>2.4M</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>512×</td><td>32</td><td>×</td><td>32</td><td>2.4M</td></tr><tr><td>Downsample</td><td>1</td><td>512×</td><td>16</td><td>×</td><td>16</td><td>1</td></tr><tr><td>Conv3×3</td><td>LReLU</td><td>512×</td><td>16</td><td>×</td><td>16</td><td>2.4M</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>512×</td><td>16</td><td>×</td><td>16</td><td>2.4M</td></tr><tr><td>Downsample</td><td>1</td><td>512×</td><td>8</td><td>×</td><td>8</td><td>1</td></tr><tr><td>Conv3×3</td><td>LReLU</td><td>512×</td><td>8</td><td>×</td><td>8</td><td>2.4M</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>512×</td><td>8</td><td>×</td><td>8</td><td>2.4M</td></tr><tr><td>Downsample</td><td>1</td><td>512×</td><td>4</td><td>×</td><td>4</td><td>1</td></tr><tr><td>Minibatch stddev</td><td>1</td><td>513×</td><td>4</td><td>×</td><td>4</td><td>1</td></tr><tr><td>Conv 3×3</td><td>LReLU</td><td>512×</td><td>4</td><td>×</td><td>4</td><td>2.4M</td></tr><tr><td>Conv 4×4</td><td>LReLU</td><td>512×</td><td>1</td><td>×</td><td>1</td><td>4.2M</td></tr><tr><td>Fully-connected</td><td>linear</td><td>1×</td><td>1</td><td>×</td><td>1</td><td>513</td></tr><tr><td>Total trainableparameters</td><td></td><td></td><td></td><td></td><td></td><td>23.1M</td></tr></table>
263
+
264
+ Table 2: Generator and discriminator that we use with CELEBA-HQ to generate $1 0 2 4 \times 1 0 2 4$ images.
265
+
266
+ # A NETWORK STRUCTURE AND TRAINING CONFIGURATION
267
+
268
+ A.1 $1 0 2 4 \times 1 0 2 4$ NETWORKS USED FOR CELEBA-HQ
269
+
270
+ Table 2 shows network architectures of the full-resolution generator and discriminator that we use with the CELEBA-HQ dataset. Both networks consist mainly of replicated 3-layer blocks that we introduce one by one during the course of the training. The last Conv $1 \times 1$ layer of the generator corresponds to the toRGB block in Figure 2, and the first Conv $1 \times 1$ layer of the discriminator similarly corresponds to fromRGB. We start with $4 \times 4$ resolution and train the networks until we have shown the discriminator $8 0 0 \mathrm { k }$ real images in total. We then alternate between two phases: fade in the first 3-layer block during the next $8 0 0 \mathrm { k }$ images, stabilize the networks for $8 0 0 \mathrm { k }$ images, fade in the next 3-layer block during $8 0 0 \mathrm { k }$ images, etc.
271
+
272
+ Our latent vectors correspond to random points on a 512-dimensional hypersphere, and we represent training and generated images in [-1,1]. We use leaky ReLU with leakiness 0.2 in all layers of both networks, except for the last layer that uses linear activation. We do not employ batch normalization, layer normalization, or weight normalization in either network, but we perform pixelwise normalization of the feature vectors after each Conv $3 \times 3$ layer in the generator as described in Section 4.2. We initialize all bias parameters to zero and all weights according to the normal distribution with unit variance. However, we scale the weights with a layer-specific constant at runtime as described in Section 4.1. We inject the across-minibatch standard deviation as an additional feature map at $4 \times 4$ resolution toward the end of the discriminator as described in Section 3. The upsampling and downsampling operations in Table 2 correspond to $2 \times 2$ element replication and average pooling, respectively.
273
+
274
+ We train the networks using Adam (Kingma & Ba, 2015) with $\alpha = 0 . 0 0 1$ , $\beta _ { 1 } = 0$ , $\beta _ { 2 } = 0 . 9 9$ , and $\epsilon = 1 0 ^ { - 8 }$ . We do not use any learning rate decay or rampdown, but for visualizing generator output at any given point during the training, we use an exponential running average for the weights of the generator with decay 0.999. We use a minibatch size 16 for resolutions $\bar { 4 } ^ { 2 } { - } 1 2 8 ^ { 2 }$ and then gradually decrease the size according to $2 5 6 ^ { 2 } 1 4$ , $5 1 2 ^ { 2 } 6$ , and $1 0 2 4 ^ { 2 } 3$ to avoid exceeding the available memory budget. We use the WGAN-GP loss, but unlike Gulrajani et al. (2017), we alternate between optimizing the generator and discriminator on a per-minibatch basis, i.e., we set $n _ { \mathrm { c r i t i c } } = 1$ . Additionally, we introduce a fourth term into the discriminator loss with an extremely small weight to keep the discriminator output from drifting too far away from zero. To be precise, we set $L ^ { \prime } \overset { \cdot } { = } L + \epsilon _ { \mathrm { d r i f t } } \mathbb { E } _ { x \in \mathbb { P } _ { r } } [ D ( x ) ^ { 2 } ]$ , where $\epsilon _ { \mathrm { d r i f t } } = 0 . 0 0 1$ .
275
+
276
+ # A.2 OTHER NETWORKS
277
+
278
+ Whenever we need to operate on a spatial resolution lower than $1 0 2 4 \times 1 0 2 4$ , we do that by leaving out an appropriate number copies of the replicated 3-layer block in both networks.
279
+
280
+ Furthermore, Section 6.1 uses a slightly lower-capacity version, where we halve the number of feature maps in Conv $3 \times 3$ layers at the $1 6 \times 1 6$ resolution, and divide by 4 in the subsequent resolutions. This leaves 32 feature maps to the last Conv $3 \times 3$ layers. In Table 1 and Figure 4 we train each resolution for a total $6 0 0 \mathrm { k }$ images instead of $8 0 0 \mathbf { k }$ , and also fade in new layers for the duration of 600k images.
281
+
282
+ For the “Gulrajani et al. (2017)” case in Table 1, we follow their training configuration as closely as possible. In particular, we set $\alpha = 0 . 0 0 0 1$ , $\beta _ { 2 } = 0 . 9$ , $n _ { \mathrm { c r i t i c } } = 5$ , $\epsilon _ { \mathrm { d r i f t } } = 0$ , and minibatch size 64. We disable progressive resolution, minibatch stddev, as well as weight scaling at runtime, and initialize all weights using He’s initializer (He et al., 2015). Furthermore, we modify the generator by replacing LReLU with ReLU, linear activation with tanh in the last layer, and pixelwise normalization with batch normalization. In the discriminator, we add layer normalization to all Conv $3 \times 3$ and Conv $4 \times 4$ layers. For the latent vectors, we use 128 components sampled independently from the normal distribution.
283
+
284
+ # B LEAST-SQUARES GAN (LSGAN) AT $1 0 2 4 \times 1 0 2 4$
285
+
286
+ We find that LSGAN is generally a less stable loss function than WGAN-GP, and it also has a tendency to lose some of the variation towards the end of long runs. Thus we prefer WGAN-GP, but have also produced high-resolution images by building on top of LSGAN. For example, the $1 0 2 4 ^ { 2 }$ images in Figure 1 are LSGAN-based.
287
+
288
+ On top of the techniques described in Sections 2–4, we need one additional hack with LSGAN that prevents the training from spiraling out of control when the dataset is too easy for the discriminator, and the discriminator gradients are at risk of becoming meaningless as a result. We adaptively increase the magnitude of multiplicative Gaussian noise in discriminator as a function of the discriminator’s output. The noise is applied to the input of each Conv $3 \times 3$ and Conv $4 \times 4$ layer. There is a long history of adding noise to the discriminator, and it is generally detrimental for the image quality (Arjovsky et al., 2017) and ideally one would never have to do that, which according to our tests is the case for WGAN-GP (Gulrajani et al., 2017). The magnitude of noise is determined as $0 . 2 \cdot \operatorname* { m a x } ( 0 , \hat { d } _ { t } - 0 . 5 ) ^ { 2 }$ , where $\hat { d } _ { t } = 0 . 1 d + 0 . 9 \hat { d } _ { t - 1 }$ is an exponential moving average of the discriminator output $d$ . The motivation behind this hack is that LSGAN is seriously unstable when $d$ approaches (or exceeds) 1.0.
289
+
290
+ # C CELEBA-HQ DATASET
291
+
292
+ In this section we describe the process we used to create the high-quality version of the CELEBA dataset, consisting of 30000 images in $1 0 2 4 \times 1 0 2 4$ resolution. As a starting point, we took the collection of in-the-wild images included as a part of the original CELEBA dataset. These images are extremely varied in terms of resolution and visual quality, ranging all the way from $4 3 \times 5 5$ to $6 7 3 2 \times 8 9 8 4$ . Some of them show crowds of several people whereas others focus on the face of a single person – often only a part of the face. Thus, we found it necessary to apply several image processing steps to ensure consistent quality and to center the images on the facial region.
293
+
294
+ Our processing pipeline is illustrated in Figure 8. To improve the overall image quality, we preprocess each JPEG image using two pre-trained neural networks: a convolutional autoencoder trained to remove JPEG artifacts in natural images, similar in structure to the proposed by Mao et al. (2016a), and an adversarially-trained 4x super-resolution network (Korobchenko & Foco, 2017) similar to Ledig et al. (2016). To handle cases where the facial region extends outside the image, we employ padding and filtering to extend the dimensions of the image as illustrated in Fig.8(c–d). We then select an oriented crop rectangle based on the facial landmark annotations included in the
295
+
296
+ ![](images/39d1eeb4a773c2079f8b21b37cffa835b2699bb425cea663a5546a57597dbf07.jpg)
297
+ Figure 8: Creating the CELEBA-HQ dataset. We start with a JPEG image (a) from the CelebA inthe-wild dataset. We improve the visual quality (b,top) through JPEG artifact removal (b,middle) and $4 \mathbf { x }$ super-resolution (b,bottom). We then extend the image through mirror padding (c) and Gaussian filtering (d) to produce a visually pleasing depth-of-field effect. Finally, we use the facial landmark locations to select an appropriate crop region (e) and perform high-quality resampling to obtain the final image at $1 0 2 4 \times 1 0 2 4$ resolution (f).
298
+
299
+ original CELEBA dataset as follows:
300
+
301
+ $$
302
+ \begin{array} { l c l } { { x ^ { \prime } } } & { { = } } & { { e _ { 1 } - e _ { 0 } } } \\ { { y ^ { \prime } } } & { { = } } & { { \displaystyle \frac { 1 } { 2 } ( e _ { 0 } + e _ { 1 } ) - \displaystyle \frac { 1 } { 2 } ( m _ { 0 } + m _ { 1 } ) } } \\ { { } } & { { } } & { { } } \\ { { c } } & { { = } } & { { \displaystyle \frac { 1 } { 2 } ( e _ { 0 } + e _ { 1 } ) - 0 . 1 \cdot y ^ { \prime } } } \\ { { } } & { { s } } & { { = } } & { { \operatorname* { m a x } \left( 4 . 0 \cdot | x ^ { \prime } | , 3 . 6 \cdot | y ^ { \prime } | \right) } } \\ { { x } } & { { = } } & { { \mathrm { N o r m a l i z e } \left( x ^ { \prime } - \mathrm { R o t a t e g 0 } ( y ^ { \prime } ) \right) } } \\ { { y } } & { { = } } & { { \mathrm { R o t a t e g o } ( x ) } } \end{array}
303
+ $$
304
+
305
+ $e _ { 0 } , e _ { 1 } , m _ { 0 }$ , and $m _ { 1 }$ represent the 2D pixel locations of the two eye landmarks and two mouth landmarks, respectively, $c$ and $s$ indicate the center and size of the desired crop rectangle, and $x$ and $y$ indicate its orientation. We constructed the above formulas empirically to ensure that the crop rectangle stays consistent in cases where the face is viewed from different angles. Once we have calculated the crop rectangle, we transform the rectangle to $4 0 9 6 \times 4 0 9 6$ pixels using bilinear filtering, and then scale it to $1 0 2 4 \times 1 0 2 4$ resolution using a box filter.
306
+
307
+ We perform the above processing for all 202599 images in the dataset, analyze the resulting $1 0 2 4 \times$ 1024 images further to estimate the final image quality, sort the images accordingly, and discard all but the best 30000 images. We use a frequency-based quality metric that favors images whose power spectrum contains a broad range of frequencies and is approximately radially symmetric. This penalizes blurry images as well as images that have conspicuous directional features due to, e.g., visible halftoning patterns. We selected the cutoff point of 30000 images as a practical sweet spot between variation and image quality, because it appeared to yield the best results.
308
+
309
+ # D CIFAR10 RESULTS
310
+
311
+ Figure 9 shows non-curated images generated in the unsupervised setting, and Table 3 compares against prior art in terms of inception scores. We report our scores in two different ways: 1) the highest score observed during training runs (here $\pm$ refers to the standard deviation returned by the inception score calculator) and 2) the mean and standard deviation computed from the highest scores seen during training, starting from ten random initializations. Arguably the latter methodology is much more meaningful as one can be lucky with individual runs (as we were). We did not use any kind of augmentation with this dataset.
312
+
313
+ # E MNIST-1K DISCRETE MODE TEST WITH CRIPPLED DISCRIMINATOR
314
+
315
+ Metz et al. (2016) describe a setup where a generator synthesizes MNIST digits simultaneously to 3 color channels, the digits are classified using a pre-trained classifier $0 . 4 \%$ error rate in our case), and concatenated to form a number in $\left[ 0 , 9 9 9 \right]$ . They generate a total of 25,600 images and count how many of the discrete modes are covered. They also compute KL divergence as KL(histogram || uniform). Modern GAN implementations can trivially cover all modes at very low divergence (0.05 in our case), and thus Metz et al. specify a fairly low-capacity generator and two severely crippled discriminators (“K/2” has $\sim 2 0 0 0$ params and $\mathbf { \ddot { \Delta } K } / 4 \mathbf { \ ' }$ only about $\sim 5 0 0$ ) to tease out differences between training methodologies. Both of these networks use batch normalization.
316
+
317
+ ![](images/12d4d0a8a7ebe09acdfa99c0e7dfc59834667a7ff5ff241996cb8100f5c7eb7d.jpg)
318
+ Figure 9: CIFAR10 images generated using a network that was trained unsupervised (no label conditioning), and achieves a record 8.80 inception score.
319
+
320
+ Table 3: CIFAR10 inception scores, higher is better.
321
+
322
+ <table><tr><td colspan="3">UNSUPERVISED</td></tr><tr><td colspan="2">Method</td><td>Inception score</td></tr><tr><td>ALI GMAN Improved GAN</td><td>(Dumoulin et al., 2016) (Durugkar et al.,2016) (Salimans et al., 2016) (Dai et al.,2017)</td><td>5.34± 0.05 6.00 ±0.19 6.86 ±0.06</td></tr><tr><td>LR-AGN DFM WGAN-GP</td><td>CEGAN-Ent-VI (Yang et al.,2017) (Warde-Farley &amp; Bengio,2017) (Gulrajani et al., 2017)</td><td>7.07±0.07 7.17 ± 0.17 7.72 ± 0.13 7.86 ± 0.07 7.90 ±0.09</td></tr><tr><td colspan="3">Splitting GAN (Grinblat et al.,2017) Our (best run) 8.80± 0.05 Our (computed from 10 runs) 8.56 ± 0.06</td></tr></table>
323
+
324
+ LABEL CONDITIONED
325
+
326
+ <table><tr><td>Method</td><td></td><td>Inception score</td></tr><tr><td>DCGAN</td><td>(Radford et al., 2015)</td><td>6.58</td></tr><tr><td></td><td>Improved GAN (Salimans et al., 2016)</td><td>8.09 ±0.07</td></tr><tr><td>AC-GAN</td><td>(Odena et al., 2017)</td><td>8.25 ± 0.07</td></tr><tr><td>SGAN</td><td>(Huang et al.,2016)</td><td>8.59 ±0.12</td></tr><tr><td>WGAN-GP</td><td>(Gulrajani et al., 2017)</td><td>8.67 ± 0.14</td></tr><tr><td>Splitting GAN</td><td>(Grinblat et al.,2017)</td><td>8.87±0.09</td></tr></table>
327
+
328
+ As shown in Table 4, using WGAN-GP loss with the networks specified by Metz et al. covers much more modes than the original GAN loss, and even more than the unrolled original GAN with the smaller (K/4) discriminator. The KL divergence, which is arguably a more accurate metric than the raw count, acts even more favorably.
329
+
330
+ Replacing batch normalization with our normalization (equalized learning rate, pixelwise normalization) improves the result considerably, while also removing a few trainable parameters from the discriminators. The addition of a minibatch stddev layer further improves the scores, while restoring the discriminator capacity to within $0 . 5 \%$ of the original. Progression does not help much with these tiny images, but it does not hurt either.
331
+
332
+ <table><tr><td>Arch</td><td>GAN</td><td>+unrolling</td><td>WGAN-GP</td><td>+our norm</td><td>+ mb stddev</td><td>+ progression</td></tr><tr><td># K/4</td><td>30.6±20.7</td><td>372.2±20.7</td><td>640.1± 136.3</td><td>856.7± 50.4</td><td>881.3±39.2</td><td>859.5 ±36.2</td></tr><tr><td>KL</td><td>5.99 ±0.04</td><td>4.66 ± 0.46</td><td>1.97 ± 0.70</td><td>1.10±0.19</td><td>1.09 ± 0.16</td><td>1.05 ± 0.09</td></tr><tr><td>K/2 #</td><td>628.0±140.9</td><td>817.4 ± 39.9</td><td>772.4±146.5</td><td>886.6± 58.5</td><td>918.3± 30.2</td><td>919.8± 35.1</td></tr><tr><td>KL</td><td>2.58 ± 0.75</td><td>1.43 ± 0.12</td><td>1.35 ± 0.55</td><td>0.98 ± 0.33</td><td>0.89 ±0.21</td><td>0.82± 0.13</td></tr></table>
333
+
334
+ Table 4: Results for MNIST discrete mode test using two tiny discriminators (K/4, K/2) defined by Metz et al. (2016). The number of covered modes (#) and KL divergence from a uniform distribution are given as an average $\pm$ standard deviation over 8 random initializations. Higher is better for the number of modes, and lower is better for KL divergence.
335
+
336
+ # F ADDITIONAL CELEBA-HQ RESULTS
337
+
338
+ Figure 10 shows the nearest neighbors found for our generated images. Figure 11 gives additional generated examples from CELEBA-HQ. We enabled mirror augmentation for all tests using CELEBA and CELEBA-HQ. In addition to the sliced Wasserstein distance (SWD), we also quote the recently introduced Frechet Inception Distance (FID) (Heusel et al., 2017) computed from 50K ´ images.
339
+
340
+ # G LSUN RESULTS
341
+
342
+ Figures 12–17 show representative images generated for all 30 LSUN categories. A separate network was trained for each category using identical parameters. All categories were trained using 100k images, except for BEDROOM and DOG that used all the available data. Since $1 0 0 \mathrm { k }$ images is a very limited amount of training data for most categories, we enabled mirror augmentation in these tests (but not for BEDROOM or DOG).
343
+
344
+ # H ADDITIONAL IMAGES FOR TABLE 1
345
+
346
+ Figure 18 shows larger collections of images corresponding to the non-converged setups in Table 1. The training time was intentionally limited to make the differences between various methods more visible.
347
+
348
+ ![](images/aec7ad1d46aa1f03da7e82c84efff36cd48b20a81a640146d0b71a36d38fdadf.jpg)
349
+ Figure 10: Top: Our CELEBA-HQ results. Next five rows: Nearest neighbors found from the training data, based on feature-space distance. We used activations from five VGG layers, as suggested by Chen & Koltun (2017). Only the crop highlighted in bottom right image was used for comparison in order to exclude image background and focus the search on matching facial features.
350
+
351
+ ![](images/8cd3b51c8952deb085f7d1bdafcc894b748398258ad3672ceb17cf39c970885f.jpg)
352
+ Figure 11: Additional $1 0 2 4 \times 1 0 2 4$ images generated using the CELEBA-HQ dataset. Sliced Wasserstein Distance (SWD) $\times 1 0 ^ { 3 }$ for levels 1024, . . . , 16: 7.48, 7.24, 6.08, 3.51, 3.55, 3.02, 7.22, for which the average is 5.44. Frechet Inception Distance (FID) computed from 50K images was 7.30. ´ See the video for latent space interpolations.
353
+
354
+ ![](images/cd3b359125ecf2984da934f6575d3de0aee86f48c151c07d50596da32c8d0373.jpg)
355
+ Figure 12: Example images generated at $2 5 6 \times 2 5 6$ from LSUN categories. Sliced Wasserstein Distance (SWD) $\mathrm { \dot { \times } 1 0 ^ { 3 } }$ is given for levels 256, 128, 64, 32 and 16, and the average is bolded. We also quote the Frechet Inception Distance (FID) computed from 50K images. ´
356
+
357
+ ![](images/0ac9c950be6c012a1844b694e09ead3e5d2c080f508c959f80f6af087f446cfa.jpg)
358
+ Figure 13: Example images generated at $2 5 6 \times 2 5 6$ from LSUN categories. Sliced Wasserstein Distance (SWD) $\mathrm { \dot { \times } 1 0 ^ { 3 } }$ is given for levels 256, 128, 64, 32 and 16, and the average is bolded. We also quote the Frechet Inception Distance (FID) computed from 50K images. ´
359
+
360
+ ![](images/6d7dc58dc1de790d6ee5f29632d2c19d92996eb44b731f663cab52e483debdbc.jpg)
361
+ Figure 14: Example images generated at $2 5 6 \times 2 5 6$ from LSUN categories. Sliced Wasserstein Distance (SWD) $\mathrm { \dot { \times } 1 0 ^ { 3 } }$ is given for levels 256, 128, 64, 32 and 16, and the average is bolded. We also quote the Frechet Inception Distance (FID) computed from 50K images. ´
362
+
363
+ ![](images/0c1d8a94dc9611ecbd8ed79892fa4ffd106d70ebd3629d34a88e59e9d4988ebe.jpg)
364
+ Figure 15: Example images generated at $2 5 6 \times 2 5 6$ from LSUN categories. Sliced Wasserstein Distance (SWD) $\mathrm { \dot { \times } 1 0 ^ { 3 } }$ is given for levels 256, 128, 64, 32 and 16, and the average is bolded. We also quote the Frechet Inception Distance (FID) computed from 50K images. ´
365
+
366
+ ![](images/6efd7cd0ea1ab37d0bd5bcadc1420291f4a4829c04c8932a828f635da27561ce.jpg)
367
+ Figure 16: Example images generated at $2 5 6 \times 2 5 6$ from LSUN categories. Sliced Wasserstein Distance (SWD) $\mathrm { \dot { \times } 1 0 ^ { 3 } }$ is given for levels 256, 128, 64, 32 and 16, and the average is bolded. We also quote the Frechet Inception Distance (FID) computed from 50K images. ´
368
+
369
+ ![](images/d186ea0a04146ff60da28b1c30c6154b88e400dc646f6e7f05eba935de9613b0.jpg)
370
+ Figure 17: Example images generated at $2 5 6 \times 2 5 6$ from LSUN categories. Sliced Wasserstein Distance (SWD) $\mathrm { \dot { \times } 1 0 ^ { 3 } }$ is given for levels 256, 128, 64, 32 and 16, and the average is bolded. We also quote the Frechet Inception Distance (FID) computed from 50K images. ´
371
+
372
+ ![](images/730db3f5c0666b73711ef80949958bd2299d90a1c2d85fc26104cd40561ebaf9.jpg)
373
+ Figure 18: A larger set of generated images corresponding to the non-converged setups in Table 1.
md/train/Hkf2_sC5FX/Hkf2_sC5FX.md ADDED
@@ -0,0 +1,494 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EFFICIENT LIFELONG LEARNING WITH A-GEM
2
+
3
+ Arslan Chaudhry1, Marc’Aurelio Ranzato2, Marcus Rohrbach2, Mohamed Elhoseiny2 1University of Oxford, 2Facebook AI Research arslan.chaudhry@eng.ox.ac.uk, {ranzato,mrf,elhoseiny}@fb.com
4
+
5
+ # ABSTRACT
6
+
7
+ In lifelong learning, the learner is presented with a sequence of tasks, incrementally building a data-driven prior which may be leveraged to speed up learning of a new task. In this work, we investigate the efficiency of current lifelong approaches, in terms of sample complexity, computational and memory cost. Towards this end, we first introduce a new and a more realistic evaluation protocol, whereby learners observe each example only once and hyper-parameter selection is done on a small and disjoint set of tasks, which is not used for the actual learning experience and evaluation. Second, we introduce a new metric measuring how quickly a learner acquires a new skill. Third, we propose an improved version of GEM (Lopez-Paz & Ranzato, 2017), dubbed Averaged GEM (A-GEM), which enjoys the same or even better performance as GEM, while being almost as computationally and memory efficient as EWC (Kirkpatrick et al., 2016) and other regularizationbased methods. Finally, we show that all algorithms including A-GEM can learn even more quickly if they are provided with task descriptors specifying the classification tasks under consideration. Our experiments on several standard lifelong learning benchmarks demonstrate that A-GEM has the best trade-off between accuracy and efficiency.1
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Intelligent systems, whether they are natural or artificial, must be able to quickly adapt to changes in the environment and to quickly learn new skills by leveraging past experiences. While current learning algorithms can achieve excellent performance on a variety of tasks, they strongly rely on copious amounts of supervision in the form of labeled data.
12
+
13
+ The lifelong learning (LLL) setting attempts at addressing this shortcoming, bringing machine learning closer to a more realistic human learning by acquiring new skills quickly with a small amount of training data, given the experience accumulated in the past. In this setting, the learner is presented with a stream of tasks whose relatedness is not known a priori. The learner has then the potential to learn more quickly a new task, if it can remember how to combine and re-use knowledge acquired while learning related tasks of the past. Of course, for this learning setting to be useful, the model needs to be constrained in terms of amount of compute and memory required. Usually this means that the learner should not be allowed to merely store all examples seen in the past (in which case this reduces the lifelong learning problem to a multitask problem) nor should the learner be engaged in computations that would not be feasible in real-time, as the goal is to quickly learn from a stream of data.
14
+
15
+ Unfortunately, the established training and evaluation protocol as well as current algorithms for lifelong learning do not satisfy all the above desiderata, namely learning from a stream of data using limited number of samples, limited memory and limited compute. In the most popular training paradigm, the learner does several passes over the data (Kirkpatrick et al., 2016; Aljundi et al., 2018; Rusu et al., 2016; Schwarz et al., 2018), while ideally the model should need only a handful of samples and these should be provided one-by-one in a single pass (Lopez-Paz & Ranzato, 2017). Moreover, when the learner has several hyper-parameters to tune, the current practice is to go over the sequence of tasks several times, each time with a different hyper-parameter value, again ignoring the requirement of learning from a stream of data and, strictly speaking, violating the assumption of the LLL scenario. While some algorithms may work well in a single-pass setting, they unfortunately require a lot of computation (Lopez-Paz & Ranzato, 2017) or their memory scales with the number of tasks (Rusu et al., 2016), which greatly impedes their actual deployment in practical applications.
16
+
17
+ In this work, we propose an evaluation methodology and an algorithm that better match our desiderata, namely learning efficiently – in terms of training samples, time and memory – from a stream of tasks. First, we propose a new learning paradigm, whereby the learner performs cross validation on a set of tasks which is disjoint from the set of tasks actually used for evaluation (Sec. 2). In this setting, the learner will have to learn and will be tested on an entirely new sequence of tasks and it will perform just a single pass over this data stream. Second, we build upon GEM (Lopez-Paz & Ranzato, 2017), an algorithm which leverages a small episodic memory to perform well in a single pass setting, and propose a small change to the loss function which makes GEM orders of magnitude faster at training time while maintaining similar performance; we dub this variant of GEM, A-GEM (Sec. 4). Third, we explore the use of compositional task descriptors in order to improve the fewshot learning performance within LLL showing that with this additional information the learner can pick up new skills more quickly (Sec. 5). Fourth, we introduce a new metric to measure the speed of learning, which is useful to quantify the ability of a learning algorithm to learn a new task (Sec. 3). And finally, using our new learning paradigm and metric, we demonstrate A-GEM on a variety of benchmarks and against several representative baselines (Sec. 6). Our experiments show that AGEM has a better trade-off between average accuracy and computational/memory cost. Moreover, all algorithms improve their ability to quickly learn a new task when provided with compositional task descriptors, and they do so better and better as they progress through the learning experience.
18
+
19
+ # 2 LEARNING PROTOCOL
20
+
21
+ Currently, most works on lifelong learning (Kirkpatrick et al., 2016; Rusu et al., 2016; Shin et al., 2017; Nguyen et al., 2018) adopt a learning protocol which is directly borrowed from supervised learning. There are $T$ tasks, and each task consists of a training, validation and test sets. During training the learner does as many passes over the data of each task as desired. Moreover, hyperparameters are tuned on the validation sets by sweeping over the whole sequence of tasks as many times as required by the cross-validation grid search. Finally, metrics of interest are reported on the test set of each task using the model selected by the previous cross-validation procedure.
22
+
23
+ Since the current protocol violates our stricter definition of LLL for which the learner can only make a single pass over the data, as we want to emphasize the importance of learning quickly from data, we now introduce a new learning protocol.
24
+
25
+ We consider two streams of tasks, described by the following ordered sequences of datasets $\mathcal { D } ^ { C V } =$ $\{ \mathcal { D } _ { 1 } , \cdot \cdot \cdot , \mathcal { D } _ { T ^ { c V } } \}$ and $\mathcal { D } ^ { E V } = \{ \mathcal { D } _ { T ^ { C V } + 1 } , \cdot \cdot \cdot , \mathcal { D } _ { T } \}$ , where $\mathcal { D } _ { k } = \{ ( \mathbf { x } _ { i } ^ { \hat { k } } , t _ { i } ^ { k } , y _ { i } ^ { k } ) _ { i = 1 } ^ { n _ { k } } \}$ is the dataset of the $k$ -th task, $T ^ { C V } < T$ (in all our experiments $T ^ { C V } = 3$ while $T = 2 0$ ), and we assume that all datasets are drawn from the same distribution over tasks. To avoid cluttering of the notation, we let the context specify whether $\mathcal { D } _ { k }$ refers to the training or test set of the $k$ -th dataset.
26
+
27
+ ${ \mathcal { D } } ^ { C V }$ is the stream of datasets which will be used during cross-validation; ${ \mathcal { D } } ^ { C V }$ allows the learner to replay all samples multiple times for the purposes of model hyper-parameter selection. Instead, $\mathcal { D } ^ { E V }$ is the actual dataset used for final training and evaluation on the test set; the learner will observe training examples from $\mathcal { D } ^ { E V }$ once and only once, and all metrics will be reported on the test sets of $\mathcal { D } ^ { E \widetilde { V } }$ . Since the regularization-based approaches for lifelong learning (Kirkpatrick et al., 2016; Zenke et al., 2017) are rather sensitive to the choice of the regularization hyper-parameter, we introduced the set $\mathcal { D } ^ { C V }$ , as it seems reasonable in practical applications to have similar tasks that can be used for tuning the system. However, the actual training and testing are then performed on $\mathcal { D } ^ { E V }$ using a single pass over the data. See Algorithm 1 for a summary of the training and evaluation protocol.
28
+
29
+ Each example in any of these dataset consists of a triplet defined by an input $( \mathbf { x } ^ { k } \in \mathcal { X } )$ , task descriptor ${ \mathbf { } } ^ { t ^ { k } } \in { \mathcal { T } }$ , see Sec. 5 for examples) and a target vector $( y ^ { k } \in \mathbf { y } ^ { k } )$ , where $\mathbf { y } ^ { k }$ is the set of labels specific to task $k$ and $\mathbf { y } ^ { k } \subset \mathcal { y }$ . While observing the data, the goal is to learn a predictor $f _ { \theta } : \mathcal { X } \times \mathcal { T } \mathcal { Y }$ , parameterized by $\theta \in \mathbb { R } ^ { P }$ (a neural network in our case), that can map any test pair $\mathbf { \Psi } ( \mathbf { x } , t )$ to a target $y$ .
30
+
31
+ Algorithm 1 Learning and Evaluation Protocols
32
+ 1: for $h$ in hyper-parameter list do . Cross-validation loop, executing multiple passes over $\mathcal { D } ^ { C V }$
33
+ 2: for $k = 1$ to $T ^ { C V }$ do . Learn over data stream $\mathcal { D } ^ { C V }$ using $h$
34
+ 3: for $i = 1$ to $n _ { k }$ do $\triangleright$ Single pass over $\mathcal { D } _ { k }$
35
+ 4: Update $f _ { \theta }$ using $( \mathbf { x } _ { i } ^ { k } , t _ { i } ^ { k } , y _ { i } ^ { k } )$ and hyper-parameter $h$
36
+ 5: Update metrics on test set of $\mathcal { D } ^ { C V }$
37
+ 6: end for
38
+ 7: end for
39
+ 8: end for
40
+ 9: Select best hyper-parameter setting, $h ^ { * }$ , based on average accuracy of test set of $\mathcal { D } ^ { C V }$ , see Eq. 1.
41
+ 10: Reset $f _ { \theta }$ .
42
+ 11: Reset all metrics.
43
+ 12: for $k = T ^ { C V } + 1$ to $T$ do . Actual learning over datastream DEV
44
+ 13: for $i = 1$ to $n _ { k }$ do $\triangleright$ Single pass over $\mathcal { D } _ { k }$
45
+ 14: Update $f _ { \theta }$ using $( \mathbf { x } _ { i } ^ { k } , t _ { i } ^ { k } , y _ { i } ^ { k } )$ and hyper-parameter $h ^ { * }$
46
+ 15: Update metrics on test set of $\mathcal { D } ^ { E V }$
47
+ 16: end for
48
+ 17: end for
49
+ 18: Report metrics on test set of $\mathcal { D } ^ { E V }$ .
50
+
51
+ # 3 METRICS
52
+
53
+ Below we describe the metrics used to evaluate the LLL methods studied in this work. In addition to Average Accuracy $( A )$ and Forgetting Measure $( F )$ (Chaudhry et al., 2018), we define a new measure, the Learning Curve Area (LCA), that captures how quickly a model learns.
54
+
55
+ The training dataset of each task, $\mathcal { D } _ { k }$ , consists of a total $B _ { k }$ mini-batches. After each presentation of a mini-batch of task $k$ , we evaluate the performance of the learner on all the tasks using the corresponding test sets. Let $a _ { k , i , j } \in [ 0 , 1 ]$ be the accuracy evaluated on the test set of task $j$ , after the model has been trained with the $i$ -th mini-batch of task $k$ . Assuming the first learning task in the continuum is indexed by 1 (it will be $T ^ { C V } + 1$ for $\mathcal { D } ^ { E V }$ ) and the last one by $T$ (it will be $T ^ { C V }$ for $\mathcal { D } ^ { C V } .$ ), we define the following metrics:
56
+
57
+ Average Accuracy $( A \in [ 0 , 1 ] )$ ) Average accuracy after the model has been trained continually with all the mini-batches up till task $k$ is defined as:
58
+
59
+ $$
60
+ A _ { k } = \frac { 1 } { k } \sum _ { j = 1 } ^ { k } a _ { k , B _ { k } , j }
61
+ $$
62
+
63
+ In particular, $A _ { T }$ is the average accuracy on all the tasks after the last task has been learned; this is the most commonly used metric used in LLL.
64
+
65
+ Forgetting Measure $( F \in [ - 1 , 1 ] )$ ) (Chaudhry et al., 2018) Average forgetting after the model has been trained continually with all the mini-batches up till task $k$ is defined as:
66
+
67
+ $$
68
+ F _ { k } = { \frac { 1 } { k - 1 } } \sum _ { j = 1 } ^ { k - 1 } f _ { j } ^ { k }
69
+ $$
70
+
71
+ where $f _ { j } ^ { k }$ is the forgetting on task $\cdot _ { j } ,$ after the model is trained with all the mini-batches up till task $k$ and computed as:
72
+
73
+ $$
74
+ f _ { j } ^ { k } = \operatorname* { m a x } _ { l \in \{ 1 , \cdots , k - 1 \} } a _ { l , B _ { l } , j } - a _ { k , B _ { k } , j }
75
+ $$
76
+
77
+ Measuring forgetting after all tasks have been learned is important for a two-fold reason. It quantifies the accuracy drop on past tasks, and it gives an indirect notion of how quickly a model may learn a new task, since a forgetful model will have little knowledge left to transfer, particularly so if the new task relates more closely to one of the very first tasks encountered during the learning experience.
78
+
79
+ Learning Curve Area $( \mathbf { L C A } \in [ 0 , 1 ] )$ ) Let us first define an average $b$ -shot performance (where $b$ is the mini-batch number) after the model has been trained for all the $T$ tasks as:
80
+
81
+ $$
82
+ Z _ { b } = \frac { 1 } { T } \sum _ { k = 1 } ^ { T } a _ { k , b , k }
83
+ $$
84
+
85
+ LCA at $\beta$ is the area of the convergence curve $Z _ { b }$ as a function of $b \in [ 0 , \beta ]$ :
86
+
87
+ $$
88
+ \mathrm { L C A } _ { \beta } = \frac { 1 } { \beta + 1 } \int _ { 0 } ^ { \beta } Z _ { b } d b = \frac { 1 } { \beta + 1 } \sum _ { b = 0 } ^ { \beta } Z _ { b }
89
+ $$
90
+
91
+ LCA has an intuitive interpretation. $\mathrm { L C A _ { 0 } }$ is the average 0-shot performance, the same as forward transfer in Lopez-Paz & Ranzato (2017). $\mathrm { L C A } _ { \beta }$ is the area under the $Z _ { b }$ curve, which is high if the 0-shot performance is good and if the learner learns quickly. In particular, there could be two models with the same $Z _ { \beta }$ or $A _ { T }$ , but very different $\mathrm { L C A } _ { \beta }$ because one learns much faster than the other while they both eventually obtain the same final accuracy. This metric aims at discriminating between these two cases, and it makes sense for relatively small values of $\beta$ since we are interested in models that learn from few examples.
92
+
93
+ # 4 AVERAGED GRADIENT EPISODIC MEMORY (A-GEM)
94
+
95
+ So far we discussed a better training and evaluation protocol for LLL and a new metric to measure the speed of learning. Next, we review GEM (Lopez-Paz & Ranzato, 2017), which is an algorithm that has been shown to work well in the single epoch setting. Unfortunately, GEM is very intensive in terms of computational and memory cost, which motivates our efficient variant, dubbed A-GEM. In Sec. 5, we will describe how compositional task descriptors can be leveraged to further speed up learning in the few shot regime.
96
+
97
+ GEM avoids catastrophic forgetting by storing an episodic memory $\mathcal { M } _ { k }$ for each task $k$ . While minimizing the loss on the current task $t$ , GEM treats the losses on the episodic memories of tasks $k \ < \ t$ , given by $\begin{array} { r l r } { \ell ( f _ { \theta } , { \mathcal M } _ { k } ) } & { = } & { \frac { 1 } { | { \mathcal M } _ { k } | } \sum _ { ( { \mathbf x } _ { i } , k , y _ { i } ) \in { \mathcal M } _ { k } } \ell ( f _ { \theta } ( { \mathbf x } _ { i } , k ) , y _ { i } ) } \end{array}$ , as inequality constraints, avoiding their increase but allowing their decrease. This effectively permits GEM to do positive backward transfer which other LLL methods do not support. Formally, at task $t$ , GEM solves for the following objective:
98
+
99
+ $$
100
+ \begin{array} { r l } { \mathrm { m i n i m i z e } _ { \theta } \quad \ell ( f _ { \theta } , \mathcal { D } _ { t } ) \quad \mathrm { s . t . } \quad \ell ( f _ { \theta } , \mathcal { M } _ { k } ) \leq \ell ( f _ { \theta } ^ { t - 1 } , \mathcal { M } _ { k } ) \qquad \forall k < t } \end{array}
101
+ $$
102
+
103
+ Where $f _ { \theta } ^ { t - 1 }$ is the network trained till task $t - 1$ . To inspect the increase in loss, GEM computes the angle between the loss gradient vectors of previous tasks $g _ { k }$ , and the proposed gradient update on the current task $g$ . Whenever the angle is greater than $9 0 ^ { \circ }$ with any of the $g _ { k }$ ’s, it projects the proposed gradient to the closest in L2 norm gradient $\tilde { g }$ that keeps the angle within the bounds. Formally, the optimization problem GEM solves is given by:
104
+
105
+ $$
106
+ \mathrm { m i n i m i z e } _ { \tilde { g } } \quad { \frac { 1 } { 2 } } | | g - \tilde { g } | | _ { 2 } ^ { 2 } \quad \mathrm { s . t . } \quad \langle \tilde { g } , g _ { k } \rangle \geq 0
107
+ $$
108
+
109
+ Eq.7 is a quadratic program (QP) in $P$ -variables (the number of parameters in the network), which for neural networks could be in millions. In order to solve this efficiently, GEM works in the dual space which results in a much smaller QP with only $t - 1$ variables:
110
+
111
+ $$
112
+ \mathrm { m i n i m i z e } _ { v } \quad { \frac { 1 } { 2 } } { v } ^ { \top } G G ^ { \top } v + g ^ { \top } G ^ { \top } v \quad \mathrm { s . t . } \quad v \geq 0
113
+ $$
114
+
115
+ where $G = - ( g _ { 1 } , \cdot \cdot \cdot , g _ { t - 1 } ) \in \mathbb { R } ^ { ( t - 1 ) \times P }$ is computed at each gradient step of training. Once the solution $v ^ { * }$ to Eq. 8 is found, the projected gradient update can be computed as $\tilde { g } = G ^ { \top } v ^ { * } + g$ .
116
+
117
+ While GEM has proven very effective in a single epoch setting (Lopez-Paz & Ranzato, 2017), the performance gains come at a big computational burden at training time. At each training step, GEM computes the matrix $G$ using all samples from the episodic memory, and it also needs to solve the QP of Eq. 8. Unfortunately, this inner loop optimization becomes prohibitive when the size of $\mathcal { M }$ and the number of tasks is large, see Tab. 7 in Appendix for an empirical analysis. To alleviate the computational burden of GEM, next we propose a much more efficient version of GEM, called Averaged GEM (A-GEM).
118
+
119
+ Whereas GEM ensures that at every training step the loss of each individual previous tasks, approximated by the samples in episodic memory, does not increase, A-GEM tries to ensure that at every training step the average episodic memory loss over the previous tasks does not increase. Formally, while learning task $t$ , the objective of A-GEM is:
120
+
121
+ $$
122
+ \operatorname { m i n i m i z e } _ { \boldsymbol { \theta } } \quad \ell ( f _ { \boldsymbol { \theta } } , \mathcal { D } _ { t } ) \quad \mathrm { s . t . } \quad \ell ( f _ { \boldsymbol { \theta } } , \mathcal { M } ) \leq \ell ( f _ { \boldsymbol { \theta } } ^ { t - 1 } , \mathcal { M } ) \qquad \mathrm { w h e r e ~ } \mathcal { M } = \cup _ { k < t } \mathcal { M } _ { k }
123
+ $$
124
+
125
+ The corresponding optimization problem reduces to:
126
+
127
+ $$
128
+ \mathrm { m i n i m i z e } _ { \tilde { g } } \quad \frac { 1 } { 2 } | | g - \tilde { g } | | _ { 2 } ^ { 2 } \quad \mathrm { s . t . } \quad \tilde { g } ^ { \top } g _ { r e f } \geq 0
129
+ $$
130
+
131
+ where $g _ { r e f }$ is a gradient computed using a batch randomly sampled from the episodic memory, $( \mathbf { x } _ { r e f } , y _ { r e f } ) \sim \mathcal { M }$ , of all the past tasks. In other words, A-GEM replaces the $t - 1$ constraints of GEM with a single constraint, where $g _ { r e f }$ is the average of the gradients from the previous tasks computed from a random subset of the episodic memory.
132
+
133
+ The constrained optimization problem of Eq. 10 can now be solved very quickly; when the gradient $g$ violates the constraint, it is projected via:
134
+
135
+ $$
136
+ \tilde { g } = g - \frac { g ^ { \top } g _ { r e f } } { g _ { r e f } ^ { \top } g _ { r e f } } g _ { r e f }
137
+ $$
138
+
139
+ The formal proof of the update rule of A-GEM (Eq. 11) is given in Appendix C. This makes A-GEM not only memory efficient, as it does not need to store the matrix $G$ , but also orders of magnitude faster than GEM because 1) it is not required to compute the matrix $G$ but just the gradient of a random subset of memory examples, 2) it does not need to solve any QP but just an inner product, and 3) it will incur in less violations particularly when the number of tasks is large (see Tab. 7 and Fig. 6 in Appendix for empirical evidence). All together these factors make A-GEM faster while not hampering its good performance in the single pass setting.
140
+
141
+ Intuitively, the difference between GEM and A-GEM loss functions is that GEM has better guarantess in terms of worst-case forgetting of each individual task since (at least on the memory examples) it prohibits an increase of any task-specific loss, while A-GEM has better guaratees in terms of average accuracy since GEM may prevent a gradient step because of a task constraint violation although the overall average loss may actually decrease, see Appendix Sec. D.1 and D.2 for further analysis and empirical evidence. The pseudo-code of A-GEM is given in Appendix Alg. 2.
142
+
143
+ # 5 JOINT EMBEDDING MODEL USING COMPOSITIONAL TASK DESCRIPTORS
144
+
145
+ In this section, we discuss how we can improve forward transfer for all the LLL methods including A-GEM. In order to speed up learning of a new task, we consider the use of compositional task descriptors where components are shared across tasks and thus allow transfer. Examples of compositional task descriptors are, for instance, a natural language description of the task under consideration or a matrix specifying the attribute values of the objects to be recognized in the task. In our experiments, we use the latter since it is provided with popular benchmark datasets (Wah et al., 2011; Lampert et al., 2009). For instance, if the model has already learned and remembers about two independent properties (e.g., color of feathers and shape of beak), it can quickly recognize a new class provided a descriptor specifying the values of its attributes (yellow feathers and red beak), although this is an entirely unseen combination.
146
+
147
+ Borrowing ideas from literature in few-shot learning (Lampert et al., 2014; Zhang et al., 2018; Elhoseiny et al., 2017; Xian et al., 2018), we learn a joint embedding space between image features and the attribute embeddings. Formally, let $\mathbf { x } ^ { k } \in \breve { \mathcal { X } }$ be the input (e.g., an image), $t ^ { k }$ be the task descriptor in the form of a matrix of size $C _ { k } \times A$ , where $C _ { k }$ is the number of classes in the $k$ - th task and $A$ is the total number of attributes for each class in the dataset. The joint embedding model consists of a feature extraction module, $\phi _ { \theta } : \mathbf { x } ^ { k } \phi _ { \theta } ( \mathbf { x } ^ { k } )$ , where $\phi _ { \theta } ( \mathbf { x } ^ { k } ) \doteq \mathbb { R } ^ { D }$ , and a task embedding module, $\psi _ { \omega } : t ^ { k } \to \psi _ { \omega } ( t ^ { k } )$ , where $\psi _ { \omega } ( t ^ { k } ) \in \mathbb { R } ^ { C _ { k } \times D }$ . In this work, $\phi _ { \theta } ( . )$ is implemented as a standard multi-layer feed-forward network (see Sec. 6 for the exact parameterization), whereas $\psi _ { \omega } ( . )$ is implemented as a parameter matrix of dimensions $A \times D$ . This matrix can be interpreted as an attribute look-up table as each attribute is associated with a $D$ dimensional vector, from which a class embedding vector is constructed via a linear combination of the attributes present in the class; the task descriptor embedding is then the concatenation of the embedding vectors of the classes present in the task (see Appendix Fig. 9 for the pictorial description of the joint embedding model). During training, the parameters $\theta$ and $\omega$ are learned by minimizing the cross-entropy loss:
148
+
149
+ $$
150
+ \ell _ { k } ( \theta , \omega ) = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } - \log ( p ( y _ { i } ^ { k } | \mathbf { x } _ { i } ^ { k } , t ^ { k } ; \theta , \omega ) )
151
+ $$
152
+
153
+ where $( \mathbf { x } _ { i } ^ { k } , t ^ { k } , y _ { i } ^ { k } )$ is the $i$ -th example of task $k$ . If $y _ { i } ^ { k } = c$ , then the distribution $p ( . )$ is given by:
154
+
155
+ $$
156
+ p ( c | \mathbf { x } _ { i } ^ { k } , t ^ { k } ; \theta , \omega ) = \frac { \exp ( [ \phi _ { \theta } ( \mathbf { x } _ { i } ^ { k } ) \psi _ { \omega } ( t ^ { k } ) ^ { \top } ] _ { c } ) } { \sum _ { j } \exp ( [ \phi _ { \theta } ( \mathbf { x } _ { i } ^ { k } ) \psi _ { \omega } ( t ^ { k } ) ^ { \top } ] _ { j } ) }
157
+ $$
158
+
159
+ where $[ a ] _ { i }$ denotes the $i$ -th element of the vector $a$ . Note that the architecture and loss functions are general, and apply not only to A-GEM but also to any other LLL model (e.g., regularization based approaches). See Sec. 6 for the actual choice of parameterization of these functions.
160
+
161
+ # 6 EXPERIMENTS
162
+
163
+ We consider four dataset streams, see Tab.1 in Appendix Sec. A for a summary of the statistics. Permuted MNIST (Kirkpatrick et al., 2016) is a variant of MNIST (LeCun, 1998) dataset of handwritten digits where each task has a certain random permutation of the input pixels which is applied to all the images of that task. Split CIFAR (Zenke et al., 2017) consists of splitting the original CIFAR-100 dataset (Krizhevsky & Hinton, 2009) into 20 disjoint subsets, where each subset is constructed by randomly sampling 5 classes without replacement from a total of 100 classes. Similarly to Split CIFAR, Split CUB is an incremental version of the fine-grained image classification dataset CUB (Wah et al., 2011) of 200 bird categories split into 20 disjoint subsets of classes. Split AWA, on the other hand, is the incremental version of the AWA dataset (Lampert et al., 2009) of 50 animal categories, where each task is constructed by sampling 5 classes with replacement from the total 50 classes, constructing 20 tasks. In this setting, classes may overlap among multiple tasks, but within each task they compete against different set of classes. Note that to make sure each training example is only seen once, the training data of a each class is split into disjoint sets depending on the frequency of its occurrence in different tasks. For Split AWA, the classifier weights of each class are randomly initialized within each head without any transfer from the previous occurrence of the class in past tasks. Finally, while on Permuted MNIST and Split CIFAR we provide integer task descriptors, on Split CUB and Split AWA we stack together the attributes of the classes (specifying for instance the type of beak, the color of feathers, etc.) belonging to the current task to form a descriptor.
164
+
165
+ In terms of architectures, we use a fully-connected network with two hidden layers of 256 ReLU units each for Permuted MNIST, a reduced ResNet18 for Split CIFAR like in Lopez-Paz & Ranzato (2017), and a standard ResNet18 (He et al., 2016) for Split CUB and Split AWA. For a given dataset stream, all models use the same architecture, and all models are optimized via stochastic gradient descent with mini-batch size equal to 10. We refer to the joint-embedding model version of these models by appending the suffix ‘-JE’ to the method name.
166
+
167
+ As described in Sec. 2 and outlined in Alg. 1, in order to cross validate we use the first 3 tasks, and then report metrics on the remaining 17 tasks after doing a single training pass over each task in sequence.
168
+
169
+ Lastly, we compared A-GEM against several baselines and state-of-the-art LLL approaches which we describe next. VAN is a single supervised learning model, trained continually without any regularization, with the parameters of a new task initialized from the parameters of the previous task. ICARL (Rebuffi et al., 2017) is a class-incremental learner that uses nearest-exemplar-based classifier and avoids catastrophic forgetting by regularizing over the feature representation of previous tasks using a knowledge distillation loss. EWC (Kirkpatrick et al., 2016), PI (Zenke et al., 2017), RWALK (Chaudhry et al., 2018) and MAS (Aljundi et al., 2018) are regularization-based approaches aiming at avoiding catastrophic forgetting by limiting learning of parameters critical to the performance of past tasks. Progressive Networks (PROG-NN) (Rusu et al., 2016) is a modular approach whereby a new “column” with lateral connections to previous hidden layers is added once a new task arrives. GEM (Lopez-Paz & Ranzato, 2017) described in Sec. 4 is another natural baseline of comparison since A-GEM builds upon it. The amount of episodic memory per task used in ICARL, GEM and A-GEM is set to 250, 65, 50, and 100, and the batch size for the computation of $g _ { r e f }$ (when the episodic memory is sufficiently filled) in A-GEM is set to 256, 1300, 128 and 128 for MNIST, CIFAR, CUB and AWA, respectively. While populating episodic memory, the samples are chosen uniformly at random for each task. Whereas the network weights are randomly initialized for MNIST, CIFAR and AWA, on the other hand, for CUB, due to the small dataset size, a pre-trained ImageNet model is used. Finally, we consider a multi-task baseline, MULTI-TASK, trained on a single pass over shuffled data from all tasks, and thus violating the LLL assumption. It can be seen as an upper bound performance for average accuracy.
170
+
171
+ ![](images/a31e6bf25bbad1939f9629625b6552c2c4dbdd7c2ef233a6d338f91dad450e7d.jpg)
172
+ Figure 1: Performance of LLL models across different measures on Permuted MNIST and Split CIFAR. For Accuracy $( A _ { T } )$ and Learning Curve Measure $( L C A _ { 1 0 } )$ the higher the number (indicated by ↑) the better is the model. For Forgetting $( F _ { T } )$ , Time and Memory the lower the number (indicated by ↓) the better is the model. For Time and Memory, the method with the highest complexity is taken as a reference (value of 1) and the other methods are reported relative to that method. $A _ { T }$ , $F _ { T }$ and $L C A _ { 1 0 }$ values and confidence intervals are computed over 5 runs. A-GEM provides the best trade-off across different measures and dimensions. Other baselines are given in Tab. 4 and 7 in the Appendix, which are used to generate the plots.
173
+
174
+ ![](images/0f15052f26c48ea5e8fb8a44697683e3f4cbc6cac5cbe875b9ac04917901f715.jpg)
175
+ Figure 2: Performance of LLL models across different measures on Split CUB and Split AWA. On both the datasets, PROG-NN runs out of memory. The memory and time complexities of joint embedding models are the same as those of the corresponding standard models and are hence omitted. $A _ { T }$ , $F _ { T }$ and $L C A _ { 1 0 }$ values and confidence intervals are computed over 10 runs. Other baselines are given in Tab. 5, 6 and 7 in the Appendix, which are used to generate the plots.
176
+
177
+ # 6.1 RESULTS
178
+
179
+ Fig. 1 and 2 show the overall results on all the datasets we considered (for brevity we show only representative methods, see detailed results in Appendix Tab. 4, 5, 6 and 7). First, we observe that A-GEM achieves the best average accuracy on all datasets, except Permuted MNIST, where PROGNN works better. The reason is because on this dataset each task has a large number of training examples, which enables PROG-NN to learn its task specific parameters and to leverage its lateral connections. However, notice how PROG-NN has the worst memory cost by the end of training - as its number of parameters grows super-linearly with the number of tasks. In particular, in large scale setups (Split CUB and AWA), PROG-NN runs out of memory during training due to its large size. Also, PROG-NN does not learn well on datasets where tasks have fewer training examples. Second, A-GEM and GEM perform comparably in terms of average accuracy, but A-GEM has much lower time (about 100 times faster) and memory cost (about 10 times lower), comparable to regularizationbased approaches like EWC. Third, EWC and similar methods perform only slightly better than VAN on this single pass LLL setting. The analysis in Appendix Sec. F demonstrates that EWC requires several epochs and over-parameterized architectures in order to work well. Fourth, PROG-NN has no forgetting by construction and A-GEM and GEM have the lowest forgetting among methods that use a fixed capacity architecture. Next, all methods perform similarly in terms of LCA, with PROGNN being the worst because of its ever growing number of parameters and A-GEM slightly better than all the other approaches. And finally, the use of task descriptors improves average accuracy across the board as shown in Fig.2, with A-GEM a bit better than all the other methods we tried. All joint-embedding models using task descriptors have better LCA performance, although this is the same across all methods including A-GEM. Overall, we conclude that A-GEM offers the best trade-off between average accuracy performance and efficiency in terms of sample, memory and computational cost.
180
+
181
+ ![](images/0f85b86c3a7876b61b6b28dafe04a4b9ee8e26dbba4d681da496e91770e9fb61.jpg)
182
+ Figure 3: Top Row: Evolution of average accuracy $( A _ { k } )$ as new tasks are learned. Bottom Row: Evolution of LCA during the first ten mini-batches.
183
+
184
+ ![](images/04b36ea073776c12611d463920ed118425e1c1e24720ca913773729b6ef66f68.jpg)
185
+ Figure 4: Evolution of LCA during the first ten mini-batches.
186
+
187
+ Fig. 3 shows a more fine-grained analysis and comparison with more methods on Permuted MNIST and Split CIFAR. The average accuracy plots show how A-GEM and GEM greatly outperform other approaches, with the exception of PROG-NN on MNIST as discussed above. On different datasets, different methods are best in terms of LCA, although A-GEM is always top-performing. Fig. 4 shows in more detail the gain brought by task descriptors which greatly speed up learning in the few-shot regime. On these datasets, A-GEM performs the best or on par to the best.
188
+
189
+ ![](images/94132bf2931f255a034e2078abe892843bd98492500194e4837678d985acf63d.jpg)
190
+ Figure 5: Evolution of zero-shot performance as the learner sees new tasks on Split CUB and Split AWA datasets.
191
+
192
+ Finally, in Fig. 5, we report the 0-shot performance of LLL methods on Split CUB and Split AWA datasets over time, showing a clear advantage of using compositional task descriptors with joint embedding models, which is more significant for A-GEM. Interestingly, the zero-shot learning performance of joint embedding models improves over time, indicating that these models get better at forward transfer or, in other words, become more efficient over time.
193
+
194
+ # 7 RELATED WORK
195
+
196
+ Continual (Ring, 1997) or Lifelong Learning (LLL) (Thrun, 1998) have been the subject of extensive study over the past two decades. One approach to LLL uses modular compositional models (Fernando et al., 2017; Aljundi et al., 2017; Rosenbaum et al., 2018; Chang et al., 2018; Xu & Zhu, 2018; Ferran Alet, 2018), which limit interference among tasks by using different subset of modules for each task. Unfortunately, these methods require searching over the space of architectures which is not sample efficient with current methods. Another approach is to regularize parameters important to solve past tasks (Kirkpatrick et al., 2016; Zenke et al., 2017; Chaudhry et al., 2018), which has been proven effective for over-parameterized models in the multiple epoch setting (see Appendix Sec. F), while we focus on learning from few examples using memory efficient models. Methods based on episodic memory (Rebuffi et al., 2017; Lopez-Paz & Ranzato, 2017) require a little bit more memory at training time but can work much better in the single pass setting we considered (Lopez-Paz & Ranzato, 2017).
197
+
198
+ The use of task descriptors for LLL has already been advocated by Isele et al. (2016) but using a sparse coding framework which is not obviously applicable to deep nets in a computationally efficient way, and also by Lopez-Paz & Ranzato (2017) although they did not explore the use of compositional descriptors. More generally, tasks descriptors have been used in Reinforcement Learning with similar motivations by several others (Sutton et al., 2011; Schaul et al., 2015; Baroni et al., 2017), and it is also a key ingredient in all the zero/few-shot learning algorithms (Lampert et al., 2014; Xian et al., 2018; Elhoseiny et al., 2017; Wah et al., 2011; Lampert et al., 2009).
199
+
200
+ # 8 CONCLUSION
201
+
202
+ We studied the problem of efficient Lifelong Learning (LLL) in the case where the learner can only do a single pass over the input data stream. We found that our approach, A-GEM, has the best tradeoff between average accuracy by the end of the learning experience and computational/memory cost. Compared to the original GEM algorithm, A-GEM is about 100 times faster and has 10 times less memory requirements; compared to regularization based approaches, it achieves significantly higher average accuracy. We also demonstrated that by using compositional task descriptors all methods can improve their few-shot performance, with A-GEM often being the best.
203
+
204
+ Our detailed experiments reported in Appendix E also show that there is still a substantial performance gap between LLL methods, including A-GEM, trained in a sequential learning setting and the same network trained in a non-sequential multi-task setting, despite seeing the same data samples. Moreover, while task descriptors do help in the few-shot learning regime, the LCA performance gap between different methods is very small; suggesting a poor ability of current methods to transfer knowledge even when forgetting has been eliminated. Addressing these two fundamental issues will be the focus of our future research.
205
+
206
+ # REFERENCES
207
+
208
+ Rahaf Aljundi, Punarjay Chakravarty, and Tinne Tuytelaars. Expert gate: Lifelong learning with a network of experts. In CVPR, pp. 7120–7129, 2017.
209
+
210
+ Rahaf Aljundi, Francesca Babiloni, Mohamed Elhoseiny, Marcus Rohrbach, and Tinne Tuytelaars. Memory aware synapses: Learning what (not) to forget. In ECCV, 2018.
211
+
212
+ Marco Baroni, Armand Joulin, Allan Jabri, German Kruszewski, Angeliki Lazaridou, Klemen Si- \` monic, and Tomas Mikolov. Commai: Evaluating the first steps towards a useful general ai. arXiv preprint arXiv:1701.08954, 2017.
213
+
214
+ Michael Chang, Abhishek Gupta, Sergey Levine, and Thomas L. Griffiths. Automatically composing representation transformations as a means for generalization. In ICML workshop Neural Abstract Machines and Program Induction v2, 2018.
215
+
216
+ Arslan Chaudhry, Puneet K Dokania, Thalaiyasingam Ajanthan, and Philip HS Torr. Riemannian walk for incremental learning: Understanding forgetting and intransigence. In ECCV, 2018.
217
+
218
+ Mohamed Elhoseiny, Ahmed Elgammal, and Babak Saleh. Write a classifier: Predicting visual classifiers from unstructured text. IEEE TPAMI, 39(12):2539–2553, 2017.
219
+
220
+ Chrisantha Fernando, Dylan Banarse, Charles Blundell, Yori Zwols, David Ha, Andrei A Rusu, Alexander Pritzel, and Daan Wierstra. Pathnet: Evolution channels gradient descent in super neural networks. arXiv preprint arXiv:1701.08734, 2017.
221
+
222
+ Leslie P. Kaelbling Ferran Alet, Tomas Lozano-Perez. Modular meta-learning. arXiv preprint arXiv:1806.10166v1, 2018.
223
+
224
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016.
225
+
226
+ David Isele, Mohammad Rostami, and Eric Eaton. Using task features for zero-shot knowledge transfer in lifelong learning. In Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI’16, pp. 1620–1626. AAAI Press, 2016. ISBN 978-1-57735-770- 4.
227
+
228
+ James Kirkpatrick, Razvan Pascanu, Neil C. Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences of the United States of America (PNAS), 2016.
229
+
230
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. https://www.cs.toronto.edu/ kriz/cifar.html, 2009.
231
+
232
+ Christoph H Lampert, Hannes Nickisch, and Stefan Harmeling. Learning to detect unseen object classes by between-class attribute transfer. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 951–958. IEEE, 2009.
233
+
234
+ Christoph H Lampert, Hannes Nickisch, and Stefan Harmeling. Attribute-based classification for zero-shot visual object categorization. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(3):453–465, 2014.
235
+
236
+ Yann LeCun. The mnist database of handwritten digits. http://yann.lecun.com/exdb/mnist/, 1998.
237
+
238
+ David Lopez-Paz and Marc’Aurelio Ranzato. Gradient episodic memory for continuum learning. In NIPS, 2017.
239
+
240
+ Cuong V Nguyen, Yingzhen Li, Thang D Bui, and Richard E Turner. Variational continual learning. ICLR, 2018.
241
+
242
+ S-V. Rebuffi, A. Kolesnikov, and C. H. Lampert. iCaRL: Incremental classifier and representation learning. In CVPR, 2017.
243
+
244
+ Mark B Ring. Child: A first step towards continual learning. Machine Learning, 28(1):77–104, 1997.
245
+
246
+ Clemens Rosenbaum, Tim Klinger, and Matthew Riemer. Routing networks: Adaptive selection of non-linear functions for multi-task learning. In International Conference on Learning Representations, 2018.
247
+
248
+ Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016.
249
+
250
+ T. Schaul, D. Horgan, K. Gregor, and D. Silver. Universal value function approximators. ICML, 2015.
251
+
252
+ Jonathan Schwarz, Jelena Luketina, Wojciech M. Czarnecki, Agnieszka Grabska-Barwinska, Yee Whye Teh, Razvan Pascanu, and Raia Hadsell. Progress and compress: A scalable framework for continual learning. In International Conference in Machine Learning, 2018.
253
+
254
+ Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. Continual learning with deep generative replay. In NIPS, 2017.
255
+
256
+ R. S. Sutton, J. Modayil, M. Delp, T. Degris, P. M. Pilarski, A. White, and D. Precup. Horde: A scalable real-time architecture for learning knowledge from unsupervised sensorimotor interaction. The 10th International Conference on Autonomous Agents and Multiagent Systems, 2011.
257
+
258
+ Sebastian Thrun. Lifelong learning algorithms. In Learning to learn, pp. 181–209. Springer, 1998.
259
+
260
+ C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie. The caltech-ucsd birds-200-2011 dataset. Technical Report CNS-TR-2011-001, California Institute of Technology, 2011.
261
+
262
+ Yongqin Xian, Christoph H Lampert, Bernt Schiele, and Zeynep Akata. Zero-shot learning-a comprehensive evaluation of the good, the bad and the ugly. IEEE transactions on pattern analysis and machine intelligence, 2018.
263
+
264
+ Ju Xu and Zhanxing Zhu. Reinforced continual learning. In arXiv preprint arXiv:1805.12369v1, 2018.
265
+
266
+ F. Zenke, B. Poole, and S. Ganguli. Continual learning through synaptic intelligence. In ICML, 2017.
267
+
268
+ Ji Zhang, Yannis Kalantidis, Marcus Rohrbach, Manohar Paluri, Ahmed Elgammal, and Mohamed Elhoseiny. Large-scale visual relationship understanding. arXiv preprint arXiv:1804.10660, 2018.
269
+
270
+ # APPENDIX
271
+
272
+ In Sec. A we report the summary of datasets used for the experiments. Sec. B details our A-GEM algorithm and Sec. C provides the proof of update rule of A-GEM discussed in Sec. 4 of the main paper. In Sec. D, we analyze the differences between A-GEM and GEM, and describe another variation of GEM, dubbed Stochastic GEM (S-GEM). The detailed results of the experiments which were used to generate Fig 1 and 2 in the main paper are given in Sec. E. In Sec. F, we provide empirical evidence to the conjecture that regularization-based approaches like EWC require over-parameterized architectures and multiple passes over data in order to perform well as discussed in the Sec. 6.1 of the main paper. In Sec. G, we provide the grid used for the cross-validation of different hyperparameters and report the optimal values for different models. Finally, in Sec. H, we pictorially describe the joint embedding model discussed in Sec. 5.
273
+
274
+ # A DATASET STATISTICS
275
+
276
+ Table 1: Dataset statistics.
277
+
278
+ <table><tr><td></td><td>Perm.MNIST</td><td>Split CIFAR</td><td>Split CUB</td><td>Split AWA</td></tr><tr><td>num.of tasks</td><td>20</td><td>20</td><td>20</td><td>20</td></tr><tr><td>input size</td><td>1×28×28</td><td>3×32×32</td><td>3×224×224</td><td>3×224×224</td></tr><tr><td>num. of classes per task</td><td>10</td><td>5</td><td>10</td><td>5</td></tr><tr><td>num.of training images per task</td><td>60000</td><td>2500</td><td>300</td><td>1</td></tr><tr><td>num.of test images per task</td><td>10000</td><td>500</td><td>290</td><td>560</td></tr></table>
279
+
280
+ # B A-GEM ALGORITHM
281
+
282
+ # Algorithm 2 Training and evaluation of A-GEM on sequential data $\mathcal { D } = \{ \mathcal { D } _ { 1 } , \cdot \cdot \cdot , \mathcal { D } _ { T } \}$
283
+
284
+ 1: procedure TRAIN(fθ, Dtrain, Dtest)
285
+ 2: M ← {}
286
+ 3: A ← 0 ∈ RT ×T
287
+ 4: for $t = \{ 1 , \cdots , T \}$ do
288
+ 5: for $( \mathbf { x } , y ) \in \mathcal { D } _ { t } ^ { t r a i n }$ do
289
+ 6: $( \mathbf { x } _ { r e f } , y _ { r e f } ) \sim \mathcal { M }$
290
+ 7: $g _ { r e f } \gets \nabla _ { \theta } \ell ( f _ { \theta } ( \mathbf { x } _ { r e f } , t ) , y _ { r e f } )$
291
+ 8: g ← ∇θ\`(fθ(x, t), y)
292
+ 9: if g>gref ≥ 0 then
293
+ 10: g˜ ← g
294
+ 11: else
295
+ 12: 13: g˜ ← g $\begin{array} { r } { \tilde { g } \gets g - \frac { g ^ { \top } g _ { r e f } } { g _ { r e f } ^ { \top } g _ { r e f } } } { g _ { r e f } g _ { r e f } } \end{array}$
296
+ 14: θ ← θ − αg˜
297
+ 15: end for
298
+ 16: M ← UPDATEEPSMEM(M, Dtraint , T )
299
+ 17: At,: ← EVAL(fθ, Dtest)
300
+ 18: end for
301
+ 19: return $f _ { \theta , A }$
302
+ 20: end procedure
303
+ 1: procedure EVAL(fθ, Dtest)
304
+ 2: a ← 0 ∈ RT
305
+ 3: for t = {1, · · · , T } do
306
+ 4: at ← 0
307
+ 5: for (x, y) ∈ Dtestt do
308
+ 6: at ← at + ACCURACY(fθ(x, t), y)
309
+ 7: end for
310
+ 8: $\begin{array} { r } { a _ { t } \gets \frac { a _ { t } } { l e n ( \mathcal { D } _ { t } ^ { t e s t } ) } } \end{array}$
311
+ 9: end for
312
+ 10: return $a$
313
+ 11: end procedure
314
+ 1: procedure UPDATEEPSMEM $\mathsf { \Omega } _ { [ } ( \mathcal { M } , \mathcal { D } _ { t } , T )$
315
+ 2: $s { \frac { \vert { \mathcal { M } } \vert } { T } }$
316
+ 3: for i = {1, · · · , s} do
317
+ 4: (x, y) ∼ Dt
318
+ 5: M ← (x, y)
319
+ 6: end for
320
+ 7: return $\mathcal { M }$
321
+ 8: end procedure
322
+
323
+ # C A-GEM UPDATE RULE
324
+
325
+ Here we provide the proof of the update rule of A-GEM (Eq. 11), $\begin{array} { r } { \tilde { g } = g - \frac { g ^ { \top } g _ { r e f } } { g _ { r e f } ^ { \top } g _ { r e f } } g _ { r e f } } \end{array}$ − g grefg> gref gref , stated in Sec. 4 of the main paper.
326
+
327
+ Proof. The optimization objective of A-GEM as described in the Eq. 10 of the main paper, is:
328
+
329
+ $$
330
+ \begin{array} { r l } { \operatorname* { m i n i m i z e } _ { \tilde { g } } } & { \frac { 1 } { 2 } | | g - \tilde { g } | | _ { 2 } ^ { 2 } } \\ { \mathrm { s . t . } } & { \tilde { g } ^ { \top } g _ { r e f } \geq 0 } \end{array}
331
+ $$
332
+
333
+ Replacing $\tilde { g }$ with $z$ and rewriting Eq. 14 yields:
334
+
335
+ $$
336
+ \begin{array} { r l } { \operatorname * { m i n i m i z e } _ { z } } & { { } \frac { 1 } { 2 } z ^ { \top } z - g ^ { \top } z } \\ { \mathrm { s . t . } } & { { } - z ^ { \top } g _ { r e f } \leq 0 } \end{array}
337
+ $$
338
+
339
+ Note that we discard the term $g ^ { \intercal } g$ from the objective and change the sign of the inequality constraint. The Lagrangian of the constrained optimization problem defined above can be written as:
340
+
341
+ $$
342
+ \mathcal { L } ( z , \alpha ) = \frac { 1 } { 2 } z ^ { \top } z - g ^ { \top } z - \alpha z ^ { \top } g _ { r e f }
343
+ $$
344
+
345
+ Now, we pose the dual of Eq. 16 as:
346
+
347
+ $$
348
+ \theta _ { \mathcal D } ( \alpha ) = \operatorname* { m i n } _ { z } \mathcal L ( z , \alpha )
349
+ $$
350
+
351
+ Lets find the value $z ^ { * }$ that minimizes the $\mathcal { L } ( z , \alpha )$ by setting the derivatives of $\mathcal { L } ( z , \alpha )$ w.r.t. to $z$ to zero:
352
+
353
+ $$
354
+ \begin{array} { r } { \nabla _ { z } \mathcal { L } ( z , \alpha ) = 0 } \\ { z ^ { * } = g + \alpha g _ { r e f } } \end{array}
355
+ $$
356
+
357
+ The simplified dual after putting the value of $z ^ { * }$ in Eq. 17 can be written as:
358
+
359
+ $$
360
+ \begin{array} { l } { { \displaystyle \theta _ { D } ( \alpha ) = \frac { 1 } { 2 } ( g ^ { \top } g + 2 \alpha g ^ { \top } g _ { r e f } + \alpha ^ { 2 } g _ { r e f } ^ { \top } g _ { r e f } ) - g ^ { \top } g - 2 \alpha g ^ { \top } g _ { r e f } - \alpha ^ { 2 } g _ { r e f } ^ { \top } g _ { r e f } } } \\ { { \displaystyle \quad \quad = - \frac { 1 } { 2 } g ^ { \top } g - \alpha g ^ { \top } g _ { r e f } - \frac { 1 } { 2 } \alpha ^ { 2 } g _ { r e f } ^ { \top } g _ { r e f } } } \end{array}
361
+ $$
362
+
363
+ The solution $\begin{array} { r } { \alpha ^ { * } = \operatorname* { m a x } _ { \alpha ; \alpha > 0 } \theta _ { \mathcal { D } } ( \alpha ) } \end{array}$ to the dual is given by:
364
+
365
+ $$
366
+ \begin{array} { r } { \nabla _ { \alpha } \theta _ { \mathcal { D } } ( \alpha ) = 0 } \\ { \alpha ^ { * } = - \frac { g ^ { \top } g _ { r e f } } { g _ { r e f } ^ { \top } g _ { r e f } } } \end{array}
367
+ $$
368
+
369
+ By putting $\alpha ^ { * }$ in Eq. 18, we recover the A-GEM update rule:
370
+
371
+ $$
372
+ z ^ { * } = g - \frac { g ^ { \top } g _ { r e f } } { g _ { r e f } ^ { \top } g _ { r e f } } g _ { r e f } = \tilde { g }
373
+ $$
374
+
375
+ # D ANALYSIS OF GEM AND A-GEM
376
+
377
+ In this section, we empirically analyze the differences between A-GEM and GEM, and report experiments with another computationally efficient but worse performing version of GEM.
378
+
379
+ # D.1 FREQUENCY OF CONSTRAINT VIOLATIONS
380
+
381
+ Fig. 6 shows the frequency of constraint violations (see Eq. 8 and 10) on Permuted MNIST and Split CIFAR datasets. Note that, the number of gradient updates (training steps) per task on MNIST and CIFAR are 5500 and 250, respectively. As the number of tasks increase, GEM violates the optimization constraints at almost each training step, whereas A-GEM plateaus to a much lower value. Therefore, the computational efficiency of A-GEM not only stems from the fact that it avoids solving a QP at each training step (which is much more expensive than a simple inner product) but also from the fewer number of constraint violations. From the figure, we can also infer that as the number of tasks grows the gap between GEM and A-GEM would grow further. Thus, the computational and memory overhead of GEM over A-GEM, see also Tab. 7, gets worse as the number of tasks increases.
382
+
383
+ ![](images/11de576c0a305ef6ed772507c504abd22d6213a6852c5a81bd046c65745080d4.jpg)
384
+ Figure 6: Number of constraint violations in GEM and A-GEM on Permuted MNIST and Split CIFAR as new tasks are learned.
385
+
386
+ D.2 AVERAGE ACCURACY AND WORST-CASE FORGETTING
387
+
388
+ In Tab. 2, we empirically demonstrate the different properties induced by the objective functions of GEM and A-GEM. GEM enjoys lower worst-case task forgetting while A-GEM enjoys better overall average accuracy. This is particularly true on the training examples stored in memory, as on the test set the result is confounded by the generalization error.
389
+
390
+ Table 2: Comparison of average accuracy $( A _ { T } )$ and worst-case forgetting $( F _ { w s t } )$ on the Episodic Memory $( \mathcal { M } )$ and Test Set $( \mathcal { D } ^ { \check { E } V } )$ .
391
+
392
+ <table><tr><td>Methods</td><td colspan="4">MNIST</td><td colspan="4">CIFAR</td></tr><tr><td rowspan="2"></td><td colspan="2">M</td><td colspan="2">DEV</td><td colspan="2">M</td><td colspan="2">DEV</td></tr><tr><td>AT</td><td>Fwst</td><td>AT</td><td>Fwst</td><td>Ar</td><td>Fwst</td><td>AT</td><td>Fwst</td></tr><tr><td>GEM</td><td>99.5</td><td>0</td><td>89.5</td><td>0.10</td><td>97.1</td><td>0.05</td><td>61.2</td><td>0.14</td></tr><tr><td>A-GEM</td><td>99.3</td><td>0.008</td><td>89.1</td><td>0.13</td><td>72.1</td><td>0.15</td><td>62.3</td><td>0.15</td></tr></table>
393
+
394
+ # D.3 STOCHASTIC GEM (S-GEM)
395
+
396
+ In this section we report experiments with another variant of GEM, dubbed Stochastic GEM (SGEM). The main idea in S-GEM is to randomly sample one constraint, at each training step, from the possible $t - 1$ constraints of GEM. If that constraint is violated, the gradient is projected only taking into account that constraint. Formally, the optimization objective of S-GEM is given by:
397
+
398
+ $$
399
+ \begin{array} { r l } { \operatorname * { m i n i m i z e } _ { \tilde { g } } } & { \displaystyle \frac { 1 } { 2 } | | g - \tilde { g } | | _ { 2 } ^ { 2 } } \\ { \mathrm { s . t . } } & { \langle \tilde { g } , g _ { k } \rangle \geq 0 \quad \mathrm { w h e r e } \ k \sim \{ 1 , \cdots , t - 1 \} } \end{array}
400
+ $$
401
+
402
+ In other words, at each training step, S-GEM avoids the increase in loss of one of the previous tasks sampled randomly. In Tab. 3 we report the comparison of GEM, S-GEM and A-GEM on Permuted MNIST and Split CIFAR.
403
+
404
+ Although, S-GEM is closer in spirit to GEM, as it requires randomly sampling one of the GEM constraints to satisfy, compared to A-GEM, which defines the constraint as the average gradient of the previous tasks, it perform slightly worse than GEM, as can be seen from Tab. 3.
405
+
406
+ Table 3: Comparison of different variations of GEM on MNIST Permutations and Split CIFAR.
407
+
408
+ <table><tr><td>Methods</td><td colspan="2">Permuted MNIST</td><td colspan="2">Split CIFAR</td></tr><tr><td></td><td>Ar(%)</td><td>FT</td><td>Ar(%)</td><td>FT</td></tr><tr><td>GEM</td><td>89.5</td><td>0.06</td><td>61.2</td><td>0.06</td></tr><tr><td>S-GEM</td><td>88.2</td><td>0.08</td><td>56.2</td><td>0.12</td></tr><tr><td>A-GEM</td><td>89.1</td><td>0.06</td><td>62.3</td><td>0.07</td></tr></table>
409
+
410
+ # E RESULT TABLES
411
+
412
+ In Tab. 4, 5, 6 and 7 we report the detailed results which were used to generate Fig.1 and 2.
413
+
414
+ Table 4: Comparison with different baselines on Permuted MNIST and Split CIFAR. The value of $\infty$ is assigned to a metric when the model fails to train with the cross-validated values of hyperparameters found on the subset of the tasks as discussed in Sec. 2 of the main paper. The numbers are averaged across 5 runs using a different seed each time. The results from this table are used to generate Fig 1 in Sec. 6.1 of the main paper.
415
+
416
+ <table><tr><td>Methods</td><td colspan="3">Permuted MNIST</td><td colspan="3">Split CIFAR</td></tr><tr><td></td><td>Ar(%)</td><td>FT</td><td>LCA10</td><td>Ar(%)</td><td>FT</td><td>LCA10</td></tr><tr><td>VAN</td><td>47.9 (± 1.32)</td><td>0.51 (± 0.01)</td><td>0.26 (± 0.006)</td><td>42.9 (± 2.07)</td><td>0.25 (± 0.03)</td><td>0.30 (± 0.008)</td></tr><tr><td>ICARL</td><td></td><td></td><td></td><td>50.1</td><td>0.11</td><td></td></tr><tr><td>EWC</td><td>68.3 (± 0.69)</td><td>0.29 (± 0.01)</td><td>0.27 (± 0.003)</td><td>42.4 (± 3.02)</td><td>0.26 (± 0.02)</td><td>0.33 (± 0.01)</td></tr><tr><td>PI</td><td>8</td><td>8</td><td>8</td><td>47.1 (± 4.41)</td><td>0.17 (± 0.04)</td><td>0.31 (± 0.008)</td></tr><tr><td>MAS</td><td>69.6 (± 0.93)</td><td>0.27 (± 0.01)</td><td>0.29 (± 0.003)</td><td>44.2 (± 2.39)</td><td>0.25 (± 0.02)</td><td>0.33 (± 0.009)</td></tr><tr><td>RWALK</td><td>85.7 (± 0.56)</td><td>0.08 (± 0.01)</td><td>0.31 (± 0.005)</td><td>40.9 (± 3.97)</td><td>0.29 (± 0.04)</td><td>0.32 (± 0.005)</td></tr><tr><td>PROG-NN</td><td>93.5 (± 0.07)</td><td>0</td><td>0.19 (± 0.006)</td><td>59.2 (± 0.85)</td><td>0</td><td>0.21 (± 0.001)</td></tr><tr><td>GEM</td><td>89.5 (± 0.48)</td><td>0.06 (± 0.004)</td><td>0.23 (± 0.005)</td><td>61.2 (± 0.78)</td><td>0.06 (± 0.007)</td><td>0.36 (± 0.007)</td></tr><tr><td>A-GEM (Ours)</td><td>89.1 (± 0.14)</td><td>0.06 (± 0.001)</td><td>0.29 (± 0.004)</td><td>62.3 (± 1.24)</td><td>0.07 (± 0.01)</td><td>0.35 (± 0.01)</td></tr><tr><td>MULTI-TASK</td><td>95.3</td><td>-</td><td>=</td><td>68.3</td><td>-</td><td>-</td></tr></table>
417
+
418
+ Table 5: Average accuracy and forgetting of standard models (left) and joint embedding models (right) on Split CUB. The value of ‘OoM’ is assigned to a metric when the model fails to fit in the memory. The numbers are averaged across 10 runs using a different seed each time. The results from this table are used to generate Fig 2 in Sec. 6.1 of the main paper.
419
+
420
+ <table><tr><td>Methods</td><td colspan="3">Split CUB</td></tr><tr><td></td><td>Ar(%)</td><td>FT</td><td>LCA10</td></tr><tr><td>VAN</td><td>54.3 (± 2.03)/67.1 (± 4.77)</td><td>0.13 (± 0.02)/ 0.10 (± 0.04)</td><td>0.29 (± 0.009)/0.52 (± 0.01)</td></tr><tr><td>EWC</td><td>54 (±1.08)/68.4(± 4.08)</td><td>0.13 (± 0.02)/0.09 (± 0.03)</td><td>0.29 (± 0.007)/0.52 (± 0.01)</td></tr><tr><td>PI</td><td>55.3 (± 2.28) / 66.6 (± 5.18)</td><td>0.12 (±0.02)/0.10 (±0.04)</td><td>0.29 (± 0.008)/0.52 (± 0.01)</td></tr><tr><td>RWALK</td><td>54.4 (± 1.82) /67.4 (± 3.50)</td><td>0.13 (± 0.01)/0.10 (± 0.03)</td><td>0.29 (± 0.008)/0.52 (± 0.01)</td></tr><tr><td>PROG-NN</td><td>OoM/OoM</td><td>OoM/OoM</td><td>OoM/OoM</td></tr><tr><td>A-GEM (Ours)</td><td>62 (± 3.5) /71(± 2.83)</td><td>0.07 (± 0.02)/0.07 (± 0.01)</td><td>0.30 (± 0.008)/0.54 (± 0.02)</td></tr><tr><td>MULTI-TASK</td><td>65.6 / 73.8</td><td>-/-</td><td>-/-</td></tr></table>
421
+
422
+ Table 6: Average accuracy and forgetting of standard models (left) and joint embedding models (right) on Split AWA. The value of ‘OoM’ is assigned to a metric when the model fails to fit in the memory. The numbers are averaged across 10 runs using a different seed each time. The results from this table are used to generate Fig 2 in Sec. 6.1 of the main paper.
423
+
424
+ <table><tr><td>Methods</td><td colspan="3">Split AWA</td></tr><tr><td></td><td>Ar(%)</td><td>FT</td><td>LCA10</td></tr><tr><td>VAN</td><td>30.3 (± 2.84)/42.8 (± 2.86)</td><td>0.04 (± 0.01)/0.07 (± 0.02)</td><td>0.21 (± 0.008)/0.37 (±0.02)</td></tr><tr><td>EWC</td><td>33.9 (± 2.87) /43.3 (± 3.71)</td><td>0.08 (± 0.02)/0.07 (± 0.03)</td><td>0.26 (± 0.01)/ 0.37 (± 0.02)</td></tr><tr><td>PI</td><td>33.9 (± 3.25)/43.4 (±3.49)</td><td>0.08 (± 0.02)/0.06 (±0.02)</td><td>0.26 (± 0.01)/0.37 (±0.02)</td></tr><tr><td>RWALK</td><td>33.9 (± 2.91)/42.9 (± 3.10)</td><td>0.08 (± 0.02)/0.07 (±0.02)</td><td>0.26 (± 0.01) / 0.37 (± 0.02)</td></tr><tr><td>PROG-NN</td><td>OoM/OoM</td><td>OoM/OoM</td><td>OoM/OoM</td></tr><tr><td>A-GEM (Ours)</td><td>44 (± 4.10) / 50 (± 3.25)</td><td>0.05 (± 0.02) /0.03 (± 0.02)</td><td>0.29 (± 0.01) / 0.39 (± 0.02)</td></tr><tr><td>MULTI-TASK</td><td>64.8 / 66.8</td><td>-/-</td><td>-/-</td></tr></table>
425
+
426
+ Table 7: Computational cost and memory complexity of different LLL approaches. The timing refers to training time on a GPU device. Memory cost is provided in terms of the total number of parameters P, the size of the minibatch B, the total size of the network hidden state $H$ (assuming all methods use the same architecture), the size of the episodic memory M per task. The results from this table are used to generate Fig. 1 and 2 in Sec. 6.1 of the main paper.
427
+
428
+ <table><tr><td>Methods</td><td colspan="4">Training Time [s]</td><td colspan="2">Memory</td></tr><tr><td></td><td>MNIST</td><td>CIFAR</td><td>CUB</td><td>AWA</td><td>Training</td><td>Testing</td></tr><tr><td>VAN</td><td>186</td><td>105</td><td>54</td><td>4123</td><td>P +B*H</td><td>P+B*H</td></tr><tr><td>EWC</td><td>403</td><td>250</td><td>72</td><td>4136</td><td>4*P+B*H</td><td>P +B*H</td></tr><tr><td>PROGRESSIVE NETS</td><td>510</td><td>409</td><td>8</td><td>8</td><td>2*P*T + B*H*T</td><td>2*P*T+B*H*T</td></tr><tr><td>GEM</td><td>3442</td><td>5238</td><td>-</td><td>-</td><td>P*T + (B+M)*H</td><td>P +B*H</td></tr><tr><td>A-GEM (Ours)</td><td>477</td><td>449</td><td>420</td><td>5221</td><td>2*P + (B+M)*H</td><td>P +B*H</td></tr></table>
429
+
430
+ # F ANALYSIS OF EWC
431
+
432
+ In this section we provide empirical evidence to the conjecture that regularization-based approaches like EWC need over-parameterized architectures and multiple passes over the samples of each task in order to perform well. The intuition as to why models need to be over-parameterized is because it is easier to avoid cross-task interference when the model has additional capacity. In the single-pass setting and when each task does not have very many training samples, regularization-based appraches also suffer because regularization parameters cannot be estimated well from a model that has not fully converged. Moreover, for tasks that do not have much data, rgularization-based approaches do not enable any kind of positive backward transfer (Lopez-Paz & Ranzato, 2017) which further hurts performance as the predictor cannot leverage knowledge acquired later to improve its prediction on past tasks. Finally, regularization-based approaches perform much better in the multi-epoch setting simply because in this setting the baseline un-regularized model performs much worse, as it overfits much more to the data of the current task, every time unlearning what it learned before.
433
+
434
+ We consider Permuted MNIST and Split CIFAR datasets as described in Sec. 6 of the main paper. For MNIST, the two architecture variants that we experiment with are; 1) two-layer fully-connected network with 256 units in each layer (denoted by $- S$ suffix), and 2) two-layer fully-connected network with 2000 units in each layer (denoted by $- B$ suffix).
435
+
436
+ For CIFAR, the two architecture variants are; 1) ResNet-18 with 3 times less feature maps in all the layers (denoted by $- S$ suffix), and 2) Standard ResNet-18 (denoted by $- B$ token).
437
+
438
+ We run the experiments on VAN and EWC with increasing the number of epochs from 1 to 10 for Permuted MNIST and from 1 to 30 for CIFAR. For instance, when epoch is set to 10, it means that the training samples of task $t$ are presented 10 times before showing examples from task $t + 1$ . In Fig. 7 and 8 we plot the Average Accuracy (Eq. 1) and Forgetting (Eq. 2) on Permuted MNIST and Split CIFAR, respectively.
439
+
440
+ We observe that the average accuracy significantly improves with the number of epochs only when EWC is applied to the big network. In particular, in the single epoch setting, EWC peforms similarly to the baseline VAN on Split CIFAR which has fewer number of training examples per task.
441
+
442
+ ![](images/827122b242f9c02719c1d8c4cbc9f2ab63d03d83556a22db119b433dbc3e22d8.jpg)
443
+ Figure 7: Permuted MNIST: Change in average accuracy and forgetting as the number of epochs are increased. Tokens $\because S ^ { \prime }$ and $\mathbf { \epsilon } _ { - B } ,$ denote smaller and bigger networks, respectively.
444
+
445
+ ![](images/98fdcbd533faa39646c4b2f6d1aaa2c22a3fdddf0adeb2950c58c5ea70b94885.jpg)
446
+ Figure 8: Split CIFAR: Change in average accuracy and forgetting as the number of epochs are increased. Tokens $\because S ^ { \prime }$ and $\mathbf { \epsilon } _ { - B } ,$ denote smaller and bigger networks, respectively.
447
+
448
+ # G HYPER-PARAMETER SELECTION
449
+
450
+ Below we report the hyper-parameters grid considered for different experiments. Note, as described in the Sec. 6 of the main paper, to satisfy the requirement that a learner does not see the data of a task more than once, first $T ^ { C V }$ tasks are used to cross-validate the hyper-parameters. In all the datasets, the value of $T ^ { C V }$ is set to ‘3’. The best setting for each experiment is reported in the parenthesis.
451
+
452
+ • MULTI-TASK – learning rate: [0.3, 0.1, 0.03 (MNIST perm, Split CIFAR, Split CUB, Split AWA), 0.01, 0.003, 0.001, 0.0003, 0.0001]
453
+ • MULTI-TASK-JE – learning rate: [0.3, 0.1, 0.03 (Split CUB, Split AWA), 0.01, 0.003, 0.001, 0.0003, 0.0001]
454
+ • VAN – learning rate: [0.3, 0.1, 0.03 (MNIST perm, Split CUB), 0.01 (Split CIFAR), 0.003, 0.001 (Split AWA), 0.0003, 0.0001]
455
+ • VAN-JE – learning rate: [0.3, 0.1, 0.03 (Split CUB), 0.01, 0.003 (Split AWA), 0.001, 0.0003, 0.0001]
456
+ • PROG-NN – learning rate: [0.3, 0.1 (MNIST perm, ), 0.03 (Split CIFAR, Split AWA), 0.01 (Split CUB), 0.003, 0.001, 0.0003, 0.0001]
457
+ • EWC – learning rate: [0.3, 0.1, 0.03 (MNIST perm, Split CIFAR, Split CUB), 0.01, 0.003 (Split AWA), 0.001, 0.0003, 0.0001]
458
+
459
+ – regularization: [1 (Split CUB), 10 (MNIST perm, Split CIFAR), 100 (Split AWA), 1000, 10000]
460
+
461
+ • EWC-JE – learning rate: [0.3, 0.1, 0.03 (Split CUB), 0.01, 0.003 (Split AWA), 0.001, 0.0003, 0.0001] – regularization: [1, 10 (Split CUB), 100 (Split AWA), 1000, 10000]
462
+
463
+ P I – learning rate: [0.3, 0.1 (MNIST perm), 0.03 (Split CUB), 0.01 (Split CIFAR), 0.003 (Split AWA), 0.001, 0.0003, 0.0001] – regularization: [0.001, 0.01, 0.1 (MNIST perm, Split CIFAR, Split CUB), 1 (Split AWA), 10]
464
+
465
+ • PI-JE
466
+
467
+ – learning rate: [0.3, 0.1, 0.03 (Split CUB), 0.01, 0.003 (Split AWA), 0.001, 0.0003, 0.0001] – regularization: [0.001, 0.01, 0.1 (Split CUB), 1, 10 (Split AWA)]
468
+
469
+ • MAS – learning rate: [0.3, 0.1 (MNIST perm), 0.03 (Split CIFAR, Split CUB), 0.01, 0.003 (Split AWA), 0.001, 0.0003, 0.0001] – regularization: [0.01, 0.1 (MNIST perm, Split CIFAR, Split CUB), 1 (Split AWA), 10]
470
+
471
+ • MAS-JE
472
+
473
+ – learning rate: [0.3, 0.1, 0.03 (Split CUB), 0.01, 0.003, 0.001 (Split AWA), 0.0003, 0.0001]
474
+ – regularization: [0.01, 0.1 (Split CUB, Split AWA), 1, 10]
475
+
476
+ • RWALK
477
+
478
+ – learning rate: [0.3, 0.1 (MNIST perm), 0.03 (Split CIFAR, Split CUB), 0.01, 0.003 (Split AWA), 0.001, 0.0003, 0.0001]
479
+ – regularization: [0.1, 1 (MNIST perm, Split CIFAR, Split CUB), 10 (Split AWA), 100, 1000]
480
+
481
+ • RWALK-JE
482
+
483
+ – learning rate: [0.3, 0.1, 0.03 (SPLIT CUB), 0.01, 0.003 (Split AWA), 0.001, 0.0003, 0.0001] – regularization: [0.1, 1 (Split CUB), 10 (Split AWA), 100, 1000]
484
+
485
+ • A-GEM – learning rate: [0.3, 0.1 (MNIST perm), 0.03 (Split CIFAR, Split CUB), 0.01 (Split AWA), 0.003, 0.001, 0.0003, 0.0001]
486
+
487
+ • A-GEM-JE – learning rate: [0.3, 0.1, 0.03 (SPLIT CUB), 0.01, 0.003 (Split AWA), 0.001, 0.0003, 0.0001]
488
+
489
+ # H PICTORIAL DESCRIPTION OF JOINT EMBEDDING MODEL
490
+
491
+ In Fig. 9 we provide a pictorial description of the joint embedding model discussed in the Sec. 5 of the main paper.
492
+
493
+ ![](images/eb9814ca8c064b11916d7438e838829a7db0e0ad5080d45dc2c545d02aae770a.jpg)
494
+ Figure 9: Pictorial description of the joint embedding model discussed in the Sec. 5 of the main paper. Modules; $\phi _ { \theta } ( . )$ and $\psi _ { \omega } ( . )$ are implemented as feed-forward neural networks with $P$ and $A \times D$ parameters, respectively. The descriptor of task $k$ $( t ^ { k } )$ is a matrix of dimensions $C _ { k } \times A$ , shared among all the examples of the task, constructed by concatenating the $A$ -dimensional class attribute vectors of $C _ { k }$ classes in the task.
md/train/HkxlcnVFwB/HkxlcnVFwB.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/Hyepjh4FwB/Hyepjh4FwB.md ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PROTOATTEND: ATTENTION-BASED PROTOTYPICAL LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We propose a novel inherently interpretable machine learning method that bases decisions on few relevant examples that we call prototypes. Our method, ProtoAttend, can be integrated into a wide range of neural network architectures including pre-trained models. It utilizes an attention mechanism that relates the encoded representations to samples in order to determine prototypes. The resulting model outperforms state of the art in three high impact problems without sacrificing accuracy of the original model: (1) it enables high-quality interpretability that outputs samples most relevant to the decision-making (i.e. a sample-based interpretability method); (2) it achieves state of the art confidence estimation by quantifying the mismatch across prototype labels; and (3) it obtains state of the art in distribution mismatch detection. All this can be achieved with minimal additional test time and a practically viable training time computational cost.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks have been pushing the frontiers of artificial intelligence (AI) by yielding excellent performance in numerous tasks, from understanding images (He et al., 2016) to text (Conneau et al., 2016). Yet, high performance is not always a sufficient factor - as some realworld deployment scenarios might necessitate that an ideal AI system is ‘interpretable’, such that it builds trust by explaining rationales behind decisions, allow detection of common failure cases and biases, and refrains from making decisions without sufficient confidence. In their conventional form, deep neural networks are considered as black-box models – they are controlled by complex nonlinear interactions between many parameters that are difficult to understand. There are numerous approaches, (Kim et al., 2018; Erhan et al., 2009; Zeiler & Fergus, 2013; Simonyan et al., 2013), that bring post-hoc explainability of decisions to already-trained models. Yet, these have the fundamental limitation that the models are not designed for interpretability. There are also approaches on the redesign of neural networks towards making them inherently-interpretable, as in this paper. Some notable ones include sequential attention (Bahdanau et al., 2015), capsule networks (Sabour et al., 2017), and interpretable convolutional filters (Zhang et al., 2018).
12
+
13
+ ![](images/141a9afc992c57a8503608a14f6d6de9425d4c43ba3c5f51d12692c086a72674.jpg)
14
+ Figure 1: ProtoAttend bases the decision on a few prototypes from the database. This enables interpretability of the prediction (by visualizing the highest weight prototypes) and confidence estimation for the decision (by measuring agreement across prototype labels).
15
+
16
+ We focus on inherently-interpretable deep neural network modeling with the foundations of prototypical learning. Prototypical learning decomposes decision making into known samples (see Fig. 1), referred here as prototypes. We base our method on the principle that prototypes should constitute a minimal subset of samples with high interpretable value that can serve as a distillation or condensed view of a dataset (Bien & Tibshirani, 2012). Given that the number of objects a human can interpret is limited (Miller, 1956), outputting few prototypes can be an effective approach for humans to understand the AI model behavior. In addition to such interpretability, prototypical learning:
17
+
18
+ (1) provides an efficient confidence metric by measuring mismatches in prototype labels, allowing performance to be improved by refraining from making predictions in the absence of sufficient confidence, (2) helps detect deviations in the test distribution by measuring mismatches in prototype labels that represent the support of the training dataset, and (3) enables performance in the high label noise regime to be improved by controlling the number of selected prototypes. Given these motivations, prototypes should be controllable in number, and should be perceptually relevant to the input in explaining the decision making task. Prototype selection in its naive form is computationally expensive and perceptually challenging (Bien & Tibshirani, 2012). We design ProtoAttend to address this problem in an efficient way. Our contributions can be summarized as follows:
19
+
20
+ 1. We present principles that can be guiding for the design of inherently-interpretable models based on sample-based interpretability.
21
+ 2. We propose a novel method, ProtoAttend, for selecting input-dependent prototypes based on an attention mechanism between the input and prototype candidates. ProtoAttend is model-agnostic and can even be integrated with pre-trained models.
22
+ 3. ProtoAttend allows interpreting the contribution of each prototype via the attention outputs.
23
+ 4. For a ‘condensed view’, we demonstrate that sparsity in weights can be efficiently imposed via the choice of the attention normalization and additional regularization.
24
+ 5. On image, text and tabular data, we demonstrate the four key benefits of ProtoAttend: interpretability, confidence control, diagnosis of distribution mismatch, and robustness against label noise. ProtoAttend yields superior quality for sample-based interpretability, better-calibrated confidence scoring, and more sensitive out-of-distribution detection compared to alternative approaches.
25
+ 6. ProtoAttend enables all these benefits via the same architecture and method, while maintaining comparable overall accuracy.
26
+
27
+ # 2 RELATED WORK
28
+
29
+ Prototypical learning: The principles of ProtoAttend are inspired by (Bien & Tibshirani, 2012). They formulate prototype selection as an integer program and solve it using a greedy approach with linear program relaxation. It seems unclear whether such approaches can be efficiently adopted to deep learning. (Chen et al., 2018) and (Li et al., 2018) introduce a prototype layer for interpretability by replacing the conventional inner product with a distance computation for perceptual similarity. In contrast, our method uses an attention mechanism to quantify perceptual similarity and can choose input-dependent prototypes from a large-scale candidate database. (Yeh et al., 2018) decomposes the prediction into a linear combination of activations of training points for interpretability using representer values. The linear decomposition idea also exists in ProtoAttend, but the weights are learned via an attention mechanism and sparsity is encouraged in the decomposition. In (Koh & Liang, 2017), the training points that are the most responsible for a given prediction are identified using influence functions via oracle access to gradients and Hessian-vector products.
30
+
31
+ Metric learning: Metric learning aims to find an embedding representation of the data where similar data points are close and dissimilar data pointers are far from each other. ProtoAttend is motivated by efficient learning of such an embedding space which can be used to decompose decisions. Metric learning for deep neural networks is typically based on modifications to the objective function, such as using triplet loss and N-pair loss (Sohn, 2016; Cui et al., 2016; Hoffer & Ailon, 2014). These yield perceptually meaningful embedding spaces yet typically require a large subset of nearest neighbors to avoid degradation in performance (Cui et al., 2016). (Kim et al., 2018) proposes a deep metric learning framework which employs an attention-based ensemble with a divergence loss so that each learner can attend to different parts of the object. Our method has metric learning capabilities like relating similar data points, but also performs well on the ultimate supervised learning task.
32
+
33
+ Attention-based few-shot learning: Some of our inspirations are based on recent advances in attention-based few-shot learning. In (Vinyals et al., 2016), an attention mechanism is used to relate an example with candidate examples from a support set using a weighted nearest-neighbor classifier applied within an embedding space. In (Ren et al., 2018), incremental few-shot learning is implemented using an attention attractor network on the encoded and support sets. In (Snell et al., 2017), a non-linear mapping is learned to determine the prototype of a class as the mean of its support set in the embedding space. During training, the support set is randomly sampled to mimic the inference task. Overall, the attention mechanism in our method follows related principles but fundamentally differs in that few-shot learning aims for generalization to unseen classes whereas the goal of our method is robust and interpretable learning for seen classes.
34
+
35
+ Uncertainty and confidence estimation: ProtoAttend takes a novel perspective on the perennial problem of quantifying how much deep neural networks’ predictions can be trusted. Common approaches are based on using the scores from the prediction model, such as the probabilities from the softmax layer of a neural network, yet it has been shown that the raw confidence values are typically poorly calibrated (Guo et al., 2017). Ensemble of models (Lakshminarayanan et al., 2017) is one of the simplest and most efficient approaches, but significantly increases complexity and decreased interpretability. In (Papernot & McDaniel, 2018), the intermediate representations of the network are used to define a distance metric, and a confidence metric is proposed based on the conformity of the neighbors. (Jiang et al., 2018), proposes a confidence metric based on the agreement between the classifier and a modified nearest-neighbor classifier on the test sample. In (DeVries & Taylor, 2018), direct inference of confidence output is considered with a modified loss. Another direction of uncertainty and confidence estimation is Bayesian neural networks that return a distribution over the outputs (Kendall & Gal, 2017b) (Mullachery et al., 2018) (Kendall & Gal, 2017a).
36
+
37
+ # 3 PROTOATTEND: ATTENTION-BASED PROTOTYPICAL LEARNING
38
+
39
+ Consider a training set with samples, $\mathcal { T } = \{ \mathbf { x _ { i } } , y _ { i } \}$ . Conventional supervised learning aims to learn a model $s ( \mathbf { x _ { i } } ; \mathbf { S } )$ that minimizes a predefined loss $\begin{array} { r } { \dot { 1 } / B \cdot \sum _ { i = 1 } ^ { B } L ( y _ { i } , \hat { y _ { i } } = s ( \mathbf x _ { \mathbf i } ; \mathbf S ) ) ^ { 1 } } \end{array}$ at each iteration, where $B$ is the batch size for training. Our goal is to impose that decision making should be based on only a small number of training examples, i.e. prototypes, such that their linear superposition in an embedding space can yield the overall decision and the superposition weights correspond to their importance. Towards this goal, we propose defining a solution to prototypical learning with the following six principles:
40
+
41
+ i. $\mathbf { v _ { i } } = f ( \mathbf { x _ { i } } ; \theta )$ encodes all relevant information of $\mathbf { x _ { i } }$ for the final decision. $f ( )$ considers the global distribution of the samples, i.e. learns from all $\{ \mathbf { x _ { i } } , y _ { i } \}$ . Although all the information in training dataset is embodied in the weights of the encoder2, we construct the learning method in such a way that decision is dominated by the prototypes with high weights. ii. From the encoded information, we can find a decision function so that the mapping $g ( \mathbf { v _ { i } } ; \eta )$ is close to the ground truth $y _ { i }$ , in a consistent way with conventional supervised learning.
42
+ iii. Given candidates $\mathbf { x _ { j } ^ { ( c ) } }$ to select the prototypes from, there exists weights $p _ { i , j }$ (where $p _ { i , j } \geq 0$ and is cl $\textstyle \sum _ { j = 1 } ^ { D } p _ { i , j } = 1 )$ , such td truth t the decision . $g ( \sum _ { j = 1 } ^ { D } p _ { i , j } \mathbf { v _ { j } ^ { ( c ) } } ; \eta )$ (where ${ \bf v _ { j } ^ { ( c ) } } = f ( { \bf x _ { j } ^ { ( c ) } } ; \theta ) )$ $y _ { i }$
43
+ iv. When the linear combination $\textstyle \sum _ { j = 1 } ^ { D } p _ { i , j } \mathbf { v _ { j } ^ { ( c ) } }$ is considered, prototypes with higher weights $p _ { i , j }$ have higher contribution in the decision $g ( \sum _ { j = 1 } ^ { D } p _ { i , j } \mathbf { v _ { j } ^ { ( c ) } } ; \eta )$ v. The weights should be sparse – only a controllable amount of weights $p _ { i , j }$ should be nonzero. Ideally, there exists an efficient mechanism for outputting $p _ { i , j }$ to control the sparsity without significantly affecting performance.
44
+ vi. The weights $p _ { i , j }$ depend on the relation between input and the candidate samples, $p _ { i , j } =$ $r ( \mathbf { x _ { i } } , \mathbf { x _ { j } ^ { ( c ) } } ; \mathbf { r } )$ , based on their perceptual relation for decision making. We do not introduce any heuristic relatedness metric such as distances in the representation space, but we allow the model to learn the relation function that helps the overall performance.
45
+
46
+ Learning involves optimization of the parameters $\theta , { \mathbf { \Gamma } } , \eta$ of the corresponding functions. If the proposed principles (such as reasoning from the linear combination of embeddings or assigning relevance to the weights) are not imposed during training but only at inference, a high performance cannot be obtained due to the train-test mismatch, as the intermediate representations can be learned in an arbitrary way without any necessities to satisfy them.3 The subsequent section presents ProtoAttend and training procedure to implement it.
47
+
48
+ # 3.1 NETWORK ARCHITECTURE AND TRAINING
49
+
50
+ The principles above are conditioned on efficient learning of an encoding function to encode the relevant information for decision making, a relation function to determine the prototype weights, and a final decision making block to return the output. Conventional supervised learning comprises the encoding and decision blocks. On the other hand, it is challenging to design a learning method with a relation function with a reasonable complexity. To this end, we adapt the idea of attention (Corbetta & Shulman, 2002; Vaswani et al., 2017), where the model focuses on an adaptive small portion of input while making the decision. Different from conventional employment of attention in sequence or visual learning, we propose to use attention at sample level, such that the attention mechanism is used to determine the prototype weights by relating the input and the candidate samples via alignment of their keys and queries. Fig. 2 shows the proposed architecture for training and inference. The three main blocks are described below:
51
+
52
+ ![](images/c44b480160305586dc6788fbb6715a797e9d7cd241009c74c79f4614711ebfd6.jpg)
53
+ Figure 2: ProtoAttend method for training and testing. Shared encoder between input samples and the candidate samples generates input representations, that are mapped to key, query and value embeddings (with a single nonlinear layer). The alignment between keys and queries determines the weights of the prototypes, and the linear combination of the values determines the final decision. Conformity of the prototype labels is used as a confidence metric.
54
+
55
+ Encoder: A trainable encoder is employed to transform $B$ input samples (note that $B$ may be 1 at inference) and $D$ samples from the database of prototype candidates (note that $D$ may be as large as the entire training dataset at inference) into keys, queries and values. The encoder is shared and jointly updated for the input samples and prototype candidate database, to learn a common representation space for the values. The encoder architecture can be based on any trainable discriminative feature mapping function, e.g. ResNet (He et al., 2016) for images, with the modification of generating three types of embeddings. For mapping of the last encoder layer to key, query and value embeddings, we simply use a single fully-connected layer with a nonlinearity, separately for each.4 For input samples, $\mathbf { \bar { V } } \in \mathfrak { R } ^ { B \times d _ { o u t } }$ and $\mathbf { \check { Q } } \in \Re ^ { B \times d _ { a t t } }$ denote the values and queries, and for candidate database samples ${ \bf K } ^ { ( { \bf c } ) } \in \Re ^ { D \times d _ { a t t } }$ and $\mathbf { V } ^ { ( \mathbf { c } ) } \in \mathfrak { R } ^ { D \times d _ { o u t } }$ denote the keys and values. For keys and queries, we use separate representations as the entire system is not symmetric, there are a lot of candidate samples and the model may prefer to learn the keys to arrange the representation space such that it is meaningful when their inner products with a single query are considered.
56
+
57
+ Relational attention: The relational attention yields the weight between the $i ^ { t h }$ sample and $j ^ { t h }$ candidate, $p _ { i , j }$ , via alignment of the corresponding key and query in dot-product attention form5:
58
+
59
+ $$
60
+ p _ { i , j } = n \left( \mathbf { K _ { j } ^ { ( c ) } } \mathbf { Q _ { i } } ^ { T } / \sqrt { d _ { a t t } } \right) ,
61
+ $$
62
+
63
+ where $n ( )$ is a normalization function to satisfy $p _ { i , j } \geq 0$ and $\textstyle \sum _ { j = 1 } ^ { D } p _ { i , j } = 1$ for which we consider softmax and sparsemax (Martins & Astudillo, $2 0 1 6 ) ^ { 6 }$ . The choice of the normalization function is an efficient mechanism to control the sparsity of the prototype weights, as demonstrated in experiments. Note that the relational attention mechanism does not introduce any extra trainable parameters.
64
+
65
+ Decision making: The final decision block simply consists of a linear mapping from a convex combination of values that results in the output $y _ { i }$ . Consider the convex combination of value embeddings, parameterized by $\alpha$ :
66
+
67
+ $$
68
+ \hat { y } _ { i } ( \alpha ) = g \left( ( 1 - \alpha ) \mathbf { v _ { i } } + \alpha \sum _ { j = 1 } ^ { D } p _ { i , j } \mathbf { v _ { j } ^ { ( c ) } } \right) .
69
+ $$
70
+
71
+ For $\alpha = 0$ , $L \left( y _ { i } , \hat { y _ { i } } ( 0 ) \right)$ is the conventional supervised learning loss (ignoring the relational attention mechanism) that can only impose principles (i) and (ii), but not the principles (iii)-(vi). A high accuracy for $\hat { y _ { i } } ( 0 )$ merely indicates that the value embedding space represents each input sample accurately. For $\alpha = 1$ , $\dot { L } \left( y _ { i } , \hat { y _ { i } } ( 1 ) \right)$ encourages the principles (i), (iii)-(iv), but not the principles (ii) and (vi).7 A high accuracy for $\hat { y _ { i } } ( 1 )$ indicates that the linear combination of value embeddings accurately maps to the decision. For (vi), we propose that there should be a similar output mapping for the input and prototypes, for which we encourage high accuracy for both $\hat { y } _ { i } ( 0 )$ and $\hat { y _ { i } } ( 1 )$ with a loss term that is a mixture of $L \left( y _ { i } , \hat { y _ { i } } ( 0 ) \right)$ and $L \left( y _ { i } , { \hat { y _ { i } } } ( 1 ) \right)$ or guidance with an intermediate term, as ${ \hat { y } } _ { i } ( 0 . 5 )$ , is required. Lastly, when $\alpha \leq 0 . 5$ , we obtain the condition that the input sample itself has the largest contribution in the linear combination. Intuitively, the sample itself should be more relevant for the output compared to other samples, so the principles (iii) and (iv) can be encouraged. We propose and compare different training objective functions in Table 1. We observe that the last four are all viable options as the training objective, with similar performance. We choose the last one for the rest of the experiments, as in some cases, slightly better prototypes are observed qualitatively (see Sect. 5.2 for further discussion).
72
+
73
+ Table 1: Ablation study. Impact of various training losses on ProtoAttend with softmax attention for Fashion-MNIST. $1 \leq i \leq N _ { t }$ is the training iteration index and $N _ { t }$ is the total number of iterations.
74
+
75
+ <table><tr><td rowspan=1 colspan=1>Training objective function</td><td rowspan=1 colspan=1>Acc.%for yi(0)</td><td rowspan=1 colspan=1>Acc.%for yi(1)</td><td rowspan=1 colspan=1>-E{C}g=y</td><td rowspan=1 colspan=1>-E{C}gy</td></tr><tr><td rowspan=1 colspan=1>L (yi,yi(O))</td><td rowspan=1 colspan=1>94.28</td><td rowspan=1 colspan=1>13.13</td><td rowspan=1 colspan=1>0.029</td><td rowspan=1 colspan=1>0.194</td></tr><tr><td rowspan=1 colspan=1>L(yi,yi(1))</td><td rowspan=1 colspan=1>10.92</td><td rowspan=1 colspan=1>94.21</td><td rowspan=1 colspan=1>0.103</td><td rowspan=1 colspan=1>0.002</td></tr><tr><td rowspan=1 colspan=1>L (yi, yi(0.5))</td><td rowspan=1 colspan=1>94.01</td><td rowspan=1 colspan=1>94.25</td><td rowspan=1 colspan=1>0.927</td><td rowspan=1 colspan=1>0.049</td></tr><tr><td rowspan=1 colspan=1>L(yi,yi(O))+L(yi,yi(1))</td><td rowspan=1 colspan=1>94.37</td><td rowspan=1 colspan=1>94.38</td><td rowspan=1 colspan=1>0.931</td><td rowspan=1 colspan=1>0.047</td></tr><tr><td rowspan=1 colspan=1>(1-i/Nt)·L(yi,y(O)) +(i/Nt)·L(yi,yi(1))</td><td rowspan=1 colspan=1>94.14</td><td rowspan=1 colspan=1>94.18</td><td rowspan=1 colspan=1>0.927</td><td rowspan=1 colspan=1>0.049</td></tr><tr><td rowspan=1 colspan=1>L(yi,yi(O)) +L(yi,,yi(1)) +L(yi,yi(0.5))</td><td rowspan=1 colspan=1>94.37</td><td rowspan=1 colspan=1>94.45</td><td rowspan=1 colspan=1>0.928</td><td rowspan=1 colspan=1>0.047</td></tr></table>
76
+
77
+ To control the sparsity of the weights (beyond the choice of the attention operation), we also propose a sparsity regularization term with a coefficient $\lambda _ { s p a r s e }$ in the form of entropy, $L _ { s p a r s e } ( \mathbf { p } ) =$ $- 1 / B \textstyle \sum _ { i = 1 } ^ { B } \sum _ { j = 1 } ^ { D } p _ { i , j } \log ( p _ { i , j } + \epsilon )$ , where $\epsilon$ is a small number for numerical stability. $L _ { s p a r s e } ( \mathbf { p } )$ is minimized when $\mathbf { p }$ has only 1 non-zero value.
78
+
79
+ # 3.2 CONFIDENCE SCORING USING PROTOTYPES
80
+
81
+ ![](images/bce2b5a023f7fb5db212946b111d8d7baf40321a778282f3f65b4015a9d4ecdb.jpg)
82
+ Figure 3: Impact of confidence on ProtoAttend accuracy. Reliability diagram for Fashion-MNIST, as in (Papernot & McDaniel, 2018). Bars (left axis) indicate the mean accuracy of predictions binned by confidence; the red line (right axis) shows the number of samples across bins.
83
+
84
+ ProtoAttend provides a linear decomposition (via value embeddings) of the decision into prototypes that have known labels. Ideally, labels of the prototypes should all be the same as the labels of the input. When prototypes with high weights belong to the same class, the model shall be more confident and a correct classification result is expected, whereas in the cases of disagreement between prototype labels, the model shall be less confident and the likelihood of a wrong prediction is higher. With the motivation of separating correct vs. incorrect decisions via its value, we propose a confidence score based on the agreement between the prototypes:
85
+
86
+ $$
87
+ C _ { i } = \sum _ { j = 1 } ^ { D } p _ { i , j } \cdot \operatorname { I } ( y _ { j } ^ { ( c ) } = \hat { y _ { i } } ) ,
88
+ $$
89
+
90
+ where $I ( )$ is the indicator function. Table 1 shows the significant difference of the average confidence metric between correct vs. incorrect classification cases for the test dataset, as desired. In Fig. 3, the impact of confidence on accuracy is further analyzed with the reliability diagram as in (Papernot & McDaniel, 2018). When test samples are binned according to their confidence, it is observed that the bins with higher confidence yield much higher accuracy. There are small number of samples in the bins with lower confidence, and those tend to be the incorrect classification cases. In Section 4.4, the efficacy of confidence score in separating correct vs. incorrect classification is experimented in confidence-controlled prediction setting, demonstrating how much the prediction accuracy can be improved by refraining from small number of samples with low confidence at test time.
91
+
92
+ To further encourage confidence during training, we also consider a regularization term $- 1 / B \textstyle \sum _ { i = 1 } ^ { B } \sum _ { j = 1 } ^ { D } p _ { i , j } \cdot \operatorname { I } ( y _ { j } ^ { ( c ) } = y _ { i } )$ with a coefficient $\lambda _ { c o n f }$ . $L _ { c o n f }$ s minimized when all proto-8 $L _ { c o n f } ( \mathbf { p } ) =$ types with $p _ { i , j } > 0$ are from the same ground truth class with output $y _ { i }$
93
+
94
+ # 4 EXPERIMENTS
95
+
96
+ # 4.1 SETUP
97
+
98
+ We demonstrate the results of ProtoAttend for image, text and tabular data classification problems with different encoder architectures (see Supplementary Material for details). Outputs of the encoders are mapped to queries, keys and values using a fully-connected layer followed by ReLU. For values, layer normalization (Lei Ba et al., 2016) is employed for more stable training. A fully-connected layer is used in the decision making block, yielding logits for determining the estimated class. Softmax cross entropy loss is used as $L ( )$ . Adam optimization algorithm is employed (Kingma & Ba, 2014) with exponential learning rate decay (with parameters optimized on a validation set). For image encoding, unless specified, we use the standard ResNet model (He et al., 2016). For text encoding, we use the very deep convolutional neural network (VDCNN) (Conneau et al., 2016) model, inputting sequence of raw characters. For tabular data encoding, we use an LSTM model (Hochreiter & Schmidhuber, 1997), which inputs the feature embeddings at every timestep. See Supplementary Material for implementation details, additional results and discussions.
99
+
100
+ # 4.2 SPARSE EXPLANATIONS OF DECISIONS
101
+
102
+ We foremost demonstrate that our inherently-interpretable model design does not cause significant degradation in performance. Table 2 shows the accuracy and the median number of prototypes required to add up to a particular portion of the decision9 for different prototypical learning cases. In all cases, very small accuracy gap is observed with the baseline encoder that is trained in conventional supervised learning way. The attention normalization function and sparsity regularization are efficient mechanisms to control the sparsity – the number of prototypes required is much lower with sparsemax attention compared to softmax attention and can be further reduced with sparsity regularization (see Supplementary Material for details). With a small decrease in performance, the number of prototypes can be reduced to just a handful.10 There is difference between datasets, as intuitively expected from the discrepancy in the degree of similarity between the intra-class samples.
103
+
104
+ Table 2: ProtoAttend achieves interpretability without significant degradation in performance. Accuracy and median number of prototypes to add up to $50 \%$ , $90 \%$ and $9 5 \%$ of the decision, quantified with prototype weights.
105
+
106
+ <table><tr><td rowspan=2 colspan=1>Dataset</td><td rowspan=2 colspan=1>Method</td><td rowspan=2 colspan=1>Acc.%</td><td rowspan=1 colspan=3>No. of prototypes</td></tr><tr><td rowspan=1 colspan=3>50 % 90 % 95%</td></tr><tr><td rowspan=3 colspan=1>MNIST</td><td rowspan=1 colspan=1>Baseline enc.</td><td rowspan=1 colspan=1>99.70</td><td rowspan=1 colspan=3>1</td></tr><tr><td rowspan=1 colspan=1>Softmax attn.</td><td rowspan=1 colspan=1>99.66</td><td rowspan=1 colspan=1>365</td><td rowspan=1 colspan=1>1324</td><td rowspan=1 colspan=1>1648</td></tr><tr><td rowspan=1 colspan=1>Sparsemax attn.</td><td rowspan=1 colspan=1>99.69</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td></tr><tr><td rowspan=4 colspan=1>Fashion-MNIST</td><td rowspan=1 colspan=1>Baseline enc.</td><td rowspan=1 colspan=1>94.74</td><td rowspan=1 colspan=3>1</td></tr><tr><td rowspan=1 colspan=1>Softmax attn.</td><td rowspan=1 colspan=1>94.42</td><td rowspan=1 colspan=1>712</td><td rowspan=1 colspan=1>2320</td><td rowspan=1 colspan=1>2702</td></tr><tr><td rowspan=1 colspan=1>Sparsemax attn.</td><td rowspan=1 colspan=1>94.42</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>11</td></tr><tr><td rowspan=1 colspan=1>Sparsemax attn. + sparsity reg.</td><td rowspan=1 colspan=1>94.47</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>2</td></tr><tr><td rowspan=4 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>Baseline enc.</td><td rowspan=1 colspan=1>91.97</td><td rowspan=1 colspan=3>-</td></tr><tr><td rowspan=1 colspan=1>Softmax attn.</td><td rowspan=1 colspan=1>91.69</td><td rowspan=1 colspan=1>317</td><td rowspan=1 colspan=1>1453</td><td rowspan=1 colspan=1>1898</td></tr><tr><td rowspan=1 colspan=1>Sparsemax attn.</td><td rowspan=1 colspan=1>91.44</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>14</td><td rowspan=1 colspan=1>16</td></tr><tr><td rowspan=1 colspan=1>Sparsemax attn. + sparsity reg.</td><td rowspan=1 colspan=1>91.26</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td></tr><tr><td rowspan=3 colspan=1>DBPedia</td><td rowspan=1 colspan=1>Baseline enc.</td><td rowspan=1 colspan=1>98.25</td><td rowspan=1 colspan=2>1</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Softmax attn.</td><td rowspan=1 colspan=1>98.20</td><td rowspan=1 colspan=1>63</td><td rowspan=1 colspan=1>190</td><td rowspan=1 colspan=1>225</td></tr><tr><td rowspan=1 colspan=1>Sparsemax attn.</td><td rowspan=1 colspan=1>97.74</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>4</td></tr><tr><td rowspan=4 colspan=1>Income</td><td rowspan=1 colspan=1>Baseline enc.</td><td rowspan=1 colspan=1>85.68</td><td rowspan=1 colspan=3>-</td></tr><tr><td rowspan=1 colspan=1>Softmax attn.</td><td rowspan=1 colspan=1>85.64</td><td rowspan=1 colspan=1>2263</td><td rowspan=1 colspan=1>9610</td><td rowspan=1 colspan=1>12419</td></tr><tr><td rowspan=1 colspan=1>Sparsemax attn.</td><td rowspan=1 colspan=1>85.58</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>57</td><td rowspan=1 colspan=1>67</td></tr><tr><td rowspan=1 colspan=1>Sparsemax attn. + sparsity reg.</td><td rowspan=1 colspan=1>85.41</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>7</td></tr></table>
107
+
108
+ ![](images/6067e1c598a850d0865f30ad7d8c4e0fe47cff0b6d4c9585b1c9d89d33c59be8.jpg)
109
+ Figure 4: Example inputs and ProtoAttend prototypes for (a) MNIST (with sparsemax), FashionMNIST dataset (with sparsemax and sparsity regularization) and (b) Fruits (with sparsemax and sparsity regularization). For MNIST & Fashion-MNIST, prototypes typically consist of discriminative features such as the straight line shape for the digit 1, and the long heels and strips for the sandal. For Fruits, prototypes often correspond to the same fruit captured from a very similar angle.
110
+
111
+ ![](images/b77e2ea292c994b192a4a05347b446e6a013a7768cee836590131973ae5bae53.jpg)
112
+ Figure 5: Example inputs and ProtoAttend prototypes for DBPedia (with sparsemax). While classifying the inputs as athlete, prototypes have very similar sentence structure, words and concepts.
113
+
114
+ # Inputs
115
+
116
+ # Prototypes
117
+
118
+ ![](images/8ce470d06f2745621153b260151b1e2105ba58828a88749ef817fcec823f5a20.jpg)
119
+
120
+ Figure 6: Example inputs and ProtoAttend prototypes for Adult Census Income (with sparsemax and sparsity regularization). For the first example, all prototypes have similar age, two share similar education level and one has the same occupation. For the second example, three prototypes have the same occupation, all work more than 40 hours/week, and three have postgraduate education.
121
+
122
+ Figs. 4, 5 and 6 exemplify prototypes for image, text and tabular data. In general, perceptually-similar samples are chosen as the prototypes with the largest weights. We also compare the relevant samples found by ProtoAttend with the methods of representer point selection (Yeh et al., 2018) and influence functions (Koh & Liang, 2017) (see Supplementary Material for details) on Animals with Attributes dataset. As shown in Fig. 7, our method finds qualitatively more relevant samples. This case also exemplifies the potential of our method for integration into pre-trained models by addition of simple layers for key, query and value generation.
123
+
124
+ ![](images/10d0a87a1ec524026d704164a749e6f06d6a2dd6b8d5967a139f41d9643803e7.jpg)
125
+ Figure 7: Samples found by ProtoAttend vs. representer point selection (Yeh et al., 2018) and influence function (Koh & Liang, 2017) for the two examples from (Yeh et al., 2018) on Animals with Attributes dataset. See Supplementary Material for more examples.
126
+
127
+ 4.3 ROBUSTNESS TO LABEL NOISE
128
+
129
+ Table 3: Label noise ratio vs. accuracy for baseline encoder, dropout method (Arpit et al., 2017) (optimizing the keep probability) and ProtoAttend with sparsemax attention and sparsity regularization for CIFAR-10.
130
+
131
+ <table><tr><td rowspan=2 colspan=1>Noise level</td><td rowspan=1 colspan=3>Test accuracy%</td></tr><tr><td rowspan=1 colspan=1>Baseline</td><td rowspan=1 colspan=1>Dropout</td><td rowspan=1 colspan=1>ProtoAttend</td></tr><tr><td rowspan=1 colspan=1>0.8</td><td rowspan=1 colspan=1>57.02</td><td rowspan=1 colspan=1>56.76</td><td rowspan=1 colspan=1>60.50</td></tr><tr><td rowspan=1 colspan=1>0.6</td><td rowspan=1 colspan=1>71.27</td><td rowspan=1 colspan=1>72.15</td><td rowspan=1 colspan=1>74.67</td></tr><tr><td rowspan=1 colspan=1>0.4</td><td rowspan=1 colspan=1>77.47</td><td rowspan=1 colspan=1>78.99</td><td rowspan=1 colspan=1>80.04</td></tr></table>
132
+
133
+ As prototypical learning with sparsemax attention aims to extract decision-making information from a small subset of training samples, it can be used to improve performance when the training dataset contains noisy labels (see Table 3). The optimal value11 of $\lambda _ { s p a r s e }$ increases with higher noisy label ratios, underlining the increasing importance of sparse learning.
134
+
135
+ # 4.4 CONFIDENCE-CONTROLLED PREDICTION
136
+
137
+ ![](images/63d10481d6635174332b841e716f6182533446db42924cf1efe71cf2f21185ab.jpg)
138
+ Figure 8: Confidence-controlled prediction. (a) Accuracy vs. ratio of samples for MNIST. We compare dkNN (Papernot & McDaniel, 2018) and prototypical learning (with softmax attention and $\lambda _ { c o n f } { = } 0 . 1 $ using the same network architecture from (Papernot & McDaniel, 2018) without augmentation. (b) Accuracy vs. ratio of samples for CIFAR-10. We compare prototypical learning (with softmax attention and $\lambda _ { c o n f } { = } 0 . 1 )$ with trust score (Jiang et al., 2018) and deep ensemble (Lakshminarayanan et al., 2017) methods for the same baseline encoder network architecture.
139
+
140
+ By varying the threshold for the confidence metric, a trade-off can be obtained for what ratio of the test samples that the model makes a prediction for vs. the overall accuracy it obtains on the samples above that threshold.12 Figs. 8(a) and 8(b) demonstrate this trade-off and compare it to alternative methods. The sharper slope of the plots show that our method is superior to dkNN (Papernot & McDaniel, 2018) and trust score (Jiang et al., 2018), the methods based on quantifying the mismatch with nearest-neighbor samples, in terms of finding related samples. Although the baseline accuracy is higher with 4 ensemble networks obtained via deep ensemble (Lakshminarayanan et al., 2017), our method utilizes a single network and the additional accuracy gains by refraining from uncertain predictions is similar to our approach as shown by the similar slopes of the curves.
141
+
142
+ Overall, the baseline accuracy can be significantly improved by making less predictions. Compared to the state of the art models, our canonical method with simple and small models shows similar accuracy by making slightly fewer predictions – e.g. for MNIST, (Wan et al., 2013) achieves $0 . 2 1 \%$ error rate, that is obtained by our method refraining from only $0 . 4 5 \%$ of predictions using ResNet-32 and for DBpedia, (Sachan & Petuum, 2018) achieves $0 . 9 1 \%$ error, that is obtained by our method refraining from $3 \%$ of predictions using 9-layer VDCNN. In general, the smaller the number of prototypes, the smaller the trade-off space. Thus, softmax attention (which normally results in more prototypes) is better suited for confidence-controlled prediction compared to sparsemax (see Supplementary Material for more comparisons).
143
+
144
+ # 4.5 OUT-OF-DISTRIBUTION SAMPLES
145
+
146
+ Well-calibrated confidence scores at inference can be used to detect deviations from the training dataset. As the test distribution deviates from the training distribution, prototype weights tend to mismatch more and yield lower confidence scores. Fig. 9 (a) shows the ratio of samples above a certain confidence level as the test dataset deviates. Rotations deviate the distribution of test images from the training images, and cause significant degradation in confidence scores, as well as the overall accuracy. On the other hand, using test image from a different dataset, degrade them even further. Next, Fig. 9 (b) shows quantification of out-of-distribution detection with prototypical learning, using the method from (Hendrycks & Gimpel, 2016). ProtoAttend yields an AUC of 0.838, being on par with the-state of the art approaches (Hendrycks et al.).
147
+
148
+ ![](images/2c553620572a6e45f5fc0ab60b86dfead180af1d3ae2d36892ce2aed4decf6de.jpg)
149
+ Figure 9: Out-of-distribution detection. (a) Ratio of samples above the confidence level for prototypical learning with softmax attention, trained with Fashion-MNIST, and tested on the shown datasets. E.g. if we assess the ratio of samples above confidence 0.9, it is far more likely that those samples come from the same distribution with the training dataset. (b) ROC curve for in-distribution vs. out-of-distribution detection, using CIFAR-10 as in-distribution and SVHN as out-of-distribution, computed using the method from (Hendrycks & Gimpel, 2016) and compared to the proposed baseline in (Hendrycks & Gimpel, 2016). Softmax attention and confidence regularization $( \lambda _ { c o n f } = 0 . 1 )$ ) are used.
150
+
151
+ # 5 COMPUTATIONAL COST
152
+
153
+ ProtoAttend requires only a very small increase in the number of learning parameters (merely two extra small matrices for the fully-connected layers to obtain queries and keys). However, it does require a longer training time and has higher memory requirements to process the candidate database. At inference, keys and values for the candidate database can be computed only once and integrated into the model. Thus, the overhead merely becomes the computation of attention outputs (e.g. for CIFAR-10 model, the attention overhead at inference is less than 0.6 MFLOPs, orders of magnitude lower than the computational complexity of a ResNet model). During training on the other hand, both forward and backward propagation steps for the encoder need to be computed for all candidate samples and the total time is higher (e.g. 4.45 times slower to train until convergence for CIFAR-10 compared to the conventional supervised learning). The size of the candidate database is limited by the memory of the processor, so in practice we sample different candidate databases randomly from the training dataset at each iteration. For faster training, data and model parallelism approaches are straightforward to implement – e.g., different processors can focus on different samples, or they can focus on different parts of the convolution or inner product operations. Further computationally-efficient approaches may involve less frequent updates for candidate queries and values.
154
+
155
+ # 6 CONCLUSIONS
156
+
157
+ We propose an attention-based prototypical learning method, ProtoAttend, and demonstrate its usefulness for a wide range of problems on image, text and tabular data. By adding a relational attention mechanism to an encoder, prototypical learning enables novel capabilities. With sparsemax attention, it can base the learning on a few relevant samples that can be returned at inference for interpretability, and can also improve robustness to label noise. With softmax attention, it enables confidence-controlled prediction that can outperform state of the art results with simple architectures by simply making slightly fewer predictions, as well as enables detecting deviations from the training data. All these capabilities are achieved without sacrificing overall accuracy of the base model.
158
+
159
+ # REFERENCES
160
+
161
+ Devansh Arpit, Stanislaw Jastrzkbski, Nicolas Ballas, David Krueger, Emmanuel Bengio, et al. A Closer Look at Memorization in Deep Networks. arXiv:1706.05394, 2017.
162
+
163
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
164
+
165
+ Jacob Bien and Robert Tibshirani. Prototype selection for interpretable classification. arXiv:1202.5933, 2012.
166
+
167
+ Chaofan Chen, Oscar Li, Alina Barnett, Jonathan Su, and Cynthia Rudin. This looks like that: deep learning for interpretable image recognition. arXiv:1806.10574, 2018.
168
+
169
+ Alexis Conneau, Holger Schwenk, Lo¨ıc Barrault, and Yann LeCun. Very deep convolutional networks for natural language processing. arXiv:1606.01781, 2016.
170
+
171
+ Maurizio Corbetta and Gordon L. Shulman. Control of goal-directed and stimulus-driven attention in the brain. Nature Reviews Neuroscience, 3:201–215, 2002.
172
+
173
+ Yin Cui, Feng Zhou, Yuanqing Lin, and Serge J. Belongie. Fine-grained categorization and dataset bootstrapping using deep metric learning with humans in the loop. CVPR, 2016.
174
+
175
+ Terrance DeVries and Graham W. Taylor. Learning Confidence for Out-of-Distribution Detection in Neural Networks. arXiv:1802.04865, 2018.
176
+
177
+ Dumitru Erhan, Yoshua Bengio, Aaron Courville, and Pascal Vincent. Visualizing higher-layer features of a deep network. In Technical report, 2009.
178
+
179
+ Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. On calibration of modern neural networks. arXiv:1706.04599, 2017.
180
+
181
+ H A Haenssle, C Fink, R Schneiderbauer, F Toberer, T Buhl, et al. Man against machine: diagnostic performance of a deep learning convolutional neural network for dermoscopic melanoma recognition in comparison to 58 dermatologists. Annals of Oncology, 29(8):1836–1842, 2018.
182
+
183
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
184
+
185
+ Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. arXiv:1610.02136, 2016.
186
+
187
+ Dan Hendrycks, Mantas Mazeika, and Thomas G. Dietterich. Deep anomaly detection with outlier exposure. arXiv:1812.04606.
188
+
189
+ Sepp Hochreiter and Jrgen Schmidhuber. Long short-term memory. Neural Computation, 9(8): 1735–1780, 1997.
190
+
191
+ Elad Hoffer and Nir Ailon. Deep metric learning using triplet network. arXiv:1412.6622, 2014.
192
+
193
+ ISIC. ISIC Archive, 2016. URL http://www.isic-archive.com/.
194
+
195
+ Anthony F. Jerant, Jennifer T. Johnson, Catherine Demastes Sheridan, and Timothy J. Caffrey. Early detection and treatment of skin cancer. Am Fam Physician, 2000.
196
+
197
+ Heinrich Jiang, Been Kim, and Maya R. Gupta. To trust or not to trust a classifier. In NIPS, 2018.
198
+
199
+ Alex Kendall and Yarin Gal. What Uncertainties Do We Need in Bayesian Deep Learning for Computer Vision? In arXiv:1703.04977, March 2017a.
200
+
201
+ Alex Kendall and Yarin Gal. What uncertainties do we need in bayesian deep learning for computer vision? In NIPS, 2017b.
202
+
203
+ B. Kim, M. Wattenberg, J. Gilmer, C. Cai, J. Wexler, F. Viegas, and R. Sayres. Interpretability Beyond Feature Attribution: Quantitative Testing with Concept Activation Vectors (TCAV). In ICML, 2018.
204
+
205
+ Wonsik Kim, Bhavya Goyal, Kunal Chawla, Jungmin Lee, and Keunjoo Kwon. Attention-based ensemble for deep metric learning. In ECCV, 2018.
206
+
207
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2014.
208
+
209
+ Pang Wei Koh and Percy Liang. Understanding Black-box Predictions via Influence Functions. In ICML, 2017.
210
+
211
+ Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In NIPS. 2017.
212
+
213
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer Normalization. arXiv:1607.06450, 2016.
214
+
215
+ Oscar Li, Hao Liu, Chaofan Chen, and Cynthia Rudin. Deep learning for case-based reasoning through prototypes: A neural network that explains its predictions. In AAAI, 2018.
216
+
217
+ Andre F. T. Martins and Ram ´ on Fern ´ andez Astudillo. From softmax to sparsemax: A sparse model ´ of attention and multi-label classification. In MLR, 2016.
218
+
219
+ G.A. Miller. The magical number seven, plus or minus 2: Some limits on our capacity for processing information. Psychological review, 63:81–97, 04 1956.
220
+
221
+ Vikram Mullachery, Aniruddh Khera, and Amir Husain. Bayesian neural networks. arXiv:1801.07710, 2018.
222
+
223
+ Nicolas Papernot and Patrick D. McDaniel. Deep k-nearest neighbors: Towards confident, interpretable and robust deep learning. arXiv:1803.04765, 2018.
224
+
225
+ Mengye Ren, Renjie Liao, Ethan Fetaya, and Richard S. Zemel. Incremental few-shot learning with attention attractor networks. arXiv:1810.07218, 2018.
226
+
227
+ Sara Sabour, Nicholas Frosst, and Geoffrey E. Hinton. Dynamic routing between capsules. In NIPS, 2017.
228
+
229
+ Devendra Singh Sachan and Petuum. Revisiting lstm networks for semi-supervised text classification via mixed objective function. In KDD, 2018.
230
+
231
+ Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv:1312.6034, 2013.
232
+
233
+ Chawin Sitawarin and David A. Wagner. On the robustness of deep $\mathbf { k }$ -nearest neighbors. arXiv:1903.08333, 2019.
234
+
235
+ Jake Snell, Kevin Swersky, and Richard S. Zemel. Prototypical networks for few-shot learning. In NIPS, 2017.
236
+
237
+ Kihyuk Sohn. Improved deep metric learning with multi-class n-pair loss objective. In NIPS. 2016.
238
+
239
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, et al. Attention is all you need. arXiv:1706.03762, 2017.
240
+
241
+ Oriol Vinyals, Charles Blundell, Timothy P. Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. In NIPS, 2016.
242
+
243
+ Li Wan, Matthew Zeiler, Sixin Zhang, Yann Le Cun, and Rob Fergus. Regularization of neural networks using dropconnect. In ICML, 2013.
244
+
245
+ Chih-Kuan Yeh, Joon Sik Kim, Ian En-Hsu Yen, and Pradeep Ravikumar. Representer point selection for explaining deep neural networks. arXiv:1811.09720, 2018.
246
+
247
+ Matthew D. Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. arXiv:1311.2901, 2013.
248
+
249
+ Quanshi Zhang, Ying Nian Wu, and Song Chun Zhu. Interpretable convolutional neural networks. In CVPR, 2018.
250
+
251
+ A PSEUDO CODE FOR TRAINING
252
+
253
+ # Algorithm 1 Pseudo-code of ProtoAttend training
254
+
255
+ 1: Inputs: Training dataset $\tau$ , encoder model $h ( \mathbf { x } ; \theta )$ , classifier model $h ( \mathbf { v } ; \phi )$ , normalization function $n$ , input batch size $B$ , candidate batch size $D$ , attention dimension $d _ { a t t }$ , $\alpha$ values to be used for loss: (0, 0.5, 1), task-specific loss function $L$ , ADAM learning rate $r$ , and exponential decay rate parameters $\beta _ { 1 }$ and $\beta _ { 2 }$
256
+
257
+ $\theta$ $\phi$
258
+
259
+ 3: while until convergence do
260
+
261
+ 4: Sample a mini-batch from the training dataset for the inputs: $( \mathbf { x } _ { i } , y _ { i } ) _ { i = 1 } ^ { B } \sim T$
262
+
263
+ 5: Sample a mini-batch from the training dataset for the prototypes: $( \mathbf { x _ { j } ^ { ( c ) } } , y _ { j } ^ { ( c ) } ) _ { j = 1 } ^ { D } \sim \mathcal { T }$
264
+ 6: for $i = 1 , . . . , B$ do
265
+
266
+ 7: Obtain queries and values for the input:
267
+
268
+ $$
269
+ \mathbf { Q _ { i } } , \mathbf { V _ { i } } h ( \mathbf { x } ; \theta )
270
+ $$
271
+
272
+ 8: for $j = 1 , . . . , D$ do
273
+
274
+ 9: Obtain keys and values for the prototypes:
275
+
276
+ $$
277
+ \mathbf { K _ { j } ^ { ( c ) } } , \mathbf { V _ { j } ^ { ( c ) } } \gets h ( \mathbf { x } ^ { ( \mathbf { c } ) } ; \theta )
278
+ $$
279
+
280
+ 10: for $i = 1 , . . . , B$ do
281
+ 11: for $j = 1 , . . . , D$ do
282
+ 12: Estimate the relational attention coefficients:
283
+
284
+ $$
285
+ p _ { i , j } \gets n \left( \mathbf { K _ { j } ^ { ( c ) } } \mathbf { Q _ { i } } ^ { T } / \sqrt { d _ { a t t } } \right)
286
+ $$
287
+
288
+ 13: Obtain the predictions
289
+
290
+ 14: for $i = 1 , . . . , B$ do
291
+
292
+ $$
293
+ \hat { y } _ { i } ( \alpha = 0 ) \gets g \left( \mathbf { v _ { i } } ; \phi \right)
294
+ $$
295
+
296
+ $$
297
+ { \hat { y } } _ { i } ( \alpha = 0 . 5 ) \gets g \left( 0 . 5 { \bf v _ { i } } + 0 . 5 \sum _ { j = 1 } ^ { D } p _ { i , j } { \bf v _ { j } ^ { ( c ) } } ; \phi \right)
298
+ $$
299
+
300
+ $$
301
+ \hat { y } _ { i } ( \alpha = 1 ) \gets g \left( \sum _ { j = 1 } ^ { D } p _ { i , j } \mathbf { v _ { j } ^ { ( c ) } } ; \boldsymbol { \phi } \right)
302
+ $$
303
+
304
+ 15: Estimate the total loss function
305
+
306
+ $$
307
+ L _ { b a t c h } \gets 1 / B \cdot \sum _ { i = 1 } ^ { B } L \left( y _ { i } , \hat { y _ { i } } ( 0 ) \right) + L \left( y _ { i } , \hat { y _ { i } } ( 1 ) \right) + L \left( y _ { i } , \hat { y _ { i } } ( 0 . 5 ) \right)
308
+ $$
309
+
310
+ 16: Update the encoder model and the classifier layer
311
+
312
+ $$
313
+ \begin{array} { r l } & { \phi \phi - \mathrm { A D A M } ( \nabla _ { \phi } L _ { b a t c h } , r , \beta _ { 1 } , \beta _ { 2 } ) } \\ & { } \\ & { \theta \theta - \mathrm { A D A M } ( \nabla _ { \theta } L _ { b a t c h } , r , \beta _ { 1 } , 2 ) } \end{array}
314
+ $$
315
+
316
+ # B RELATION TO INFLUENCE FUNCTIONS
317
+
318
+ Here we clarify the relationship of our work to influence functions from a theoretical perspective. Influence functions quantify how a model’s predictions would change if we did not have a particular training point. For the purpose of sample-based explainability, (Koh & Liang, 2017) proposes that the relation between an input sample $\mathbf { x _ { i } }$ and the candidate samples13 $\bf { x } _ { j } ^ { ( c ) }$ can be obtained by quantifying the influence of upweighting $( \mathbf { x _ { j } ^ { ( c ) } } , y _ { j } ^ { ( c ) } )$ on the loss at a query point $( \mathbf { x _ { i } } , y _ { i } )$
319
+
320
+ $$
321
+ \mathcal { T } _ { i , j } = - \nabla _ { ( \theta , \phi ) } L ( y _ { j } ^ { ( c ) } ) ^ { T } ( \mathbf H _ { ( \hat { \theta } , \hat { \phi } ) } ^ { - 1 } ) ^ { T } \nabla _ { ( \theta , \phi ) } L ( y _ { i } ) ,
322
+ $$
323
+
324
+ where $\mathbf { H } _ { ( \hat { \theta } , \hat { \phi } ) }$ is the Hessian and is positive definite by assumption. Let’s consider the singular value decomposition $( \mathbf { H } _ { ( \hat { \theta } , \hat { \phi } ) } ^ { - 1 } ) = \Xi \cdot \Sigma \cdot \Psi ^ { T }$ and also define the function $k ( \mathbf { x } , y ) = \nabla _ { ( \theta , \phi ) } L ( y )$ . Then, Eq. 4 can be written as:
325
+
326
+ $$
327
+ \mathcal { T } _ { i , j } = ( \boldsymbol { \Psi } ^ { T } \cdot k ( \mathbf { x _ { j } ^ { ( c ) } } , y _ { j } ^ { ( c ) } ) ) ^ { T } \cdot ( - \Sigma \cdot \Xi ^ { T } ) \cdot k ( \mathbf { x _ { i } } , y _ { i } ) ,
328
+ $$
329
+
330
+ We can observe that $\mathcal { T } _ { i , j }$ is in the form of an inner product between two functions applied on $\left( \mathbf { x _ { i } } , y _ { i } \right)$ and $( \mathbf { x _ { j } ^ { ( c ) } } , y _ { j } ^ { ( c ) } )$ y(c)j ). These two functions are composed of a shared (and potentially complex) function, followed by a linear mapping with non-shared parameters. This expression is indeed in a similar form with the argument of the normalization function for attention in Eq. 1, where the queries and keys are obtained by a shared encoder except the last layer. The only notable difference is that ProtoAttend encoder functions merely input xi and x(c)j , not the ground truth labels. Instead of relying on ground truth labels or complex Hessian estimations, ProtoAttend infers the encoded representations for the queries and keys directly in a feedforward way, by learning from the entire training dataset. Note that ProtoAttend does not use a separate encoder for values, and obtains a high performance by sharing the vast majority of the parameters while obtaining the keys, queries and values.
331
+
332
+ In (Koh & Liang, 2017), Influence Functions are also related to nearest neighbor search-based relevant point determination approaches, for sample-based explainability. When Euclidean space is considered for distances, with the assumption that all points have the same norm, the inner product between the representations correspond to their similarity. This scenario is the special case of ProtoAttend when we use the same representation for keys, queries and values, and when we train with only $\alpha = 0$ loss term although we would use $p _ { i , j }$ for similarity determination. As studied in (Koh & Liang, 2017), nearest neighbor-based methods are far less accurate in capturing the effect of model training, compared to Influence Functions. Our empirical results in Figs. 7 and 13 show superior performance of ProtoAttend compared to Influence Functions in finding perceptually more similar samples.
333
+
334
+ Overall, unlike Influence Functions, ProtoAttend modifies the model training for the desired goals, that fundamentally yields more degrees of freedom to optimize while achieving superior prototype learning quality effectively.
335
+
336
+ # C TRAINING DETAILS
337
+
338
+ Different candidate databases are sampled randomly from the training dataset at each iteration. Training database size is chosen to fit the model to the memory of a single GPU. $D$ at inference is chosen sufficiently large to obtain high accuracy. Table 4 shows the database size $D$ for the datasets used in the experiments. The size of the prototype candidate database should be sufficiently large such that the model can attend to reasonable prototypes with high coefficients (separately for each input). With appropriate sparsity mechanisms, we normally only end up with a few prototypes with large coefficients. Indeed, most of the coefficients would be zero with sparsemax activation and sparsity regularization.
339
+
340
+ Table 4: Datasets and database size D.
341
+
342
+ <table><tr><td rowspan=2 colspan=1>Dataset</td><td rowspan=2 colspan=1>Encoder</td><td rowspan=1 colspan=2>Database size D</td></tr><tr><td rowspan=1 colspan=1>Training</td><td rowspan=1 colspan=1>Inference</td></tr><tr><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>ResNet</td><td rowspan=1 colspan=1>1024</td><td rowspan=1 colspan=1>32768</td></tr><tr><td rowspan=1 colspan=1>Fashion-MNIST</td><td rowspan=1 colspan=1>ResNet</td><td rowspan=1 colspan=1>1024</td><td rowspan=1 colspan=1>32768</td></tr><tr><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>ResNet</td><td rowspan=1 colspan=1>1024</td><td rowspan=1 colspan=1>32768</td></tr><tr><td rowspan=1 colspan=1>Fruits</td><td rowspan=1 colspan=1>ResNet</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>4096</td></tr><tr><td rowspan=1 colspan=1>ISICMelanoma</td><td rowspan=1 colspan=1>ResNet</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>4096</td></tr><tr><td rowspan=1 colspan=1>DBPedia</td><td rowspan=1 colspan=1>VDCNN</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>4096</td></tr><tr><td rowspan=1 colspan=1>Census Income</td><td rowspan=1 colspan=1>LSTM</td><td rowspan=1 colspan=1>4096</td><td rowspan=1 colspan=1>15360</td></tr></table>
343
+
344
+ # C.1 IMAGE DATA
345
+
346
+ # C.1.1 MNIST DATASET
347
+
348
+ We apply random cropping after padding each side by 2 pixels and per image standardization. The base encoder uses a standard 32 layer ResNet architecture. The number of filters is initially 16 and doubled every 5 blocks. In each block, two $3 \times 3$ convolutional layers are used to transform the input, and the transformed output is added to the input after a $1 \times 1$ convolution. $4 \times$ downsampling is applied by choosing the stride as 2 after $5 ^ { t h }$ and $1 0 ^ { t h }$ blocks. Each convolution is followed by batch normalization and ReLU nonlinearity. After the last convolution, $7 \times 7$ average pooling is applied. The output is followed by a fully-connected layer of 256 units and ReLU nonlinearity, followed by layer normalization (Lei Ba et al., 2016). Keys and queries are mapped from the output using a fully-connected layer followed by ReLU nonlinearity, where the attention size is $d _ { a t t } { = } 1 6$ . Values are mapped from the output using a fully-connected layer of $d _ { o u t } { = } 6 4$ units and ReLU nonlinearity, followed by layer normalization. For the baseline encoder, the initial learning rate is chosen as 0.002 and exponential decay is applied with a rate of 0.9 applied every $^ \mathrm { 6 k }$ iterations. The model is trained for 84k iterations. For prototypical learning model with softmax attention, the initial learning rate is chosen as 0.002 and exponential decay is applied with a rate of 0.8 applied every 8k iterations. The model is trained for 228k iterations. For prototypical learning model with sparsemax attention, the initial learning rate is chosen as 0.001 and exponential decay is applied with a rate of 0.93 applied every 6k iterations. The model is trained for $2 2 8 \mathrm { k }$ iterations. All models use a batch size of 128 and gradient clipping above 20.
349
+
350
+ # C.1.2 FASHION-MNIST DATASET
351
+
352
+ We apply random cropping after padding each side by 2 pixels, random horizontal flipping, and per image standardization. The base encoder uses a standard 32 layer ResNet architecture, similar to our MNIST experiments. For the baseline encoder, the initial learning rate is chosen as 0.0015 and exponential decay is applied with a rate of 0.9 applied every $1 0 \mathrm { k }$ iterations. The model is trained for 332k iterations. For prototypical learning with softmax attention, the initial learning rate is chosen as 0.0007 and exponential decay is applied with a rate of 0.92 applied every $^ { 8 \mathrm { k } }$ iterations. The model is trained for $4 5 0 \mathrm { k }$ iterations. For prototypical learning with sparsemax attention, the initial learning rate is chosen as 0.001 and exponential decay is applied with a rate of 0.9 applied every $^ { 8 \mathrm { k } }$ iterations. The model is trained for 392k iterations. For prototypical learning with sparsemax attention and sparsity regularization (with $\lambda _ { s p a r s e } = 0 . 0 0 0 3 )$ , the initial learning rate is chosen as 0.001 and exponential decay is applied with a rate of 0.94 applied every 8k iterations. $\lambda _ { c o n f } = 0 . 1$ is chosen when confidence regularization is applied. The model is trained for $4 4 0 \mathrm { k }$ iterations. All models use a batch size of 128 and gradient clipping above 20.
353
+
354
+ # C.1.3 CIFAR-10 DATASET
355
+
356
+ We apply random cropping after padding each side by 3 pixels, random horizontal flipping, random vertical flipping and per image standardization. The base encoder uses a standard 50 layer ResNet architecture. The number of filters is initially 16 and doubled every 8 blocks. In each block, two $3 \times 3$ convolutional layers are used to transform the input, and the transformed output is added to the input after a $1 \times 1$ convolution. $4 \times$ downsampling is applied by choosing the stride as 2 after $8 ^ { t h }$ and $1 \dot { 6 } ^ { t h }$ blocks. Each convolution is followed by batch normalization and the ReLU nonlinearity. After the last convolution, $8 \times 8$ average pooling is applied. The output is followed by a fully-connected layer of 256 units and the ReLU nonlinearity, followed by layer normalization (Lei Ba et al., 2016). Keys and queries are mapped from the output using a fully-connected layer followed by the ReLU nonlinearity, where the attention size is $d _ { a t t } { = } 1 6$ . Values are mapped from the output using a fully-connected layer of $d _ { o u t } { = } 1 2 8$ units and the ReLU nonlinearity, followed by layer normalization. For the baseline encoder, the initial learning rate is chosen as 0.002 and exponential decay is applied with a rate of 0.95 applied every 10k iterations. The model is trained for $9 4 0 \mathrm { k }$ iterations. For prototypical learning with softmax attention, the initial learning rate is chosen as 0.0035 and exponential decay is applied with a rate of 0.95 applied every 10k iterations. The model is trained for $6 2 5 \mathrm { k }$ iterations. For prototypical learning with sparsemax attention, the initial learning rate is chosen as 0.0015 and exponential decay is applied with a rate of 0.95 applied every 10k iterations. The model is trained for $9 0 5 \mathrm { k }$ iterations. For prototypical learning with sparsemax attention and sparsity regularization (with $\lambda _ { s p a r s e } = 0 . 0 0 0 0 8 )$ , the initial learning rate is chosen as 0.0015 and exponential decay is applied with a rate of 0.95 applied every $1 2 \mathrm { k }$ iterations. $\lambda _ { c o n f } = 0 . 1$ is chosen when confidence regularization is applied. The model is trained for $4 5 0 \mathrm { k }$ iterations. All models use a batch size of 128 and gradient clipping above 20.
357
+
358
+ CIFAR-10 experiments with noisy labels. For CIFAR-10 experiments with noisy labels for the base encoder we only optimize the learning parameters. Noisy labels are sampled uniformly from the set of labels excluding the correct one. The baseline model with noisy label ratio of 0.8 uses an initial learning rate of 0.001, decayed with a rate of 0.92 every $^ \mathrm { 6 k }$ iterations, and is trained for $1 5 \mathrm { k }$ iterations. For the dropout approach, dropout with a rate of 0.1 is applied, and the model uses an initial learning rate of 0.002, decayed with a rate of 0.85 every $^ { 8 \mathrm { k } }$ iterations, and is trained for $2 4 \mathrm { k }$ iterations. The baseline model with noisy label ratio of 0.6 uses an initial learning rate of 0.002, decayed with a rate of 0.92 every $^ \mathrm { 6 k }$ iterations, and is trained for 12k iterations. For the dropout approach, dropout with a rate of 0.3 is applied, and the model uses an initial learning rate of 0.002, decayed with a rate of 0.92 every $^ \mathrm { 8 k }$ iterations, and is trained for $1 8 \mathrm { k }$ iterations. The baseline model with noisy label ratio of 0.4 uses an initial learning rate of 0.002, decayed with a rate of 0.92 every 6k iterations, and is trained for $1 5 \mathrm { k }$ iterations. For the dropout approach, dropout with a rate of 0.5 is applied, and the model uses an initial learning rate of 0.002, decayed with a rate of 0.92 every $^ \mathrm { 6 k }$ iterations, and is trained for $1 8 \mathrm { k }$ iterations. For experiments for the prototypical learning model with sparsemax attention, we optimize the learning parameters and $\lambda _ { s p a r s e }$ . For the model with noisy label ratio of 0.8, $\lambda _ { s p a r s e } = 0 . 0 0 1 5$ , initial learning rate is chosen as 0.0006 and exponential decay is applied with a rate of 0.95 applied every $^ \mathrm { 8 k }$ iterations. The model is trained for $1 0 8 \mathrm { k }$ iterations. For the model with noisy label ratio of 0.6, $\lambda _ { s p a r s e } = 0 . 0 0 0 5$ , initial learning rate is chosen as 0.001 and exponential decay is applied with a rate of 0.9 applied every $^ \mathrm { 8 k }$ iterations. The model is trained for $9 2 \mathrm { k }$ iterations. For the model with noisy label ratio of 0.4, $\lambda _ { s p a r s e } = 0 . 0 0 0 3$ , initial learning rate is chosen as 0.001 and exponential decay is applied with a rate of 0.9 applied every $^ \mathrm { 6 k }$ iterations. The model is trained for $1 2 2 \mathrm { k }$ iterations.
359
+
360
+ # C.1.4 FRUITS DATASET
361
+
362
+ We apply random cropping after padding each side by 5 pixels, random horizontal flipping, random vertical flipping and per image standardization. In the encoder, first, a downsampling with a convolutional layer is applied with a stride of 2, and using 16 filters, followed by a downsampling with max-pooling with a stride of 2. After obtaining the $2 5 \times 2 5$ inputs, a standard 32 layer ResNet architecture (similar to MNIST) is used, followed by a fully-connected layer of 128 units and the ReLU nonlinearity, followed by layer normalization (Lei Ba et al., 2016). Keys and queries are mapped from the output using a fully-connected layer followed by the ReLU nonlinearity, where the attention size is $d _ { a t t } { = } 1 6$ . Values are mapped from the output using a fully-connected layer of $d _ { o u t } { = } 6 4$ units and the ReLU nonlinearity, followed by layer normalization. W eight decay with a factor of 0.0001 is applied for the convolutional filters. The model uses a batch size of 128 and gradient clipping above 20.
363
+
364
+ # C.1.5 ISIC MELANOMA DATASET
365
+
366
+ The ISIC Melanoma dataset is formed from the ISIC Archive (ISIC, 2016) that contains over $1 3 \mathrm { k }$ dermoscopic images collected from leading clinical centers internationally and acquired from a variety of devices within each center. The dataset consists of skin images with labels denoting whether they contain melanoma or are benign. We construct the training and validation dataset using 15122 images (13511 benign and 1611 melanoma cases), and the evaluation dataset using 3203 images (2867 benign and 336 melanoma). While training, benign cases are undersampled in each batch to have 0.6 ratio including candidate database sets at training and inference. All images are resized to $1 2 8 \times 1 2 8$ pixels. We apply random cropping after padding each side by 8 pixels, random horizontal flipping, random vertical flipping and per image standardization. In the encoder, first, a downsampling with a convolutional layer is applied with a stride of 2, and using 16 filters, followed by a downsampling with max-pooling with a stride of 2. After obtaining the $3 2 \times 3 2$ inputs, the base encoder uses a standard 50 layer ResNet architecture (similar to CIFAR10), followed by a fully-connected layer of 128 units and the ReLU nonlinearity, followed by layer normalization (Lei Ba et al., 2016). Keys and queries are mapped from the output using a fully-connected layer followed by the ReLU nonlinearity, where the attention size is $d _ { a t t } { = } 1 6$ . Values are mapped from the output using a fully-connected layer of $d _ { o u t } { = } 6 4$ units and the ReLU nonlinearity, followed by layer normalization. For the baseline encoder, the initial learning rate is chosen as 0.002 and exponential decay is applied with a rate of 0.9 applied every 3k iterations. The model is trained for 220k iterations. For prototypical learning with softmax attention, the initial learning rate is chosen as 0.0006 and exponential decay is applied with a rate of 0.9 applied every $3 \mathrm { k }$ iterations. The model is trained for $1 4 7 \mathrm { k }$ iterations. For prototypical learning with sparsemax attention, the initial learning rate is chosen as 0.0006 and exponential decay is applied with a rate of 0.9 applied every 4k iterations. The model is trained for 166k iterations. All models use a batch size of 128 and gradient clipping above 20.
367
+
368
+ # C.1.6 ANIMALS WITH ATTRIBUTES DATASET
369
+
370
+ We train ProtoAttend with sparsemax attention using the features from a pre-trained ResNet-50 as provided in (Yeh et al., 2018). To map the pre-trained features, we simply insert a single fullyconnected layer with 256 units with ReLU nonlinearity and layer normalization, followed by the individual fully-connected layers of keys, queries and values (16, 16 and 64 units respectively with ReLU nonlinearity). Sparsity regularization is applied with $\lambda _ { s p a r s e } = 0 . 0 0 0 0 0 1$ . We train the model for $7 0 \mathrm { k }$ iterations. The initial learning rate is chosen as 0.0006 and exponential decay is applied with a rate of 0.8 applied every 10k iterations. A classification accuracy above $91 \%$ is obtained for the test set.
371
+
372
+ # C.2 TEXT DATA
373
+
374
+ # C.2.1 DBPEDIA DATASET
375
+
376
+ There are 14 output classes: Company, Educational Institution, Artist, Athlete, Office Holder, Mean Of Transportation, Building, Natural Place, Village, Animal, Plant, Album, Film, Written Work. As the input, 16-dimensional trainable embeddings are mapped from the dictionary of 69 raw characters (Conneau et al., 2016). The maximum length is set to 448 and longer inputs are truncated while the shorter inputs are padded. The input embeddings are first transformed with a 1-D convolutional block consisting 64 filters with kernel width of 3 and stride of 2. Then, 8 convolution blocks as in (Conneau et al., 2016) are applied, with 64, 64, 128, 128, 256, 256, 512 and 512 filters respectively. All use the kernel width of 3, and after each two layers, max pooling is applied with kernel width of 3 and a stride of 2. All convolutions are followed by batch normalization and the ReLU nonlinearity. Convolutional filters use weight normalization with parameter 0.00001. The last convolution block is followed by $\mathbf { k }$ -max pooling with $k { = } 8$ (Conneau et al., 2016). Finally, we apply two fully-connected layers with 1024 hidden units. In contrast to (Conneau et al., 2016), we also use layer normalization (Lei Ba et al., 2016) after fully-connected layers as we observe this leads to more stable training behavior. Keys and queries are mapped from the output using a fully-connected layer followed by the ReLU nonlinearity, where the attention size is $d _ { a t t } { = } 1 6$ . Values are mapped from the output using a fully-connected layer of $d _ { o u t } { = } 6 4$ units and the ReLU nonlinearity, followed by layer normalization. For the baseline encoder, initial learning rate is chosen as 0.0008 and exponential decay is applied with a rate of 0.9 applied every $^ { 8 \mathrm { k } }$ iterations. The model is trained for 212k iterations. For prototypical learning model with softmax attention, the initial learning rate is chosen as 0.0008 and exponential decay is applied with a rate of 0.9 applied every 8k iterations. The model is trained for 146k iterations. For prototypical learning model with sparsemax attention, the initial learning rate is chosen as 0.0005 and exponential decay is applied with a rate of 0.82 applied every $^ \mathrm { 8 k }$ iterations. The model is trained for $2 7 0 \mathrm { k }$ iterations. All models use a batch size of 128 and gradient clipping above 20. We do not apply any data augmentation.
377
+
378
+ # C.3 TABULAR DATA
379
+
380
+ # C.3.1 ADULT CENSUS INCOME
381
+
382
+ There are two output classes: whether or not the annual income is above $\$ 50\mathrm { k }$ . Categorical categories such as the ‘marital-status’ are mapped to multi-hot representations. Continuous variables are used after a fixed normalization transformation. For ‘age’, the transformation first subtracts 50 and then divides by 30. For ‘fnlwgt’, the transformation first takes the log, and then subtracts 9, and then divides by 3. For ‘education-num’, the transformation first subtracts 6 and then divides by 6. For ‘hours-per-week’, the transformation first subtracts 50 and then divides by 50. For ‘capital-gain’ and ‘capital-loss’, the normalization takes the log, and then subtracts 5, and then divides by 5. The concatenated features are then mapped to a 64 dimensional vector using a fully-connected layer, followed by the ReLU nonlinearity. The base encoder uses an LSTM architecture, with 4 timesteps. At each timestep, 64-dimensional inputs are applied after a dropout with rate 0.5. The output of the last timestep is used after applying a dropout with rate 0.5. Keys and queries are mapped from this output using a fully-connected layer followed by the ReLU nonlinearity, where the attention size is $d _ { a t t } { = } 1 6$ . Values are mapped from the output using a fully-connected layer of $d _ { o u t } { = } 1 6$ units and the ReLU nonlinearity, followed by layer normalization. For the baseline encoder, the initial learning rate is chosen as 0.002 and exponential decay is applied with a rate of 0.9 applied every $2 \mathrm { k }$ iterations. The model is trained for $4 . 5 \mathrm { k }$ iterations. For the models with attention in prototypical learning framework, the initial learning rate is chosen as 0.0005 and exponential decay is applied with a rate of 0.92 applied every $2 \mathrm { k }$ iterations. The softmax attention model is trained for $1 3 . 5 \mathrm { k }$ iterations and the sparsemax attention model is trained for $1 1 . 5 \mathrm { k }$ iterations. For the model with sparsity regularization, the initial learning rate is 0.003 and exponential decay is applied with a rate of 0.7 applied every 2k iterations, and the model is trained for 7k iterations. All models use a batch size of 128 and gradient clipping above 20. We do not apply any data augmentation.
383
+
384
+ # D ADDITIONAL PROTOTYPE EXAMPLES
385
+
386
+ Fig. 10 exemplify prototypes for CIFAR-10. For most cases, we observe the similarity of discriminative features between inputs and prototypes. For example, the body figures of birds, the shape of tires, the face patterns of dogs, the body figures of frogs, the appearance of the background sky for planes, are among the features apparent in examples.
387
+
388
+ Fig. 11 shows additional prototype examples for DBPedia dataset. Prototypes have very similar sentence structure, words and concepts, while categorizing the sentences into ontologies.
389
+
390
+ Fig. 12 shows example prototypes for ISIC Melanoma. In some cases, we observe the commonalities between input and prototypes that distinguish melanoma cases such as the non-circular geometry or irregularly-notched borders (Jerant et al., 2000). Compared to other datasets, ISIC Melonama dataset yields lower interpretable prototype quality on average. We hypothesize this to be due to the perceptual difficulty of the problem as well as the insufficient encoder performance shown by the lower classification accuracy (despite the acceptable AUC).
391
+
392
+ Fig. 13 shows more comparison examples for prototypical learning framework with sparsemax attention vs. representer point selection (Yeh et al., 2018) on Animals with Attributes dataset. For some cases, including chimpanzee, zebra, dalmatian and tiger, ProtoAttend yields perceptually very similar samples. The similarity of the chimpanzee body form and the background, zebra patterns, dalmatian pattern on the grass, and tiger pattern and head pose, are prominent. Representer point selection fails to capture such similarity features as effectively. On the other hand, for bat, otter and wolf, the results are somewhat less satisfying. The wing part of the bat, multiple count of the otters with the background, and the color and furry head of the wolf seem to be captured, but with less apparent similarity than some other possible samples from the dataset. Representer point selection method also cannot be claimed to be successful in these cases. Lastly, for leopard, ProtoAttend only yields one non-zero prototype (which is indeed statistically rare given the model and sparsity choices). The pattern of the leopard image seems relevant, but it is also not fully satisfying to observe a single prototype that is not perceptually more similar. All of the test examples in Fig. 13 are classified correctly with our framework and all of the shown prototypes are also from the correct classes.
393
+
394
+ # E COMPARISON OF CONFIDENCE-CONTROLLED PREDICTION FOR SOFTMAX VS. SPARSEMAX
395
+
396
+ Figs. 14 and 15 show the accuracy vs. ratio of samples for softmax vs. sparsemax attention without confidence regularization. The baseline accuracy (at $100 \%$ prediction ratio) is higher for softmax attention for some datasets, whereas higher for sparsemax for some others. On the other hand, higher number of prototypes yielded by softmax attention results in a wider range for confidence-controlled prediction trade-off.
397
+
398
+ ![](images/034410d775358765eda1d519c1daeb3e662c320a26531ac53b3f0968afc698cc.jpg)
399
+ Figure 10: Example inputs and corresponding prototypes for CIFAR-10.
400
+
401
+ ![](images/6346891a1d9baf573abbbbd4d63a7e341f1418424e30ef470b09fb170aba7b49.jpg)
402
+
403
+ ![](images/8405a0a63865bc2883fe05bdd2dc5a40b8924bc6967a30ca93582dba712b965f.jpg)
404
+ Figure 12: Example inputs and corresponding prototypes for ISIC Melanoma (with sparsemax attention).
405
+
406
+ ![](images/1e04bb9f13278fd7c431a54f690147d6dfac1fddfd666069c913eda4e5a2268f.jpg)
407
+ Figure 13: Relevant samples found by ProtoAttend with sparsemax attention vs. representer point selection (Yeh et al., 2018) for the examples from Supplementary Material of (Yeh et al., 2018).
408
+
409
+ ![](images/29459b15e38c3d80ce18d3c943ab234845c13b8b07ab710d6543051d3ce1bbce.jpg)
410
+ Figure 14: Accuracy vs. ratio of samples for (a) MNIST and (b) Fashion MNIST, for confidence levels between 0 and 0.999.
411
+
412
+ ![](images/fb2536ee6dff6378458471d6bd4cb7c0362afe86d2f456fe18025df8f28b7af6.jpg)
413
+ Figure 15: Accuracy vs. ratio of samples for (a) DBpedia and (b) Adult Census Income, for confidence levels between 0 and 0.999.
414
+
415
+ As an impactful case study, we consider melanoma detection problem with ISIC dataset (ISIC, 2016) in Supplementary Material. In medical diagnosis, it is strongly desired to maintain a sufficiently-high prediction performance, potentially by verifying the decisions of an AI system by medical experts in the cases where the AI models are not confident. By refraining from some predictions, as shown in Fig. 16, we demonstrate unprecedentedly high AUC values without using transfer learning or highly-customized models (Haenssle et al., 2018).
416
+
417
+ ![](images/8dc8c38f0305b29206d04ceb30d3dccb5e0de500f65f9183364883d44ceea47f.jpg)
418
+ Figure 16: Area-under-curve (AUC) vs. ratio of samples for ISIC Melanoma with softmax attention, for confidence values ranging between 0 and 0.99.
419
+
420
+ # F HUMAN USER STUDY ON THE USEFULNESS OF PROTOTYPES
421
+
422
+ We perform a user study by asking humans how much an extra image helps in explaining the guessed class of the input, after showing what the trained network predicts for that input. We consider the Animals with Attributes dataset (exemplified in Fig. 13). We randomly pick test samples and assess how much showing the top prototype makes a difference. The results in Table 5 shows that ProtoAttend picks
423
+
424
+ Table 5: Human ratings (mean score and $9 5 \%$ confidence interval) on how much an extra image helps guessing the class of the input.
425
+
426
+ <table><tr><td rowspan=1 colspan=1>Samplingmethod</td><td rowspan=1 colspan=1>Score (out of 5)</td></tr><tr><td rowspan=1 colspan=1>Top prototype by ProtoAttend</td><td rowspan=1 colspan=1>4.33± 0.09</td></tr><tr><td rowspan=1 colspan=1>Randomly sampled from the predicted class</td><td rowspan=1 colspan=1>3.97 ± 0.12</td></tr><tr><td rowspan=1 colspan=1>Randomlysampled fromanyclass</td><td rowspan=1 colspan=1>1.33± 0.09</td></tr></table>
427
+
428
+ # G CONTROLLING SPARSITY VIA REGULARIZATION
429
+
430
+ ![](images/38c031db2ac9516eef1580214ba82ca130f21a0dfed84a3594d2181343386939.jpg)
431
+
432
+ Figure 17: Number of training iterations vs. median number prototypes to explain $9 5 \%$ of the decision (in logarithmic scale), for Fashion-MNIST with softmax attention.
433
+
434
+ Fig. 17 shows the impact of sparsity regularization coefficient on training. By varying the value of $\lambda _ { s p a r s e }$ , the number of prototypes can be efficiently controlled. For high values of sparsity regularization coefficient, the model gets stuck at a point where it is forced to make decision from a low number of prototypes before the encoder model is properly learned, hence typically yields considerably lower performance. We also observe sparsity mechanism via sparsemax attention to yield better performance than softmax attention with high sparsity regularization.
435
+
436
+ # H PROTOTYPE QUALITY
437
+
438
+ In general, the following scenarios may yield low prototype quality:
439
+
440
+ 1. Lack of related samples in the candidate database.
441
+ 2. Perceptual difference between humans and encoders in determining discriminative features.
442
+ 3. High intra-class variability that makes training difficult.
443
+ 4. Imperfect encoder that cannot yield fully accurate representations of the input.
444
+ 5. Insufficiency of relational attention to determine weights from queries and keys.
445
+ 6. Inefficient decoupling between encoder & attention blocks and the final decision block.
446
+
447
+ There can be problem-dependent fundamental limitations on (1)-(3), whereas (4)-(6) are raised by choices of models and losses and can be further improved. We leave the quantification of prototype quality using information-theoretic metrics or discriminative neural networks to future work.
448
+
449
+ # I UNDERSTANDING MISCLASSIFICATION CASES
450
+
451
+ One of the benefits of prototypical learning is insights into wrong decision cases. Fig. 18 exemplifies prototypes with wrong labels, that give insights about why the model is confused about a particular input (e.g. due to similarity of the visual patterns). Such insights can be actionable to improve the model performance, such as adding more training samples for the confusing classes or modifying the loss functions.
452
+
453
+ ![](images/5fd04f5881a72367af0b9121f5e1e20ac9c96b37d66e173012084d35766900b9.jpg)
454
+ Figure 18: Example prototypes with wrong labels for CIFAR-10.
md/train/Hygm8jC9FQ/Hygm8jC9FQ.md ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FAVAE: SEQUENCE DISENTANGLEMENT USING INFORMATION BOTTLENECK PRINCIPLE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We propose the factorized action variational autoencoder (FAVAE), a state-of-theart generative model for learning disentangled and interpretable representations from sequential data via the information bottleneck without supervision. The purpose of disentangled representation learning is to obtain interpretable and transferable representations from data. We focused on the disentangled representation of sequential data since there is a wide range of potential applications if disentanglement representation is extended to sequential data such as video, speech, and stock price data. Sequential data is characterized by dynamic factors and static factors: dynamic factors are time dependent, and static factors are independent of time. Previous works succeed in disentangling static factors and dynamic factors by explicit modeling the priors of latent variables to distinguish between static and dynamic factors. However, this model cannot disentangle representations between dynamic factors, such as disentangling ”picking” and ”throwing” in robotic tasks. In this paper, we propose new model that can disentangle multiple dynamic factors. Since our method does not require modeling priors, it is capable of disentangling ”between” dynamic factors. In experiments, we show that FAVAE can extract the disentangled dynamic factors.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Representation learning is one of the most fundamental problems in machine learning. A real world data distribution can be regarded as a low-dimensional manifold in a high-dimensional space (Bengio et al., 2013). Generative models in deep learning, such as the variational autoencoder (VAE) (Kingma & Welling, 2013) and the generative adversarial network (GAN) (Goodfellow et al., 2014), are able to learn low-dimensional manifold representation (factor) as a latent variable. The factors are fundamental components such as position, color, and degree of smiling in an image of a human face (Liu et al., 2015). Disentangled representation is defined as a single factor being represented by a single latent variable (Bengio et al., 2013). Thus, if in a model of learned disentangled representation, shifting one latent variable while leaving the others fixed generates data showing that only the corresponding factor was changed. This is called latent traversals (a good demonstration of which was given by Higgins et al. $( 2 0 1 6 \mathrm { a } ) ^ { 1 }$ ). There are two advantages of disentangled representation. First, latent variables are interpretable. Second, the disentangled representation is generalizable and robust against adversarial attacks (Alemi et al., 2016).
12
+
13
+ We focus on the disentangled representation learning of sequential data. Sequential data is characterized by dynamic factors and static factors: dynamic factors are time dependent, and static factors are independent of time. With disentangled representation learning from sequential data, we should be able to extract dynamic factors that cannot be extracted by disentangled representation learning models for non-sequential data such as $\beta$ -VAE (Higgins et al., 2016a;b) and InfoGAN (Chen et al., 2016). The concept of disentangled representation learning for sequential data is illustrated in Fig. 1. Consider that the pseudo-dataset of the movement of a submarine has a dynamic factor: the trajectory shape. The disentangled representation learning model for sequential data can extract this shape. On the other hand, since the disentangled representation learning model for non-sequential data does not consider the sequence of data, it merely extracts the $\mathbf { X }$ -position and y-position.
14
+
15
+ (c) FAVAE accepts sequential data.
16
+
17
+ ![](images/d791a4a43bd7873e6856996a67db2eab578a5e68ad71e5cdec1fe65206843e5f.jpg)
18
+ (d) Latent traversal of FAVAE.
19
+ Figure 1: Illustration of how FAVAE differs from $\beta$ -VAE. $\beta$ -VAE does not accept data sequentially; it cannot differentiate data points from different trajectories or sequences of data points. FAVAE considers a sequence of data points, taking all data points in a trajectory as one datum. For example, for a pseudo-dataset representing the trajectory of a submarine (1a,1c), $\beta$ -VAE accepts 11 different positions of the submarine as non-sequential data while FAVAE accepts three different trajectories of the submarine as sequential data. Therefore, the latent variable in $\beta$ -VAE learns only the coordinates of the submarine, and the latent traversal shows the change in the submarines position. On the other hand, FAVAE learns the factor that controls the trajectory of the submarine, so the latent traversal shows the change in the submarines trajectory.
20
+
21
+ There is a wide range of potential applications if we extend disentanglement representation to sequential data such as speech, video, and stock market data. For example, disentangled representation learning for stock price data can extract the fundamental trend of a given stock price. Another application is the reduction of action space in reinforcement learning. Extracting dynamic factors would enable the generation of macro-actions (Durugkar et al., 2016), which are sets of sequential actions that represent the fundamental factors of the actions. Thus, disentangled representation learning for sequential data opens the door to new areas of research.
22
+
23
+ Very recent related work (Hsu et al., 2017; Li & Mandt, 2018) separated factors of sequential data into dynamic and static factors. The factorized hierarchical variational autoencoder (FHVAE) (Hsu et al., 2017) is based on a graphical model using latent variables with different time dependencies. By maximizing the variational lower bound of the graphical model, the FHVAE separates the different time dependent factors such as the dynamic and static factors. The VAE architecture developed by Li & Mandt (2018) is the same as the FHVAE in terms of the time dependencies of the latent variables. Since these models require different time dependencies for the latent variables, these approaches cannot be used disentangle variables with the same time dependency factor.
24
+
25
+ We address this problem by taking a different approach. First, we analyze the root cause of disentanglement from the perspective of information theory. As a result, the term causing disentanglement is derived from a more fundamental rule: reduce the mutual dependence between the input and output of an encoder while keeping the reconstruction of the data. This is called the information bottleneck (IB) principle. We naturally extend this principle to sequential data from the relationship between $x$ and $z$ to $x _ { t : T }$ and $z$ . This enables the separation of multiple dynamic factors as a consequence of information compression. It is difficult to learn a disentangled representation of sequential data since not only the feature space but also the time space should be compressed. We created the factorized action variational autoencoder (FAVAE) in which we implemented the concept of information capacity to stabilize learning and a ladder network to learn a disentangled representation in accordance with the level of data abstraction. Since our model is a more general model without the restriction of a graphical model design to distinguish between static and dynamic factors, it can separate dependency factors occurring at the same time. Moreover, it can separate factors into dynamic and static factors.
26
+
27
+ # 2 DISENTANGLEMENT FOR NON-SEQUENTIAL DATA
28
+
29
+ $\beta$ -VAE (Higgins et al., 2016a;b) is a commonly used method for learning disentangled representations based on the VAE framework (Kingma $\&$ Welling, 2013) for a generative model. The VAE can estimate the probability density from data $\mathbf { X }$ . The objective function of the VAE maximizes the evidence lower bound (ELBO) of $\log p \left( x \right)$ as
30
+
31
+ $$
32
+ \log p \left( x \right) = \mathcal { L } _ { \mathrm { V A E } } + \underbrace { D _ { \mathrm { K L } } \left( q \left( z \vert x \right) \vert \vert p \left( z \vert x \right) \right) } _ { \ge 0 } ,
33
+ $$
34
+
35
+ where $z$ is latent variable, $D _ { \mathrm { K L } }$ is the Kullback-Leibler divergence, and $q \left( z | x \right)$ is an approximated distribution of $p \left( z | x \right) . \ D _ { \mathrm { K L } } \left( q \left( z | x \right) | | p \left( z | x \right) \right)$ reduces to zero as the ELBO $\mathcal { L } _ { \mathrm { V A E } }$ increases; thus, $q \left( z | x \right)$ learns a good approximation of $p \left( z | x \right)$ . The ELBO is defined as
36
+
37
+ $$
38
+ \mathcal { L } _ { \mathrm { V A E } } \equiv E _ { q ( z | x ) } \left[ \log p \left( x | z \right) \right] - D _ { \mathrm { K L } } \left( q \left( z | x \right) | | p \left( z \right) \right) ,
39
+ $$
40
+
41
+ where the first term, $E _ { q ( \boldsymbol { z } | \boldsymbol { x } ) } \left[ \log p \left( \boldsymbol { x } | \boldsymbol { z } \right) \right]$ , is a reconstruction term used to reconstruct $x$ , and the second term $D _ { \mathrm { K L } } \left( q \left( z | x \right) \^ { } | | \dot { p } \left( z \right) \right)$ is a regularization term used to regularize posterior $q \left( z | x \right)$ . Encoder $q \left( z | x \right)$ and decoder $p \left( x | z \right)$ are learned in the VAE.
42
+
43
+ Next we will explain how $\beta$ -VAE extracts disentangled representations from unlabeled data. $\beta$ -VAE is an extension of the coefficient $\beta > 1$ of the regularization term $D _ { \mathrm { K L } } \left( q \left( z | x \right) | | p \left( z \right) \right)$ in the VAE. The objective function of $\beta$ -VAE is
44
+
45
+ $$
46
+ \mathcal { L } _ { \beta - \mathrm { V A E } } = E _ { q ( z | x ) } \left[ \log p \left( x | z \right) \right] - \beta D _ { \mathrm { K L } } \left( q \left( z | x \right) | | p \left( z \right) \right) ,
47
+ $$
48
+
49
+ where $\beta > 1$ and $p \left( z \right) = \mathcal { N } \left( 0 , 1 \right)$ . $\beta$ -VAE promotes disentangled representation learning via the Kullback-Leibler divergence term. As $\beta$ increases, the latent variable $q \left( z | x \right)$ approaches the prior $p \left( z \right)$ ; therefore, each $z _ { i }$ is pressured to learn the probability distribution of $\mathcal { N } ( 0 , 1 )$ . However, if all latent variables $z _ { i }$ become $\mathcal { N } ( 0 , 1 )$ , the model cannot reconstruct $x$ . As a result, as long as $z$ reconstructs $x$ , $\beta$ -VAE reduces the information of $z$ .
50
+
51
+ # 3 PRELIMINARY: ORIGIN OF DISENTANGLEMENT
52
+
53
+ To clarify the origin of disentanglement, we will explain the regularization term. The regularization term has been decomposed into three terms (Chen et al., 2018; Kim & Mnih, 2018; Hoffman & Johnson, 2016):
54
+
55
+ $$
56
+ E _ { p \left( x \right) } \left[ D _ { \mathrm { K L } } \left( q \left( \boldsymbol { z } \left| \boldsymbol { x } \right) \right| \left| p \left( \boldsymbol { z } \right) \right) \right] = I \left( \boldsymbol { x } ; \boldsymbol { z } \right) + D _ { \mathrm { K L } } \left( q \left( \boldsymbol { z } \right) \right| \Big | \prod _ { j } q \left( z _ { j } \right) \right) + \sum _ { j } D _ { \mathrm { K L } } \left( q \left( \boldsymbol { z } _ { j } \right) \right| \left| p \left( z _ { j } \right) \right) ,
57
+ $$
58
+
59
+ where $z _ { j }$ denotes the $j$ -th dimension of the latent variable. The second term, which is called ”total correlation” in information theory, quantifies the redundancy or dependency among a set of $\mathbf { n }$ random variables (Watanabe, 1960). $\beta$ -TCVAE has been experimentally shown to reduce the total correlation causing disentanglement (Chen et al., 2018). The third term indirectly causes disentanglement by bringing $q \left( z | x \right)$ close to the independent standard normal distribution $p \left( z \right)$ . The first term is mutual information between the data variable and latent variable based on the empirical data distribution. Minimizing the regularization term causes disentanglement but disturbs reconstruction via the first term in Eq. (4). The shift $C$ scheme was proposed (Burgess et al., 2018) as a means to solve this conflict:
60
+
61
+ $$
62
+ - { \cal E } _ { q _ { \phi } ( z | x ) } [ \log p _ { \theta } ( x | z ) ] + \beta | { \cal D } _ { \mathrm { K L } } ( q ( z | x ) | | p ( z ) ) - C | ,
63
+ $$
64
+
65
+ where constant shift $C$ , which is called ”information capacity,” linearly increases during training. This shift $C$ can be understood from the point of view of an information bottleneck (Tishby et al., 2000). The VAE can be derived by maximizing the ELBO, but $\beta$ -VAE can no longer be interpreted as an ELBO once this scheme has been applied. The objective function of $\beta$ -VAE is derived from the information bottleneck (Alemi et al., 2016; Achille & Soatto, 2018; Tishby et al., 2000; Chechik et al., 2005).
66
+
67
+ $$
68
+ \operatorname* { m a x } I \left( z ; x \right) \qquad \mathrm { s . t . } ~ | I \left( \hat { x } ; z \right) - C | = 0 ,
69
+ $$
70
+
71
+ where $C$ is the information capacity and $\hat { x }$ is the empirical distribution. Solving this equation by using Lagrange multipliers drives the objective function of $\beta$ -VAE Eq. (5) with $\beta$ as the Lagrange multiplier (details in Appendix $\mathbf { B }$ of (Alemi et al., 2016)). In Eq. (5), information capacity $C$ prevents $I \left( \hat { x } , z \right)$ from becoming zero. In the information bottleneck literature, $y$ typically stands for a classification task; however, the formulation can be related to the autoencoding objective (Alemi et al., 2016). Therefore, the objective function of $\beta$ -VAE can be understood using the information bottleneck principle.
72
+
73
+ # 4 PROPOSED MODEL: DISENTANGLEMENT FOR SEQUENTIAL DATA
74
+
75
+ Our proposed FAVAE model learns disentangled and interpretable representations from sequential data without supervision. We consider sequential data $x _ { 1 : T } \equiv \{ x _ { 1 } , x _ { 2 } , \cdot \cdot \cdot , x _ { T } \}$ generated from a latent variable model,
76
+
77
+ $$
78
+ p \left( x _ { 1 : T } \right) = \int p \left( x _ { 1 : T } | z \right) p \left( z \right) d z .
79
+ $$
80
+
81
+ For sequential data, we replace $x$ with $\scriptstyle ( x _ { 1 : T } )$ in Eq. 5. The objective function of the FAVAE model is
82
+
83
+ $$
84
+ - { \cal E } _ { q _ { \phi } ( z | ( x _ { 1 : T } ) _ { i } ) } [ \log p _ { \theta } ( x _ { 1 : T } | z ) ] + \beta | { \cal D } _ { \mathrm { K L } } ( q ( z | ( x _ { 1 : T } ) _ { i } ) | | p ( z ) ) - C | ,
85
+ $$
86
+
87
+ where $p \left( z \right) = \mathcal { N } \left( 0 , 1 \right)$ . The variational recurrent neural network (Chung et al., 2015) and stochastic recurrent neural network (Fraccaro et al., 2016) extend the VAE model to a recurrent framework. The priors of both networks are dependent on time. The time dependent prior experimentally improves the ELBO. In contrast, the prior of our model is independent of time like those of the stochastic recurrent network (Bayer $\&$ Osendorfer, 2014) and the Deep Recurrent Attentive Writer (DRAW) neural network architecture (Gregor et al., 2015); this is because FAVAE is disentangled representation learning rather than density estimation. For better understanding, consider FAVAE from the perspective of IB. As with $\beta$ -VAE, FAVAE can be understood from the information bottleneck principle.
88
+
89
+ $$
90
+ \operatorname* { m a x } I \left( z ; x _ { 1 : T } \right) \qquad \mathrm { s . t . } ~ | I \left( \hat { x } _ { 1 : T } ; z \right) - C | = 0 ,
91
+ $$
92
+
93
+ where $\hat { x } _ { 1 : T }$ follows an empirical distribution. These principles make the representation of $z$ compact while reconstruction of the sequential data is represented by $x _ { 1 : T }$ (see Appendix A).
94
+
95
+ # 4.1 LADDER NETWORK
96
+
97
+ An important extension to FAVAE is a hierarchical representation scheme inspired by the VLAE (Zhao et al., 2017). Encoder $q \left( z | x _ { 1 : T } \right)$ within a ladder network is defined as
98
+
99
+ $$
100
+ \begin{array} { l } { { h _ { l } = f _ { l } \left( h _ { l - 1 } \right) , } } \\ { { z _ { l } \sim \mathcal { N } \left( \mu _ { l } \left( h _ { l } \right) , \sigma _ { l } \left( h _ { l } \right) \right) , } } \end{array}
101
+ $$
102
+
103
+ where $l$ is a layer index, $h _ { 0 } \equiv x _ { 1 : T }$ , and $f$ is a time convolution network, which is explained in the next section. Decoder $p \left( x _ { 1 : T } | z \right)$ within the ladder network is defined as
104
+
105
+ ![](images/b346278abc264002383add7d500381c122f5b7482bf1b7ccbe274fd1a4fe979e.jpg)
106
+ Figure 2: FAVAE architecture.
107
+
108
+ $$
109
+ \begin{array} { r } { \tilde { z } _ { L } = g _ { l } \left( z _ { L } \right) } \\ { \tilde { z } _ { l } = g _ { l } \left( \tilde { z } _ { l + 1 } + \mathrm { g a t e } \left( z _ { l } \right) \right) , } \\ { x _ { 1 : T } \sim r \left( x _ { 1 : T } , \tilde { z } _ { 0 } \right) ~ } \end{array}
110
+ $$
111
+
112
+ where $g _ { l }$ is the time deconvolution network with $l = 1 , \cdots , L - 1$ , and $r$ is a distribution family parameterized by $g _ { 0 } \left( \tilde { z } _ { 0 } \right)$ . The gate computes the Hadamard product of its learnable parameter and input tensor. We set $r$ as a fixed-variance factored Gaussian distribution with the mean given by $\mu _ { t : T } = g _ { 0 } \left( \tilde { z } _ { 0 } \right)$ . Fig. (2) shows the architecture of the proposed model. The difference between each ladder network in the model is the number of convolution networks through which data passes. The abstract expressions should differ between ladders since the time convolution layer abstracts sequential data. Without the ladder network, the proposed method can disentangle only the representations at the same level of abstraction; with the ladder network, it can disentangle representations at different levels of abstraction.
113
+
114
+ ![](images/a788ce73cb8b7bfaad254b437844807e035d2ae99c0c0ceda9ad26e554da2d1a.jpg)
115
+ Figure 3: Visualization of latent traversal of $\beta$ -VAE and FAVAE. On one sampled trajectory (red), each latent variable is traversed and purple and/or blue points are generated. The color corresponds to the value of the traversed latent variable. 3a represents all data trajectories of 2D reaching.
116
+
117
+ # 4.2 HOW TO ENCODE AND DECODE
118
+
119
+ There are several mainstream neural network models designed for sequential data, such as the long short-term memory model (Hochreiter & Schmidhuber, 1997), the gated recurrent unit model (Chung et al., 2014), and the quasi-recurrent neural network QRNN (Bradbury et al., 2016). However, the VLAE has a hierarchical structure created by abstracting a convolutional neural network, so it is simple to add the time convolution of the QRNN to our model. The input data are $x _ { t , i }$ , where $t$ is the time index and $i$ is the dimension of the feature vector index. The time convolution considers the dimensions of feature vector $j$ as a convolution channel and performs convolution in the time direction:
120
+
121
+ $$
122
+ z _ { t j } = \sum _ { p , i } x _ { t - p , i } h _ { p i j } + b _ { j } ,
123
+ $$
124
+
125
+ where $j$ is the channel index. The proposed FAVAE model has a network similar to the VAE one regarding time convolution and a loss function similar to the $\beta$ -VAE one (Eq. (8)). We used the batch normalization (Hinton et al., 2012) and ReLU as activation functions though other variations are possible. For example, 1d convolutional neural networks use a filter size of 3 and a stride of 2 and do not use a pooling layer.
126
+
127
+ # 5 MEASURING DISENTANGLEMENT
128
+
129
+ While latent traversals are useful for checking the success or failure of disentanglement, quantification of the disentanglement is required for reliably evaluating the model. Various disentanglement quantification methods have been reported (Eastwood & Williams, 2018; Chen et al., 2018; Kim & Mnih, 2018; Higgins et al., 2016b;a), but there is no standard method. We use the mutual information gap (MIG) (Chen et al., 2018) as the metric for disentanglement. The basic idea of MIG is measuring the mutual information between latent variables $z _ { j }$ and a ground truth factor $v _ { k }$ . Higher mutual information means that $z _ { j }$ contains more information regarding $v _ { k }$ .
130
+
131
+ $\begin{array} { r } { \mathrm { M I G } \equiv \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \frac { 1 } { H \left( v _ { k } \right) } \left( I \left( z _ { j ^ { ( k ) } } ; v _ { k } \right) - \operatorname* { m a x } _ { j \neq j ^ { ( k ) } } I \left( z _ { j } ; v _ { k } \right) \right) } \end{array}$ , where ${ j ^ { ( k ) } \equiv \arg \operatorname* { m a x } _ { j } I \left( z _ { j } ; v _ { k } \right) }$ and $H \left( v _ { k } \right)$ is entropy for normalization. In our evaluation we experimentally measure disentanglement with MIG.
132
+
133
+ Table 1: Disentanglement scores (MIG, and Reconstruction loss) with standard deviations by 10 seeds for the different model. Best results are shown in bold.
134
+
135
+ <table><tr><td rowspan="2">Model</td><td colspan="2">2D Reaching</td><td colspan="2">2D wavy Reaching</td></tr><tr><td>MIG</td><td>Reconstruction</td><td>MIG</td><td>Reconstruction</td></tr><tr><td>Time Convolution AE</td><td>0.21(27)</td><td>0.18(13)</td><td>0.04(3)</td><td>0.06(1)</td></tr><tr><td>FAVAE (without ladder and C)</td><td>0.34(21)</td><td>0.62(115)</td><td>0.22(14)</td><td>23.6(279)</td></tr><tr><td>FAVAE (with ladder and without C)</td><td>0.41(13)</td><td>0.03(5)</td><td>0.26(7)</td><td>0.08(2)</td></tr><tr><td>FAVAE (without ladder and with C)</td><td>0.34(21)</td><td>0.62(115)</td><td>0.11(10)</td><td>1.47(73)</td></tr><tr><td>FAVAE (with ladder and C)</td><td>0.41(13)</td><td>0.03(5)</td><td>0.34(28)</td><td>1.81(170)</td></tr></table>
136
+
137
+ # 6 RELATED WORK
138
+
139
+ Several recently reported models (Hsu et al., 2017; Li & Mandt, 2018) graphically disentangle static and dynamic factors in sequential data such as speech data and video data (Garofolo et al., 1993; Pearce & Picone, 2002). In contrast, our model performs disentanglement by using a loss function (see Eq. 8). The advantage of the graphical models is that they can control the interpretable factors by controlling the priors time dependency. Since dynamic factors have the same time dependency, these models cannot disentangle dynamic factors. A loss function model can disentangle sets of dynamic factors as well as disentangle static and dynamic factors.
140
+
141
+ # 7 EVALUATION
142
+
143
+ We evaluated our model experimentally using three sequential datasets: 2D Reaching, 2D Wavy Reaching, and Gripper. We used a batch size of 128 and the Adam (Kingma & Ba, 2014) optimizer with a learning rate of $1 0 ^ { - 3 }$ .
144
+
145
+ # 7.1 2D REACHING
146
+
147
+ To determine the differences between FAVAE and $\beta$ -VAE, we used a bi-dimensional space reaching dataset. Starting from point $( 0 , 0 )$ , the point travels to goal position $( - 0 . 1 , + 1 )$ or $( + 0 . 1 , + 1 )$ . There are ten possible trajectories to each goal; five are curved inward, and the other five are curved outward. The degree of curvature for all five trajectories is different. The number of factor combinations was thus 20 (2x2x5). The trajectory length was 1000, so the size of one trajectory was $[ 1 0 0 0 \mathrm { x } 2 ]$ .
148
+
149
+ We compared the performances of $\beta$ -VAE and FAVAE trained on the 2D Reaching dataset. The results of latent traversal are transforming one dimension of latent variable z into another value and reconstructing something from the traversed latent variables. $\beta$ -VAE, which is only able to learn from every point of a trajectory separately, encodes data points into latent variables that are parallel to the $\mathbf { X }$ and y axes (3b, 3c). In contrast, FAVAE learns through one entire trajectory and can encode disentangled representation effectively so that feasible trajectories are generated from traversed latent variables (3d, 3e).
150
+
151
+ # 7.2 2D WAVY REACHING
152
+
153
+ To confirm the effect of disentanglement through information bottleneck, we evaluated the validity of our model under more complex factors by adding more factors to the 2D Reaching dataset. Five factors in total generated data compared to the three factors that generate data in 2D Reaching. This modified dataset differed in that four out of the five factors affect only part of the trajectory: two of them affect the first half, and the other two affect the second half. This means that the model should be able to focus on a certain part of the whole trajectory and be able to extract factors related to that part. A detailed explanation of these factors is given in Appendix B.
154
+
155
+ We compared various models on the basis of MIG to demonstrate the validity of our proposed model in comparison of a time convolution AE in which a loss function is used only for the autoencoder ( $\beta = 0$ ), FAVAE without the ladder network and information capacity $C$ , and FAVAE with the ladder network and information capacity $C$ . As shown in Table 1, FAVAE with the ladder network and C had the highest MIG scores for 2D Reaching and 2D Wavy Reaching. This indicates that this model learned a disentangled representation best. Note that for 2D Reaching, the best value for $C$ was small, meaning that there was little effect from adding $C$ (since the dataset was simple, this task can be solved even if the amount of information of $\mathbf { Z }$ is small).
156
+
157
+ ![](images/f01901b6971fd5a8db90e6cf3c95eeb6a623b75861e2421a6a2b3dbf4fb4fc1a.jpg)
158
+ Figure 4: MIG score and reconstruction loss for different values of $\beta$ . Blue line represents results with information capacity $C$ greater than zero; red line represents results with $C$ set to e zero. Note that $\mathbf { X }$ axis is plotted in log scale.
159
+
160
+ ![](images/b57addf8cf5aa9b7ee9e51ea1c882d13a1370cfeaa4554ced84a275746fbca89.jpg)
161
+ Figure 5: Visualization of latent traversal for 2D Wavy Reaching. Each plot was decoded by traversing one latent variable; different colors represent trajectories generated from different values of same latent variable, z.
162
+
163
+ Fig. 4. We evaluated reconstruction loss and the MIG score for various values of $\beta$ using three ladder networks (Fig. 6) with a different value of $C$ for each ladder: $\begin{array} { r l } { C } & { { } = } \end{array}$ [LowerLadder, MiddleLadder, HigherLadder]. One setting used was $C = [ 0 , 0 , 0 ]$ , meaning that $C$ was not used; another setting was $C = [ 2 0 , 1 , 5 ]$ , meaning that $C$ was adjusted on the basis of values of KL-Divergence for $\beta = 1$ and $\dot { C } = [ 0 , \dot { 0 } , 0 ]$ . When $C$ was not used, the model could not reconstruct data when $\beta$ was high; thus, disentangled representation was not learned well when $\beta$ was high. When $C$ was used, the MIG score increased with $\beta$ while reconstruction loss was suppressed.
164
+
165
+ The latent traversal results for 2D Wavy Reaching are plotted in Fig. 5. Even though not all learned representations are perfectly disentangled, the visualization shows that all five generation factors were learned from five latent variables; the other latent variables did not learn any meaningful factors, indicating that the factors could be expressed as a combination of five ”active” latent variables. We tested our model for $\beta = 3 0 0$ .
166
+
167
+ ![](images/e02bc66dbc528f5a4577bc3ed31795379f1949b47c1b3c825077681ee325c131.jpg)
168
+ Figure 6: Evaluation of ladders (left); structure used for each experiment (right).
169
+
170
+ ![](images/4acf414e8b61f125fbb858bb241498545bc1deb9515d1fce021f72be4fcdf42b.jpg)
171
+ Figure 7: Visualization of latent traversal of FAVAE. The horizontal axis represents sequence and the vertical axis represents the difference of $z$ values.
172
+
173
+ The use of a ladder network in our model improved disentangled representation learning and minimized the reconstruction loss. The graph in Fig. 6 shows the MIG scores for networks with different numbers of ladders. The error bars represent the standard deviation for ten repetitive trials. Using all three ladders resulted in the minimum reconstruction loss with the highest MIG score (green curve) except for ”Higher Ladder One”. ”Higher Ladder One” has a large reconstruction error.
174
+
175
+ # 7.3 SPRITES DATASET.
176
+
177
+ To evaluate the effectiveness of the video dataset, we trained our model with the Sprites dataset which is used in (Li & Mandt, 2018). This dataset has sequential length $= 8$ RGB video data with $3 \times 6 4 \times 6 4$ . This data set consists of static factor and dynamic factor. We note that the motion is not created with the combination of dynamic factors, and each motion exists individually (detail is E.2). Table 4 show the factors used in our experiment. We executed disentangled representation learning by using the FAVAE model with $\beta = 2 0$ , $C = [ 0 . 3 , 0 . 1 7 , 0 . 0 6 ]$ and network architecture used for this training is explained in Section F.1. Fig. 7 shows the results of latent traversal, and we chose two $z$ values to change from $z = 3$ to 3. Since this dataset is composed of discrete factors, we show two $z$ values at a time.The latent variables in the 1st ladder extract expressions of motion (4th $z$ in 1st ladder), pants color (5th $z$ in 1st ladder), direction of character (6th $z$ in 1st ladder) and the shirts color (7th $z$ in 1st ladder). The latent variables in the 2nd ladder extract expressions of the hair color (1st $z$ in 2nd ladder) and the body color (2nd $z$ in 2nd ladder). FHVAE can extract the disentangled representations between static factors and dynamic factor in high dimension dataset.
178
+
179
+ # 8 SUMMARY AND FUTURE WORK
180
+
181
+ Our factorized action variational autoencoder (FAVAVE) generative model learns disentangled and interpretable representations via the information bottleneck from sequential data. Evaluation using three sequential datasets demonstrated that it can learn disentangled representations. Future work includes extending the time convolution part to a sequence-to-sequence model (Sutskever et al., 2014) and applying the model to actions of reinforcement learning to reduce the pattern of actions.
182
+
183
+ # REFERENCES
184
+
185
+ Alessandro Achille and Stefano Soatto. Information dropout: Learning optimal representations through noisy computation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2018.
186
+
187
+ Alexander A Alemi, Ian Fischer, Joshua V Dillon, and Kevin Murphy. Deep variational information bottleneck. arXiv preprint arXiv:1612.00410, 2016.
188
+
189
+ Justin Bayer and Christian Osendorfer. Learning stochastic recurrent networks. arXiv preprint arXiv:1411.7610, 2014.
190
+
191
+ Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798–1828, 2013.
192
+
193
+ James Bradbury, Stephen Merity, Caiming Xiong, and Richard Socher. Quasi-recurrent neural networks. arXiv preprint arXiv:1611.01576, 2016.
194
+
195
+ Christopher P Burgess, Irina Higgins, Arka Pal, Loic Matthey, Nick Watters, Guillaume Desjardins, and Alexander Lerchner. Understanding disentangling in $\beta$ -VAE. arXiv preprint arXiv:1804.03599, 2018.
196
+
197
+ Gal Chechik, Amir Globerson, Naftali Tishby, and Yair Weiss. Information bottleneck for Gaussian variables. Journal of machine learning research, 6(Jan):165–188, 2005.
198
+
199
+ Tian Qi Chen, Xuechen Li, Roger Grosse, and David Duvenaud. Isolating sources of disentanglement in variational autoencoders. arXiv preprint arXiv:1802.04942, 2018.
200
+
201
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. InfoGan: Interpretable representation learning by information maximizing generative adversarial nets. In Advances in neural information processing systems, pp. 2172–2180, 2016.
202
+
203
+ 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.
204
+
205
+ Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In Advances in neural information processing systems, pp. 2980–2988, 2015.
206
+
207
+ Ishan P Durugkar, Clemens Rosenbaum, Stefan Dernbach, and Sridhar Mahadevan. Deep reinforcement learning with macro-actions. arXiv preprint arXiv:1606.04615, 2016.
208
+
209
+ Cian Eastwood and Christopher KI Williams. A framework for the quantitative evaluation of disentangled representations. 2018.
210
+
211
+ Marco Fraccaro, Søren Kaae Sønderby, Ulrich Paquet, and Ole Winther. Sequential neural models with stochastic layers. In Advances in neural information processing systems, pp. 2199–2207, 2016.
212
+
213
+ John S Garofolo, Lori F Lamel, William M Fisher, Jonathan G Fiscus, and David S Pallett. DARPA TIMIT acoustic-phonetic continous speech corpus CD-ROM. NIST speech disc 1-1.1. NASA STI/Recon technical report n, 93, 1993.
214
+
215
+ 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.
216
+
217
+ Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. DRAW: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623, 2015.
218
+
219
+ Irina Higgins, Loic Matthey, Xavier Glorot, Arka Pal, Benigno Uria, Charles Blundell, Shakir Mohamed, and Alexander Lerchner. Early visual concept learning with unsupervised deep learning. arXiv preprint arXiv:1606.05579, 2016a.
220
+
221
+ Irina Higgins, Loic Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. beta-VAE: Learning basic visual concepts with a constrained variational framework. 2016b.
222
+
223
+ Geoffrey E Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan R Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580, 2012.
224
+
225
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
226
+
227
+ Matthew D Hoffman and Matthew J Johnson. ELBO surgery: yet another way to carve up the variational evidence lower bound. In Workshop in Advances in Approximate Bayesian Inference, NIPS, 2016.
228
+
229
+ Wei-Ning Hsu, Yu Zhang, and James Glass. Unsupervised learning of disentangled and interpretable representations from sequential data. In Advances in neural information processing systems, pp. 1878–1889, 2017.
230
+
231
+ Hyunjik Kim and Andriy Mnih. Disentangling by factorising. arXiv preprint arXiv:1802.05983, 2018.
232
+
233
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
234
+
235
+ Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. arXiv preprint arXiv:1312.6114, 2013.
236
+
237
+ Yingzhen Li and Stephan Mandt. A deep generative model for disentangled representations of sequential data. arXiv preprint arXiv:1803.02991, 2018.
238
+
239
+ 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.
240
+
241
+ David Pearce and J Picone. Aurora working group: DSR front end LVCSR evaluation AU/384/02. Inst. for Signal & Inform. Process., Mississippi State Univ., Tech. Rep, 2002.
242
+
243
+ 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.
244
+
245
+ Naftali Tishby, Fernando C Pereira, and William Bialek. The information bottleneck method. arXiv preprint physics/0004057, 2000.
246
+
247
+ Satosi Watanabe. Information theoretical analysis of multivariate correlation. IBM Journal of research and development, 4(1):66–82, 1960.
248
+
249
+ Shengjia Zhao, Jiaming Song, and Stefano Ermon. Learning hierarchical features from generative models. arXiv preprint arXiv:1702.08396, 2017.
250
+
251
+ # A INFORMATION BOTTLENECK PRINCIPLE FOR SEQUENTIAL DATA.
252
+
253
+ Here the aim is to show the relationship between FAVAE and the information bottleneck for sequential data. Consider the information bottleneck object:
254
+
255
+ $$
256
+ \begin{array} { r l } { \operatorname* { m a x } I \left( z ; x _ { 1 : T } \right) \quad } & { { } \mathrm { s . t . } \ \lvert I \left( \hat { x } _ { 1 : T } ; z \right) - C \rvert = 0 } \end{array}
257
+ $$
258
+
259
+ is expanded from Alemi et al. (2016) to sequential data. We need to distinguish between $\hat { x } _ { 1 : T }$ and $x _ { 1 : T }$ , where $x _ { 1 : T }$ is the true distribution and $\hat { x } _ { 1 : T }$ is the empirical distribution created by sampling from the true distribution. We maximize the mutual information of true data $x _ { 1 : T }$ and $z$ while constraining the information contained in the empirical data distribution. We do this by using Lagrange multiplier:
260
+
261
+ $$
262
+ \begin{array} { r } { I \left( z ; x _ { 1 : T } \right) + \beta \left| I \left( \hat { x } _ { 1 : T } ; z \right) - C \right| , } \end{array}
263
+ $$
264
+
265
+ where $\beta$ is a constant. For the first term,
266
+
267
+ $$
268
+ \begin{array} { l } { { I \left( z ; x _ { 1 : T } \right) = \displaystyle \iint p \left( z ; x _ { 1 : T } \right) \log \frac { p \left( x _ { 1 : T } \vert z \right) } { p \left( x _ { 1 : T } \right) } d x _ { 1 : T } d z } } \\ { { \displaystyle \qquad = \iint p \left( z ; x _ { 1 : T } \right) \log p \left( x _ { 1 : T } \vert z \right) d x _ { 1 : T } d z - \displaystyle \iint p \left( x _ { 1 : T } ; z \right) \log p \left( x _ { 1 : T } \right) d x _ { 1 : T } d z } } \\ { { \displaystyle \qquad = \displaystyle \iint p \left( x _ { 1 : T } \right) p \left( z \vert x _ { 1 : T } \right) \log p \left( x _ { 1 : T } \vert z \right) d x _ { 1 : T } d z + H \left( x _ { 1 : T } \right) } } \\ { { \displaystyle \qquad \sim \frac { 1 } { N } \sum _ { i } \left[ p \left( z \vert \left( x _ { 1 : T } \right) _ { i } \right) \log p \left( \left( x _ { 1 : T } \right) _ { i } \vert z \right) \right] + H \left( x _ { 1 : T } \right) } , } \end{array}
269
+ $$
270
+
271
+ where $H \left( x _ { 1 : T } \right)$ is entropy, which can be neglected in optimization. The last line is Monte Carlo approximation. For the second term,
272
+
273
+ $$
274
+ \begin{array} { l } { { \displaystyle I \left( \hat { x } _ { 1 : T } ; z \right) = \int p \left( z \vert \hat { x } _ { 1 : T } \right) p \left( \hat { x } _ { 1 : T } \right) \log \frac { p \left( z \vert \hat { x } _ { 1 : T } \right) } { p \left( z \right) } d z d \hat { x } _ { 1 : T } } } \\ { { \displaystyle \quad \sim \frac { 1 } { N } \sum _ { j } p \left( z \vert \left( x _ { 1 : T } \right) _ { j } \right) \log \frac { p \left( z \vert \left( x _ { 1 : T } \right) _ { j } \right) } { p \left( z \right) } d z } } \\ { { \displaystyle \quad = \frac { 1 } { N } \sum _ { j } D _ { \mathrm { K L } } \left( p \left( z \vert \left( x _ { 1 : T } \right) _ { j } \right) \vert \vert p \left( z \right) \right) . } } \end{array}
275
+ $$
276
+
277
+ As a result,
278
+
279
+ $$
280
+ \begin{array} { r } { I \left( z ; x _ { 1 : T } \right) + \beta \left| I \left( \tilde { x } _ { 1 : T } ; z \right) - C \right| \leq \displaystyle \frac { 1 } { N } \sum _ { i } \left[ p \left( z \right| \left( x _ { 1 : T } \right) _ { i } \right) \log p \left( \left( x _ { 1 : T } \right) _ { i } \left| z \right) \right] } \\ { + \displaystyle \frac { 1 } { N } \sum _ { j } D _ { \mathrm { K L } } \left( p \left( z \right| \left( x _ { 1 : T } \right) _ { j } \right) \left| | p \left( z \right) \right) . } \end{array}
281
+ $$
282
+
283
+ For convenience of calculation, we use $x _ { i }$ sampled from mini-batch data for both the reconstruction term and the regularization term. This is only an approximation. If the information bottleneck principle is followed completely, it is better to use different batch data for the reconstruction and regularization terms.
284
+
285
+ # B EXTRACTED FACTORS OF EACH LADDER IN FAVAE
286
+
287
+ We expect the ladder network can disentangle representations at different levels of abstraction. In this section, We check the factor extracted in each ladder by using 2D Reaching and 2D Wavy.
288
+
289
+ Table 2: Counting the index of latent variable in each factor by 10 seeds. The detail of factor is in Table 4.
290
+
291
+ <table><tr><td colspan="3">1st ladder</td><td>2nd ladder</td><td>3rd ladder</td></tr><tr><td rowspan="3">2D Reaching</td><td>factor 1</td><td>1</td><td>1</td><td>8</td></tr><tr><td>factor 2</td><td>10</td><td>0</td><td>0</td></tr><tr><td>factor 3</td><td>10</td><td>0</td><td>0</td></tr><tr><td rowspan="5">2D wavy Reaching</td><td>factor 1</td><td>3</td><td>0</td><td>7</td></tr><tr><td>factor 2</td><td>8</td><td>0</td><td>2</td></tr><tr><td>factor 3</td><td>8</td><td>0</td><td>2</td></tr><tr><td>factor 4</td><td>9</td><td>1</td><td>0</td></tr><tr><td>factor 5</td><td>9</td><td>0</td><td>1</td></tr></table>
292
+
293
+ Table 3: Disentanglement scores (MIG, and Reconstruction loss) with standard deviations by 10 seeds for the different model in sequence length $= 1 0 0$ . Best results are shown in bold.
294
+
295
+ <table><tr><td rowspan="2">Model</td><td colspan="2">2D Reaching</td><td colspan="2">2D wavy Reaching</td></tr><tr><td>MIG</td><td>Reconstruction</td><td>MIG</td><td>Reconstruction</td></tr><tr><td>FHVAE</td><td>0.62(17)</td><td>0.0003(5)</td><td>0.19(6)</td><td>0.051(36)</td></tr><tr><td>Time Convolution AE</td><td>0.06(4)</td><td>0.014(7)</td><td>0.26(6)</td><td>0.019(2)</td></tr><tr><td>FAVAE (without ladder and C)</td><td>0.52(6)</td><td>0.007(1)</td><td>0.28(2)</td><td>0.058(3)</td></tr><tr><td>FAVAE (without ladder with C)</td><td>0.47(4)</td><td>0.005(0)</td><td>0.26(1)</td><td>0.069(4)</td></tr><tr><td>FAVEA (with ladder without C)</td><td>0.34(11)</td><td>0.005(1)</td><td>0.31(8)</td><td>0.022(2)</td></tr><tr><td>FAVAE (with ladder and C)</td><td>0.35(7)</td><td>0.007(1)</td><td>0.40(7)</td><td>0.055(4)</td></tr></table>
296
+
297
+ Table 2 shows the counting index of latent variable with the highest mutual information in each ladder network. In Table 2, the rows represent factor and the columns represent the index of the ladder networks. The factor 1 (goal left / goal right) in 2D Reaching and the factor 1 (goal position) in 2D wavy Reaching were extracted to the most frequently in the latent variable in 3rd ladder. Since the latent variables have 8 dimensions for the 1st ladder, 4 dimensions for the 2nd ladder and 2 dimensions for the 3rd ladder, the 3rd ladder should be the least frequent when factors are randomly entered for each z. Especially long-term and short-term factors are clear in the 2D wavy Reaching dataset. In 2D Wavy Reaching dataset, there is distinct difference between factors of long and short time dependency. The ”goal position” is the factor which affect the entire trajectory, and other factors affect half length of the trajectory (Fig. 9).In our experiment the goal of the trajectory which affect the entire trajectory tended to be expressed in the 3rd ladder. In both datasets, only factor 1 represents goal positions while others represent shape of the trajectories. Since factor 1 has different abstraction level from others, factor 1 and others result in different ladders such as ladder 3 and others.
298
+
299
+ # C COMPARING WITH FHVAE
300
+
301
+ FHVAE model is the recently proposed disentangled representation learning model. We note that FHVAE model uses label information to disentangle time series data, which is different setup with our FAVAE model. Table 3 shows a comparison of MIG and reconstruction using FHVAE as the baseline. It was not possible to disentangle in 2D Reaching and 2D wavy using FHVAE, because LSTM used at the FHVAE can not learn data with very long sequences (sequence length of 1000). For fair comparison with the FHVAE, we experimented with 2D Reaching (sequence length 100), 2D wavy Reaching (sequence length 100) at Table 3. In 2D Reaching, FHVAE model has the best score, while in 2D wavy Reaching FAVAE model with ladders and $C$ has the best score. Our model is slightly worse than FHVAE in 2D Reaching Dataset. The parameters searched are $\alpha = 1$ to 30 (the best $\alpha = 2 0 a n d 1$ ), $\beta = 0$ to 60 (the best $\beta = 0 . 4$ and 4 in 2D Reaching and 2D wavy Reaching) and the best $C = [ c = 0 . 0 4 , 0 . 0 2 , 0 . 0 2 ]$ and $[ 0 . 0 3 , 0 , 0 , 0 6 ]$ in 2D Reaching and 2D wavy
302
+
303
+ ![](images/9e59da1502ef8fd62f7a26e72178f26a02414848c0c5ae3b38b763f6056f9794.jpg)
304
+ Figure 8: Visualization of learned disentangled representations for Gripper dataset. Traversed latent variable shows changing position of blue objects:(b) (9th $z$ in 1st ladder), changing target ball from red one to blue one and moving accordingly:(c) (1st $z$ in 2nd ladder), reaching ball using different plan:(d) (2nd $z$ in 2nd ladder), changing plan to place ball from drop ball to placing it gently:(e) (4th $z$ in 2nd ladder).
305
+
306
+ Reaching. The best $C$ was decided by the value of KL divergence loss when we experimented to allow reconstruction with $C = 0 , 0 , 0$ .
307
+
308
+ # D GRIPPER
309
+
310
+ To evaluate the potential application of our model to robotic tasks, we constructed a robot endeffector simulation environment based on Bullet Real-Time Physics Simulation2. The environment consisted of an end-effector, two balls (red and blue), and two baskets (red and blue) in a bi-dimensional space. The end-effector grabs one of the balls and places it into the basket with the same color as the ball. The data factors include movement ”habits.” For example, the end-effector could reach the targeted ball by either directly moving toward the ball obliquely or first moving above of the ball and then lowering itself until it reached the ball (perpendicular movement). The end-effector could drop the ball from far above the basket or place it gently in the basket. Each factor could affect different lengths among the data; e.g., ”the plan to place the ball in the basket” factor affects different lengths per datum since the initial distance from the target ball to the corresponding basket may differ. This means that the time required to reach the ball should differ. Note that input is a value such as gripper’s position, not an image. See Appendix B for a more detailed explanation.
311
+
312
+ FAVAE learned the disentangled factors of the Gripper dataset. Example visualized latent traversals are shown in Fig. 8. The traversed latent variable determined which factors were disentangled, such as the initial position of blue ball and basket (b), the targeted ball (red or blue) (c), plan to reach the ball (move obliquely or move perpendicularly) (d), and plan to place the ball in the basket (drop the ball or placing it in the basket gently) (e). These results indicate that our model can learn generative factors such as disentangled latent variables for robotic tasks, even though the length of the data affected by each factor may differ for each datum. We used FAVAE in a two-ladder network with 12 and 8 latent variables with $\beta { = } 1 0 0 0$ .
313
+
314
+ ![](images/17788be1c6940dc3b590d5a26edc1c87b24e879399043d17fcdde6c0e89b4abd.jpg)
315
+ Figure 9: Visualization of factors of 2D Wavy Reaching training data.
316
+
317
+ # E DATASET DETAILS
318
+
319
+ # E.1 2D WAVY REACHING
320
+
321
+ Five different factors generate each trajectory: (9a) Shape of trajectory from start position to intermediate point. The first shape is created using a cycloid function while the other one adds a sine curve on the cycloid. (9b) Shape of trajectory from intermediate point to goal; shape is the same as for (9a). (9c) Location of goal; five different goal locations were used. (9d) Degree of curvature from start to intermediate point. (9e) Degree of curvature from intermediate point to goal.
322
+
323
+ # E.2 SPRITES
324
+
325
+ Sprits dataset is video data of video game ”sprites”. It used was used in (Li & Mandt, 2018) for confirming the extraction of disentangled representation between static factors and dynamic factors. The dataset consists of sequences with $T = 8$ frames of dimension $3 \times 6 4 \times 6 4$ . We use factors and motion of Sprites is shown in Table 4 and Fig. 10.
326
+
327
+ # E.3 GRIPPER
328
+
329
+ We implemented the end-effector only rather than the entire robot arm since controlling the robot arm during the picking task is easily computable by calculating the inverse kinematics and inverse dynamics. Gripper is a 12 dimensional data set: [joint $\mathbf { X }$ position, joint y position, finger1 joint position(angle), finger2 joint position(angle), box1 $\mathbf { X }$ position, box1 y position, $\mathbf { b } 0 \mathbf { X } 2 \textbf { X }$ position, box2 y position, ball1 x position, ball1 y position, ball2 $\mathbf { X }$ position, ball2 y position]. Eight factors are represented in this dataset: 1) color of ball to pick up, 2) initial location of red ball, 3) initial location of blue ball, 4) initial location of blue basket, 5) initial location of red basket, 6) plan for using end effector to move to ball to pick it up [first, moving horizontally to the $\mathbf { X }$ -location of ball and then descending horizontally to the y-location of ball, like the movement of the doll drawing machine (perpendicular motion); second, moving straight to the location of he ball to pick it up (oblique motion)], 7) plan for using end effector to move to point above basket after picking up ball (perpendicular or oblique motion), 8) plan for placing ball in basket (by dropping ball or descending to basket and gently placing ball in basket). Among the four initial positions, the two balls and two baskets are placed randomly. The movement of the robot is hard-coded on the basis of a goalposition-based script. To reduce collision detection errors during the simulation, we used a large physical model (end effector size $1 \mathrm { m } \dot { }$ ), which does not affect the overall validity. The length of the data-point sequence was 400.
330
+
331
+ ![](images/752a1a74fa5e7ea0ccaa20aa73aa19dc22fdff677762c35557984ea8df971371.jpg)
332
+ Figure 10: Motions in Sprites dataset. Row 1/2/3 represent walk left/forward/right, row 4/5/6 represent spellcast left/forward/right, and row 7/8/9 represent slash left/forward/right’ respectfully.
333
+
334
+ Table 4: Factors in dataset
335
+
336
+ <table><tr><td>Dataset</td><td>Degree of factors</td><td>Ground truth factors</td></tr><tr><td rowspan="3">2D Reaching</td><td>2</td><td>Goal positon</td></tr><tr><td>2</td><td>Curved inward /outward</td></tr><tr><td>5</td><td>Degree of curvature</td></tr><tr><td rowspan="5">2D wavy Reaching</td><td>4</td><td>1st trajectory shape</td></tr><tr><td>4</td><td>2nd trajectory shape</td></tr><tr><td>5</td><td>Goal position</td></tr><tr><td>2</td><td>1st trajectory degree of curvature</td></tr><tr><td>2</td><td>2nd trajectory degree of curvature</td></tr><tr><td rowspan="6">Sprites Dataset</td><td>3</td><td>Motions (walk, spellcast or slash)</td></tr><tr><td>2</td><td>Body color (light or dark2)</td></tr><tr><td>2</td><td>Shirts color (brown or teal)</td></tr><tr><td>2</td><td>Hair color (green or pink)</td></tr><tr><td>2</td><td>Pants color (red or teal)</td></tr><tr><td>3</td><td>Direction of character (left,foward, right)</td></tr><tr><td rowspan="8">Gripper</td><td>2</td><td>Targeted ball to grasp (red or blue)</td></tr><tr><td>4</td><td>Red ball initial position</td></tr><tr><td>4</td><td>Blue ball initial position</td></tr><tr><td>4</td><td>Red basket position</td></tr><tr><td>4</td><td>Blue basket position</td></tr><tr><td>2</td><td>Plan to reach target ball</td></tr><tr><td>2</td><td>Plan to reach corresponding basket</td></tr><tr><td>2</td><td>Plan to place ball in basket</td></tr></table>
337
+
338
+ # F ARCHITECTURE DETAILS
339
+
340
+ # F.1 FAVAE
341
+
342
+ We show the hyper parameters in Table 1, Fig. 7 and Table 3. The parameters searched are $\beta = 0$ to 10000 (the best $\beta = 1$ and $C = [ 0 , 0 , 0 ]$ and the best $\beta = 1 0 0 0 0 0$ and $C = [ 2 0 , 1 , 5 ]$ in 2D Reaching and 2D wavy Reaching in Table 1) The best $C$ was decided by the value of KL divergence loss when we experimented to allow reconstruction with $C = 0 , 0 , 0$ . In Table 3, we search the parameters from $\beta = 0$ to 60 (the best $\beta = 0 . 4$ and 4 in 2D Reaching and 2D wavy Reaching) and the best $C = [ c = 0 . 0 4 , 0 . 0 2 , 0 . 0 2 ]$ and $[ 0 . 0 3 , 0 , 0 , 0 6 ]$ in 2D Reaching and 2D wavy Reaching. In Fig. 7.3, we add the pre-encoder and post-decoder for encoding and decoding of images at each time step. The pre-encoding and post-decoding architecture is same as ”encode frames” and ”decode frames” in the code implementing Disentangled-Sequential-Autoencoder3 with conv $\mathrm { d i m } = 4 8$ . We search the parameters from $\beta = 0$ to $\beta = 1 0 0$ and the best $\beta = 2 0$ with $C = [ 0 . 3 , 0 . 1 7 , 0 . 0 6$ ].
343
+
344
+ # F.2 FHVAE
345
+
346
+ For the FHVAE experiments, we used the code from the implementation at Github4. We used recurrent setting with LSTM encoders and decoder with unit size 256 and batch size 80. Dimensions of latent variable z1 and $_ { z 2 }$ are 7 for each. We used Adam optimizer with learning rate 0.001. We applied goal position factors (2 classes for 2D Reaching and 5 classes for 2D wavy Reaching) as label inputs. We varied $\alpha$ from 1.0 to 30.0, and the best $\alpha$ was 20.0 for 2D Reaching and 1.0 for 2D wavy reaching.
md/train/Hygxb2CqKm/Hygxb2CqKm.md ADDED
@@ -0,0 +1,667 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # STABLE RECURRENT MODELS
2
+
3
+ John Miller & Moritz Hardt University of California, Berkeley {miller john,hardt}@berkeley.edu
4
+
5
+ # ABSTRACT
6
+
7
+ Stability is a fundamental property of dynamical systems, yet to this date it has had little bearing on the practice of recurrent neural networks. In this work, we conduct a thorough investigation of stable recurrent models. Theoretically, we prove stable recurrent neural networks are well approximated by feed-forward networks for the purpose of both inference and training by gradient descent. Empirically, we demonstrate stable recurrent models often perform as well as their unstable counterparts on benchmark sequence tasks. Taken together, these findings shed light on the effective power of recurrent networks and suggest much of sequence learning happens, or can be made to happen, in the stable regime. Moreover, our results help to explain why in many cases practitioners succeed in replacing recurrent models by feed-forward models.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Recurrent neural networks are a popular modeling choice for solving sequence learning problems arising in domains such as speech recognition and natural language processing. At the outset, recurrent neural networks are non-linear dynamical systems commonly trained to fit sequence data via some variant of gradient descent.
12
+
13
+ Stability is of fundamental importance in the study of dynamical system. Surprisingly, however, stability has had little impact on the practice of recurrent neural networks. Recurrent models trained in practice do not satisfy stability in an obvious manner, suggesting that perhaps training happens in a chaotic regime. The difficulty of training recurrent models has compelled practitioners to successfully replace recurrent models with non-recurrent, feed-forward architectures.
14
+
15
+ This state of affairs raises important unresolved questions. Is sequence modeling in practice inherently unstable? When and why are recurrent models really needed?
16
+
17
+ In this work, we shed light on both of these questions through a theoretical and empirical investigation of stability in recurrent models.
18
+
19
+ We first prove stable recurrent models can be approximated by feed-forward networks. In particular, not only are the models equivalent for inference, they are also equivalent for training via gradient descent. While it is easy to contrive non-linear recurrent models that on some input sequence cannot be approximated by feed-forward models, our result implies such models are inevitably unstable. This means in particular they must have exploding gradients, which is in general an impediment to learnibility via gradient descent.
20
+
21
+ Second, across a variety of different sequence tasks, we show how recurrent models can often be made stable without loss in performance. We also show models that are nominally unstable often operate in the stable regime on the data distribution. Combined with our first result, these observation helps to explain why an increasingly large body of empirical research succeeds in replacing recurrent models with feed-forward models in important applications, including translation (Vaswani et al., 2017; Gehring et al., 2017), speech synthesis (Van Den Oord et al., 2016), and language modeling (Dauphin et al., 2017). While stability does not always hold in practice to begin with, it is often possible to generate a high-performing stable model by imposing stability during training.
22
+
23
+ Our results also shed light on the effective representational properties of recurrent networks trained in practice. In particular, stable models cannot have long-term memory. Therefore, when stable and unstable models achieve similar results, either the task does not require long-term memory, or the unstable model does not have it.
24
+
25
+ # 1.1 CONTRIBUTIONS
26
+
27
+ In this work, we make the following contributions.
28
+
29
+ 1. We present a generic definition of stable recurrent models in terms of non-linear dynamical systems and show how to ensure stability of several commonly used models. Previous work establishes stability for vanilla recurrent neural networks. We give new sufficient conditions for stability of long short-term memory (LSTM) networks. These sufficient conditions come with an efficient projection operator that can be used at training time to enforce stability.
30
+ 2. We prove, under the stability assumption, feed-forward networks can approximate recurrent networks for purposes of both inference and training by gradient descent. While simple in the case of inference, the training result relies on non-trivial stability properties of gradient descent.
31
+ 3. We conduct extensive experimentation on a variety of sequence benchmarks, show stable models often have comparable performance with their unstable counterparts, and discuss when, if ever, there is an intrinsic performance price to using stable models.
32
+
33
+ # 2 STABLE RECURRENT MODELS
34
+
35
+ In this section, we define stable recurrent models and illustrate the concept for various popular model classes. From a pragmatic perspective, stability roughly corresponds to the criterion that the gradients of the training objective do not explode over time. Common recurrent models can operate in both the stable and unstable regimes, depending on their parameters. To study stable variants of common architectures, we give sufficient conditions to ensure stability and describe how to efficiently enforce these conditions during training.
36
+
37
+ # 2.1 DEFINING STABLE RECURRENT MODELS
38
+
39
+ A recurrent model is a non-linear dynamical system given by a differentiable state-transition map $\phi _ { w } : { \mathbf { R } } ^ { n } \times { \mathbf { R } } ^ { d } \to { \mathbf { R } } ^ { n }$ , parameterized by $w \in { \mathbf { R } } ^ { m }$ . The hidden state $h _ { t } \in \mathbf { R } ^ { n }$ evolves in discrete time steps according to the update rule
40
+
41
+ $$
42
+ h _ { t } = \phi _ { w } ( h _ { t - 1 } , x _ { t } ) ,
43
+ $$
44
+
45
+ where the vector $\boldsymbol { x } _ { t } \in \mathbb { R } ^ { d }$ is an arbitrary input provided to the system at time $t$ . This general formulation allows us to unify many examples of interest. For instance, for a recurrent neural network, given weight matrices $W$ and $U$ , the state evolves according to
46
+
47
+ $$
48
+ h _ { t } = \phi _ { W , U } \big ( h _ { t - 1 } , x _ { t } \big ) = \operatorname { t a n h } \big ( W h _ { t - 1 } + U x _ { t } \big ) .
49
+ $$
50
+
51
+ Recurrent models are typically trained using some variant of gradient descent. One natural—even if not strictly necessary—requirement for gradient descent to work is that the gradients of the training objective do not explode over time. Stable recurrent models are precisely the class of models where the gradients cannot explode. They thus constitute a natural class of models where gradient descent can be expected to work. In general, we define a stable recurrent model as follows.
52
+
53
+ Definition 1. A recurrent model $\phi _ { w }$ is stable if there exists some $\lambda < 1$ such that, for any weights $w \in { \mathbf { R } } ^ { m }$ , states $h , h ^ { \prime } \in \mathbf { R } ^ { n }$ , and input $\boldsymbol { x } \in \mathbf { R } ^ { d }$ ,
54
+
55
+ $$
56
+ \begin{array} { r } { \| \phi _ { w } ( h , x ) - \phi _ { w } ( h ^ { \prime } , x ) \| \leq \lambda \| h - h ^ { \prime } \| . } \end{array}
57
+ $$
58
+
59
+ Equivalently, a recurrent model is stable if the map $\phi _ { w }$ is $\lambda$ -contractive in $h$ . If $\phi _ { w }$ is $\lambda$ -stable, then $\| \nabla _ { h } \phi _ { w } ( h , x ) \| < \lambda$ , and for Lipschitz loss $p$ , $\| \nabla _ { w } p \|$ is always bounded (Pascanu et al., 2013).
60
+
61
+ Stable models are particularly well-behaved and well-justified from a theoretical perspective. For instance, at present, only stable linear dynamical systems are known to be learnable via gradient
62
+
63
+ descent (Hardt et al., 2018). In unstable models, the gradients of the objective can explode, and it is a delicate matter to even show that gradient descent converges to a stationary point. The following proposition offers one such example. The proof is provided in the appendix.
64
+
65
+ Proposition 1. There exists an unstable system $\phi _ { w }$ where gradient descent does not converge to a stationary point, and $\| \nabla _ { w } p \| \to \infty$ as the number of iterations $N \to \infty$ .
66
+
67
+ # 2.2 EXAMPLES OF STABLE RECURRENT MODELS
68
+
69
+ In this section, we provide sufficient conditions to ensure stability for several common recurrent models. These conditions offer a way to require learning happens in the stable regime– after each iteration of gradient descent, one imposes the corresponding stability condition via projection.
70
+
71
+ Linear dynamical systems and recurrent neural networks. Given a Lipschitz, point-wise nonlinearity $\rho$ and matrices $W \in \mathbf { R } ^ { n \times n }$ and $U \in \mathbf { R } ^ { n \times d }$ , the state-transition map for a recurrent neural network (RNN) is
72
+
73
+ $$
74
+ h _ { t } = \rho ( W h _ { t - 1 } + U x _ { t } ) .
75
+ $$
76
+
77
+ If $\rho$ is the identity, then the system is a linear dynamical system. Jin et al. (1994) show if $\rho$ is $L _ { \rho }$ -Lipschitz, then the model is stable provided $\begin{array} { r } { \| \dot { W } \| < \frac { 1 } { L _ { \rho } } } \end{array}$ . Indeed, for any states $h , h ^ { \prime }$ , and any $x$ ,
78
+
79
+ $$
80
+ \left\| \rho ( W h + U x ) - \rho ( W h ^ { \prime } + U x ) \right\| \leq L _ { \rho } \left\| W h + U x - W h ^ { \prime } - U x \right\| \leq L _ { \rho } \left\| W \right\| \left\| h - h ^ { \prime } \right\| .
81
+ $$
82
+
83
+ In the case of a linear dynamical system, the model is stable provided $\| W \| < 1$ . Similarly, for the 1-Lipschitz tanh-nonlinearity, stability obtains provided $\| W \| < 1$ . In the appendix, we verify the assumptions required by the theorems given in the next section for this example. Imposing this condition during training corresponds to projecting onto the spectral norm ball.
84
+
85
+ Long short-term memory networks. Long Short-Term Memory (LSTM) networks are another commonly used class of sequence models (Hochreiter & Schmidhuber, 1997). The state is a pair of vectors $s = ( c , h ) \in \mathbf { R } ^ { 2 \bar { d } }$ , and the model is parameterized by eight matrices, $W _ { \perp } \in \mathbf { R } ^ { d \times d }$ and $U _ { \bigstar } \in \mathbf { R } ^ { d \times n }$ , for $\boldsymbol { \bigtriangledown } \in \{ i , f , o , z \}$ . The state-transition map $\phi _ { \mathrm { L S T M } }$ is given by
86
+
87
+ $$
88
+ \begin{array} { r l } & { f _ { t } = \sigma ( W _ { f } h _ { t - 1 } + U _ { f } x _ { t } ) } \\ & { i _ { t } = \sigma ( W _ { i } h _ { t - 1 } + U _ { i } x _ { t } ) } \\ & { o _ { t } = \sigma ( W _ { o } h _ { t - 1 } + U _ { o } x _ { t } ) } \\ & { z _ { t } = \operatorname { t a n h } ( W _ { z } h _ { t - 1 } + U _ { z } x _ { t } ) } \\ & { c _ { t } = i _ { t } \circ z _ { t } + f _ { t } \circ c _ { t - 1 } } \\ & { h _ { t } = o _ { t } \cdot \operatorname { t a n h } ( c _ { t } ) , } \end{array}
89
+ $$
90
+
91
+ where $\circ$ denotes elementwise multiplication, and $\sigma$ is the logistic function.
92
+
93
+ We provide conditions under which the iterated system $\phi _ { \mathrm { L S T M } } ^ { r } = \phi _ { \mathrm { L S T M } } \circ \cdot \cdot \cdot \circ \phi _ { \mathrm { L S T M } }$ is stable. Let $\left\| f \right\| _ { \infty } = \operatorname* { s u p } _ { t } \left\| f _ { t } \right\| _ { \infty }$ . If the weights $W _ { f } , U _ { f }$ and inputs $x _ { t }$ are bounded, then $\| f \| _ { \infty } < 1$ since $| \sigma | < 1$ for any finite input. This means the next state $c _ { t }$ must “forget” a non-trivial portion of $c _ { t - 1 }$ . We leverage this phenomenon to give sufficient conditions for $\phi _ { \mathrm { L S T M } }$ to be contractive in the $\ell _ { \infty }$ norm, which in turn implies the iterated system $\phi _ { \mathrm { L S T M } } ^ { r }$ is contractive in the $\ell _ { 2 }$ norm for $r = O ( \log ( d ) )$ . Let $\| W \| _ { \infty }$ denote the induced $\ell _ { \infty }$ matrix norm, which corresponds to the maximum absolute row sum $\operatorname* { m a x } _ { i } \sum _ { j } ^ { \sim } | W _ { i j } |$ .
94
+
95
+ Proposition 2. If $\left\| \boldsymbol { W } _ { i } \right\| _ { \infty } , \left\| \boldsymbol { W } _ { o } \right\| _ { \infty } < ( 1 - \left\| \boldsymbol { f } \right\| _ { \infty } )$ , $\| W _ { z } \| _ { \infty } \leq ( 1 / 4 ) ( 1 - \| f \| _ { \infty } )$ , $\| W _ { f } \| _ { \infty } <$ $( 1 - \| f \| _ { \infty } ) ^ { 2 }$ , and $r = O ( \log ( d ) )$ , then the iterated system $\phi _ { \mathrm { L S T M } } ^ { r }$ is stable.
96
+
97
+ The proof is given in the appendix. The conditions given in Proposition 2 are fairly restrictive. Somewhat surprisingly we show in the experiments models satisfying these stability conditions still achieve good performance on a number of tasks. We leave it as an open problem to find different parameter regimes where the system is stable, as well as resolve whether the original system $\phi _ { \mathrm { L S T M } }$ is stable. Imposing these conditions during training and corresponds to simple row-wise normalization of the weight matrices and inputs. More details are provided in Section 4 and the appendix.
98
+
99
+ # 3 STABLE RECURRENT MODELS HAVE FEED-FORWARD APPROXIMATIONS
100
+
101
+ In this section, we prove stable recurrent models can be well-approximated by feed-forward networks for the purposes of both inference and training by gradient descent. From a memory perspective, stable recurrent models are equivalent to feed-forward networks—both models use the same amount of context to make predictions. This equivalence has important consequences for sequence modeling in practice. When a stable recurrent model achieves satisfactory performance on some task, a feed-forward network can achieve similar performance. Consequently, if sequence learning in practice is inherently stable, then recurrent models may not be necessary. Conversely, if feed-forward models cannot match the performance of recurrent models, then sequence learning in practice is in the unstable regime.
102
+
103
+ # 3.1 TRUNCATED RECURRENT MODELS
104
+
105
+ For our purposes, the salient distinction between a recurrent and feed-forward model is the latter has finite-context. Therefore, we say a model is feed-forward if the prediction made by the model at step $t$ is a function only of the inputs $x _ { t - k } , \ldots , x _ { t }$ for some finite $k$ .
106
+
107
+ While there are many choices for a feed-forward approximation, we consider the simplest one— truncation of the system to some finite context $k$ . In other words, the feed-forward approximation moves over the input sequence with a sliding window of length $k$ producing an output every time the sliding window advances by one step. Formally, for context length $k$ chosen in advance, we define the truncated model via the update rule
108
+
109
+ $$
110
+ h _ { t } ^ { k } = \phi _ { w } \big ( h _ { t - 1 } ^ { k } , x _ { t } \big ) , \quad h _ { t - k } ^ { k } = 0 .
111
+ $$
112
+
113
+ Note that $h _ { t } ^ { k }$ is a function only of the previous $k$ inputs $x _ { t - k } , \ldots , x _ { t }$ . While this definition is perhaps an abuse of the term “feed-forward”, the truncated model can be implemented as a standard autoregressive, depth- $k$ feed-forward network, albeit with significant weight sharing.
114
+
115
+ Let $f$ denote a prediction function that maps a state $h _ { t }$ to outputs $f ( h _ { t } ) = y _ { t }$ . Let $y _ { t } ^ { k }$ denote the predictions from the truncated model. To simplify the presentation, the prediction function $f$ is not parameterized. This is without loss of generality because it is always possible to fold the parameters into the system $\phi _ { w }$ itself. In the sequel, we study $\left\| y _ { t } - y _ { t } ^ { k } \right\|$ both during and after training.
116
+
117
+ # 3.2 APPROXIMATION DURING INFERENCE
118
+
119
+ Suppose we train a full recurrent model $\phi _ { w }$ and obtain a prediction $y _ { t }$ . For an appropriate choice of context $k$ , the truncated model makes essentially the same prediction $y _ { t } ^ { k }$ as the full recurrent model. To show this result, we first control the difference between the hidden states of both models.
120
+
121
+ Lemma 1. Assume $\phi _ { w }$ is $\lambda$ -contractive in $h$ and $L _ { x }$ -Lipschitz in $x$ . Assume the input sequence $\| x _ { t } \| \leq B _ { x }$ for all $t$ . If the truncation length $\begin{array} { r } { k \ge \log _ { 1 / \lambda } \left( \frac { L _ { x } B _ { x } } { ( 1 - \lambda ) \varepsilon } \right) } \end{array}$ , then the difference in hidden states $\left\| h _ { t } - h _ { t } ^ { k } \right\| \leq \varepsilon$ .
122
+
123
+ Lemma 1 effectively says stable models do not have long-term memory– distant inputs do not change the states of the system. A proof is given in the appendix. If the prediction function is Lipschitz, Lemma 1 immediately implies the recurrent and truncated model make nearly identical predictions.
124
+
125
+ Proposition 3. If $\phi _ { w }$ is a $L _ { x }$ -Lipschitz and $\lambda$ -contractive map, and $f$ is $L _ { f }$ Lipschitz, and the truncation length $\begin{array} { r } { k \ge \log _ { 1 / \lambda } \left( \frac { L _ { f } L _ { x } B _ { x } } { ( 1 - \lambda ) \varepsilon } \right) } \end{array}$ , then $\left\| y _ { t } - y _ { t } ^ { k } \right\| \leq \varepsilon$ .
126
+
127
+ # 3.3 APPROXIMATION DURING TRAINING VIA GRADIENT DESCENT
128
+
129
+ Equipped with our inference result, we turn towards optimization. We show gradient descent for stable recurrent models finds essentially the same solutions as gradient descent for truncated models. Consequently, both the recurrent and truncated models found by gradient descent make essentially the same predictions.
130
+
131
+ Our proof technique is to initialize both the recurrent and truncated models at the same point and track the divergence in weights throughout the course of gradient descent. Roughly, we show if $k \approx { \cal O } ( \log ( N / \varepsilon ) )$ , then after $N$ steps of gradient descent, the difference in the weights between the recurrent and truncated models is at most $\varepsilon$ . Even if the gradients are similar for both models at the same point, it is a priori possible that slight differences in the gradients accumulate over time and lead to divergent weights where no meaningful comparison is possible. Building on similar techniques as Hardt et al. (2016), we show that gradient descent itself is stable, and this type of divergence cannot occur.
132
+
133
+ Our gradient descent result requires two essential lemmas. The first bounds the difference in gradient between the full and the truncated model. The second establishes the gradient map of both the full and truncated models is Lipschitz. We defer proofs of both lemmas to the appendix.
134
+
135
+ Let $p _ { T }$ denote the loss function evaluated on recurrent model after $T$ time steps, and define $p _ { T } ^ { k }$ similarly for the truncated model. Assume there some compact, convex domain $\boldsymbol { \Theta } \subset \mathbf { R } ^ { m }$ so that the map $\phi _ { w }$ is stable for all choices of parameters $w \in \Theta$ .
136
+
137
+ Lemma 2. Assume $p$ (and therefore $p ^ { k }$ ) is Lipschitz and smooth. Assume $\phi _ { w }$ is smooth, $\lambda$ - contractive, and Lipschitz in $x$ and $w$ . Assume the inputs satisfy $\| x _ { t } \| \leq B _ { x }$ , then
138
+
139
+ $$
140
+ \left\| \nabla _ { w } p _ { T } - \nabla _ { w } p _ { T } ^ { k } \right\| = \gamma k \lambda ^ { k } ,
141
+ $$
142
+
143
+ where $\gamma = O \left( B _ { x } ( 1 - \lambda ) ^ { - 2 } \right)$ , suppressing dependence on the Lipschitz and smoothness parameters.
144
+
145
+ Lemma 3. For any $w , w ^ { \prime } \in \Theta$ , suppose $\phi _ { w }$ is smooth, $\lambda$ -contractive, and Lipschitz in $w$ . If $p$ is Lipschitz and smooth, then
146
+
147
+ $$
148
+ \begin{array} { r } { \| \nabla _ { w } p _ { T } ( w ) - \nabla _ { w } p _ { T } ( w ^ { \prime } ) \| \leq \beta \| w - w ^ { \prime } \| , } \end{array}
149
+ $$
150
+
151
+ where $\beta = O \left( ( 1 - \lambda ) ^ { - 3 } \right)$ , suppressing dependence on the Lipschitz and smoothness parameters.
152
+
153
+ cate Let wirecurr be the weights of tl. At initialization, l on s. For p s $i$ and define fficiently la $w _ { \mathrm { t r u n c } } ^ { i }$ similarly for the trun-mma 2 guarantees the $w _ { \mathrm { r e c u r r } } ^ { 0 } = w _ { \mathrm { t r u n c } } ^ { 0 }$ $k$ difference between the gradient of the recurrent and truncated models is negligible. Therefore, after a gradient update, $\lVert w _ { \mathrm { r e c u r r } } ^ { 1 } - w _ { \mathrm { t r u n c } } ^ { 1 } \rVert$ is small. Lemma 3 then guarantees that this small difference in weights does not lead to large differences in the gradient on the subsequent time step. For an appropriate choice of learning rate, formalizing this argument leads to the following proposition.
154
+
155
+ Proposition 4. Under the assumptions oprojected gradient descent with step size $\Theta$ $N$ steps of $\alpha _ { t } = \alpha / t$ $| t , \big | \big | w _ { \mathrm { r e c u r r } } ^ { N } - w _ { \mathrm { t r u n c } } ^ { N ^ { \ast } } \big | \big | \leq \alpha \gamma k \lambda ^ { k } N ^ { \tilde { \alpha } \beta + 1 }$
156
+
157
+ The decaying step size in our theorem is consistent with the regime in which gradient descent is known to be stable for non-convex training objectives (Hardt et al., 2016). While the decay is faster than many learning rates encountered in practice, classical results nonetheless show that with this learning rate gradient descent still converges to a stationary point; see p. 119 in Bertsekas (1999) and references there. In the appendix, we give empirical evidence the $O ( 1 / t )$ rate is necessary for our theorem and show examples of stable systems trained with constant or $O ( 1 / \sqrt { t } )$ rates that do not satisfy our bound.
158
+
159
+ Critically, the bound in Proposition 4 goes to 0 as $k \infty$ . In particular, if we take $\alpha = 1$ and $k \geq \Omega ( \log ( \gamma N ^ { \beta } / \varepsilon ) )$ , then after $N$ → ∞steps of projected gradient descent, $\lVert w _ { \mathrm { r e c u r r } } ^ { N } - w _ { \mathrm { t r u n c } } ^ { N } \rVert \leq \varepsilon$ . For this choice of $k$ , we obtain the main theorem. The proof is left to the appendix.
160
+
161
+ Theorem 1. Let $p$ be Lipschitz and smooth. Assume $\phi _ { w }$ is smooth, $\lambda$ -contractive, Lipschitz in $x$ and $w$ . Assume the inputs are bounded, and the prediction function $f$ is $L _ { f }$ -Lipschitz. If $k \geq \Omega ( \log ( \gamma N ^ { \beta } / \varepsilon ) )$ , then after $N$ steps of projected gradient descent with step size $\alpha _ { t } = 1 / t$ , $\left\| y _ { T } - y _ { T } ^ { k } \right\| \leq \varepsilon$ .
162
+
163
+ # 4 EXPERIMENTS
164
+
165
+ In the experiments, we show stable recurrent models can achieve solid performance on several benchmark sequence tasks. Namely, we show unstable recurrent models can often be made stable without a loss in performance. In some cases, there is a small gap between the performance between unstable and stable models. We analyze whether this gap is indicative of a “price of stability” and show the unstable models involved are stable in a data-dependent sense.
166
+
167
+ # 4.1 TASKS
168
+
169
+ We consider four benchmark sequence problems–word-level language modeling, character-level language modeling, polyphonic music modeling, and slot-filling.
170
+
171
+ Language modeling. In language modeling, given a sequence of words or characters, the model must predict the next word or character. For character-level language modeling, we train and evaluate models on Penn Treebank (Marcus et al., 1993). To increase the coverage of our experiments, we train and evaluate the word-level language models on the Wikitext-2 dataset, which is twice as large as Penn Treebank and features a larger vocabulary (Merity et al., 2017). Performance is reported using bits-per-character for character-level models and perplexity for word-level models.
172
+
173
+ Polyphonic music modeling. In polyphonic music modeling, a piece is represented as a sequence of 88-bit binary codes corresponding to the 88 keys on a piano, with a 1 indicating a key that is pressed at a given time. Given a sequence of codes, the task is to predict the next code. We evaluate our models on JSB Chorales, a polyphonic music dataset consisting of 382 harmonized chorales by J.S. Bach (Allan & Williams, 2005). Performance is measured using negative log-likelihood.
174
+
175
+ Slot-filling. In slot filling, the model takes as input a query like “I want to Boston on Monday” and outputs a class label for each word in the input, e.g. Boston maps to Departure City and Monday maps to Departure Time. We use the Airline Travel Information Systems (ATIS) benchmark and report the F1 score for each model (Price, 1990).
176
+
177
+ # 4.2 COMPARING STABLE AND UNSTABLE MODELS
178
+
179
+ For each task, we first train an unconstrained RNN and an unconstrained LSTM. All the hyperparameters are chosen via grid-search to maximize the performance of the unconstrained model. For consistency with our theoretical results in Section 3 and stability conditions in Section 2.2, both models have a single recurrent layer and are trained using plain SGD. In each case, the resulting model is unstable. However, we then retrain the best models using projected gradient descent to enforce stability without retuning the hyperparameters. In the RNN case, we constrain $\| W \| < 1$ . After each gradient update, we project the $W$ onto the spectral norm ball by computing the SVD and thresholding the singular values to lie in $[ 0 , 1 )$ . In the LSTM case, after each gradient update, we normalize each row of the weight matrices to satisfy the sufficient conditions for stability given in Section 2.2. Further details are given in the appendix.
180
+
181
+ Stable and unstable models achieve similar performance. Table 1 gives a comparison of the performance between stable and unstable RNNs and LSTMs on each of the different tasks. Each of the reported metrics is computed on the held-out test set. We also show a representative comparison of learning curves for word-level language modeling and polyphonic music modeling in Figures 1(a) and 1(b).
182
+
183
+ ![](images/1628a1c276de18cff1c5c32e660b499e8c36a246c3042a510e4c43b7e79686a3.jpg)
184
+ Figure 1: Stable and unstable variants of common recurrent architectures achieve similar performance across a range of different sequence tasks.
185
+
186
+ Table 1: Comparison of stable and unstable models on a variety of sequence modeling tasks. For all the tasks, stable and unstable RNNs achieve the same performance. For polyphonic music and slot-filling, stable and unstable LSTMs achieve the same results. On language modeling, there is a small gap between stable and unstable LSTMs. We discuss this in Section 4.3. Performance is evaluated on the held-out test set. For negative log-likelihood (nll), bits per character (bpc), and perplexity, lower is better. For F1 score, higher is better.
187
+
188
+ Model
189
+
190
+ <table><tr><td rowspan="2">Sequence Task</td><td rowspan="2">Dataset (measure)</td><td colspan="2">RNN</td><td colspan="2">LSTM</td></tr><tr><td>Unstable</td><td>Stable</td><td>Unstable</td><td>Stable</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Polyphonic Music</td><td>JSB Chorales (nll)</td><td>8.9</td><td>8.9</td><td>8.5</td><td>8.5</td></tr><tr><td>Slot-Filling</td><td>Atis (F1 score)</td><td>94.7</td><td>94.7</td><td>95.1</td><td>94.6</td></tr><tr><td>Word-level LM</td><td>Wikitext-2 (perplexity)</td><td>146.7</td><td>143.5</td><td>95.7</td><td>113.2</td></tr><tr><td>Character-level LM</td><td>Penn Treebank (bpc)</td><td>1.8</td><td>1.9</td><td>1.4</td><td>1.9</td></tr></table>
191
+
192
+ Across all the tasks we considered, stable and unstable RNNs have roughly the same performance. Stable RNNs and LSTMs achieve results comparable to published baselines on slot-filling (Mesnil et al., 2015) and polyphonic music modeling (Bai et al., 2018). On word and character level language modeling, both stable and unstable RNNs achieve comparable results to (Bai et al., 2018).
193
+
194
+ On the language modeling tasks, however, there is a gap between stable and unstable LSTM models. Given the restrictive conditions we place on the LSTM to ensure stability, it is surprising they work as well as they do. Weaker conditions ensuring stability of the LSTM could reduce this gap. It is also possible imposing stability comes at a cost in representational capacity required for some tasks.
195
+
196
+ 4.3 WHAT IS THE “PRICE OF STABILITY” IN SEQUENCE MODELING?
197
+
198
+ The gap between stable and unstable LSTMs on language modeling raises the question of whether there is an intrinsic performance cost for using stable models on some tasks. If we measure stability in a data-dependent fashion, then the unstable LSTM language models are stable, indicating this gap is illusory. However, in some cases with short sequences, instability can offer modeling benefits.
199
+
200
+ LSTM language models are stable in a “data-dependent” way. Our notion of stability is conservative and requires stability to hold for every input and pair of hidden states. If we instead consider a weaker, data-dependent notion of stability, the word and character-level LSTM models are stable (in the iterated sense of Proposition 2). In particular, we compute the stability parameter only using input sequences from the data. Furthermore, we only evaluate stability on hidden states reachable via gradient descent. More precisely, to estimate $\lambda$ , we run gradient ascent to find worst-case hidden states $h , h ^ { \prime }$ to maximize kφw(h,x)−φw(h0,x)kk − 0k . More details are provided in the appendix.
201
+
202
+ The data-dependent definition given above is a useful diagnostic— when the sufficient stability conditions fail to hold, the data-dependent condition addresses whether the model is still operating in the stable regime. Moreover, when the input representation is fixed during training, our theoretical results go through without modification when using the data-dependent definition.
203
+
204
+ Using the data-dependent measure, in Figure 2(a), we show the iterated character-level LSTM, $\phi _ { \mathrm { L S T M } } ^ { r }$ , is stable for $r \approx 8 0$ iterations. A similar result holds for the word-level language model for $r \approx 1 0 0$ . These findings are consistent with experiments in Laurent & von Brecht (2017) which find LSTM trajectories converge after approximately 70 steps only when evaluated on sequences from the data. For language models, the “price of stability” is therefore much smaller than the gap in Table 1 suggests– even the “unstable” models are operating in the stable regime on the data distribution.
205
+
206
+ Unstable systems can offer performance improvements for short-time horizons. When sequences are short, training unstable models is less difficult because exploding gradients are less of an issue. In these case, unstable models can offer performance gains. To demonstrate this, we train truncated unstable models on the polyphonic music task for various values of the truncation parameter $k$ . In Figure 2(b), we simultaneously plot the performance of the unstable model and the stability parameter $\lambda$ for the converged model for each $k$ . For short-sequences, the final model is more unstable $( \lambda \approx 3 . 5 )$ and achieves a better test-likelihood. For longer sequence lengths, $\lambda$ decreases closer to the stable regime $\left( \lambda \approx 1 . 5 \right)$ ), and this improved test-likelihood performance disappears.
207
+
208
+ ![](images/527d5e269348aa2db67694da6730ff856052b523d9bea2fda4f42ef8222a5d43.jpg)
209
+
210
+ (a) Data-dependent stability of character-level language models. The iterated-LSTM refers to the iteration system $\phi _ { \mathrm { L S T M } } ^ { r } = \phi _ { \mathrm { L S T M } } \circ \cdot \cdot \cdot \circ \phi _ { \mathrm { L S T M } }$ .
211
+
212
+ ![](images/f282c4adb4fa436abe557a08aac14b09601a6865f3b718a3c23d995e0102b57e.jpg)
213
+ (b) Unstable models can boost performance for short sequences.
214
+
215
+ Figure 2: What is the intrinsic “price of stability”? For language modeling, we show the unstable LSTMs are actually stable in weaker, data-dependent sense. On the other hand, for polyphonic music modeling with short sequences, instability can improve model performance.
216
+
217
+ # 4.4 UNSTABLE MODELS OPERATE IN THE STABLE REGIME
218
+
219
+ In the previous section, we showed nominally unstable models often satisfy a data-dependent notion of stability. In this section, we offer further evidence unstable models are operating in the stable regime. These results further help explain why stable and unstable models perform comparably in experiments.
220
+
221
+ Vanishing gradients. Stable models necessarily have vanishing gradients, and indeed this ingredient is a key ingredient in the proof of our training-time approximation result. For both word and character-level language models, we find both unstable RNNs and LSTMs also exhibit vanishing gradients. In Figures 3(a) and 3(b), we plot the average gradient of the loss at time $t + i$ with respect to the input at time $t$ , $\| \nabla _ { x _ { t } } p _ { t + i } \|$ as $t$ ranges over the training set. For either language modeling task, the LSTM and the RNN suffer from limited sensitivity to distant inputs at initialization and throughout training. The gradients of the LSTM vanish more slowly than those of the RNN, but both models exhibit the same qualitative behavior.
222
+
223
+ ![](images/562b80e4783bef0c16d64d02a308f7983e074a824796ca50596c255ca3d40b17.jpg)
224
+ Figure 3: Unstable word and character-level language models exhibit vanishing gradients. We plot the norm of the gradient with respect to inputs, $\| \nabla _ { x _ { t } } p _ { t + i } \|$ , as the distance between the input and the loss grows, averaged over the entire training set. The gradient vanishes for moderate values of $i$ for both RNNs and LSTMs, though the decay is slower for LSTMs.
225
+
226
+ Truncating Unstable Models. The results in Section 3 show stable models can be truncated without loss of performance. In practice, unstable models can also be truncated without performance loss. In Figures 4(a) and 4(b), we show the performance of both LSTMs and RNNs for various values of the truncation parameter $k$ on word-level language modeling and polyphonic music modeling. Initially, increasing $k$ increases performance because the model can use more context to make predictions. However, in both cases, there is diminishing returns to larger values of the truncation parameter $k$ . LSTMs are unaffected by longer truncation lengths, whereas the performance of RNNs slightly degrades as $k$ becomes very large, possibly due to training instability. In either case, diminishing returns to performance for large values of $k$ means truncation and therefore feed-forward approximation is possible even for these unstable models.
227
+
228
+ ![](images/dc44c6050af8f079adf13da995f8e80349dcbf7d9d878975267f82b08c9a76f1.jpg)
229
+ Figure 4: Effect of truncating unstable models. On both language and music modeling, RNNs and LSTMs exhibit diminishing returns for large values of the truncation parameter $k$ . In LSTMs, larger $k$ doesn’t affect performance, whereas for unstable RNNs, large $k$ slightly decreases performance
230
+
231
+ Proposition (4) holds for unstable models. In stable models, Proposition (4) in Section 3 ensures the distance between the weight matrices $\lVert w _ { \mathrm { r e c u r r } } - w _ { \mathrm { t r u n c } } \rVert$ grows slowly as training progresses, and this rate decreases as $k$ becomes large. In Figures 5(a) and 5(b), we show a similar result holds empirically for unstable word-level language models. All the models are initialized at the same point, and we track the distance between the hidden-to-hidden matrices $W$ as training progresses. Training the full recurrent model is impractical, and we assume $k = 6 5$ well captures the fullrecurrent model. In Figures 5(a) and 5(b), we plot $\| W _ { k } - W _ { 6 5 } \|$ for $k \in \{ 5 , 1 0 , 1 5 , 2 5 , 3 5 , 5 0 , 6 4 \}$ throughout training. As suggested by Proposition (4), after an initial rapid increase in distance, $\| W _ { k } - W _ { 6 5 } \|$ grows slowly, as suggested by Proposition 4. Moreover, there is a diminishing return to choosing larger values of the truncation parameter $k$ in terms of the accuracy of the approximation.
232
+
233
+ ![](images/e62eb2ca9d12bb93404441676bbbe47f26c133a3a792ca5cbcad142eb241d7dc.jpg)
234
+ Figure 5: Qualitative version of Proposition 4 for unstable, word-level language models. We assume $k = 6 5$ well-captures the full-recurrent model and plot $\left. w _ { \mathrm { t r u n c } } - w _ { \mathrm { r e c u r r } } \right. = \left. W _ { k } - W _ { 6 5 } \right.$ as training proceeds, where $W$ denotes the recurrent weights. As Proposition 4 suggests, this quantity grows slowly as training proceeds, and the rate of growth decreases as $k$ increases.
235
+
236
+ # 5 ARE RECURRENT MODELS TRULY NECESSARY?
237
+
238
+ Our experiments show recurrent models trained in practice operate in the stable regime, and our theoretical results show stable recurrent models are approximable by feed-forward networks, As a consequence, we conjecture recurrent networks trained in practice are always approximable by feed-forward networks. Even with this conjecture, we cannot yet conclude recurrent models as commonly conceived are unnecessary. First, our present proof techniques rely on truncated versions of recurrent models, and truncated recurrent architectures like LSTMs may provide useful inductive bias on some problems. Moreover, implementing the truncated approximation as a feed-forward network increases the number of weights by a factor of $k$ over the original recurrent model. Declaring recurrent models truly superfluous would require both finding more parsimonious feed-forward approximations and proving natural feed-forward models, e.g. fully connected networks or CNNs, can approximate stable recurrent models during training. This remains an important question for future work.
239
+
240
+ # 6 RELATED WORK
241
+
242
+ Learning dynamical systems with gradient descent has been a recent topic of interest in the machine learning community. Hardt et al. (2018) show gradient descent can efficiently learn a class of stable, linear dynamical systems, Oymak (2018) shows gradient descent learns a class of stable, non-linear dynamical systems. Work by Sedghi & Anandkumar (2016) gives a moment-based approach for learning some classes of stable non-linear recurrent neural networks. Our work explores the theoretical and empirical consequences of the stability assumption made in these works. In particular, our empirical results show models trained in practice can be made closer to those currently being analyzed theoretically without large performance penalties.
243
+
244
+ For linear dynamical systems, Tu et al. (2017) exploit the connection between stability and truncation to learn a truncated approximation to the full stable system. Their approximation result is the same as our inference result for linear dynamical systems, and we extend this result to the non-linear setting. We also analyze the impact of truncation on training with gradient descent. Our training time analysis builds on the stability analysis of gradient descent in Hardt et al. (2016), but interestingly uses it for an entirely different purpose. Results of this kind are completely new to our knowledge.
245
+
246
+ For RNNs, the link between vanishing and exploding gradients and $\| W \|$ was identified in Pascanu et al. (2013). For 1-layer RNNs, Jin et al. (1994) give sufficient conditions for stability in terms of the norm $\| W \|$ and the Lipschitz constant of the non-linearity. Our work additionally considers LSTMs and provides new sufficient conditions for stability. Moreover, we study the consequences of stability in terms of feed-forward approximation.
247
+
248
+ A number of recent works have sought to avoid vanishing and exploding gradients by ensuring the system is an isometry, i.e. $\lambda = 1$ . In the RNN case, this amounts to constraining $\lvert | W \rvert | = \bar { 1 }$ (Arjovsky et al., 2016; Wisdom et al., 2016; Jing et al., 2017; Mhammedi et al., 2017; Jose et al., 2018). Vorontsov et al. (2017) observes strictly requiring $\| W \| = 1$ reduces performance on several tasks, and instead proposes maintaining $\| W \| \in [ 1 - \varepsilon , 1 + \varepsilon ]$ . Zhang et al. (2018) maintains this “soft-isometry” constraint using a parameterization based on the SVD that obviates the need for the projection step used in our stable-RNN experiments. Kusupati et al. (2018) sidestep these issues and stabilizes training using a residual parameterization of the model. At present, these unitary models have not yet seen widespread use, and our work shows much of the sequence learning in practice, even with nominally unstable models, actually occurs in the stable regime.
249
+
250
+ From an empirical perspective, Laurent $\&$ von Brecht (2017) introduce a non-chaotic recurrent architecture and demonstrate it can perform as well more complex models like LSTMs. Bai et al. (2018) conduct a detailed evaluation of recurrent and convolutional, feed-forward models on a variety of sequence modeling tasks. In diverse settings, they find feed-forward models outperform their recurrent counterparts. Their experiments are complimentary to ours; we find recurrent models can often be replaced with stable recurrent models, which we show are equivalent to feed-forward networks.
251
+
252
+ # ACKNOWLEDGEMENTS
253
+
254
+ This material is based upon work supported by the National Science Foundation Graduate Research Fellowship Program under Grant No. DGE 1752814 and a generous grant from the AWS Cloud Credits for Research program.
255
+
256
+ # REFERENCES
257
+
258
+ Moray Allan and Christopher Williams. Harmonising chorales by probabilistic inference. In Advances in Neural Information Processing Systems (NeurIPS), pp. 25–32, 2005.
259
+
260
+ Martin Arjovsky, Amar Shah, and Yoshua Bengio. Unitary evolution recurrent neural networks. In International Conference on Machine Learning (ICML), pp. 1120–1128, 2016.
261
+
262
+ Shaojie Bai, J Zico Kolter, and Vladlen Koltun. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:1803.01271, 2018.
263
+
264
+ Dimitri P. Bertsekas. Nonlinear Programming. Athena Scientific, 1999.
265
+
266
+ Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In International Conference on Machine Learning (ICML), pp. 933–941, 2017.
267
+
268
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. In International Conference on Machine Learning (ICML), pp. 1243–1252, 2017.
269
+
270
+ Moritz Hardt, Benjamin Recht, and Yoram Singer. Train faster, generalize better: Stability of stochastic gradient descent. In International Conference on Machine Learning (ICML), pp. 1225– 1234, 2016.
271
+
272
+ Moritz Hardt, Tengyu Ma, and Benjamin Recht. Gradient descent learns linear dynamical systems. The Journal of Machine Learning Research, 19(1):1025–1068, 2018.
273
+
274
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
275
+
276
+ Liang Jin, Peter N Nikiforuk, and Madan M Gupta. Absolute stability conditions for discrete-time recurrent neural networks. IEEE Transactions on Neural Networks, 5(6):954–964, 1994.
277
+
278
+ Li Jing, Yichen Shen, Tena Dubcek, John Peurifoy, Scott Skirlo, Yann LeCun, Max Tegmark, and Marin Soljaciˇ c. Tunable efficient unitary neural networks (EUNN) and their application to rnns. ´ In International Conference on Machine Learning (ICML), pp. 1733–1741, 2017.
279
+
280
+ Cijo Jose, Moustpaha Cisse, and Francois Fleuret. Kronecker recurrent units. In International Conference on Machine Learning (ICML), pp. 2380–2389, 2018.
281
+
282
+ Aditya Kusupati, Manish Singh, Kush Bhatia, Ashish Kumar, Prateek Jain, and Manik Varma. Fastgrnn: A fast, accurate, stable and tiny kilobyte sized gated recurrent neural network. In Advances in Neural Information Processing Systems (NeurIPS), pp. 9031–9042, 2018.
283
+
284
+ Thomas Laurent and James von Brecht. A recurrent neural network without chaos. In International Conference on Learning Representations (ICLR), 2017.
285
+
286
+ 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.
287
+
288
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In International Conference on Learning Representations (ICLR), 2017.
289
+
290
+ Stephen Merity, Nitish Shirish Keskar, and Richard Socher. Regularizing and Optimizing LSTM Language Models. In International Conference on Learning Representations (ICLR), 2018.
291
+
292
+ Gregoire Mesnil, Yann Dauphin, Kaisheng Yao, Yoshua Bengio, Li Deng, Dilek Hakkani-Tur, Xi-´ aodong He, Larry Heck, Gokhan Tur, Dong Yu, et al. Using recurrent neural networks for slot filling in spoken language understanding. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 23(3):530–539, 2015.
293
+
294
+ Zakaria Mhammedi, Andrew Hellicar, Ashfaqur Rahman, and James Bailey. Efficient orthogonal parametrisation of recurrent neural networks using householder reflections. In International Conference on Machine Learning (ICML), pp. 2401–2409, 2017.
295
+
296
+ Samet Oymak. Stochastic gradient descent learns state equations with nonlinear activations. arXiv preprint arXiv:1809.03019, 2018.
297
+
298
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning (ICML), pp. 1310–1318, 2013.
299
+
300
+ Patti J Price. Evaluation of spoken language systems: The atis domain. In Speech and Natural Language: Proceedings of a Workshop Held at Hidden Valley, Pennsylvania, June 24-27, 1990, 1990.
301
+
302
+ Hanie Sedghi and Anima Anandkumar. Training input-output recurrent neural networks through spectral methods. CoRR, abs/1603.00954, 2016.
303
+
304
+ Stephen Tu, Ross Boczar, Andrew Packard, and Benjamin Recht. Non-asymptotic analysis of robust control from coarse-grained identification. arXiv preprint arXiv:1707.04791, 2017.
305
+
306
+ Aaron Van Den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
307
+
308
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems (NeurIPS), pp. 6000–6010, 2017.
309
+
310
+ Eugene Vorontsov, Chiheb Trabelsi, Samuel Kadoury, and Chris Pal. On orthogonality and learning recurrent networks with long term dependencies. In International Conference on Machine Learning (ICML), pp. 3570–3578, 2017.
311
+
312
+ Scott Wisdom, Thomas Powers, John Hershey, Jonathan Le Roux, and Les Atlas. Full-capacity unitary recurrent neural networks. In Advances in Neural Information Processing Systems (NeurIPS), pp. 4880–4888, 2016.
313
+
314
+ Jiong Zhang, Qi Lei, and Inderjit Dhillon. Stabilizing gradients for deep neural networks via efficient SVD parameterization. In International Conference on Machine Learning (ICML), pp. 5806– 5814, 2018.
315
+
316
+ # A PROOFS FROM SECTION 2
317
+
318
+ # A.1 GRADIENT DESCENT ON UNSTABLE SYSTEMS NEED NOT CONVERGE
319
+
320
+ Proof of Proposition $^ { l }$ . Consider a scalar linear dynamical system
321
+
322
+ $$
323
+ \begin{array} { l } { { h _ { t } = a h _ { t - 1 } + b x _ { t } } } \\ { { \hat { y } _ { t } = h _ { t } , } } \end{array}
324
+ $$
325
+
326
+ where $h _ { 0 } = 0$ , $a , b \in \mathbf { R }$ are parameters, and $x _ { t } , y _ { t } \in \textbf { R }$ are elements the input-output sequence $\left\{ \left( x _ { t } , y _ { t } \right) \right\} _ { t = 1 } ^ { T }$ , where $L$ is the sequence length, and $\hat { y } _ { t }$ is the prediction at time $t$ . Stability of the above system corresponds to $| a | \overset { \vartriangle } { < } 1$ .
327
+
328
+ Suppose $( x _ { t } , y _ { t } ) \ : = \ : ( 1 , 1 )$ for $t = 1 , \dots , L$ . Then the desired system (4) simply computes the identity mapping. Suppose we use the squared-loss $\ell ( y _ { t } , \hat { y } _ { t } ) = ( 1 / \overset { \cdot } { 2 } ) ( y _ { t } - \hat { y } _ { t } ) ^ { 2 }$ , and suppose further $b = 1$ , so the problem reduces to learning $a = 0$ . We first compute the gradient. Compactly write
329
+
330
+ $$
331
+ h _ { t } = \sum _ { i = 0 } ^ { t - 1 } a ^ { t } b = \left( \frac { 1 - a ^ { t } } { 1 - a } \right) .
332
+ $$
333
+
334
+ Let $\delta _ { t } = \left( \hat { y } _ { t } - y _ { t } \right)$ . The gradient for step $T$ is then
335
+
336
+ $$
337
+ \begin{array} { r l } { \displaystyle \frac { d } { d a } \ell ( y _ { T } , \hat { y } _ { T } ) = \delta _ { T } \frac { d } { d a } = \delta _ { T } \sum _ { t = 0 } ^ { T - 1 } a ^ { T - 1 - t } h _ { t } } & { } \\ { = \delta _ { T } \sum _ { t = 0 } ^ { T - 1 } a ^ { T - 1 - t } \left( \frac { 1 - a ^ { t } } { 1 - a } \right) } & { } \\ { = \delta _ { T } \left[ \displaystyle \frac { 1 } { ( 1 - a ) } \sum _ { t = 0 } ^ { T - 1 } a ^ { t } - \frac { T a ^ { T - 1 } } { ( 1 - a ) } \right] } & { } \\ { = \delta _ { T } \left[ \displaystyle \frac { ( 1 - a ^ { T } ) } { ( 1 - a ) ^ { 2 } } - \frac { T a ^ { T - 1 } } { ( 1 - a ) } \right] . } \end{array}
338
+ $$
339
+
340
+ Plugging in $y _ { t } = 1$ , this becomes
341
+
342
+ $$
343
+ \frac { d } { d a } \ell ( y _ { T } , \hat { y } _ { T } ) = \left( \frac { ( 1 - a ^ { T } ) } { ( 1 - a ) } - 1 \right) \left[ \frac { ( 1 - a ^ { T } ) } { ( 1 - a ) ^ { 2 } } - \frac { T a ^ { T - 1 } } { ( 1 - a ) } \right] .
344
+ $$
345
+
346
+ For large $T$ , if $| a | > 1$ , then $a ^ { L }$ grows exponentially with $T$ and the gradient is approximately
347
+
348
+ $$
349
+ \frac { d } { d a } \ell ( y _ { T } , \hat { y } _ { T } ) \approx \left( a ^ { T - 1 } - 1 \right) T a ^ { T - 2 } \approx T a ^ { 2 T - 3 }
350
+ $$
351
+
352
+ Therefore, if $a ^ { 0 }$ is initialized outside of $[ - 1 , 1 ]$ , the iterates $a ^ { i }$ from gradient descent with step size $\alpha _ { i } = ( 1 / i )$ diverge, i.e. $a ^ { i } \infty$ , and from equation (6), it is clear that such $a ^ { i }$ are not stationary points. □
353
+
354
+ # A.2 PROOFS FROM SECTION 2.2
355
+
356
+ # A.2.1 RECURRENT NEURAL NETWORKS
357
+
358
+ Assume $\| W \| \le \lambda < 1$ and $\| U \| \le B _ { U }$ . Notice $\operatorname { t a n h } ^ { \prime } ( x ) = 1 - \operatorname { t a n h } ( x ) ^ { 2 }$ , so since $\operatorname { t a n h } ( x ) \in$ $[ - 1 , 1 ]$ , $\operatorname { t a n h } ( x )$ is 1-Lipschitz and 2-smooth. We previously showed the system is stable since, for any states $h , h ^ { \prime }$ ,
359
+
360
+ $$
361
+ \begin{array} { r l } & { \| \mathrm { t a n h } ( W h + U x ) - \operatorname { t a n h } ( W h ^ { \prime } + U x ) \| } \\ & { \leq \| W h + U x - W h ^ { \prime } - U x \| } \\ & { \leq \| W \| \| h - h ^ { \prime } \| . } \end{array}
362
+ $$
363
+
364
+ Using Lemma 1 with $k = 0$ , $\begin{array} { r } { \| h _ { t } \| \le \frac { B _ { U } B _ { x } } { ( 1 - \lambda ) } } \end{array}$ for all $t$ . Therefore, for any $W , W ^ { \prime } , U , U ^ { \prime }$ ,
365
+
366
+ $$
367
+ \begin{array} { r l } & { \| \mathrm { t a n h } ( W h _ { t } + U x ) - \mathrm { t a n h } ( W ^ { \prime } h _ { t } + U ^ { \prime } x ) \| } \\ & { \leq \| W h _ { t } + U x - W ^ { \prime } h _ { t } - U ^ { \prime } x \| } \\ & { \leq \underset { t } { \operatorname* { s u p } } \left\| h _ { t } \right\| \| W - W ^ { \prime } \| + B _ { x } \left\| U - U ^ { \prime } \right\| . } \\ & { \leq \frac { B _ { U } B _ { x } } { ( 1 - \lambda ) } \left\| W - W ^ { \prime } \right\| + B _ { x } \left\| U - U ^ { \prime } \right\| , } \end{array}
368
+ $$
369
+
370
+ so the model is Lipschitz in $U , W$ . We can similarly argue the model is $B _ { U }$ Lipschitz in $x$ . For smoothness, the partial derivative with respect to $h$ is
371
+
372
+ $$
373
+ \frac { \partial \phi _ { w } ( h , x ) } { \partial h } = { \bf d i a g } ( \operatorname { t a n h } ^ { \prime } ( W h + U x ) ) W ,
374
+ $$
375
+
376
+ so for any $h , h ^ { \prime }$ , bounding the $\ell _ { \infty }$ norm with the $\ell _ { 2 }$ norm,
377
+
378
+ $$
379
+ \begin{array} { r l } & { \left\| \frac { \partial \phi _ { w } ( h , x ) } { \partial h } - \frac { \partial \phi _ { w } ( h ^ { \prime } , x ) } { \partial h } \right\| = \left\| \mathbf { d i a g } ( \operatorname { t a n h } ^ { \prime } ( W h + U x ) ) W - \mathbf { d i a g } ( \operatorname { t a n h } ^ { \prime } ( W h ^ { \prime } + U x ) ) W \right\| } \\ & { \qquad \leq \| W \| \left\| \mathbf { d i a g } ( \operatorname { t a n h } ^ { \prime } ( W h + U x ) - \operatorname { t a n h } ^ { \prime } ( W h ^ { \prime } + U x ) ) \right\| } \\ & { \qquad \leq 2 \left\| W \right\| \left\| W h + U x - W h ^ { \prime } - U x \right\| _ { \infty } } \\ & { \qquad \leq 2 \lambda ^ { 2 } \left\| h - h ^ { \prime } \right\| . } \end{array}
380
+ $$
381
+
382
+ For any $W , W ^ { \prime } , U , U ^ { \prime }$ satisfying our assumptions,
383
+
384
+ $$
385
+ \begin{array} { r l } { \| \frac { \partial \phi _ { w } ( h , x ) } { \partial h } - \frac { \partial \phi _ { w ^ { \prime } } ( h , x ) } { \partial h } \| = \| \mathrm { d i a g } ( \operatorname { t a n h } ^ { \prime } ( W h + U x ) ) W - \mathrm { d i a g } ( \operatorname { t a n h } ^ { \prime } ( W ^ { \prime } h + U ^ { \prime } x ) ) W ^ { \prime } \| } & { } \\ & { \leq \| \mathrm { d i a g } ( \operatorname { t a n h } ^ { \prime } ( W h + U x ) - \operatorname { t a n h } ^ { \prime } ( W ^ { \prime } h + U ^ { \prime } x ) ) \| \| W \| } \\ & { \quad + \| \mathrm { d i a g } ( \operatorname { t a n h } ^ { \prime } ( W ^ { \prime } h + U ^ { \prime } x ) ) \| \| \| W - W ^ { \prime } \| } \\ & { \leq 2 \lambda \| ( W - W ^ { \prime } ) h + ( U - U ^ { \prime } ) x \| _ { \infty } + \| W - W ^ { \prime } \| } \\ & { \leq 2 \lambda \| ( W - W ^ { \prime } ) \| \| h \| + 2 \lambda \| U - U ^ { \prime } \| \| x \| + \| W - W ^ { \prime } \| } \\ & { \leq \frac { 2 \lambda B _ { U } B _ { x } + ( 1 - \lambda ) } { ( 1 - \lambda ) } \| W - W ^ { \prime } \| + 2 \lambda B _ { x } \| U - U ^ { \prime } \| . } \end{array}
386
+ $$
387
+
388
+ Similar manipulations establish $\frac { \partial \phi _ { w } ( h , x ) } { \partial w }$ is Lipschitz in $h$ and $w$ .
389
+
390
+ # A.2.2 LSTMS
391
+
392
+ Similar to the previous sections, we assume $s _ { 0 } = 0$ .
393
+
394
+ The state-transition map is not Lipschitz in $s$ , much less stable, unless $\| c \|$ is bounded. However, assuming the weights are bounded, we first prove this is always the case.
395
+
396
+ Lemma 4. Let $\left\| f \right\| _ { \infty } = \operatorname* { s u p } _ { t } \left\| f _ { t } \right\| _ { \infty }$ . If $\| W _ { f } \| _ { \infty } < \infty$ , $\| U _ { f } \| _ { \infty } < \infty$ , and $\| x _ { t } \| _ { \infty } \leq B _ { x }$ , then $\| f \| _ { \infty } < 1$ and $\begin{array} { r } { \left\| c _ { t } \right\| _ { \infty } \le \frac { 1 } { ( 1 - \left\| f \right\| _ { \infty } ) } } \end{array}$ for all $t$ .
397
+
398
+ Proof of Lemma 4. Note $| \mathrm { t a n h } ( x ) | , | \sigma ( x ) | \le 1$ for all $x$ . Therefore, for any $t$ , $\| h _ { t } \| _ { \infty } \ =$ $\left\| o _ { t } \circ \operatorname { t a n h } ( c _ { t } ) \right\| _ { \infty } \leq 1$ . Since $\sigma ( x ) < 1$ for $x < \infty$ and $\sigma$ is monotonically increasing
399
+
400
+ $$
401
+ \begin{array} { r l } & { \left\| f _ { t } \right\| _ { \infty } \leq \sigma \left( \left\| W _ { f } h _ { t - 1 } + U _ { f } x _ { t } \right\| _ { \infty } \right) } \\ & { \qquad \leq \sigma \left( \left\| W _ { f } \right\| _ { \infty } \left\| h _ { t - 1 } \right\| _ { \infty } + \left\| U _ { f } \right\| _ { \infty } \left\| x _ { t } \right\| _ { \infty } \right) } \\ & { \qquad \leq \sigma \left( B _ { W } + B _ { u } B _ { x } \right) } \\ & { \qquad < 1 . } \end{array}
402
+ $$
403
+
404
+ Using the trivial bound, $\| i _ { t } \| _ { \infty } \leq 1$ and $\begin{array} { r } { \| z _ { t } \| _ { \infty } \leq 1 } \end{array}$ , so
405
+
406
+ $$
407
+ \left\| { c _ { t + 1 } } \right\| _ { \infty } = \left\| { i _ { t } \circ z _ { t } + f _ { t } \circ c _ { t } } \right\| _ { \infty } \leq 1 + \left\| { f _ { t } } \right\| _ { \infty } \left\| { c _ { t } } \right\| _ { \infty } .
408
+ $$
409
+
410
+ Unrolling this recursion, we obtain a geometric series
411
+
412
+ $$
413
+ \left\| { c _ { t + 1 } } \right\| _ { \infty } \leq \sum _ { i = 0 } ^ { t } \left\| { f _ { t } } \right\| _ { \infty } ^ { i } \leq \frac { 1 } { \left( 1 - \left\| { f } \right\| _ { \infty } \right) } .
414
+ $$
415
+
416
+ Proof of Proposition 2. We show $\phi _ { \mathrm { L S T M } }$ is $\lambda$ -contractive in the $\ell _ { \infty }$ -norm for some $\lambda < 1$ . For $r \geq \log _ { 1 / \lambda } ( \sqrt { d } )$ , this in turn implies the iterated system $\phi _ { \mathrm { L S T M } } ^ { r }$ is contractive is the $\ell _ { 2 }$ -norm.
417
+
418
+ Consider the pair of reachable hidden states $s = ( c , h ) , s ^ { \prime } = ( c ^ { \prime } , h ^ { \prime } )$ . By Lemma 4, $c , c ^ { \prime }$ are bounded. Analogous to the recurrent network case above, since $\sigma$ is $( 1 / 4 )$ -Lipschitz and tanh is 1-Lipschitz,
419
+
420
+ $$
421
+ \begin{array} { l } { \displaystyle \| i - i ^ { \prime } \| \leq \frac 1 4 \| W _ { i } \| _ { \infty } \| h - h ^ { \prime } \| _ { \infty } } \\ { \displaystyle \| f - f ^ { \prime } \| \leq \frac 1 4 \| W _ { f } \| _ { \infty } \| h - h ^ { \prime } \| _ { \infty } } \\ { \displaystyle \| o - o ^ { \prime } \| \leq \frac 1 4 \| W _ { o } \| _ { \infty } \| h - h ^ { \prime } \| _ { \infty } } \\ { \displaystyle \| z - z ^ { \prime } \| \leq \| W _ { z } \| _ { \infty } \| h - h ^ { \prime } \| _ { \infty } . } \end{array}
422
+ $$
423
+
424
+ Both $\| z \| _ { \infty } , \| i \| _ { \infty } \leq 1$ since they’re the output of a sigmoid. Letting $c _ { + }$ and $c _ { + } ^ { \prime }$ denote the state on the next time step, applying the triangle inequality,
425
+
426
+ $$
427
+ \begin{array} { r l } & { \left\| c _ { + } - c _ { + } ^ { \prime } \right\| _ { \infty } \leq \left\| i \circ z - i ^ { \prime } \circ z ^ { \prime } \right\| _ { \infty } + \left\| f \circ c - f ^ { \prime } \circ c ^ { \prime } \right\| _ { \infty } } \\ & { \qquad \leq \left\| \left( i - i ^ { \prime } \right) \circ z \right\| _ { \infty } + \left\| i ^ { \prime } \circ \left( z - z ^ { \prime } \right) \right\| _ { \infty } + \left\| f \circ \left( c - c ^ { \prime } \right) \right\| _ { \infty } + \left\| c \circ \left( f - f ^ { \prime } \right) \right\| _ { \infty } } \\ & { \qquad \leq \left\| i - i ^ { \prime } \right\| _ { \infty } \left\| z \right\| _ { \infty } + \left\| z - z ^ { \prime } \right\| _ { \infty } \left\| i ^ { \prime } \right\| _ { \infty } + \left\| c - c ^ { \prime } \right\| _ { \infty } \left\| f \right\| _ { \infty } + \left\| f - f ^ { \prime } \right\| _ { \infty } \left\| c \right\| _ { \infty } } \\ & { \qquad \leq \left( \frac { \left\| W _ { i } \right\| _ { \infty } + \left\| c \right\| _ { \infty } \left\| W _ { f } \right\| _ { \infty } } { 4 } + \left\| W _ { z } \right\| _ { \infty } \right) \left\| h - h ^ { \prime } \right\| _ { \infty } + \left\| f \right\| _ { \infty } \left\| c - c ^ { \prime } \right\| _ { \infty } . } \end{array}
428
+ $$
429
+
430
+ A similar argument shows
431
+
432
+ $$
433
+ \left\| h _ { + } - h _ { + } ^ { \prime } \right\| _ { \infty } \leq \left\| o - o ^ { \prime } \right\| _ { \infty } + \left\| c _ { + } - c _ { + } ^ { \prime } \right\| _ { \infty } \leq \frac { \| W _ { o } \| _ { \infty } } { 4 } \left\| h - h ^ { \prime } \right\| _ { \infty } + \left\| c _ { + } - c _ { + } ^ { \prime } \right\| _ { \infty } .
434
+ $$
435
+
436
+ By assumption,
437
+
438
+ $$
439
+ \left( \frac { \| W _ { i } \| _ { \infty } + \| c \| _ { \infty } \| W _ { f } \| _ { \infty } + \| W _ { o } \| _ { \infty } } { 4 } + \| W _ { z } \| _ { \infty } \right) < 1 - \| f \| _ { \infty } ,
440
+ $$
441
+
442
+ and so
443
+
444
+ $$
445
+ \begin{array} { r } { \left\| h _ { + } - h _ { + } ^ { \prime } \right\| _ { \infty } < \left( 1 - \left\| f \right\| _ { \infty } \right) \left\| h - h ^ { \prime } \right\| _ { \infty } + \left\| f \right\| _ { \infty } \left\| c - c ^ { \prime } \right\| _ { \infty } \leq \left\| s - s ^ { \prime } \right\| _ { \infty } , } \end{array}
446
+ $$
447
+
448
+ as well as
449
+
450
+ $$
451
+ \left\| c _ { + } - c _ { + } ^ { \prime } \right\| _ { \infty } < ( 1 - \| f \| _ { \infty } ) \left\| h - h ^ { \prime } \right\| _ { \infty } + \left\| f \right\| _ { \infty } \left\| c - c ^ { \prime } \right\| _ { \infty } \leq \left\| s - s ^ { \prime } \right\| _ { \infty } ,
452
+ $$
453
+
454
+ which together imply
455
+
456
+ $$
457
+ \begin{array} { r } { \left\| s _ { + } - s _ { + } ^ { \prime } \right\| _ { \infty } < \| s - s ^ { \prime } \| _ { \infty } , } \end{array}
458
+ $$
459
+
460
+ establishing $\phi _ { \mathrm { L S T M } }$ is contractive in the $\ell _ { \infty }$ norm.
461
+
462
+ # B PROOFS FROM SECTION 3
463
+
464
+ Throughout this section, we assume the initial state $h _ { 0 } = 0$ . Without loss of generality, we also assume $\phi _ { w } ( 0 , 0 ) = 0$ for all $w$ . Otherwise, we can reparameterize $\phi _ { w } ( h , x ) \mapsto \phi _ { w } ( h , x ) - \phi _ { w } ( 0 , 0 )$ without affecting expressivity of $\phi _ { w }$ . For stable models, we also assume there some compact, convex domain $\boldsymbol { \Theta } \subset \mathbf { R } ^ { m }$ so that the map $\phi _ { w }$ is stable for all choices of parameters $w \in \Theta$ .
465
+
466
+ Proof of Lemma $^ { l }$ . For any $t \geq 1$ , by triangle inequality,
467
+
468
+ $$
469
+ \begin{array} { r } { \| h _ { t } \| = \left\| \phi _ { w } ( h _ { t - 1 } , x _ { t } ) - \phi _ { w } ( 0 , 0 ) \right\| \leq \left\| \phi _ { w } ( h _ { t - 1 } , x _ { t } ) - \phi _ { w } ( 0 , x _ { t } ) \right\| + \left\| \phi _ { w } ( 0 , x _ { t } ) - \phi _ { w } ( 0 , 0 ) \right\| . } \end{array}
470
+ $$
471
+
472
+ Applying the stability and Lipschitz assumptions and then summing a geometric series,
473
+
474
+ $$
475
+ \left\| h _ { t } \right\| \leq \lambda \left\| h _ { t - 1 } \right\| + L _ { x } \left\| x _ { t } \right\| \leq \sum _ { i = 0 } ^ { t } \lambda ^ { i } L _ { x } B _ { x } \leq { \frac { L _ { x } B _ { x } } { ( 1 - \lambda ) } } .
476
+ $$
477
+
478
+ Now, consider the difference between hidden states at time step $t$ . Unrolling the iterates $k$ steps and then using the previous display yields
479
+
480
+ $$
481
+ \left\| h _ { t } - h _ { t } ^ { k } \right\| = \left\| \phi _ { w } ( h _ { t - 1 } , x _ { t } ) - \phi _ { w } ( h _ { t - 1 } ^ { k } , x _ { t } ) \right\| \leq \lambda \left\| h _ { t - 1 } - h _ { t - 1 } ^ { k } \right\| \leq \lambda ^ { k } \left\| h _ { t - k } \right\| \leq { \frac { \lambda ^ { k } L _ { x } B _ { x } } { ( 1 - \lambda ) } } ,
482
+ $$
483
+
484
+ and solving for $k$ gives the result.
485
+
486
+ # B.1 PROOFS FROM SECTION 3.3
487
+
488
+ Before proceeding, we introduce notation for our smoothness assumption. We assume the map $\phi _ { w }$ satisfies four smoothness conditions: for any reachable states $h , h ^ { \prime }$ , and any weights $w , w ^ { \prime } \in \Theta$ , there are some scalars $\beta _ { w w } , \beta _ { w h } , \beta _ { h w } , \beta _ { h h }$ such that
489
+
490
+ $$
491
+ \begin{array} { r l } & { \left| \frac { \partial \phi _ { w } ( h , x ) } { \partial w } - \frac { \partial \phi _ { w ^ { \prime } } ( h , x ) } { \partial w } \right| \leq \beta _ { w w } \left\| w - w ^ { \prime } \right\| . } \\ & { \left\| \frac { \partial \phi _ { w } ( h , x ) } { \partial w } - \frac { \partial \phi _ { w } ( h ^ { \prime } , x ) } { \partial w } \right\| \leq \beta _ { w h } \left\| h - h ^ { \prime } \right\| . } \\ & { \left\| \frac { \partial \phi _ { w } ( h , x ) } { \partial h } - \frac { \partial \phi _ { w ^ { \prime } } ( h , x ) } { \partial h } \right\| \leq \beta _ { h w } \left\| w - w ^ { \prime } \right\| . } \\ & { \left\| \frac { \partial \phi _ { w } ( h , x ) } { \partial h } - \frac { \partial \phi _ { w } ( h ^ { \prime } , x ) } { \partial h } \right\| \leq \beta _ { h h } \left\| h - h ^ { \prime } \right\| . } \end{array}
492
+ $$
493
+
494
+ # B.1.1 GRADIENT DIFFERENCE DUE TO TRUNCATION IS NEGLIGIBLE
495
+
496
+ In the section, we argue the difference in gradient with respect to the weights between the recurrent and truncated models is $O ( k \lambda ^ { k } )$ . For sufficiently large $k$ (independent of the sequence length), the impact of truncation is therefore negligible. The proof leverages the “vanishing-gradient” phenomenon– the long-term components of the gradient of the full recurrent model quickly vanish. The remaining challenge is to show the short-term components of the gradient are similar for the full and recurrent models.
497
+
498
+ Proof of Lemma 2. The Jacobian of the loss with respect to the weights is
499
+
500
+ $$
501
+ \frac { \partial p _ { T } } { \partial w } = \frac { \partial p _ { T } } { \partial h _ { T } } \left( \sum _ { t = 0 } ^ { T } \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } \right) ,
502
+ $$
503
+
504
+ where ∂ht∂w is the partial derivative of ht with respect to w, assuming ht−1 is constant with respect to $w$ . Expanding the expression for the gradient, we wish to bound
505
+
506
+ $$
507
+ \begin{array} { r l } { { \| \nabla _ { w } p _ { T } ( w ) - \nabla _ { w } p _ { T } ^ { k } ( w ) \| = \| \sum _ { t = 1 } ^ { T } ( \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } ) ^ { \top } \nabla _ { h _ { T } } p _ { T } - \sum _ { t = T - k + 1 } ^ { T } ( \frac { \partial h _ { T } ^ { k } } { \partial h _ { t } ^ { k } } \frac { \partial h _ { t } ^ { k } } { \partial w } ) ^ { \top } \nabla _ { h _ { T } ^ { k } } p _ { T } ^ { k } \| } } \\ & { \leq \| \sum _ { t = 1 } ^ { T - k } ( \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } ) ^ { \top } \nabla _ { h _ { T } } p _ { T } \| } \\ & { + \sum _ { t = T - k + 1 } ^ { T } \| ( \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } ) ^ { \top } \nabla _ { h _ { T } } p _ { T } - ( \frac { \partial h _ { T } ^ { k } } { \partial h _ { t } ^ { k } } \frac { \partial h _ { t } ^ { k } } { \partial w } ) ^ { \top } \nabla _ { h _ { T } ^ { k } } p _ { T } \| . } \end{array}
508
+ $$
509
+
510
+ The first term consists of the “long-term components” of the gradient for the recurrent model. The second term is the difference in the “short-term components” of the gradients between the recurrent and truncated models. We bound each of these terms separately.
511
+
512
+ For the first term, by the Lipschitz assumptions, $\| \nabla _ { h _ { T } } p _ { T } \| \le L _ { p }$ and $\| \nabla _ { w } h _ { t } \| \le L _ { w }$ . Since $\phi _ { w }$ is $\lambda$ -contractive, so $\left\| { \frac { \partial h _ { t } } { \partial h _ { t - 1 } } } \right\| \leq \lambda$ . Using submultiplicavity of the spectral norm,
513
+
514
+ $$
515
+ \left\| \frac { \partial p _ { T } } { \partial h _ { T } } \sum _ { t = 0 } ^ { T - k } \frac { \partial p _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } \right\| \leq \| \nabla _ { h _ { T } } p _ { T } \| \sum _ { t = 0 } ^ { T - k } \left\| \prod _ { i = t } ^ { T } \frac { \partial h _ { i } } { \partial h _ { i - 1 } } \right\| \| \nabla _ { w } h _ { t } \| \leq L _ { p } L _ { w } \sum _ { t = 0 } ^ { T - k } \lambda ^ { T - t } \leq \lambda ^ { k } \frac { L _ { p } L _ { w } } { ( 1 - \lambda ) } .
516
+ $$
517
+
518
+ Focusing on the second term, by triangle inequality and smoothness,
519
+
520
+ $$
521
+ \begin{array} { r l } & { \underset { t = T - k + 1 } { \overset { T } { \sum } } \left. \left( \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } \right) ^ { \top } \nabla _ { h _ { T } } p _ { T } - \left( \frac { \partial h _ { T } ^ { k } } { \partial h _ { t } ^ { k } } \frac { \partial h _ { t } ^ { k } } { \partial w } \right) ^ { \top } \nabla _ { h _ { T } ^ { k } } p _ { T } \right. } \\ & { \leq \underset { t = T - k + 1 } { \overset { T } { \sum } } \left. \nabla _ { h _ { T } } p _ { T } - \nabla _ { h _ { T } ^ { k } } p _ { T } ^ { k } \right. \left. \frac { \partial h _ { T } ^ { k } } { \partial h _ { t } ^ { k } } \frac { \partial h _ { t } ^ { k } } { \partial w } \right. + \left. \nabla _ { h _ { T } } p _ { T } \right. \left. \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } - \frac { \partial h _ { T } ^ { k } } { \partial h _ { t } ^ { k } } \frac { \partial h _ { t } ^ { k } } { \partial w } \right. } \\ & { \leq \underset { t = T - k + 1 } { \overset { T } { \sum } } \underset { ( \alpha ) } { \overset { \beta _ { p } } { \sum } } \left. h _ { T } - h _ { T } ^ { k } \right. \lambda ^ { T - t } L _ { w } + \underset { ( \alpha ) } { \overset { \beta _ { p } } { \sum } } \left. \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } - \frac { \partial h _ { T } ^ { k } } { \partial h _ { t } ^ { k } } \frac { \partial h _ { t } ^ { k } } { \partial w } \right. . } \end{array}
522
+ $$
523
+
524
+ Using Lemma 1 to upper bound (a),
525
+
526
+ $$
527
+ \sum _ { t = T - k } ^ { T } \beta _ { p } \left. h _ { T } - h _ { T } ^ { k } \right. \lambda ^ { T - t } L _ { w } \leq \sum _ { t = T - k } ^ { T } \lambda ^ { T - t } \frac { \lambda ^ { k } \beta _ { p } L _ { w } L _ { x } B _ { x } } { ( 1 - \lambda ) } \leq \frac { \lambda ^ { k } \beta _ { p } L _ { w } L _ { x } B _ { x } } { ( 1 - \lambda ) ^ { 2 } } .
528
+ $$
529
+
530
+ Using the triangle inequality, Lipschitz and smoothness, (b) is bounded by
531
+
532
+ $$
533
+ \begin{array} { r l } & { \quad \displaystyle { \sum _ { t = T - k + 1 } ^ { T } } L _ { p } \left\| \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } - \frac { \partial h _ { t } ^ { k } } { \partial h _ { t } ^ { k } } \frac { \partial h _ { t } ^ { k } } { \partial w } \right\| } \\ & { \leq \displaystyle { \sum _ { t = T - k + 1 } ^ { T } } L _ { p } \left\| \frac { \partial h _ { T } } { \partial h _ { t } } \right\| \left\| \frac { \partial h _ { t } } { \partial w } - \frac { \partial h _ { t } ^ { k } } { \partial w } \right\| + L _ { p } \left\| \frac { \partial h _ { t } ^ { k } } { \partial w } \right\| \left\| \frac { \partial h _ { T } } { \partial h _ { t } } - \frac { \partial h _ { T } ^ { k } } { \partial h _ { t } ^ { k } } \right\| } \\ & { \leq \displaystyle { \sum _ { t = T - k + 1 } ^ { T } } L _ { p } \lambda ^ { T - t } \beta _ { w h } \left\| h _ { t } - h _ { t } ^ { k } \right\| + L _ { p } L _ { w } \left\| \frac { \partial h _ { T } } { \partial h _ { t } } - \frac { \partial h _ { T } ^ { k } } { \partial h _ { t } ^ { k } } \right\| } \\ & { \leq k \lambda ^ { k } \frac { L _ { p } \beta _ { w h } L _ { x } B _ { x } } { ( 1 - \lambda ) } + \underbrace { L _ { p } L _ { w } } _ { \mathrm { r e r - } k + 1 } \left\| \frac { \partial h _ { T } } { \partial h _ { t } } - \frac { \partial h _ { T } ^ { k } } { \partial h _ { t } ^ { k } } \right\| , } \end{array}
534
+ $$
535
+
536
+ where the last line used $\begin{array} { r } { \left\| h _ { t } - h _ { t } ^ { k } \right\| \leq \lambda ^ { t - ( T - k ) } \frac { L _ { x } B _ { x } } { ( 1 - \lambda ) } } \end{array}$ for $t \geq T - k$ . It remains to bound (c), the difference of the hidden-to-hidden Jacobians. Peeling off one term at a time and applying triangle inequality, for any $t \geq T - k + 1$ ,
537
+
538
+ $$
539
+ \begin{array} { l } { \displaystyle \left| \left| \frac { \partial h _ { T } } { \partial h _ { t } } - \frac { \partial h _ { T } ^ { k } } { \partial h _ { t } ^ { k } } \right| \right| \leq \left\| \frac { \partial h _ { T } } { \partial h _ { T - 1 } } - \frac { \partial h _ { T } ^ { k } } { \partial h _ { T - 1 } ^ { k } } \right\| \left\| \frac { \partial h _ { T - 1 } } { \partial h _ { t } } \right\| + \left\| \frac { \partial h _ { T } ^ { k } } { \partial h _ { T - 1 } ^ { k } } \right\| \left\| \frac { \partial h _ { T - 1 } } { \partial h _ { t } } - \frac { \partial h _ { T - 1 } ^ { k } } { \partial h _ { t } ^ { k } } \right\| } \\ { \leq \beta _ { h 1 } \| h _ { T - 1 } - h _ { T - 1 } \| \boldsymbol \lambda ^ { T - t - 1 } + \lambda \left\| \frac { \partial h _ { T - 1 } } { \partial h _ { t } } - \frac { \partial h _ { T - 1 } ^ { k } } { \partial h _ { t } ^ { k } } \right\| } \\ { \leq \displaystyle \sum _ { i = t } ^ { T - 1 } \beta _ { h k } \boldsymbol \lambda ^ { T - t - 1 } \left\| h _ { i } - h _ { i } ^ { k } \right\| } \\ { \leq \boldsymbol \lambda ^ { k } \frac { \beta _ { h k } L _ { x } B _ { z } } { ( 1 - \boldsymbol \lambda ) } \displaystyle \sum _ { i = t } ^ { T - 1 } \boldsymbol \lambda ^ { i - t } } \\ { \leq \boldsymbol \lambda ^ { k } \frac { \beta _ { h k } L _ { x } B _ { z } } { ( 1 - \boldsymbol \lambda ) ^ { 2 } } , } \end{array}
540
+ $$
541
+
542
+ so (c) is bounded by $\begin{array} { r } { k \lambda ^ { k } \frac { L _ { p } L _ { w } \beta _ { h h } L _ { x } B _ { x } } { ( 1 - \lambda ) ^ { 2 } } } \end{array}$ . Ignoring Lipschitz and smoothness constants, we’ve shown the entire sum is $\begin{array} { r } { O \left( \frac { k \lambda ^ { k } } { ( 1 - \lambda ) ^ { 2 } } \right) } \end{array}$
543
+
544
+ In this section, we prove that the gradient map $\nabla _ { w } p _ { T }$ is Lipschitz. First, we show on the forward pass, the difference between hidden states $h _ { t } ( w )$ and $h _ { t } ^ { \prime } ( w ^ { \prime } )$ obtained by running the model with weights $w$ and $w ^ { \prime }$ , respectively, is bounded in terms of $\| w - w ^ { \prime } \|$ . Using smoothness of $\phi$ , the difference in gradients can be written in terms of $\| h _ { t } ( w ) - h _ { t } ^ { \prime } ( w ^ { \prime } ) \|$ , which in turn can be bounded in terms of $\| w - w ^ { \prime } \|$ . We repeatedly leverage this fact to conclude the total difference in gradients must be similarly bounded.
545
+
546
+ We first show small differences in weights don’t significantly change the trajectory of the recurrent model.
547
+
548
+ Lemma 5. For some $w , w ^ { \prime }$ , suppose $\phi _ { w } , \phi _ { w ^ { \prime } }$ are $\lambda$ -contractive and $L _ { w }$ Lipschitz in $w$ . Let $h _ { t } ( w ) , h _ { t } ( w ^ { \prime } )$ be the hidden state at time $t$ obtain from running the model with weights $w , w ^ { \prime }$ on common inputs $\{ x _ { t } \}$ . If $h _ { 0 } ( w ) = h _ { 0 } ( w ^ { \prime } )$ , then
549
+
550
+ $$
551
+ \| h _ { t } ( w ) - h _ { t } ( w ^ { \prime } ) \| \leq \frac { L _ { w } \| w - w ^ { \prime } \| } { ( 1 - \lambda ) } .
552
+ $$
553
+
554
+ Proof. By triangle inequality, followed by the Lipschitz and contractivity assumptions,
555
+
556
+ $$
557
+ \begin{array} { r l } & { \left\| h _ { t } ( w ) - h _ { t } ( w ^ { \prime } ) \right\| } \\ & { = \left\| \phi _ { w } ( h _ { t - 1 } ( w ) , x _ { t } ) - \phi _ { w ^ { \prime } } ( h _ { t - 1 } ( w ^ { \prime } ) , x _ { t } ) \right\| } \\ & { \leq \left\| \phi _ { w } ( h _ { t - 1 } ( w ) , x _ { t } ) - \phi _ { w ^ { \prime } } ( h _ { t - 1 } ( w ) , x _ { t } ) \right\| + \left\| \phi _ { w ^ { \prime } } ( h _ { t - 1 } ( w ) , x _ { t } ) - \phi _ { w ^ { \prime } } ( h _ { t - 1 } ( w ^ { \prime } ) , x _ { t } ) \right\| } \\ & { \leq L _ { w } \left\| w - w ^ { \prime } \right\| + \lambda \left\| h _ { t - 1 } ( w ) - h _ { t - 1 } ( w ^ { \prime } ) \right\| . } \end{array}
558
+ $$
559
+
560
+ Iterating this argument and then using $h _ { 0 } ( w ) = h _ { 0 } ( w ^ { \prime } )$ , we obtain a geometric series in $\lambda$ .
561
+
562
+ $$
563
+ \begin{array} { r l } & { \| h _ { t } ( w ) - h _ { t } ( w ^ { \prime } ) \| \leq L _ { w } \| w - w ^ { \prime } \| + \lambda \| h _ { t - 1 } ( w ) - h _ { t - 1 } ( w ^ { \prime } ) \| } \\ & { \qquad \leq \displaystyle \sum _ { i = 0 } ^ { t } L _ { w } \| w - w ^ { \prime } \| \lambda ^ { i } } \\ & { \qquad \leq \displaystyle \frac { L _ { w } \| w - w ^ { \prime } \| } { ( 1 - \lambda ) } . } \end{array}
564
+ $$
565
+
566
+ The proof of Lemma 3 is similar in structure to Lemma 2, and follows from repeatedly using smoothness of $\phi$ and Lemma 5.
567
+
568
+ Proof of Lemma 3. Let $h _ { t } ^ { \prime } ~ = ~ h _ { t } ( w ^ { \prime } )$ . Expanding the gradients and using $\lVert h _ { t } ( w ) - h _ { t } ( w ^ { \prime } ) \rVert ~ \leq$ $\frac { L _ { w } \left| \left| w - w ^ { \prime } \right| \right| } { ( 1 - \lambda ) }$ from Lemma 5.
569
+
570
+ $$
571
+ \begin{array} { r l } & { \| \nabla _ { x } p _ { T } ( w ) - \nabla _ { w } p _ { T } ( w ^ { ' } ) \| } \\ & { \le \displaystyle \sum _ { t = 1 } ^ { T } \left\| \left( \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } \right) ^ { \top } \nabla _ { h } p _ { T } - \left( \frac { \partial h _ { T } ^ { t } } { \partial h _ { t } ^ { t } } \frac { \partial h _ { t } ^ { t } } { \partial w } \right) ^ { \top } \nabla _ { h _ { T } , p } \eta \right\| } \\ & { \le \displaystyle \sum _ { t = 1 } ^ { T } \left\| \nabla _ { h _ { T } } p _ { T } - \nabla _ { h _ { T } ^ { t } } p _ { T } \right\| \frac { \partial h _ { T } ^ { t } } { \partial h _ { t } ^ { t } } \frac { \partial h _ { t } ^ { t } } { \partial w } \bigg \| + \| \nabla _ { t _ { 2 } } p _ { T } \| \left\| \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } - \frac { \partial h _ { T } ^ { t } } { \partial h _ { t } ^ { t } } \frac { \partial h _ { t } ^ { t } } { \partial w } \right\| } \\ & { \le \displaystyle \sum _ { t = 1 } ^ { T } \beta _ { \eta } \| h _ { T } - h _ { T } ^ { t } \| \boldsymbol { \lambda } ^ { T - t } L _ { w } + L _ { p } \left\| \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } - \frac { \partial h _ { T } ^ { t } } { \partial w } \frac { \partial h _ { t } ^ { t } } { \partial w } \right\| } \\ & { \le \frac { \beta _ { \eta } L _ { \eta } ^ { 2 } \left\| w - w ^ { \prime } \right\| } { ( 1 - \lambda ) ^ { 2 } } + L _ { p } \displaystyle \sum _ { t = 1 } ^ { T } \left\| \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } - \frac { \partial h _ { T } ^ { t } } { \partial h _ { t } ^ { t } } \frac { \partial h _ { t } ^ { t } } { \partial w } \right\| . } \end{array}
572
+ $$
573
+
574
+ Focusing on term (a),
575
+
576
+ $$
577
+ \begin{array} { r l } & { \displaystyle L _ { p } \sum _ { \ell = 1 } ^ { T } \left\| \frac { \partial h _ { T } } { \partial h _ { t } } \frac { \partial h _ { t } } { \partial w } - \frac { \partial h _ { T } ^ { \prime } } { \partial h _ { t } ^ { \prime } } \frac { \partial h _ { t } ^ { \prime } } { \partial w } \right\| } \\ & { \displaystyle \leq L _ { p } \sum _ { \ell = 1 } ^ { T } \left\| \frac { \partial h _ { T } } { \partial h _ { t } } - \frac { \partial h _ { T } ^ { \prime } } { \partial h _ { t } ^ { \prime } } \right\| \left\| \frac { \partial h _ { t } } { \partial w } \right\| + L _ { p } \left\| \frac { \partial h _ { T } ^ { \prime } } { \partial h _ { t } ^ { \prime } } \right\| \left\| \frac { \partial h _ { t } } { \partial w } - \frac { \partial h _ { t } ^ { \prime } } { \partial w } \right\| } \\ & { \displaystyle \leq L _ { p } L _ { w } \sum _ { \ell = 1 } ^ { T } \left\| \frac { \partial h _ { T } } { \partial h _ { t } } - \frac { \partial h _ { T } ^ { \prime } } { \partial h _ { t } ^ { \prime } } \right\| + L _ { p } \sum _ { \ell = 1 } ^ { T } \lambda ^ { T - t } ( \beta _ { w h } \| h _ { t } - h _ { t } ^ { \prime } \| + \beta _ { w w } \| w - w ^ { \prime } \| ) } \\ & { \displaystyle \leq L _ { p } L _ { w } \sum _ { \ell = 1 } ^ { T } \left\| \frac { \partial h _ { T } } { \partial h _ { t } } - \frac { \partial h _ { T } ^ { \prime } } { \partial h _ { t } ^ { \prime } } \right\| + \frac { L _ { p } \beta _ { w h } L _ { w } \| w - w ^ { \prime } \| } { ( 1 - \lambda ) ^ { 2 } } + \frac { L _ { p } \beta _ { w w } \| w - w ^ { \prime } \| } { ( 1 - \lambda ) } , } \end{array}
578
+ $$
579
+
580
+ where the penultimate line used,
581
+
582
+ $$
583
+ \begin{array} { r l } { { \| \frac { \partial h _ { t } } { \partial w } - \frac { \partial h _ { t } ^ { \prime } } { \partial w } \| \leq \| \frac { \partial \phi _ { w } ( h _ { t - 1 } , x _ { t } ) } { \partial w } - \frac { \partial \phi _ { w } ( h _ { t - 1 } ^ { \prime } , x _ { t } ) } { \partial w } \| + \| \frac { \partial \phi _ { w } ( h _ { t - 1 } ^ { \prime } , x _ { t } ) } { \partial w } - \frac { \partial \phi _ { w ^ { \prime } } ( h _ { t - 1 } ^ { \prime } , x _ { t } ) } { \partial w } \| } } \\ & { \leq \beta _ { w h } \| h - h ^ { \prime } \| + \beta _ { w w } \| w - w ^ { \prime } \| . } \end{array}
584
+ $$
585
+
586
+ To bound (b), we peel off terms one by one using the triangle inequality,
587
+
588
+ $$
589
+ \begin{array} { r l } & \begin{array} { r l } & { L _ { P r } L _ { \infty } \displaystyle \sum _ { i = 1 } ^ { N } \left\| \frac { \partial L _ { T } } { \partial t _ { i } } - \frac { \partial N _ { T } ^ { * } } { \partial t _ { i } ^ { * } } \right\| } \\ & { \leq L _ { P r } L _ { \infty } \displaystyle \sum _ { i = 1 } ^ { N } \left\| \frac { \partial L _ { T } } { \partial t _ { i - 1 } } - \frac { \partial N _ { T } ^ { * } } { \partial t _ { i - 1 } ^ { * } } \right\| \left\| \frac { \partial B _ { P r - 1 } } { \partial t _ { i + 1 } } \right\| _ { t } \left\| \frac { \partial N _ { T } ^ { * } } { \partial t _ { i - 1 } ^ { * } } \right\| \left\| \frac { \partial B _ { T - 1 } } { \partial t _ { i } } - \frac { \partial N _ { T - 1 } ^ { * } } { \partial t _ { i } ^ { * } } \right\| } \\ & { \leq L _ { P r } L _ { \infty } \displaystyle \sum _ { i = 1 } ^ { N } \left[ \left( \partial _ { t h } \left\| b _ { T - 1 } - h _ { T - 1 } ^ { * } \right\| \right\| , \ \left| \ \partial _ { t h } \left\| | \sigma _ { i } - \sigma ^ { * } \right\| \right) \right] ^ { 1 / 2 - \epsilon - 1 } \mathrm { ~ t ~ } \lambda _ { t } \left\| \frac { \partial N _ { T - 1 } } { \partial t _ { t } } - \frac { \partial N _ { T - 1 } ^ { * } } { \partial t _ { i } ^ { * } } \right\| } \\ & { \leq L _ { P r } L _ { \infty } \displaystyle \sum _ { i = 1 } ^ { N } \left[ \beta _ { h \infty } ( T - t ) \chi ^ { * - t _ { i - 1 } } \left\| \mathrm { ~ t ~ } - \sigma ^ { * } \right\| _ { t } \left\| b _ { T - 1 } \right\| _ { t } \left\| b _ { T - 2 } - b _ { T - 1 } ^ { * } \right\| \chi ^ { * - t _ { i } } \right\| \right] } \\ & \leq L _ { P r } L _ { \infty } \displaystyle \sum _ { i = 1 } ^ { N } \left[ \beta _ { h \infty } ( T - t ) \chi ^ { * - t _ { i } } \right\| \| x - \sigma ^ { * } \| + \beta _ { h \infty } \displaystyle \sum _ { i = 1 } ^ { T - t _ { i } } \left\| b _ { T - i } - \frac { \partial L _ { T - 1 } } \end{array} \end{array}
590
+ $$
591
+
592
+ Supressing Lipschitz and smoothness constants, we’ve shown the entire sum is ${ \cal O } ( 1 / ( 1 - \lambda ) ^ { 3 } )$ , as required. □
593
+
594
+ # B.1.3 GRADIENT DESCENT ANALYSIS
595
+
596
+ Equipped with the smoothness and truncation lemmas (Lemmas 2 and 3), we turn towards proving the main gradient descent result.
597
+
598
+ Proof of Proposition 4. Let $\Pi _ { \Theta }$ denote the Euclidean projection onto $\Theta$ , and let $\begin{array} { r l } { \delta _ { i } } & { { } = } \end{array}$ $\lVert \boldsymbol { w } _ { \mathrm { r e c u r r } } ^ { i } - \boldsymbol { \dot { w } } _ { \mathrm { t r u n c } } ^ { i } \rVert$ . Initially $\delta _ { 0 } = 0$ , and on step $i + 1$ , we have the following recurrence rela
599
+
600
+ tion for $\delta _ { i + 1 }$
601
+
602
+ $$
603
+ \begin{array} { r l } { \delta _ { i + 1 } = \left\| w _ { \mathrm { r e c u r r } } ^ { i + 1 } - w _ { \mathrm { t r u n c } } ^ { i + 1 } \right\| } & { } \\ { = \left\| \Pi _ { \Theta } ( w _ { \mathrm { r e c u r r } } ^ { i } - \alpha _ { i } \nabla p _ { T } ( w ^ { i } ) ) - \Pi _ { \Theta } ( w _ { \mathrm { t r u n c } } ^ { i } - \alpha _ { i } \nabla p _ { T } ^ { k } ( w _ { \mathrm { t r u n c } } ^ { i } ) ) \right\| } & { } \\ { \leq \left\| w _ { \mathrm { r e c u r r } } ^ { i } - \alpha _ { i } \nabla p _ { T } ( w ^ { i } ) ) - w _ { \mathrm { t r u n c } } ^ { i } - \alpha _ { i } \nabla p _ { T } ^ { k } ( w _ { \mathrm { t r u n c } } ^ { i } ) \right\| } & { } \\ { \leq \left\| w _ { \mathrm { r e c u r r } } ^ { i } - w _ { \mathrm { t r u n c } } ^ { i } \right\| + \alpha _ { i } \left\| \nabla p _ { T } ( w _ { \mathrm { r e c u r r } } ^ { i } ) - \nabla p _ { T } ^ { k } ( w _ { \mathrm { t r u n c } } ^ { i } ) \right\| } & { } \\ { \leq \delta _ { i } + \alpha _ { i } \left\| \nabla p _ { T } ( w _ { \mathrm { r e c u r r } } ^ { i } ) - \nabla p _ { T } ( w _ { \mathrm { t r u n c } } ^ { i } ) \right\| + \alpha _ { i } \left\| \nabla p _ { T } ( w _ { \mathrm { t r u n c } } ^ { i } ) - \nabla p _ { T } ^ { k } ( w _ { \mathrm { t r u n c } } ^ { i } ) \right\| } & { } \\ { \leq \delta _ { i } + \alpha _ { i } \left( \beta \delta _ { i } + \gamma k \lambda ^ { k } \right) } & { } \\ { \leq \exp \left( \alpha _ { i } \beta \right) \delta _ { i } + \alpha _ { i } \gamma k \lambda ^ { k } , } \end{array}
604
+ $$
605
+
606
+ the penultimate line applied lemmas 2 and 3, and the last line used $1 + x \leq e ^ { x }$ for all $x$ . Unwinding the recurrence relation at step $N$ ,
607
+
608
+ $$
609
+ \begin{array} { l } { \displaystyle \delta _ { N } \leq \sum _ { i = 1 } ^ { N } \left\{ \prod _ { j = i + 1 } ^ { N } \exp ( \alpha _ { j } \beta ) \right\} \alpha _ { i } \gamma k \lambda ^ { k } } \\ { \displaystyle \quad \leq \sum _ { i = 1 } ^ { N } \left\{ \prod _ { j = i + 1 } ^ { N } \exp \left( \frac { \alpha \beta } { j } \right) \right\} \frac { \alpha \gamma k \lambda ^ { k } } { i } } \\ { \displaystyle \quad = \sum _ { i = 1 } ^ { N } \left\{ \exp \left( \alpha \beta \sum _ { j = i + 1 } ^ { N } \frac { 1 } { j } \right) \right\} \frac { \alpha \gamma k \lambda ^ { k } } { i } . } \end{array}
610
+ $$
611
+
612
+ Bounding the inner summation via an integral, $\begin{array} { r } { \sum _ { j = i + 1 } ^ { N } \frac { 1 } { j } \le \log ( N / i ) } \end{array}$ and simplifying the resulting expression,
613
+
614
+ $$
615
+ \begin{array} { c } { { \delta _ { N } \leq \displaystyle \sum _ { i = 1 } ^ { N } \exp ( \alpha \beta \log ( N / i ) ) \frac { \alpha \gamma k \lambda ^ { k } } { i } } } \\ { { = \alpha \gamma k \lambda ^ { k } N ^ { \alpha \beta } \displaystyle \sum _ { i = 1 } ^ { N } \frac { 1 } { i ^ { \alpha \beta + 1 } } } } \\ { { \leq \alpha \gamma k \lambda ^ { k } N ^ { \alpha \beta + 1 } . } } \end{array}
616
+ $$
617
+
618
+ # B.1.4 PROOF OF THEOREM 1
619
+
620
+ Proof of Theorem $^ { l }$ . Using $f$ is $L _ { f }$ -Lipschitz and the triangle inequality,
621
+
622
+ $$
623
+ \begin{array} { r l } & { \left\| y _ { T } - y _ { T } ^ { k } \right\| \leq L _ { f } \left\| h _ { T } ( w _ { \mathrm { r e c u r r } } ^ { N } ) - h _ { T } ^ { k } ( w _ { \mathrm { t r u n c } } ^ { N } ) \right\| } \\ & { \qquad \leq L _ { f } \left\| h _ { T } ( w _ { \mathrm { r e c u r r } } ^ { N } ) - h _ { T } ( w _ { \mathrm { t r u n c } } ^ { N } ) \right\| + L _ { f } \left\| h _ { T } ( w _ { \mathrm { t r u n c } } ^ { N } ) - h _ { T } ^ { k } ( w _ { \mathrm { t r u n c } } ^ { N } ) \right\| . } \end{array}
624
+ $$
625
+
626
+ By Lemma 5, the first term is bounded by $\frac { L _ { w } \left| \left| w _ { \mathrm { r e c u r r } } ^ { N } - w _ { \mathrm { t r u n c } } ^ { N } \right| \right| } { ( 1 - \lambda ) }$ , and by Lemma 1, the second term is bounded by λk LxBx(1−λ) . Using Proposition 4, after $N$ steps of gradient descent, we have
627
+
628
+ $$
629
+ \begin{array} { r l r } { { \| y _ { T } - y _ { T } ^ { k } \| \leq \frac { L _ { f } L _ { w } \| w _ { \mathrm { r e c u r r } } ^ { N } - w _ { \mathrm { t r u n c } } ^ { N } \| } { ( 1 - \lambda ) } + \lambda ^ { k } \frac { L _ { f } L _ { x } B _ { x } } { ( 1 - \lambda ) } } } \\ & { } & { \leq k \lambda ^ { k } \frac { \alpha L _ { f } L _ { w } N ^ { \alpha \beta + 1 } } { ( 1 - \lambda ) } + \lambda ^ { k } \frac { L _ { f } L _ { x } B _ { x } } { ( 1 - \lambda ) } , ~ } \end{array}
630
+ $$
631
+
632
+ and solving for $k$ such that both terms are less than $\varepsilon / 2$ gives the result.
633
+
634
+ ![](images/06878230c5636e61275c6ed52c1e2349ba3b84d29b5d7597346a85e401456e43.jpg)
635
+ Figure 6: Empirical validation Proposition 4 on random Gaussian instances. Without the $1 / t$ rate, the gradient descent bound no longer appears qualitatively correct, suggesting the $O ( 1 / t )$ rate is necessary.
636
+
637
+ # C EXPERIMENTS
638
+
639
+ The $O ( 1 / t )$ rate may be necessary. The key result underlying Theorem 1 is the bound on the parameter difference $\lVert w _ { \mathrm { t r u n c } } - w _ { \mathrm { r e c u r r } } \rVert$ while running gradient descent obtained in Proposition 4. We show this bound has the correct qualitative scaling using random instances and training randomly initialized, stable linear dynamical systems and tanh-RNNs. In Figure 6, we plot the parameter error $\lVert w _ { \mathrm { t r u n c } } ^ { t } - w _ { \mathrm { r e c u r r } } ^ { t } \rVert$ as training progresses for both models (averaged over 10 runs). The error scales comparably with the bound given in Proposition 4. We also find for larger step-sizes like $\alpha / \sqrt { t }$ or constant $\alpha$ , the bound fails to hold, suggesting the $O ( 1 / t )$ condition is necessary.
640
+
641
+ Concretely, we generate random problem instance by fixing a sequence length $T = 2 0 0$ , sampling input data $x _ { t } \stackrel { \mathrm { i . i . d . } } { \sim } \mathcal { N } \left( 0 , 4 \cdot I _ { 3 2 } \right)$ , and sampling $y _ { T } \ \sim \ \mathrm { U n i f [ - 2 , 2 ] }$ . Next, we set $\lambda = 0 . 7 5$ and randomly initialize a stable linear dynamical system or RNN with tanh non-linearity by sampling $U _ { i j } , W _ { i j } \stackrel { \mathrm { i . i . d . } } { \sim } \ N ( 0 , 0 . 5 )$ and thresholding the singular values of $W$ so $\| W \| \leq \lambda$ . We use the squared loss and prediction function $f ( h _ { t } , x _ { t } ) = C h _ { t } + D x _ { t }$ , where $C , D \stackrel { \mathrm { i . i . d . } } { \sim } \mathcal { N } \left( 0 , I _ { 3 2 } \right)$ . We fix the truncation length to $k = 3 5$ , set the learning rate to $\alpha _ { t } = \alpha / t$ for $\alpha = 0 . 0 1$ , and take $N = 2 0 0$ gradient steps. These parameters are chosen so that the $\gamma k \lambda ^ { k } N ^ { \dot { \alpha } \beta + 1 }$ bound from Proposition 4 does not become vacuous – by triangle inequality, we always have $\lVert w _ { \mathrm { t r u n c } } - w _ { \mathrm { r e c u r r } } \rVert \leq 2 \lambda$ .
642
+
643
+ Stable vs. unstable models. The word and character level language modeling experiments are based on publically available code from Merity et al. (2018). The polyphonic music modeling code is based on the code in Bai et al. (2018), and the slot-filling model is a reimplementation of Mesnil et al. (2015) 1
644
+
645
+ Since the sufficient conditions for stability derived in Section 2.2 only apply for networks with a single layer, we use a single layer RNN or LSTM for all experiments. Further, our theoretical results are only applicable for vanilla SGD, and not adaptive gradient methods, so all models are trained with SGD. Table 2 contains a summary of all the hyperparameters for each experiment.
646
+
647
+ All hyperparameters are shared between the stable and unstable variants of both models. In the RNN case, enforcing stability is conceptually simple, though computationally expensive. Since tanh is 1- Lipschitz, the RNN is stable as long as $\lVert W \rVert < 1$ . Therefore, after each gradient update, we project $W$ onto the spectral norm ball by taking the SVD and thresholding the singular values to lie in $[ 0 , 1 )$ . In the LSTM case, enforcing stability is conceptually more difficult, but computationally simple. To ensure the LSTM is stable, we appeal to Proposition 2. We enforce the following inequalities after each gradient update
648
+
649
+ Table 2: Hyperparameters for all experiments
650
+
651
+ <table><tr><td rowspan="2"></td><td colspan="2">Model</td></tr><tr><td></td><td>RNNLSTM</td></tr><tr><td colspan="3">Word LM</td></tr><tr><td rowspan="10"></td><td>Number layers</td><td>1</td><td>1</td></tr><tr><td>Hidden units</td><td>256</td><td>1024</td></tr><tr><td>Embedding size</td><td>1024</td><td>512</td></tr><tr><td>Dropout</td><td>0.25</td><td>0.65</td></tr><tr><td>Batch size</td><td>20</td><td>20</td></tr><tr><td>Learning rate</td><td>2.0</td><td>20.</td></tr><tr><td>BPTT</td><td>35</td><td>35</td></tr><tr><td>Gradient clipping</td><td>0.25</td><td>1.0</td></tr><tr><td>Epochs</td><td>40</td><td>40</td></tr><tr><td>Number layers</td><td>1</td><td>1</td></tr><tr><td rowspan="14"></td><td>Hidden units</td><td>768</td><td>1024</td></tr><tr><td>Embedding size</td><td>400</td><td>400</td></tr><tr><td>Dropout</td><td>0.1</td><td>0.1</td></tr><tr><td>Weight decay</td><td>1e-6</td><td>1e-6</td></tr><tr><td>Batch size</td><td>80</td><td>80</td></tr><tr><td>Learning rate</td><td>2.0 150</td><td>20.0</td></tr><tr><td>BPTT</td><td></td><td>150</td></tr><tr><td>Gradient clipping</td><td>1.0</td><td>1.0</td></tr><tr><td>Epochs Number layers</td><td>300 1</td><td>300</td></tr><tr><td>Polyphonic Music</td><td></td><td>1</td><td></td></tr><tr><td>Hidden units</td><td>1024</td><td></td><td>1024</td></tr><tr><td>Dropout Batch size</td><td></td><td>0.1</td><td>0.1</td></tr><tr><td></td><td></td><td>1</td><td>1</td></tr><tr><td></td><td>Learning rate</td><td>0.05</td><td>2.0</td></tr><tr><td></td><td>Gradient clipping</td><td>5.0</td><td>5.0</td></tr><tr><td>Slot-Filling</td><td>Epochs</td><td>100</td><td>100</td></tr><tr><td></td><td>Number layers</td><td>1</td><td>1</td></tr><tr><td></td><td>Hidden units</td><td>128</td><td>128</td></tr><tr><td></td><td>Embedding size</td><td>64</td><td>64</td></tr><tr><td></td><td>Dropout</td><td>0.5</td><td>0.5</td></tr><tr><td></td><td>Weight decay</td><td>1e-4</td><td>1e-4</td></tr><tr><td></td><td>Batch size</td><td>128</td><td>128</td></tr><tr><td></td><td>Learning rate</td><td>10.0</td><td>10.0</td></tr><tr><td></td><td>Gradient clipping</td><td>1.0</td><td>1.0</td></tr><tr><td></td><td>Epochs</td><td>100</td><td>100</td></tr></table>
652
+
653
+ 1. The hidden-to-hidden forget gate matrix should satisfy $\| W _ { f } \| _ { \infty } < 0 . 1 2 8$ , which is enforced by normalizing the $\ell _ { 1 }$ - norm of each row to have value at most 0.128.
654
+ 2. The input vectors $x _ { t }$ must satisfy $\| x _ { t } \| _ { \infty } \leq B _ { x } = 0 . 7 5$ , which is achieved by thresholding all values to lie in $[ - 0 . 7 5 , 0 . 7 5 ]$ .
655
+ 3. The bias of the forget gate $b _ { f }$ , must satsify $\| b _ { f } \| _ { \infty } \leq 0 . 2 5$ , which is again achieved by thresholding all values to lie in $[ - 0 . 2 5 , 0 . 2 5 ]$ .
656
+ 4. The input-hidden forget gate matrix $U _ { f }$ should satisfy $\| U _ { f } \| _ { \infty } \le 0 . 2 5$ . This is enforced by normalizing the $\ell _ { 1 } \cdot$ - norm of each row to have value at most 0.25.
657
+ 5. Given 1-4, the forget gate can take value at most $f _ { \infty } < 0 . 6 4$ . Consequently, we enforce $\| W _ { i } \| _ { \infty } , \| W _ { o } \| _ { \infty } \overset { \_ } { \leq } 0 . 3 6$ , $\lVert W _ { z } \rVert \leq 0 . 0 9 1$ , and $\| \dot { W } _ { f } \| _ { \infty } < \operatorname* { m i n } \left\{ 0 . 1 \dot { 2 } 8 , ( 1 \dot { - } 0 . 6 4 ) ^ { 2 } \right\} =$ 0.128.
658
+
659
+ After 1-5 are enforced, by Proposition 2, the resulting (iterated)-LSTM is stable. Although the above description is somewhat complicated, the implementation boils down to normalizing the rows of the LSTM weight matrices, which can be done very efficiently in a few lines of PyTorch.
660
+
661
+ Data-dependent stability. Unlike the RNN, in an LSTM, it is not clear how to analytically compute the stability parameter $\lambda$ . Instead, we rely on a heuristic method to estimate $\lambda$ . Recall a model is stable if for all ${ \bar { \boldsymbol { x } } } , h , h ^ { \prime }$ , we have
662
+
663
+ $$
664
+ S ( h , h ^ { \prime } , x ) : = \frac { \| \phi _ { w } ( h , x ) - \phi _ { w } ( h ^ { \prime } , x ) \| } { \| h - h ^ { \prime } \| } \leq \lambda < 1 .
665
+ $$
666
+
667
+ To estimate $\begin{array} { r } { \operatorname* { s u p } _ { h , h ^ { \prime } , x } S ( h , h ^ { \prime } , x ) } \end{array}$ , we do the following. First, we take $x$ to be point in the training set. In the language modeling case, $x$ is one of the learned word-vectors. We randomly sample and fix $x$ , and then we perform gradient ascent on $S ( h , h ^ { \prime } , x )$ to find worst-case $h , h ^ { \prime }$ . In our experiments, we initialize $h , h ^ { \prime } \sim \mathcal { N } \left( 0 , 0 . 1 \cdot I \right)$ and run gradient ascent with learning rate 0.9 for 1000 steps. This procedure is repeated 20 times, and we estimate $\lambda$ as the maximum value of $S ( h , h ^ { \prime } , x )$ encounted during any iteration from any of the 20 random starting points.
md/train/JzdYX8uzT4W/JzdYX8uzT4W.md ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Decoupled Contrastive Learning
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Contrastive learning (CL) is one of the most successful paradigms for self
11
+ 2 supervised learning (SSL). Specifically, contrastive learning treats two augmented
12
+ 3 “views” of the same sample as positive, pulling them close and treating all other
13
+ 4 samples as negative to push them far apart. Despite the evident success of CL SSL
14
+ 5 methods, there are several challenges in the existing methods as they may require
15
+ 6 special structures, large batches, or huge training epochs, etc. Our motivation in
16
+ 7 this work is to provide a simple, efficient, and yet competitive contrastive learning
17
+ 8 baseline. Through both theoretical and empirical studies, we identified a strong
18
+ 9 negative-positive-coupling (NPC) effect in the widely used cross-entropy loss in
19
+ 10 CL SSL methods. We hypothesize that the NPC effect may be a major cause of the
20
+ 11 inefficiency in many contrastive learning methods. By removing the NPC effect,
21
+ 12 we reach a decoupled contrastive learning (DCL) objective function, which signifi
22
+ 13 cantly improves the training efficiency. DCL can achieve competitive performance,
23
+ 14 requiring neither large batches in SimCLR, momentum encoding in Moco, or large
24
+ 15 epochs. We demonstrate the benefit of DCL in various benchmarks. Further, DCL
25
+ 16 is also much less sensitive to suboptimal hyperparameters. Notably, our approach
26
+ 17 achieves $6 6 . 9 \%$ ImageNet top-1 accuracy with 256 batch size within 200 epochs
27
+ 18 pre-training, which outperforms its baseline SimCLR by $5 . 1 \%$ . We believe DCL
28
+ 19 may provide a strong baseline for future contrastive learning-based SSL studies.
29
+
30
+ # 20 1 Introduction
31
+
32
+ 21 As a fundamental task in machine learning, representation learning aims to extract features to
33
+ 22 reconstruct the raw data fully. It has been regarded as a long-acting goal over the past decades. Recent
34
+ 23 progress on representation learning has achieved a significant milestone over self-supervised learning
35
+ 24 (SSL), facilitating feature learning with its competence in exploiting massive raw data without any
36
+ 25 annotated supervision. In the early stage of SSL, representation learning has focused on exploiting
37
+ 26 pretext tasks, which are addressed by generating pseudo-labels to the unlabeled data through different
38
+ 27 transformations, such as solving jigsaw puzzles [1], colorization [2] and rotation prediction [3].
39
+ 28 Though these approaches achieve some success in computer vision, there is a large gap between
40
+ 29 these methods and supervised learning. Recently, there has been a significant advancement in using
41
+ 30 contrastive learning [4, 5, 6, 7, 8] for self-supervised pre-training, which significantly closes the gap
42
+ 31 between the SSL method and supervised learning. Contrastive SSL methods, e.g., SimCLR [8], in
43
+ 32 general, try to pull different views of the same instance close and push different instances far apart in
44
+ 33 the representation space.
45
+ 34 Despite the evident progress of the state-of-the-art contrastive SSL methods, there have been several
46
+ 35 challenges in future developing this direction: 1) The SOTA models [7] may require unique structures
47
+ 36 like the momentum encoder and large memory queues, which may complicate the understanding. 2)
48
+ 37 The contrastive SSL models [8] may depend on large batch size and huge epoch numbers to achieve
49
+ 38 competitive performance, posing a computational challenge for academia to explore this direction.
50
+ 39 3) They may be sensitive to hyperparameters and optimizers, introducing additional difficulty to
51
+ 40 reproduce the results on various benchmarks.
52
+ 41 Our motivation in this work is to provide a simple, efficient, and yet competitive contrastive learning
53
+ 42 baseline. We choose SimCLR as our starting point, given its conceptual simplicity. By analyzing the
54
+ 43 objective function, we identified a Negative-Positive-Coupling (NPC) multiplier $q _ { B }$ in the gradient
55
+ 44 as shown in Proposition 1. The NPC multipliers modulate the gradient of each sample, and it
56
+ 45 mistakenly increases the impact of both negative samples and positive samples, given either of them
57
+ 46 is more informative. Such a coupling exacerbates when smaller batch sizes are used. By removing
58
+ 47 the coupling term, we reach a new formulation, the decoupled contrastive learning (DCL). The
59
+ 48 new objective function significantly improves the training efficiency, requires neither large batches,
60
+ 49 momentum encoding, or large epochs to achieve competitive performance on various different
61
+ 50 benchmarks. Specifically, DCL reaches $6 6 . 9 \%$ ImageNet top-1 (linear probing) accuracy with batch
62
+ 51 size 256, SGD optimizer within 200 epochs. Even if DCL is trained for 100 epochs, it still reaches
63
+ 52 $6 4 . 6 \%$ ImageNet top-1 accuracy with batch size 256.
64
+
65
+ ![](images/bc25c291918beafdd2137b380f58aba11d9866e7e06ee97d4153116558915405.jpg)
66
+ Figure 1: An overview of the batch size issue in the general contrastive approaches: (a) shows the NPC multiplier $q _ { B }$ in different batch sizes. As the large batch size increasing the $q _ { B }$ will approach 1 with a small coefficient of variation. (b) illustrates the distribution of $q _ { B }$ .
67
+
68
+ 53 In short, this work makes the following contributions:
69
+
70
+ 1) We provide both theoretical analysis and empirical evidence to show the negative-positive coupling in the gradient of contrastive learning;
71
+ 2) We introduce a new, decoupled contrastive learning (DCL) objective, which casts off the coupling phenomenon between positive and negative samples in contrastive learning, and significantly improves the training efficiency; Additionally, the proposed DCL objective is less sensitive the several important hyperparameters;
72
+ 3) We demonstrate our approach via extensive experiments and analysis on both large and small-scale vision benchmarks, with an optimal configuration for the standard SimCLR baseline to have a competitive performance within contrastive approaches.
73
+
74
+ # 63 2 Related work
75
+
76
+ # 2.1 Self-supervised representation learning
77
+
78
+ 65 Self-supervised representation learning (SSL) aims to learn a robust embedding space from data
79
+ 66 without human annotation. Previous arts can be roughly categorized into generative and discriminative.
80
+ 67 Generative approaches, such as autoencoders and adversarial learning, focus on reconstructing
81
+ 68 images from latent representations [9, 10]. Conversely, recent discriminative approaches, especially
82
+ 69 contrastive learning-based approaches, have gained the most ground and achieved state-of-the-art
83
+ 70 standard large-scale image classification benchmarks with increasingly more compute and data
84
+ 71 augmentations.
85
+
86
+ # 72 2.2 Contrastive learning
87
+
88
+ 73 Contrastive learning (CL) constructs positive and negative sample pairs to extract information from
89
+ 74 the data itself. In CL, each anchor image in a batch has only one positive sample to construct a positive
90
+ 75 sample pair [11, 8, 7]. CPC [5] predicts the future output of sequential data by using current output
91
+ 76 as prior knowledge, which can improve the feature representing the ability of the model. Instance
92
+ 77 discrimination [4] proposes a non-parametric cross-entropy loss to optimize the model at the instance
93
+ 78 level. Inv. spread [12] makes use of data augmentation invariants and the spread-out property of
94
+ 79 instance to learn features. MoCo [7] proposes a dictionary to maintain a negative sample set, thus
95
+ 80 increasing the number of negative sample pairs. Different from the aforementioned self-supervised
96
+ 81 CL approaches, [13] proposes a supervised CL that considers all the same categories as positive pairs
97
+ 82 to increase the utility of images.
98
+
99
+ # 83 2.3 Collapsing issue via batch size and negative sample
100
+
101
+ 84 In CL, the objective is to maximize the mutual information between the positive pairs. However, to
102
+ 85 avoid the “collapsing output”, vast quantities of negative samples are needed so that the learning
103
+ 86 objectives obtain the maximum similarity and have the minimum similarity with negative samples.
104
+ 87 For instance, in SimCLR [8], training requires many negative samples, leading to a large batch size
105
+ 88 (i.e., 4096). Furthermore, to optimize such a huge batch, a specially designed optimizer LARS [14]
106
+ 89 is used. Similarly, MoCo [7] needs a vast queue (i.e., 65536) to achieve competitive performance.
107
+ 90 BYOL [15] does not collapse output without using any negative samples by considering all the
108
+ 91 images are positive and to maximize the similarity of “projection” and “prediction ” features. On the
109
+ 92 other hand, Simsam [16] leverages the Siamese network to introduce inductive biases for modeling
110
+ 93 invariance. With the small batch size (i.e., 256), Simsam is a rival to BYOL (4096). Unlike both
111
+ 94 approaches that achieved their success through empirical studies, this paper tackles from a theoretical
112
+ 95 perspective, proving that an intertwined multiplier $q _ { B }$ of positive and negative is the main issue to
113
+ 96 contrastive learning.
114
+
115
+ ![](images/7cac23c9fb9b0b9a2a31e147df9e235518441732db80a04de0db6a27da23015b.jpg)
116
+ 97 3 Decouple negative and positive samples in contrastive learning
117
+ Figure 2: Contrastive learning and negative-positive coupling (NPC). (a) In SimCLR, each sample $\mathbf { x } _ { i }$ has two augmented views $\{ \mathbf { x } _ { i } ^ { ( 1 ) } , \mathbf { x } _ { i } ^ { ( 2 ) } \}$ . They are encoded by the same encoder $f$ and further projected to $\{ \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \}$ by a normalized MLP. (b) According to Equation 3. For the view $\mathbf { x } _ { i } ^ { ( 1 ) }$ , the cross-entropy loss ${ L } _ { i } ^ { ( 1 ) }$ leads to a positive force $\mathbf { z } _ { i } ^ { ( 2 ) }$ , which comes from the other view $\mathbf { x } _ { i } ^ { ( 2 ) }$ of $\mathbf { x }$ and a negative force, which is a weighted average of all the negative samples, i.e. $\{ \mathbf { z } _ { j } ^ { ( l ) } | l \in \{ 1 , 2 \} , j \neq i \}$ . However, the gradient $- \nabla _ { \mathbf { z } _ { i } ^ { ( 2 ) } } L _ { i } ^ { ( 1 ) }$ is proportional to the NPC multiplier.
118
+
119
+ 98 We choose to start from SimCLR because of its conceptual simplicity. Given a batch of $N$ samples (e.g. images), 99 $\{ \mathbf { x } _ { 1 } , \dotsc , \mathbf { x } _ { N } \}$ , let $\mathbf { x } _ { i } ^ { ( 1 ) } , \mathbf { x } _ { i } ^ { ( 2 ) }$ be two augmented views of the sample $x _ { i }$ and $B$ be the set of all of the augmented views in the batch, i.e. 100 $B = \{ \mathbf { x } _ { i } ^ { ( k ) } | k \in \{ 1 , 2 \} , i \in \mathbb { I } ^ { 1 , N } \mathbb { I } \}$ . As
120
+
121
+ 101 shown by Figure 2(a), each of the views $\mathbf { x } _ { i } ^ { ( k ) }$ is sent into the same encoder network $f$ and the output
122
+ 102 h(k)i $\mathbf { h } _ { i } ^ { ( k ) } = f ( \mathbf { x } _ { i } ^ { ( k ) } )$ is then projected by a normalized MLP projector that $\mathbf { z } _ { i } ^ { ( k ) } = { g ( \mathbf { h } _ { i } ^ { ( k ) } ) } / \| g ( \mathbf { h } _ { i } ^ { ( k ) } ) \|$ .
123
+ 103 For each augmented view $\mathbf { x } _ { i } ^ { ( k ) }$ , SimCLR solves a classification problem by using the rest of the
124
+ 104 105 views in creates a $B$ as targets, and assigns thoss-entropy loss function $L _ { i } ^ { ( k ) }$ y positive labelfor each view $\mathbf { x } _ { i } ^ { ( k ) }$ ${ \bf x } _ { i } ^ { ( u ) }$ , where d the o $u \ne k$ . So SimCLRoss function is
125
+ 106 $\begin{array} { r } { L = \sum _ { k \in \{ 1 , 2 \} , i \in [ [ 1 , N ] ] } L _ { i } ^ { ( k ) } } \end{array}$
126
+
127
+ $$
128
+ L _ { i } ^ { ( k ) } = - \log \frac { \exp ( \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \rangle / \tau ) } { \exp ( \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \rangle / \tau ) + \sum _ { l \in \{ 1 , 2 \} , j \in [ 1 , N ] , j \neq i } \exp ( \langle \mathbf { z } _ { i } ^ { ( k ) } , \mathbf { z } _ { j } ^ { ( l ) } \rangle / \tau ) }
129
+ $$
130
+
131
+ Proposition 1. There exists a negative-positive coupling (NPC) multiplier 107 $q _ { B , i } ^ { ( 1 ) }$ in the gradient of 108 ${ L } _ { i } ^ { ( 1 ) }$ :
132
+
133
+ $$
134
+ \begin{array}{c} \begin{array} { r } { \left\{ - \nabla _ { \mathbf { z } _ { i } ^ { ( 1 ) } } L _ { i } ^ { ( 1 ) } = \frac { q _ { B , i } ^ { ( 1 ) } } { \tau } \left[ \mathbf { z } _ { i } ^ { ( 2 ) } - \sum _ { l \in \{ 1 , 2 \} , j \in [ 1 , N ] , j \neq i } \frac { \exp { \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { j } ^ { ( l ) } \rangle } / \tau } { \sum _ { q \in \{ 1 , 2 \} , j \in [ 1 , N ] , j \neq i } \exp ( \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { j } ^ { ( 0 ) } \rangle / \tau ) } \cdot \mathbf { z } _ { j } ^ { ( l ) } \right] \right.} \\ { - \nabla _ { \mathbf { z } _ { i } ^ { ( 2 ) } } L _ { i } ^ { ( 1 ) } = \frac { q _ { B , i } ^ { ( 1 ) } } { \tau } \cdot \mathbf { z } _ { i } ^ { ( 1 ) } } \\ { - \nabla _ { \mathbf { z } _ { j } ^ { ( l ) } } L _ { i } ^ { ( 1 ) } = - \frac { q _ { B , i } ^ { ( 1 ) } } { \tau } \frac { \exp { \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { j } ^ { ( l ) } \rangle } / \tau } { \sum _ { q \in \{ 1 , 2 \} , j \in [ 1 , N ] , j \neq i } \exp ( \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { j } ^ { ( q ) } \rangle / \tau ) } \cdot \mathbf { z } _ { i } ^ { ( 1 ) } } \end{array} \end{array}
135
+ $$
136
+
137
+ where the NPC multiplier 109 $q _ { B , i } ^ { ( 1 ) }$ is:
138
+
139
+ $$
140
+ q _ { B , i } ^ { ( 1 ) } = 1 - \frac { \exp ( \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \rangle / \tau ) } { \sum _ { q \in \{ 1 , 2 \} , j \in \mathbb { [ 1 , N ] } , j \neq i } \exp ( \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { j } ^ { ( q ) } \rangle / \tau ) }
141
+ $$
142
+
143
+ Due to the symmetry, a similar NPC multiplier 110 $q _ { B , i } ^ { ( k ) }$ exists in the gradient of $L _ { i } ^ { ( k ) } , k \in \{ 1 , 2 \} , i \in$ 111 $[ 1 , N ]$ .
144
+
145
+ 112 $q _ { B , i } ^ { ( k ) }$ we can see, all of the partial gradients in Equation 2 are modified by the commonin Equation 3. Equation 3 makes intuitive sense: 1) When a positive sample pair $\{ \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \}$ lier are
146
+ 114 farther, the corresponding NPC multiplier $q _ { B , i } ^ { ( 1 ) }$ is larger. This will makes the overall gradient larger.
147
+ 115 Otherwise, the gradient is smaller. 2) When a negative sample is closer to $\mathbf { z } _ { i } ^ { ( 1 ) }$ , it makes $q _ { B , i } ^ { ( 1 ) }$ larger.
148
+ 116 Overall, the intuition here is that a positive sample farther from the target or a negative sample closer
149
+ 117 to the target is more informative. However, the positive samples and negative samples are strongly
150
+ 118 coupled. An outlier positive sample also makes the gradient from the negative samples significantly
151
+ 119 larger and vice versa.
152
+ 120 Figure 1(b) shows the NPC multiplier $q _ { B }$ distribution shift w.r.t. different batch sizes for a pre-trained
153
+ 121 SimCLR baseline model. While all of the shown distributions have prominent fluctuation, the smaller
154
+ 122 batch size makes $q _ { B }$ cluster towards 0, while the larger batch size pushes the distribution towards
155
+ 123 $\delta ( 1 )$ . Figure 1(a) shows the averaged NPC multiplier $\langle q _ { B } \rangle$ changes w.r.t. the batch size and the
156
+ 124 relative fluctuation. The small batch sizes introduce significant NPC fluctuation. Based on this
157
+ 125 observation, we propose to remove the NPC multipliers from the gradients, which corresponds to the
158
+ 126 case $q _ { B , N \infty }$ . This leads to the decoupled contrastive learning formulation.
159
+ 127 Proposition 2. Removing the positive pair from the denominator of Equation 2 leads to a decoupled
160
+ 128 contrastive learning loss. If we remove the NPC multiplier $q _ { B , i } ^ { ( k ) }$ from Equation 2, we reach a
161
+ 129 decoupled contrastive learning loss LDC = Pk∈{1,2},i∈[[1,N]] , where $L _ { D C , i } ^ { ( k ) }$ is:
162
+
163
+ $$
164
+ \begin{array} { r l } & { L _ { D C , i } ^ { ( k ) } = - \log \frac { \exp ( \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \rangle / \tau ) } { \exp ( \langle \mathbf { \hat { z } } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \rangle / \tau ) } + \sum _ { l \in \{ 1 , 2 \} , j \in [ 1 , N ] , j \neq i } \exp ( \langle \mathbf { z } _ { i } ^ { ( k ) } , \mathbf { z } _ { j } ^ { ( l ) } \rangle / \tau ) } \\ & { \quad \quad \quad = - \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \rangle / \tau + \log \underset { l \in \{ 1 , 2 \} , j \in [ 1 , N ] , j \neq i } { \sum } \exp ( \langle \mathbf { z } _ { i } ^ { ( k ) } , \mathbf { z } _ { j } ^ { ( l ) } \rangle / \tau ) } \end{array}
165
+ $$
166
+
167
+ ![](images/073f9e49f7abf8410eb3e0e37d28c2dec0fd75636d13245c1eaaec9e61fc0758.jpg)
168
+ Figure 3: Comparisons on ImageNet-1K with/without DCL under different numbers of (a): batch sizes for SimCLR [8] and (b): queues for MoCo [7]. Without DCL, the top-1 accuracy significantly drops when batch size (SimCLR) or queues (MoCo) becomes very small.
169
+
170
+ 130 The proofs of Proposition 1 and 2 are given in Appendix. Further, we can generalize the loss
171
+ 131 function $L _ { D C }$ to $L _ { D C W }$ by introducing a weighting function for the positive pairs i.e. $L _ { D C W } =$
172
+ 132 $\begin{array} { r } { \sum _ { k \in \{ 1 , 2 \} , i \in [ [ 1 , N ] ] } L _ { D C W , i } ^ { ( k ) } } \end{array}$ .
173
+
174
+ $$
175
+ L _ { D C W , i } ^ { ( k ) } = - w ( \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } ) ( \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \rangle / \tau ) + \log \sum _ { \substack { l \in \{ 1 , 2 \} , j \in [ 1 , N ] , j \neq i } } \exp ( \langle \mathbf { z } _ { i } ^ { ( k ) } , \mathbf { z } _ { j } ^ { ( l ) } \rangle / \tau )
176
+ $$
177
+
178
+ 133 where we can intuitively choose $w$ to be a negative von Mises-Fisher weighting function that
179
+ 134 $\begin{array} { r } { w ( \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } ) = 2 - \frac { \exp ( \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \rangle / \sigma ) } { \mathrm { E } _ { i } \left[ \exp ( \langle \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } \rangle / \sigma ) \right] } } \end{array}$ and E $[ w ] = 1$ . $L _ { D C }$ is a special case of $L _ { D C W }$ and we
180
+ 135 can see that $\begin{array} { r } { \operatorname* { l i m } _ { \sigma \to \infty } L _ { D C W } = L _ { D C } } \end{array}$ . The intuition behind $w ( \mathbf { z } _ { i } ^ { ( 1 ) } , \mathbf { z } _ { i } ^ { ( 2 ) } )$ z(2)i ) is that there is more learning
181
+ 136 signal when a positive pair of samples are far from each other.
182
+
183
+ # 137 4 Experiments
184
+
185
+ 138 This section evaluates our proposed decoupled contrastive learning (DCL) empirically and compares
186
+ 139 it to the general contrastive learning methods. We summarize our experiments and analysis as the
187
+ 140 following: (1) our proposed work significantly outperforms the general contrastive learning on large
188
+ 141 and small-scale vision benchmarks; (2) we show the better version of DCL: LDCW could further
189
+ 142 improve the representation quality. (3) we further analyze our DCL with few learning epochs, which
190
+ 143 shows fast convergence of the proposed DCL. Detailed experimental settings can be found in the
191
+ 144 Appendix.
192
+
193
+ # 145 4.1 Implementation details
194
+
195
+ 146 To understand the effect of the sample decoupling, we consider our proposed DCL, which is based on
196
+ 147 the general contrastive learning, where model optimization is irrelevant to the size of batches (i.e.,
197
+ 148 negative samples). Extensive experiments and analysis are demonstrated on large-scale benchmarks:
198
+ 149 ImageNet-1K [19], ImageNet-100 [6], and small-scale benchmark: CIFAR [20], and STL10 [21].
199
+ 150 Note that all of our experiments are conducted with 8 Nvidia V100 GPUs on a single machine.
200
+ 151 ImageNet For a fair comparison on ImageNet data, we implement our proposed decoupled structure,
201
+ 152 DCL by following SimCLR [8] with ResNet-50 [22] as the encoder backbone and use cosine annealing
202
+ 153 schedule. We set the temperature $\tau$ to 0.1 and the latent vector dimension to 128. Following [23],
203
+ 154 we evaluate the pre-trained models by training a linear classifier with frozen learned embedding on
204
+ 155 ImageNet data. We further consider evaluating our approach on ImageNet-100, a selected subset of
205
+ 156 100 classes of ImageNet-1K.
206
+ 157 CIFAR and STL10 For CIFAR10, CIFAR100, and STL10, ResNet-18 [22] is used as the encoder
207
+ 158 architecture. We set the temperature $\tau$ to 0.07. All models are trained for 200 epochs with SGD
208
+ 159 optimizer and a base $l r = 0 . 0 3 * $ batchsize/256. We follow NPID [4] on using $k = 2 0 0$ nearest
209
+ 160 neighbor (kNN) classifier. Note that on STL10, we follow [24] to use both train set and unlabeled
210
+ 161 set for model pre-training.
211
+
212
+ Table 1: Comparisons with/without DCL under different numbers of batch sizes from 32 to 512. Results show the effectness of DCL on four widely used benchmarks. The performance of DCL keeps steadier than the SimCLR baseline while the batch size is varied.
213
+
214
+ <table><tr><td>Dataset</td><td colspan="5">ImageNet-100 (linear)</td><td colspan="5">CIFAR10 (kNN)</td></tr><tr><td>Batch Size</td><td>32</td><td>64</td><td>128</td><td>256</td><td>512</td><td>32</td><td>64</td><td>128</td><td>256</td><td>512</td></tr><tr><td>SimCLR [8]</td><td>74.2</td><td>77.6</td><td>79.3</td><td>80.7</td><td>81.3</td><td>78.9</td><td>80.4</td><td>81.1</td><td>81.4</td><td>81.3</td></tr><tr><td>SimCLR w/DCL</td><td>80.8</td><td>82.0</td><td>81.9</td><td>83.1</td><td>82.8</td><td>83.7</td><td>84.4</td><td> 84.4</td><td>84.2</td><td>83.5</td></tr><tr><td>Dataset</td><td></td><td>CIFAR100 (kNN)</td><td></td><td></td><td></td><td></td><td>STL10 (kNN)</td><td></td><td></td><td></td></tr><tr><td>Batch Size</td><td>32</td><td>64</td><td>128</td><td>256</td><td>512</td><td>32</td><td>64</td><td>128</td><td>256</td><td>512</td></tr><tr><td>SimCLR [8]</td><td>49.4</td><td>50.3</td><td>51.8</td><td>52</td><td>52.4</td><td>74.1</td><td>76.2</td><td>76.9</td><td>77.3</td><td>77.6</td></tr><tr><td>SimCLR w/ DCL</td><td> 51.1</td><td> 54.3</td><td>54.6</td><td> 54.9</td><td>55</td><td>82.0</td><td>82.8</td><td> 81.8</td><td>81.2</td><td>81.0</td></tr></table>
215
+
216
+ Table 2: kNN top-1 accuracy $( \% )$ comparison of SSL approaches on small-scale benchmarks: CIFAR10, CIFAR100, and STL10. Results show that DCL consistently improves its SimCLR baseline. With multi-cropping [17], our DCLW reaches competitive performance within other contrastive learning approaches [8, 7, 4, 12, 18].
217
+
218
+ <table><tr><td>kNN (top-1)</td><td>SimCLR</td><td>MoCo</td><td>MoCo +CLD</td><td>NPID</td><td>NPID + CLD</td><td>Inv. Spread</td><td>Exemplar</td><td>DCL</td><td>DCLW w/ mcrop</td></tr><tr><td>CIFAR10</td><td>81.4</td><td>82.1</td><td>87.5</td><td>80.8</td><td>86.7</td><td>83.6</td><td>76.5</td><td>84.1</td><td>87.8</td></tr><tr><td>CIFAR100</td><td>52.0</td><td>53.1</td><td>58.1</td><td>51.6</td><td>57.5</td><td>N/A</td><td>N/A</td><td>54.9</td><td>58.8</td></tr><tr><td>STL10</td><td>77.3</td><td>80.8</td><td>84.3</td><td>79.1</td><td>83.6</td><td>81.6</td><td>79.3</td><td>81.2</td><td>84.1</td></tr></table>
219
+
220
+ # 4.2 Experiments and analysis
221
+
222
+ DCL on ImageNet This section illustrates the effect of our DCL under different batch sizes and queues. The initial setup is to have 1024 batch size (SimCLR [8]) and 65536 queues (MoCo [7]) and gradually reduce the batch size (SimCLR) and queue (MoCo) to show the corresponding top-1 accuracy by linear evaluation. Figure 3 indicates that without DCL, the top-1 accuracy drastically drops when batch size (SimCLR) or queue (MoCo) becomes very small. While with DCL, the performance keeps steadier than baselines (SimCLR: $- 4 . 1 \%$ vs. $- 8 . \dot { 3 } \%$ , MoCo: $- 0 . 4 \%$ vs. $- 5 . 9 \%$ ).
223
+
224
+ 169 Specifically, Figure 3 further shows that in SimCLR, the performance with DCL improves from
225
+ 170 $6 \bar { 1 } . 8 \%$ to $6 \mathrm { \bar { 5 } } . 9 \%$ under 256 batch size; MoCo with DCL improves from $5 4 . 7 \%$ to $6 0 . 8 \%$ under 256
226
+ 171 queues. The comparison fully demonstrates the necessity of DCL, especially when the number of
227
+ 172 negatives is small. Although batch size is increased to 1024, we also note that our DCL $( 6 6 . 1 \% )$ still
228
+ 173 improves over the SimCLR baseline $( 6 5 . 1 \% )$ .
229
+ 174 We further observe the same phenomenon on ImageNet-100 data. Table 1 shows that, while with
230
+ 175 DCL, the performance only drops $2 . 3 \%$ compare to the SimCLR baseline of $7 . 1 \%$ .
231
+ 176 In summary, it is worth noting that, while the batch size is small, the strength of $q _ { B , i }$ , which is used to
232
+ 177 push the negative samples away from the positive sample, is also relatively weak. This phenomenon
233
+ 178 tends to reduce the efficiency of learning representation. While taking advantage of DCL alleviates
234
+ 179 the performance gap between small and large batch sizes. Hence, through the analysis, we find out
235
+ 180 DCL can simply tackle the batch size issue in contrastive learning. With this considerable advantage
236
+ 181 given by DCL, general SSL approaches can be implemented with fewer computational resources or
237
+ 182 lower standard platforms.
238
+ 183 DCL on CIFAR and STL10 In Table 1 and Table 3, it is observed that DCL also demonstrates
239
+ 184 its effectiveness on small-scale benchmarks. In summary, DCL outperforms its baseline by $3 . 1 \%$
240
+ 185 (CIFAR10) and $2 . 8 \%$ (CIFAR100) and keeps the performance relatively steady under batch size 256.
241
+ 186 We also improve the kNN accuracy of the SimCLR baseline on STL10 by $3 . { \dot { 9 } } \%$ .
242
+ 187 Decoupled objective with re-weighting DCLW We only replace $L _ { D C }$ with $L _ { D C W }$ with no pos
243
+ 188 sible advantage from additional tricks. That is, both our approach and the baselines apply the same
244
+ 189 training instruction of the OpenSelfSup benchmark [23] for fairness. Note that we empirically choose
245
+ 190 $\sigma = 0 . 5$ in the experiments.
246
+ 191 Results in Table 3 indicates that, DCLW achieves extra $5 . 1 \%$ (ImageNet-1K), $3 . 5 \%$ (ImageNet-100)
247
+ 192 gains compared to the baseline. For CIFAR data, extra $3 . 7 \%$ (CIFAR10), $3 . 1 \%$ are gained from the
248
+ 193 addition of DCLW. It is worth to note that, trained with 200 epochs, our DCLW reaches $6 6 . 9 \%$ with
249
+ 194 batch size 256, surpassing the SimCLR [8] baseline: $6 6 . 2 \%$ with batch size 8192.
250
+
251
+ Table 3: Comparisons between SimCLR baseline, DCL, and DCLW. Results indicate that DCL improves the performance of baseline, and DCLW further provides an extra boost. Note that results are under the batch size 256 and epoch 200. All of models are both trained and evaluated with same experimental settings.
252
+
253
+ <table><tr><td></td><td>Baseline</td><td>DCL</td><td>DCLW</td></tr><tr><td>CIFAR10</td><td>81.8</td><td>84.2 (+3.1)</td><td>84.8 (+3.7)</td></tr><tr><td>CIFAR100</td><td>51.8</td><td>54.6 (+2.8)</td><td>54.9 (+3.1)</td></tr><tr><td>ImageNet-100</td><td>79.3</td><td>81.9 (+2.6)</td><td>82.8 (+3.5)</td></tr><tr><td>ImageNet-1K</td><td>61.8</td><td>65.9 (+4.1)</td><td>66.9 (+5.1)</td></tr></table>
254
+
255
+ Table 4: ImageNet-1K top-1 accuracy $( \% )$ on SimCLR and MoCo v2 with/without DCL under few training epochs. We further list results under 200 epochs for clear comparison. With DCL, the performance of SimCLR trained under 100 epochs nearly reaches its performance under 200 epochs. The MoCo v2 with DCL also reaches higher accuracy than the baseline under 100 epochs.
256
+
257
+ <table><tr><td></td><td>SimCLR[8]</td><td>SimCLR w/ DCL</td><td>MoCo v2[25]</td><td>MoCo v2 w/ DCL</td></tr><tr><td>100 epoch</td><td>57.5</td><td>64.6</td><td>63.6</td><td>64.4</td></tr><tr><td>200 epoch</td><td>61.8</td><td>65.9</td><td>67.5</td><td>67.7</td></tr></table>
258
+
259
+ # 195 4.3 Small-scale benchmark results: STL10, CIFAR10, and CIFAR100
260
+
261
+ 196 For STL10, CIFAR10, and CIFAR100, we implement our DCL with ResNet-18 [22] as encoder
262
+ 197 backbone by following small-scale benchmark of CLD [24]. All the models are trained for 200
263
+ 198 epochs with 256 batch size and evaluate by using kNN accuracies $k = 2 0 0$ ).
264
+ 199 Results in Table 2 indicates that, our DCLW with multi-cropping [17] consistently outperforms the
265
+ 200 state-of-the-art baselines on CIFAR10, STL10, and CIFAR100. Our DCL also demonstrates its
266
+ 201 capability while comparing against other baselines. More analysis of large-scale benchmarks can be
267
+ 202 found in Appendix.
268
+
269
+ # 4.4 Ablations
270
+
271
+ We perform extensive ablations on the hyperparameters of our DCL and DCLW on both ImageNet data and other small-scale data, i.e., CIFAR10, CIFAR100, and STL10. By seeking better configurations empirically, we see that our approach gives consistent gains over the standard SimCLR baseline. In other ablations, we see that our DCL achieves more gains over both SimCLR and MoCo v2, i.e., contrastive learning baselines, also when training for 100 epochs only.
272
+
273
+ ![](images/b6547bd17add024c15718688b0d8b924b97090935ad8506ae57ec959de59799e.jpg)
274
+ Figure 4: During the SSL pre-training, DCL speeds up the model convergence and provides better performance than the baseline on CIFAR and STL10 data.
275
+
276
+ 09 Few learning epochs Our DCL is inspired by the traditional contrastive learning framework, which
277
+ 10 needs a large batch size, long learning epochs to achieve higher performance. The previous state
278
+ 11 of-the-art, SimCLR [8], heavily rely on large quantities of learning epochs to obtain high top-1
279
+ 12 accuracy. (e.g., $6 9 . 3 \%$ with up to 1000 epochs). The purpose of our DCL is to achieve higher learning
280
+ 13 efficiency with few learning epochs. We demonstrate the effectiveness of DCL in contrastive learning
281
+ 14 frameworks SimCLR and MoCo v2. We choose the batch size of 256 (queue of 65536) as the baseline
282
+ 15 and train the model with only 100 epochs instead of the normal number of 200. We make sure other
283
+ 16 parameter settings are the same for a fair comparison. Table 4 shows the result on ImageNet-1K
284
+ 17 using linear evaluation. With DCL, SimCLR can achieve $6 4 . 6 \%$ top-1 accuracy with only 100 epochs
285
+ 18 compared to SimCLR baseline: $5 7 . 5 \%$ ; MoCo v2 with DCL reaches $6 4 . 4 \%$ compared to MoCo v2
286
+ 19 baseline: $6 3 . 6 \%$ with 100 epochs pre-training.
287
+
288
+ We further demonstrate that, with DCL, learning representation becomes faster during the early stage of training. The reason is that DCL successfully solves the decoupled issue between positive and negative pairs. Figure 4 (a), (b), and (c), show that our DCL improves the speed of convergence and reaches higher performance than the baseline on CIFAR and STL10 data.
289
+
290
+ # 5 Conclusion
291
+
292
+ In this paper, we identify the negative-positive-coupling (NPC) effect in SimCLR. By removing the NPC effect, we reach a new objective function, decoupled contrastive learning (DCL). The proposed DCL loss function requires minimal modification to the SimCLR baseline and provides efficient, reliable, and nontrivial performance improvement on various benchmarks. Given the conceptual simplicity of DCL and that it requires neither momentum encoding, large batch sizes, or long epochs to reach competitive performance, we wish that DCL can serve as a strong baseline for the contrastive-based SSL methods.
293
+
294
+ # References
295
+
296
+ [1] Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In European Conference on Computer Vision, pages 69–84. Springer, 2016.
297
+ [2] Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European conference on computer vision, pages 649–666. Springer, 2016.
298
+ [3] Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728, 2018.
299
+ [4] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3733–3742, 2018.
300
+ [5] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
301
+ [6] Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019.
302
+ [7] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9729–9738, 2020.
303
+ [8] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020. [9] 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, pages 2672–2680, 2014.
304
+ [10] Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
305
+ [11] Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR 2006), 17-22 June 2006, New York, NY, USA, pages 1735–1742. IEEE Computer Society, 2006. [12] Mang Ye, Xu Zhang, Pong C Yuen, and Shih-Fu Chang. Unsupervised embedding learning via invariant and spreading instance feature. In Proceedings of the IEEE Conference on computer vision and pattern recognition, pages 6210–6219, 2019.
306
+ [13] Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. CoRR, abs/2004.11362, 2020.
307
+ [14] Yang You, Igor Gitman, and Boris Ginsburg. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017.
308
+ [15] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H. Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Ávila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, Bilal Piot, Koray Kavukcuoglu, Rémi Munos, and Michal Valko. Bootstrap your own latent - A new approach to self-supervised learning. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
309
+ [16] Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. CoRR, abs/2011.10566, 2020.
310
+ [17] Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020.
311
+ [18] Alexey Dosovitskiy, Philipp Fischer, Jost Tobias Springenberg, Martin Riedmiller, and Thomas Brox. Discriminative unsupervised feature learning with exemplar convolutional neural networks. IEEE transactions on pattern analysis and machine intelligence, 38(9):1734–1747, 2015.
312
+ [19] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A largescale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009.
313
+ [20] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
314
+ [21] Adam Coates, Andrew $\mathrm { N g }$ , and Honglak Lee. An analysis of single-layer networks in unsupervised feature learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pages 215–223. JMLR Workshop and Conference Proceedings, 2011.
315
+ [22] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
316
+ [23] Xiaohang Zhan, Jiahao Xie, Ziwei Liu, Dahua Lin, and Chen Change Loy. OpenSelfSup: Open mmlab self-supervised learning toolbox and benchmark. 2020.
317
+ [24] Xudong Wang, Ziwei Liu, and X Yu Stella. Unsupervised feature learning by cross-level instance-group discrimination.
318
+
319
+ # Checklist
320
+
321
+ 1. For all authors...
322
+
323
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
324
+ (b) Did you describe the limitations of your work? [Yes] See supplementary.
325
+ (c) Did you discuss any potential negative societal impacts of your work? [No]
326
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
327
+
328
+ 2. If you are including theoretical results...
329
+
330
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3.
331
+ (b) Did you include complete proofs of all theoretical results? [Yes] See Section 3.
332
+
333
+ 3. If you ran experiments...
334
+
335
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A] It can be straightforward to reproduce. In addition, we will release our code public after the review process.
336
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section4.
337
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] . We only report the mean value of 5 runs but without standard deviation.
338
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section4.
339
+
340
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
341
+
342
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
343
+ (b) Did you mention the license of the assets? [Yes]
344
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
345
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes]
346
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
347
+
348
+ 5. If you used crowdsourcing or conducted research with human subjects...
349
+
350
+ (a) Did you include the full text of instructions given to participants and scu’re using/cuapplicable? [Yes]
351
+ (b) Did you describe any potential participant risks, with links to Inu’re using/cuview Board (IRB) approvals, if applicable? [Yes]
352
+ (c) Did you include the estimated hourly wage paid to participants and the tou’re using/cunt on participant compensation? [Yes]
md/train/ODKwX19UjOj/ODKwX19UjOj.md ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UNSUPERVISED HIERARCHICAL CONCEPT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Concepts or temporal abstractions are an essential aspect of learning among humans. They allow for succinct representations of the experiences we have through a variety of sensory inputs. Also, these concepts are arranged hierarchically, allowing for an efficient representation of complex long-horizon experiences. Analogously, here we propose a model that learns temporal representations from long-horizon visual demonstration data and associated textual descriptions without explicit temporal supervision. Additionally, our method produces a hierarchy of concepts that align more closely with ground-truth human-annotated events than several state-of-theart supervised and unsupervised baselines in complex visual domains such as chess and cooking demonstrations. We illustrate the utility of the abstracted concepts in downstream tasks, such as captioning and reasoning. Finally, we perform several ablation studies illustrating the robustness of our approach to data-scarcity.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Consider a video (Figure 1) that demonstrates how to cook an egg. Humans subconsciously learn concepts (such as boiling water) that describe different concepts (or skills) in such demonstrations Pammi et al. (2004). These learned skills can be composed and reused in different ways to learn new concepts. Discovering such concepts automatically from demonstration data is a non-trivial problem. Shankar et al. (2019) introduces a sequence-to-sequence architecture that clusters long-horizon action trajectories into shorter temporal skills. However, their approach treats skills as independent concepts. In contrast, humans organize these concepts in hierarchies where lower-level concepts can be grouped to define higher-level concepts Naim et al. (2019).
12
+
13
+ We extend the architecture in Shankar et al. (2019) to simultaneously discover concepts along with their hierarchical organization without any supervision.
14
+
15
+ We propose an end-to-end trainable architecture UNHCLE for hierarchical representation learning from demonstrations. UNHCLE takes as input a long horizon trajectory of high-dimensional images demonstrating a complex task (in our case, chess and cooking) and the associated textual commentary and isolates semantically meaningful subsequences in input trajectories. We emphasize that it does not require temporal annotations which link subsequences in the trajectories of images to the freeflowing commentary, but instead, autonomously discovers this mapping. Therefore, this work takes a step towards unsupervised video understanding of high-dimensional data. Our contributions can be summarized as follows:
16
+
17
+ • We introduce a transformer-based architecture to learn a multi-modal hierarchical latent embedding space to encode the various concepts in long-horizon demonstration trajectories. UNHCLE abstracts these concepts (shown through visual qualitative analysis) without requiring any temporal supervision, i.e., it divides long-horizon trajectories into semantically meaningful subsequences, without access to any temporal annotations that split these trajectories optimally.
18
+ We show the quantitative effectiveness of learning high-level concepts in a hierarchical manner compared to learning them in isolation while outperforming several baselines on YouCook2 (Zhou et al. (2017)) and Chess Opening dataset1.
19
+ • We further introduce a mechanism to incorporate commentary accompanying demonstrations in UNHCLE and show improvements in hierarchical concepts discovered.
20
+
21
+ ![](images/3bef29025077483e2bdbb0e67a5bab8191d754218528d999b2a74d489df0ef38.jpg)
22
+ Figure 1: Overview of our approach. UNHCLE learns a hierarchical latent space of concepts describing long horizon tasks like cooking and chess gameplay.
23
+
24
+ • We introduce TimeWarped IoU (TW-IoU), an evaluation metric that we use to compare the alignment of our discovered concepts and ground-truth events.
25
+
26
+ Existing approaches to representation learning for demonstrations or videos typically require significant supervision. Typically, sequence-to-sequence architectures are trained on datasets segmented by humans. During inference, these architectures generate proposals for timestamps that segment the input trajectory into semantically meaningful sequences. These complex sequence-to-sequence models require significant amounts of annotated data, making them costly to train them.
27
+
28
+ More generally, video and scene understanding is an important research area with wide-ranging applications. Most recently, Chen et al. (2019) utilize semantic awareness to perform complex depth estimation tasks to acquire the geometric properties of 3-dimensional space from 2-dimensional images. Tosi et al. (2020) utilize similar semantic information for depth estimation, optical flow and motion segmentation. Boggust et al. (2019) attempt to ground words in the video, but apply significant supervision to synchronize them, requiring human intervention. We attempt to learn similar embeddings but do so in a completely unsupervised manner, not utilizing any of the temporal labels available.
29
+
30
+ The field of learning from demonstrations (Nicolescu & Mataric (2003)) seeks to learn to perform tasks from a set of demonstrated behaviors. Behavioral Cloning is one popular scheme (Esmaili et al. (1995)). Atkeson & Schaal (1997) and Schaal (1997) show how agents can learn simple tasks like cartpole simply from demonstrations. Pastor et al. (2009) also study how robots can learn from human demonstrations of tasks. Peters et al. (2013) and Kober & Peters (2009) fit a parametric model to the demonstrations. Niekum et al. (2012), Murali et al. (2016), and Meier et al. (2011) first segment trajectories into subsequence and then apply a parametric models to each subsequence. More recently, Schmeckpeper et al. (2019) shows that agents can learn to maximize external reward using a large corpus of observation data, i.e., trajectories of states on a relatively smaller corpus of interaction data, i.e., trajectories of state-action pairs. Hierarchical task representations have been studied as well. Instead of treating demonstrations in a flat manner, one may also infer the hierarchical structure. A few recent works attempt to do so (Xu et al. (2018); Sun et al. (2018)), or as task graphs (Huang et al., 2019). Both Xu et al. (2018) and Huang et al. (2019) address generalizing to new instances of manipulation tasks in the few-shot regime by abstracting away low-level controls. However, all of these approaches require an environment i.e., a transition and reward function to learn from. On the contrary, humans show an ability to learn by watching demonstrations, which we attempt to replicate.
31
+
32
+ Temporal abstractions of action sequences or skill/primitive learning is also a related field. Eysenbach et al. (2018), learn a large number of low-level sequences of actions by forcing the agent to produce skills that are different from those previously acquired. However, due to the diversity bias, the agent results in learning many useless skills that cannot be used for any semantically meaningful task. Similarly, Sharma et al. (2019) attempt to learn skills such that their transitions are almost deterministic in a given environment. These approaches also require access to an environment, whereas we try to learn without an environment.
33
+
34
+ ![](images/e583437c19259fca4efbac914ef93d18b1b50864b748f31c6bdc5b7846aa1527.jpg)
35
+ Figure 2: Overview of our approach. UNHCLE learns a hierarchical semantically-meaningful embedding space which allows it to perform complex downstream tasks such as temporal concept segmentation and label prediction. Refer to Section 2.1 for details about the abbreviations used in the figure.
36
+
37
+ # 2 APPROACH
38
+
39
+ # 2.1 UNHCLE: UNSUPERVISED HIERARCHICAL CONCEPT LEARNING
40
+
41
+ Intuitively, we define a concept as a short sequence of states which repeatedly occur across several demonstration trajectories. Concepts have an upper limit on their length in time-steps. These concepts can be obtained from the images of demonstrations, denoted by $z$ , and from the associated textual description, represented by $c$ . We also refer to them as Observational Concept (OC) and Instructional Concept (IC) respectively and the module that encodes these concepts is referred to as Observational Concept Abstraction (OCA) and Instructional Concept Abstraction (ICA) modules. Additionally, concepts are hierarchical in nature - thus, lower-level and higher-level observational or image concepts are denoted by $z ^ { L }$ and $z ^ { H }$ , respectively. Analogously, lower-level, and higher-level textual concepts are represented by $c ^ { L }$ and $c ^ { H }$ , respectively. Similarly, the higher-level and lower-level modules are denoted by low or high for the corresponding level.
42
+
43
+ Once we obtain these concept abstractions across levels, we can also transform them across the levels using a Concept Regeneration (CR) Module to transform low-level concepts to high-level concepts and vice-versa. Instead of just traversing in the concept level hierarchy, we can also use the Concept Instruction Regeneration Module or CIR to obtain the original instructions that map to that concept in its respective concept modality.
44
+
45
+ Subsequently, we provide details about the different stages in our proposed technique.
46
+
47
+ Encoding Observation: Given a long horizon trajectory of demonstration images along with its associated textual description, UNHCLE is able to abstract a hierarchy of concepts from demonstration images. We first pass these input images through ResNet-32 (He et al. (2016)) to get a sequence of image vectors as $S = s _ { 1 : m }$ , and the associated text is converted into word vectors $W = w _ { 1 : n }$ using BERT-base (Devlin et al. (2018)). Observations combine to produce lower-level concepts whereas higher-level concepts are simply aggregations of such lower-level concepts. Thus, the Lower-level Observation Concept Abstraction module $( \mathrm { O C A } ^ { l o w } )$ is trained to embed a sequence of image vectors of a video $\left( s _ { 1 } , s _ { 2 } . . . . s _ { m } \right)$ into a sequence of concept vectors $( z _ { 1 } ^ { L } , z _ { 2 } ^ { L } , . . , z _ { U } ^ { L } )$ where $u < < m$ such that $z _ { 1 : u } ^ { L } = \mathbf { O C A } ^ { l o w } \left( s _ { 1 : m } \right)$ . Subsequently, lower-level concepts combine together to form a higher level of concepts using the Higher-level Observation Concept Abstraction module $( \mathrm { O C A } ^ { h i g h } )$ such that $z _ { 1 : v } ^ { H } ~ = ~ \mathrm { O C A } ^ { h i g h } \left( z _ { 1 : u } ^ { L } \right)$ .
48
+
49
+ Encoding Instructions: We also endeavour to discover these higher-level and lower-level concepts through natural language instructions. The Lower-level Instruction Concept Abstraction module $( \mathrm { I C A } ^ { l o w } )$ and Higher-level Instruction Concept Abstraction module $( \mathrm { I C A } ^ { h i _ { g h } } )$ are responsible for this functionality. From a corpus of words, $\left( w _ { 1 } , w _ { 2 } . . . . w _ { n } \right)$ , the $\mathrm { I C A } ^ { l o w }$ module generates concept $( c _ { 1 } ^ { L } , c _ { 2 } ^ { L } , . . , c _ { u } ^ { L } ) , u < < n \colon c _ { 1 : u } ^ { L } \ = \ { \mathrm { I C A } } ^ { l o w } \left( w _ { 1 : n } \right)$ . Subsequently the $\mathrm { I C A } ^ { h i g h }$ encodes the lower-level language concepts $c _ { 1 : u } ^ { L }$ into higher level concepts as $c _ { 1 : v } ^ { H } ~ = ~ \mathrm { I C A } ^ { h i g h } ~ ( c _ { 1 : u } ^ { L } )$ .
50
+
51
+ Traversing across the concept hierarchy: Learning concepts at different levels has an added advantage of traversing these concepts in the concept hierarchy. This additionally allows us to utilize these hierarchical traversals to obtain coarse or fine-grained concepts at any level. We can thus regenerate the lower concepts from higher-level instruction concepts using the Lower-level Concept Regeneration Module $( \mathbf { C R } ^ { l o w } )$ such that $\boldsymbol { z } _ { 1 : u ^ { \prime } } ^ { \prime L } ~ = \mathbf { C } \mathbf { R } ^ { l o w } ~ ( c _ { 1 : v } ^ { H } )$ . We can then later utilize this to obtain lower-level concepts from the higher-level concepts to regenerate the demonstration images $S ^ { L } = s _ { 1 : m ^ { L } } ^ { L }$ in a cross-modal fashion.
52
+
53
+ Observation and Instruction Regeneration: Under a concept, the sequence of frames is nearly deterministic i.e. the knowledge of a concept uniquely identifies the accompanying sequence of $S ^ { L } \overset { = } { = } s _ { 1 : m ^ { L } } ^ { L }$ e demonstration trajectory. Subsequently, we regenerate the demonstration image vectorsfrom lower-level concepts using Lower-level Concept Observation Regeneration Module $( \mathrm { C O R } ^ { l o w } )$ such that $s _ { 1 : m ^ { L } } ^ { L } = ~ \mathrm { C O R } ^ { l o w } ~ ( z _ { 1 : u ^ { \prime } } ^ { \prime L } )$ . We also regenerate the demonstration image vectors $S ^ { U } = s _ { 1 : m } ^ { U } \upsilon$ from higher-level coRegeneration Module $( \mathbf { C O R } ^ { h i g h } )$ racted fro such that $\begin{array} { l l l } { s _ { 1 : m ^ { U } } ^ { U } } & { = } & { \mathrm { C O R } ^ { h i g h } \ ( c _ { 1 : v } ^ { H } ) } \end{array}$ vel Conceptin a similar cross-modal manner.
54
+
55
+ Finally, inspired by humans who can easily describe concept representations using free-flowing natural language, we first regenerate lower-level concepts from higher-level observation concepts using the Lower-level Concept Regeneration Module $( \mathbf { C R } ^ { l o w } )$ such that $c _ { 1 : u ^ { \prime } } ^ { \prime L } ~ = ~ \mathbf { C } \mathbf { R } ^ { l o w } ~ ( z _ { 1 : v } ^ { H } )$ , and subsequently, regenerate the word vectors $W ^ { L } = w _ { 1 : n ^ { L } } ^ { L }$ from lower-level concepts using Lower-level Concept Instruction Regeneration Module $\scriptstyle ( \mathbf { C I R } ^ { l o w } )$ ) such that $w _ { 1 : n ^ { L } } ^ { L } = \mathrm { \bf ~ C I R } ^ { l o w } ( c _ { 1 : u ^ { \prime } } ^ { \prime L } )$ . Additionally, the higher-level concepts identified by the ${ \mathrm { O C A } } ^ { h i g h }$ module from demonstration frames are also described using a meaningful free-flowing commentary by the Higher-level Concept Instruction Regeneration module or $\mathbf { C I R } ^ { h i g h }$ . Thus, we regenerate the word vectors $W ^ { U } = w _ { 1 : n } ^ { U } \boldsymbol { v }$ from higherlevel concepts using $\mathbf { C I R } ^ { h i g h }$ such that $w _ { 1 : m ^ { U } } ^ { U } = \ { \bf C } \mathrm { I R } ^ { h i g h } \left( z _ { 1 : v } ^ { H } \right)$ .
56
+
57
+ # 2.2 SOFT-DYNAMIC TIME WARPING (SOFT-DTW)
58
+
59
+ The most significant challenge that our work overcomes is that we do not require supervision for hierarchical temporal segmentation i.e. we do not require annotations which demarcate the beginning and ending of a concept, both in language and in the space of frame’s timestamps. Currently, most approaches rely on annotation describing the frame start and end for an event and the associated text for this event. Our architecture is trained using free-flowing commentary without event demarcations. This is achieved using the loss function we implement. We utilize Soft-DTW (Cuturi & Blondel (2017)) loss to align the reconstructed trajectories with the input long-horizon trajectory. So given two trajectories $x = ( x _ { 1 } , x _ { 2 } , . . . x _ { n } )$ and $y = ( y _ { 1 } , y _ { 2 } , . . . y _ { m } )$ , the soft- $ { \mathrm { D T W } } ( x , y )$ is computed as,
60
+
61
+ where $\mathcal { A } \in \mathcal { A } _ { n , m }$ is the alignment matrix, $\Delta ( x , y ) = [ \delta ( x _ { i } , y _ { i } ) ] _ { i j } \in \mathbb { R } ^ { n \times m }$ and $\delta$ being the cost function. min $\gamma$ operator is then computed as,
62
+
63
+ $$
64
+ m i n ^ { \gamma } \{ a _ { 1 } , \cdot \cdot \cdot , a _ { n } \} = { \left\{ \begin{array} { l l } { m i n { \mathrm { ~ } } _ { i \leq n } { \mathrm { ~ } } a _ { i } , } & { \gamma = 0 , } \\ { - \gamma \log \sum _ { i = 1 } ^ { n } e ^ { - a _ { i } / \gamma } , } & { \gamma > 0 . } \end{array} \right. }
65
+ $$
66
+
67
+ For our experiments, we use $L _ { 2 }$ distance as $\delta$ and $\gamma = 1$ .
68
+
69
+ # 2.3 LEARNING OBJECTIVE
70
+
71
+ Our approach that has been outlined in Figure 2 uses several loss terms between different network outputs to achieve our objective. The soft-DTW is used between several sequences as follows.
72
+
73
+ $$
74
+ \begin{array} { r } { \dot { \gamma } _ { d y n } = \mathrm { s o f t } { \mathrm { - } \mathrm { D T W } ( z _ { 1 : u } ^ { L } , c _ { 1 : u ^ { \prime } } ^ { \prime L } ) } + \mathrm { s o f t } { \mathrm { - } \mathrm { D T W } ( c _ { 1 : u } ^ { L } , z _ { 1 : u ^ { \prime } } ^ { \prime L } ) } + \mathrm { s o f t } { \mathrm { - } \mathrm { D T W } ( s _ { 1 : m } , s _ { 1 : m ^ { \prime } } ^ { \prime L } ) } + \mathrm { s o f t } { \mathrm { - } \mathrm { D T W } ( s _ { 1 : m } , s _ { 1 : m ^ { \prime } } ^ { \prime H } ) } } \end{array}
75
+ $$
76
+
77
+ We use the Negative Log-Likelihood (NLL) loss $( { \mathcal { L } } _ { n l l } )$ between the generated comment vectors and the BERT vectors and use the $L _ { 2 }$ loss between concepts from different modalities as follows,
78
+
79
+ $$
80
+ \begin{array} { r } { \mathcal { L } _ { s t a t i c } = \mathcal { L } _ { n l l } ( w _ { 1 : n } , w _ { 1 : n } ^ { \prime L } ) + \mathcal { L } _ { n l l } ( w _ { 1 : n } , w _ { 1 : n } ^ { \prime H } ) } \end{array}
81
+ $$
82
+
83
+ We then define our final loss as, $\mathcal { L } _ { t o t a l } = \alpha * \mathcal { L } _ { d y n } + \beta * \mathcal { L } _ { s t a t i c }$
84
+
85
+ # 2.4 EVALUATION METRICS
86
+
87
+ The ground-truth events in the dataset and the concepts generated by UNHCLE may differ in number, duration, and start-time. To evaluate the efficacy of UNHCLE in generating concepts that align with the human-annotated events in our dataset, it is imperative that we utilize a metric that measures the overlap between generated concepts and ground truths and also accounts for this possible temporal mismatch. To this end, we introduce time-warp IoU. Note that we do not utilize these the temporal ground-truth event annotations during training, but only to compare the abstraction generated by our architecture to the human-annotated events.
88
+
89
+ Consider the search series $S = ( s _ { 1 } , s _ { 2 } , s _ { 3 } . . . s _ { M } ) \in \mathbb { S }$ and target series $T = ( t _ { 1 } , t _ { 2 } , t _ { 3 } . . . t _ { N } )$ where $S$ corresponds to the end-of-concept time stamp for each concept as generated by UNHCLE for a single long-horizon demonstration trajectory. Thus, the $i ^ { t h }$ concept abstracted from UNHCLE starts at time $= s _ { i - 1 }$ and end at $\mathrm { t i m e } = s _ { i }$ . Similarly, $T$ corresponds to the end-of-event time stamp for each ground-truth event in the demonstration trajectory, where the $j ^ { t h }$ ground truth event starts at time $=$ $t _ { j - 1 }$ and ends at time $= t _ { j }$ . Note that both $s _ { 0 }$ and $t _ { 0 }$ are equal to zero i.e. we measure time starting at zero for all demonstration trajectories.
90
+
91
+ # 2.4.1 TIME-WARPED IOU
92
+
93
+ We calculate the time-warped alignment between between the event annotations and the concepts from UNHCLE. This implies calculating $\Delta ( S , T )$ , solving the following optimization problem (Berndt & Clifford (1994)), $\begin{array} { r } { \Delta ( S , T ) = \operatorname* { m i n } _ { P \in \mathcal { P } } \sum _ { m , n \in P } \delta ( s _ { m } , t _ { n } ) } \end{array}$ , where the $S$ and $T$ correspond to the search and target series respectively and $\delta$ corresponds to a distance metric (in our case the $L _ { 2 }$ norm), measuring time mismatch.
94
+
95
+ $\Delta ( S , T )$ therefore corresponds to the trajectory discrepancy measure defined as the matching cost for the optimal matching path $P$ among all possible valid matching paths $\mathcal { P }$ (i.e. paths satisfying monotonicity, continuity, and boundary conditions). From this optimal trajectory obtained we can also get the warping function $W$ such that $W ( s _ { i } ) = t _ { j }$ , i.e. we find the optimal mapping between the $i ^ { t h }$ concept ending at time $= s _ { i }$ and the $j ^ { t h }$ event ending at time $= t _ { j }$ . To quantify the quality of this mapping we introduce Time-Warp Intersection over Union for a single long-horizon trajectory $S$ .
96
+
97
+ $$
98
+ T W - I o U ( S ) = \sum _ { t _ { i } } \frac { \sum _ { s _ { j } : W ( s _ { j } ) = t _ { i } } \operatorname* { m i n } ( t _ { i } , s _ { j } ) - \operatorname* { m a x } ( t _ { i - 1 } , s _ { j - 1 } ) } { \operatorname* { m a x } _ { s _ { j } : W ( s _ { j } ) = t _ { i } } \{ \operatorname* { m a x } ( t _ { i } , s _ { j } ) \} - \operatorname* { m i n } _ { s _ { j } : W ( s _ { j } ) = t _ { i } } \{ \operatorname* { m i n } ( t _ { i - 1 } , s _ { j - 1 } ) \} }
99
+ $$
100
+
101
+ Intuitively, this corresponds to the overlap between the $i ^ { t h }$ concept ending at time $= s _ { i }$ and the $j ^ { t h }$ event ending at time $= t _ { j }$ .
102
+
103
+ # 3 EXPERIMENTS
104
+
105
+ # 3.1 DATASETS
106
+
107
+ In order to find conceptual temporal patterns from videos in a hierarchical manner, we experiment with two datasets from different domains.
108
+
109
+ YouCook2 (Zhou et al. (2017)) dataset comprises of instructional videos for 89 unique recipes ${ \sim } 2 2$ videos per recipe) containing labels that separate the long horizon trajectories of demonstrations into events - with explicit time stamps for the beginning and end of each event along with the associated commentary. It contains 1,333 videos for training and 457 videos for testing. The average number of segments per video is 7.7 and the average duration of the video is 5.27 minutes.
110
+
111
+ Recommending Chess Openings2 dataset consists of opening moves in the game of Chess. An
112
+
113
+ Opening in Chess is a fixed sequence of moves which when performed leads to a final board state putting the player in a strategic position in the game. Commonly used chess openings are each labeled with a name (Figure 3 shows examples). The dataset contains 20,058 openings with each containing a sequence of chess moves and it’s corresponding opening and variation labels. The train-test split used for our experiments is 80-20.
114
+
115
+ # 3.2 IMPLEMENTATION DETAILS
116
+
117
+ The Observational Concept Abstraction (OCA) and Instructional Concept Abstraction (ICA) modules consist of the Transformer (Vaswani et al. (2017)) Encoder with 8 hidden layers and 8-Head Attention which takes as input, a sequence of frames positionally encoded and outputs a hidden vector. It is then passed through a Transformer Decoder again having 8 hidden layers and encoder-decoder crossattention with masking which finally outputs the concepts which are latent variables having dimension conceptlengt $\AA ^ { \prime } \times 7 6 8$ . We use a 1-layer GRU (Chung et al. (2014)) for our Concept Instruction Regeneration (CIR), Concept Observation Regeneration (COR), and the Concept Regeneration (CR) module which converts the high-level concepts to low-level concepts. For encoding the image frames, we down-sample all videos to 500 frames and use ResNet-32 (pretrained on MSCOCO dataset) (He et al. (2016)) for dense embedding of dimension $5 1 2 \times 1$ . We further down-sample to 200 frames per trajectory for all experiments. Comments are encoded using BERT-base pre-trained embeddings with a 768 hidden dimension.
118
+
119
+ For our low-level concepts, we keep the maximum number of concepts discovered as 16 and for high-level concepts as 4. These assumptions are based on the YouCook2 dataset statistics wherein ground-truth annotations (not used during training) the minimum number of segments were 5 and the maximum as 16. We keep $\alpha = 1$ and $\beta = 1$ for all our experiments along with a batch-size of 128 and use Adam optimizer for training with a learning rate of $1 e - 5$ and train the network for 100 epochs.
120
+
121
+ # 3.3 RESULTS AND ANALYSIS
122
+
123
+ # 3.3.1 VISUALIZING HIERARCHY
124
+
125
+ Here we analyze whether the discovered concepts are human interpretable i.e. are the temporal clusters within a single demonstration semantically meaningful?. We find that our architecture abstracts several useful human interpretable concepts without any supervision. Figure 3 and 4 shows the results obtained. These abstracted high-level concepts align well with the ground truth event labels provided in YouCook2. We also additionally find that our model is able to split each ground truth event into lower-level concepts. For instance, in a pasta-making demonstration in YouCook2, a single event corresponding to the description “heat a pan add 1 spoon oil and prosciutto to it”, UNHCLE is divided into low level concepts corresponding to “heat pan”, “add oil” and “prosciutto”. Note that no explicit event time labels were provided to UNHCLE, indicating that our model is able to abstract such coherent sub-sequences, thus taking the first step towards video understanding.
126
+
127
+ We also visualize the concepts abstracted by UNHCLE when trained on chess opening data. The concepts learnt here also produce coherent, human-interpretable results.
128
+
129
+ ![](images/9f059f65157e5e0760444066539235dd076958fe5ba5c6b9090277cd45b52ac8.jpg)
130
+ Figure 3: Hierarchy of concepts discovered by UNHCLE using openings data in Chess. At a high level, UNHCLE correctly identifies concepts corresponding to the Blackmar-Diemer Gambit and the Pietrowsky Defense. At a low level, it identifies concepts such as “d4 d5.. and e4 d3 ..” that are used across several openings
131
+
132
+ ![](images/4d2ff3a707ed12654cda5aa46b435af2f1b44fc85f859bb87556f315df11cd46.jpg)
133
+ Figure 4: Example Hierarchy of concepts discovered by UNHCLE on the YouCook2 dataset
134
+
135
+ # 3.3.2 COMPARISON WITH BASELINES
136
+
137
+ In this section, we evaluate the performance of UNHCLE quantitatively on YouCook23 and quantify its ability to generate coherent concepts that align with the human annotated ground truths using the TW-IoU metric. We compare our approach with 4 baselines. (1) Random baseline predicts segment randomly on the basis of uniformly sampled timestamps for a given video on the basis of its duration. (2) EQUALDIV consists of dividing the video into conceptual segments of equal duration (3) GRU-supervised: Further we also consider a naive supervised baseline comprising of a GRU Cho et al. (2014) based encoder that sequentially processes the Resnet features corresponding to frames in a video followed by a decoder GRU that attends Bahdanau et al. (2014) on encoder outputs and is trained to sequentially predict end timestamp of each meaningful segment (variable in number) in the video. (4) FLAT w/o comment: We implement the Shankar et al. (2019) approach which takes as input, a sequence of video frames and discovers a single level of concepts without any hierarchy. (5) FLAT w/ comment: This is a modification of the above baseline where we also decode comments from the single-level concept discovered and use that to give the model an extra signal which will help it in discovering better aligned concepts. See Figure 6(C) (in Appendix) (6) Clustering: Given an input sequence of frames, we define the weight function based on their temporal position in the sequence and also the $L _ { 2 }$ distance between the frame embeddings. Then we use standard K-means algorithm $\scriptstyle ( \mathrm { K } = 4 )$ to cluster the frames based on the weighting function defined and use the clusters formed to predict the temporal boundaries. (7) GRU_Seg: Instead of predicting end time stamps of each segment (as in GRU-supervised), the decoder is trained to predict/assign identical ids to frames which are part of the same segment. Further, the model’s decoder is trained to assign different ids to frames part of different segments while frames not part of any meaningful segment in the ground truth are trained to have a default null id - 0. During inference, continuous subsequence of frames predicted to be having same id are considered as part of one segment and different predicted segments are extracted accordingly (frames predicted to be having null ids are ignored).
138
+
139
+ For baselines, we predict only one level of concepts and hence refer to them as high-level concepts. Table 1a summarises and compares the TW-IoU computed between ground truth time stamp annotations and predicted/discovered segments. As can be seen, UNHCLE achieves the best TW-IoU compared to all other baselines. It can be noted that discovering only one (high) level of concepts (FLAT) results in low TW-IoU (for High-Level Concepts). However, UNHCLE discovers concepts that align better with the ground truth events (UNHCLE performs $\sim 2 3 \%$ better) compared to FLAT. Further, the GRU-supervised baseline performs better than FLAT but UNHCLE outperforms $( \sim 1 5 \% )$ the GRU-supervised baseline which shows that predicting such concepts is difficult even for a supervised baseline. Even though supervised GRU_Seg achieves better TW-IoU of 53.1 compared to high level concepts discovered by UNHCLE w/o comment as well as UNHCLE with comment, UNHCLE with comment (which is unsupervised) performance (TW-IoU 47.4) is still comparable with GRU_Seg. However, TW-IoU corresponding to low level concepts discovered by UNHCLE is better than GRU_Seg.
140
+
141
+ ![](images/cf2e5748cb19ef50a40666ddb927c0baa1cf7bf5a699e269079c91c38243a6e9.jpg)
142
+ Table 1: (a) TW-IoU scores for single level concepts predicted by the baselines along with the TW-IoU scores for both the high-level and low-level concepts for predictions from our proposed technique UNHCLE (b) Comparison showing the trade-off between number of down-sampled frames and TW-IoU for UNHCLE
143
+
144
+ <table><tr><td rowspan="2">Frames Used</td><td colspan="2">TW-IoU</td></tr><tr><td>high</td><td>low</td></tr><tr><td>200</td><td>37.4</td><td>58.7</td></tr><tr><td>64</td><td>33.4</td><td>34.0</td></tr><tr><td>32</td><td>13.1</td><td>12.7</td></tr></table>
145
+
146
+ # 3.3.3 EFFECT OF GUIDANCE THROUGH COMMENTARY
147
+
148
+ In this section, we discuss the improvement in the quality and precision of conceptual segments discovered by UNHCLE using video commentary to guide our model training on YouCook2 dataset. To study this, we compare UNHCLE without comment which discovers concept hierarchy using just frame observations in a video against UNHCLE with comment which additionally uses commentary as guide (as in Figure 2). Table 1a compares the TW-IoU of segments obtained corresponding to High Level Concepts for each of these two models. As can be seen, using commentary significantly improves the TW-IoU by $\sim 1 0 \%$ which establishes that using commentary enables UNHCLE to detect precise boundaries for segments corresponding to various concepts. However, we find only a marginal improvement of $\sim 1 \%$ in TW-IoU corresponding to low level concepts. Further, it can be seen in Figure 5 that using commentary allows the model to better understand how to merge lower-level concepts appropriately into higher-level concepts - “heat a pan, add 1 spoon oil and prosciutto to it” separately without merging it with subsequent segments.
149
+
150
+ ![](images/aeea5896a92812072ede49cc1fe492994b217ebd7af31683875fd36b837e4598.jpg)
151
+ Figure 5: In this figure, we show that using commentary as guide during training, UNHCLE learns to better combine low-level concepts to form high-level concepts which are better aligned towards our ground-truth annotations. A refers to the concept segments discovered w/o comments and B refers to the one with comment.
152
+
153
+ # 3.3.4 LABEL PREDICTION TASK FOR CHESS OPENINGS
154
+
155
+ We further evaluate UNHCLE on the task of label (name of opening $^ +$ variation) prediction corresponding to hierarchical concepts discovered. Since recommending Chess Openings comprises of a label for each sequence of moves in an opening, we train UNHCLE w/ commentary (Figure 2). Since there are at max only two segments corresponding to opening move and variation move in the dataset we use label prediction accuracy as our metric here instead of TW-IoU. There are 300 distinct labels and our model achieves $78 . 2 \%$ accuracy which shows that it is able to correctly discover the correct segmentation between openings with different variations as hierarchical concepts and associate them with the correct label in most of the test samples.
156
+
157
+ # 3.3.5 EFFECT OF SAMPLING RATE ON THE QUALITY OF HIERARCHY
158
+
159
+ For YouCook2 we down-sample 200 frames from the original 500 frames provided in the dataset and use that as our input to UNHCLE. We analyze the trade-off between time and performance if we further down-sample the frames. This also provides us a better insight into how much granular information regarding the video do we need to be able to discover better hierarchies. Table 1b shows the results obtained for our experiment. Interestingly, we don’t observe a linear drop in performance by reducing the number of frames. Even with just 64 frames, the results beat the other baselines.
160
+
161
+ # 3.4 ABLATION EXPERIMENTS & VISUAL ORDERING TASK
162
+
163
+ We performed more ablation experiments to show the need for the modules and the losses used in our model. We removed the soft- $\cdot D T W ( z _ { 1 : u } ^ { L } , c _ { 1 : u ^ { \prime } } ^ { \prime L } )$ loss from our UNHCLE (w/o comment) model in Figure 6(A) (in Appendix) to highlight the importance of this loss that guides traversing back and forth across the concept hierarchy. This loss guides the alignment between the initially generated low-level concepts $( z ^ { \dot { L } } )$ and the low-level concepts $( c ^ { \prime L } )$ extracted back from high-level concepts $( z ^ { H } )$ . Removing this loss reduces the TW-IoU scores drastically thus proving it’s necessity .See UNHCLE w/o comment w/o low-align loss in Table 2a.
164
+
165
+ We also choose a simplified version of the UNHCLE w/o commentary model shown in Fig. 6(A) (in Appendix), where we remove the $O C A ^ { L O W }$ modules and directly output $z ^ { H }$ , which looks simpler, but this removes the extra alignment signal as mentioned in the above point. We see this results in the drop of TW-IoU (Table 2a), thus confirming our need for the modules used. We call this the Direct Hierarchy baseline for which the system diagram is also provided in Figure 6(B) (in Appendix).
166
+
167
+ To show the effectiveness of the concepts discovered by UNHCLE we use them to perform a Visual Ordering Task. The task is that given a sequence of frames as input, our trained model (with frozen weights) should discover the high-level concepts associated with those frames and can be used to predict whether or not the given sequence of frames are in correct/meaningful order (binary classification). We use a simple 1-layer GRU to do so. To create the training data for this we take examples from the YouCook2 (Zhou et al. (2017)) dataset and randomly shuffle the sequence of frames creating 10 negative examples for each positive sample in the dataset. We finally evaluate this on our testing data after performing the same steps mentioned above and show our results in Table 2b. We report both the Accuracy and the F1 scores. As we can see that there is a significant gain of $9 \%$ in the F1 score and $2 \%$ in Accuracy using our model UNHCLE over the FLAT baseline.
168
+
169
+ ![](images/303a7456083be5c1b30e619a6b9528949bbdaec9cab5af51b55c0f46d038b1dd.jpg)
170
+ Table 2: (a) TW-IoU scores for ablation experiments for both high-level and low-level concepts prediction (b) Comparison between the Shankar et al. (2020) FLAT baseline and our proposed UNHCLE on the designed Visual Ordering Task.
171
+
172
+ # 4 CONCLUSION
173
+
174
+ We show that our approach (UNHCLE) discovers concepts and organizes them in a meaningful hierarchy using only demonstration data from chess openings and cooking. We also show that this discovered hierarchy of concepts is useful in predicting textual labels and temporal concept segmentations for the associated demonstrations. It would be interesting to use the concept hierarchy discovered by UNHCLE to generate a curriculum where lower-level concepts would be taught first followed by higher-level concepts. Another good direction would be to extend UNHCLE to learn different types of relationships between concepts without supervision.
175
+
176
+ # REFERENCES
177
+
178
+ Christopher G Atkeson and Stefan Schaal. Robot learning from demonstration. In ICML, volume 97, pp. 12–20. Citeseer, 1997.
179
+
180
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
181
+
182
+ Donald J Berndt and James Clifford. Using dynamic time warping to find patterns in time series. In KDD workshop, volume 10, pp. 359–370. Seattle, WA, USA:, 1994.
183
+
184
+ Angie W Boggust, Kartik Audhkhasi, Dhiraj Joshi, David Harwath, Samuel Thomas, Rogério Schmidt Feris, Danny Gutfreund, Yang Zhang, Antonio Torralba, Michael Picheny, et al. Grounding spoken words in unlabeled video. In CVPR Workshops, pp. 29–32, 2019.
185
+
186
+ Po-Yi Chen, Alexander H Liu, Yen-Cheng Liu, and Yu-Chiang Frank Wang. Towards scene understanding: Unsupervised monocular depth estimation with semantic-aware representation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2624–2632, 2019.
187
+
188
+ Kyunghyun Cho, Bart van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder–decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1724–1734, Doha, Qatar, October 2014. Association for Computational Linguistics. doi: 10.3115/v1/D14-1179. URL https://www.aclweb. org/anthology/D14-1179.
189
+
190
+ 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.
191
+
192
+ Marco Cuturi and Mathieu Blondel. Soft-DTW: a differentiable loss function for time-series. volume 70 of Proceedings of Machine Learning Research, pp. 894–903, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR.
193
+
194
+ 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.
195
+
196
+ Nasser Esmaili, Claude Sammut, and GM Shirazi. Behavioural cloning in control of a dynamic system. In 1995 IEEE International Conference on Systems, Man and Cybernetics. Intelligent Systems for the 21st Century, volume 3, pp. 2904–2909. IEEE, 1995.
197
+
198
+ Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. arXiv preprint arXiv:1802.06070, 2018.
199
+
200
+ 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.
201
+
202
+ 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. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8565–8574, 2019.
203
+
204
+ Jens Kober and Jan Peters. Learning motor primitives for robotics. In 2009 IEEE International Conference on Robotics and Automation, pp. 2112–2118. IEEE, 2009.
205
+
206
+ Franziska Meier, Evangelos Theodorou, Freek Stulp, and Stefan Schaal. Movement segmentation using a primitive library. In 2011 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 3407–3412. IEEE, 2011.
207
+
208
+ Adithyavairavan Murali, Animesh Garg, Sanjay Krishnan, Florian T Pokorny, Pieter Abbeel, Trevor Darrell, and Ken Goldberg. Tsc-dl: Unsupervised trajectory segmentation of multi-modal surgical demonstrations with deep learning. In 2016 IEEE International Conference on Robotics and Automation (ICRA), pp. 4150–4157. IEEE, 2016.
209
+
210
+ Michelangelo Naim, Mikhail Katkov, Stefano Recanatesi, and Misha Tsodyks. Emergence of hierarchical organization in memory for random material. Scientific Reports, 9(1):1–10, 2019.
211
+
212
+ Monica N Nicolescu and Maja J Mataric. Natural methods for robot task learning: Instructive demonstrations, generalization and practice. In Proceedings of the second international joint conference on Autonomous agents and multiagent systems, pp. 241–248, 2003.
213
+
214
+ Scott Niekum, Sarah Osentoski, George Konidaris, and Andrew G Barto. Learning and generalization of complex tasks from unstructured demonstrations. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5239–5246. IEEE, 2012.
215
+
216
+ VS Chandrasekhar Pammi, Krishna P Miyapuram, Raju S Bapi, and Kenji Doya. Chunking phenomenon in complex sequential skill learning in humans. In International Conference on Neural Information Processing, pp. 294–299. Springer, 2004.
217
+
218
+ Peter Pastor, Heiko Hoffmann, Tamim Asfour, and Stefan Schaal. Learning and generalization of motor skills by learning from demonstration. In 2009 IEEE International Conference on Robotics and Automation, pp. 763–768. IEEE, 2009.
219
+
220
+ Jan Peters, Jens Kober, Katharina Mülling, Oliver Krämer, and Gerhard Neumann. Towards robot skill learning: From simple skills to table tennis. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 627–631. Springer, 2013.
221
+
222
+ Stefan Schaal. Learning from demonstration. In Advances in neural information processing systems, pp. 1040–1046, 1997.
223
+
224
+ Karl Schmeckpeper, Annie Xie, Oleh Rybkin, Stephen Tian, Kostas Daniilidis, Sergey Levine, and Chelsea Finn. Learning predictive models from observation and interaction. arXiv preprint arXiv:1912.12773, 2019.
225
+
226
+ Tanmay Shankar, Shubham Tulsiani, Lerrel Pinto, and Abhinav Gupta. Discovering motor programs by recomposing demonstrations. In International Conference on Learning Representations, 2019.
227
+
228
+ Tanmay Shankar, Shubham Tulsiani, Lerrel Pinto, and Abhinav Gupta. Discovering motor programs by recomposing demonstrations. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $=$ rkgHY0NYwr.
229
+
230
+ Archit Sharma, Shixiang Gu, Sergey Levine, Vikash Kumar, and Karol Hausman. Dynamics-aware unsupervised discovery of skills. arXiv preprint arXiv:1907.01657, 2019.
231
+
232
+ Shao-Hua Sun, Hyeonwoo Noh, Sriram Somasundaram, and Joseph Lim. Neural program synthesis from diverse demonstration videos. In International Conference on Machine Learning, pp. 4790– 4799, 2018.
233
+
234
+ Fabio Tosi, Filippo Aleotti, Pierluigi Zama Ramirez, Matteo Poggi, Samuele Salti, Luigi Di Stefano, and Stefano Mattoccia. Distilled semantics for comprehensive scene understanding from videos. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4654–4665, 2020.
235
+
236
+ 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.
237
+
238
+ Danfei Xu, Suraj Nair, Yuke Zhu, Julian Gao, Animesh Garg, Li Fei-Fei, and Silvio Savarese. Neural task programming: Learning to generalize across hierarchical tasks. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 1–8. IEEE, 2018.
239
+
240
+ Luowei Zhou, Chenliang Xu, and Jason J Corso. Towards automatic learning of procedures from web instructional videos. arXiv preprint arXiv:1703.09788, 2017.
241
+
242
+ # A MORE DETAILS
243
+
244
+ We provide all the modified system diagrams for all the ablation experiments mentioned in Section 3.4 for clarity.
245
+
246
+ ![](images/5aeb794379236413ea2edfe263c4ed43b2c702d6b0464e05459c995df6020fff.jpg)
247
+ Figure 6: Three model variants are shown here. (A) refers to UNHCLE w/o comment. (B) refers to the Direct Hierarchy variant where we directly predict the high-level skill using OCA transformer. (C) refers to FLAT baseline with comment.
248
+
249
+ ![](images/1c898afb4b5afc6c130845006186b8b39b0fe7871295ded2fcba382313b0d510.jpg)
250
+ Figure 7: Skills discovered in the French defence.
251
+
252
+ ![](images/1e119e39379cd3e83883668bfa1e0116719e5fc3b1bb48f186e6028b5ccd1b3e.jpg)
253
+ Figure 8: Skills discovered in the Sicilian opening.
254
+
255
+ ![](images/a737a92bff8021cbf07c55a539bbea49807bb78bc26e8e0e877505a3055f4d5d.jpg)
256
+ Nimzowitsch Defense: Kennedy Variation丨 Linksspringer Variation
257
+ Figure 9: Skills discovered in the Nimzowitsch Defense: Kennedy Variation :Linksspringer Variation opening.
258
+
259
+ ![](images/3ce3b501b7047e903afb542053332208fca851f65eb3b7a9ba282cf222e06713.jpg)
260
+ Slav Defense: Exchange Variation
261
+ Figure 10: Skills discovered in the Slav Defense: Exchange Variation opening.
262
+
263
+ # Philidor Defense
264
+
265
+ ![](images/e80afc281e68c33c6a7c15e925cbf8e16b4cb1ac04a0d3e2192c52dda0fb7cb9.jpg)
266
+ Figure 11: Skills discovered in the Philidor Defense opening.
md/train/PiKUvDj5jyN/PiKUvDj5jyN.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/S19dR9x0b/S19dR9x0b.md ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ALTERNATING MULTI-BIT QUANTIZATION FORRECURRENT NEURAL NETWORKS
2
+
3
+ Chen $\mathbf { X } \mathbf { u } ^ { 1 , }$ ∗, Jianqiang $\mathbf { Y a o } ^ { 2 }$ , Zhouchen Lin1,3,†, Wenwu $\mathbf { O u } ^ { 2 }$ , Yuanbin $\mathbf { C a o ^ { 4 } }$ , Zhirong Wang2, Hongbin Zha1,3
4
+
5
+ 1 Key Laboratory of Machine Perception (MOE), School of EECS, Peking University, Ch
6
+ 2 Search Algorithm Team, Alibaba Group, China
7
+ 3 Cooperative Medianet Innovation Center, Shanghai Jiao Tong University, China
8
+ 4 AI-LAB, Alibaba Group, China
9
+
10
+ xuen@pku.edu.cn,tianduo@taobao.com,zlin@pku.edu.cn,santong.oww@taobao.com lingzun.cyb@alibaba-inc.com, qingfeng@taobao.com,zha@cis.pku.edu.cn
11
+
12
+ # ABSTRACT
13
+
14
+ Recurrent neural networks have achieved excellent performance in many applications. However, on portable devices with limited resources, the models are often too large to deploy. For applications on the server with large scale concurrent requests, the latency during inference can also be very critical for costly computing resources. In this work, we address these problems by quantizing the network, both weights and activations, into multiple binary codes $\{ - 1 , + 1 \}$ . We formulate the quantization as an optimization problem. Under the key observation that once the quantization coefficients are fixed the binary codes can be derived efficiently by binary search tree, alternating minimization is then applied. We test the quantization for two well-known RNNs, i.e., long short term memory (LSTM) and gated recurrent unit (GRU), on the language models. Compared with the full-precision counter part, by 2-bit quantization we can achieve ${ \sim } 1 6 \times$ memory saving and ${ \sim } 6 \times$ real inference acceleration on CPUs, with only a reasonable loss in the accuracy. By 3-bit quantization, we can achieve almost no loss in the accuracy or even surpass the original model, with ${ \sim } 1 0 . 5 \times$ memory saving and ${ \sim } 3 \times$ real inference acceleration. Both results beat the exiting quantization works with large margins. We extend our alternating quantization to image classification tasks. In both RNNs and feedforward neural networks, the method also achieves excellent performance.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Recurrent neural networks (RNNs) are specific type of neural networks which are designed to model the sequence data. In last decades, various RNN architectures have been proposed, such as LongShort-Term Memory (LSTM) (Hochreiter & Schmidhuber, 1997) and Gated Recurrent Units Cho et al. (2014). They have enabled the RNNs to achieve state-of-art performance in many applications, e.g., language models (Mikolov et al., 2010), neural machine translation (Sutskever et al., 2014; Wu et al., 2016), automatic speech recognition (Graves et al., 2013), image captions (Vinyals et al., 2015), etc. However, the models often build on high dimensional input/output,e.g., large vocabulary in language models, or very deep inner recurrent networks, making the models have too many parameters to deploy on portable devices with limited resources. In addition, RNNs can only be executed sequentially with dependence on current hidden states. This causes large latency during inference. For applications in the server with large scale concurrent requests, e.g., on-line machine translation and speech recognition, large latency leads to limited requests processed per machine to meet the stringent response time requirements. Thus much more costly computing resources are in demand for RNN based models.
19
+
20
+ To alleviate the above problems, several techniques can be employed, i.e., low rank approximation (Sainath et al., 2013; Jaderberg et al., 2014; Lebedev et al., 2014; Tai et al., 2016), sparsity (Liu et al., 2015; Han et al., 2015; 2016; Wen et al., 2016), and quantization. All of them are build on the redundancy of current networks and can be combined. In this work, we mainly focus on quantization based methods. More precisely, we are to quantize all parameters into multiple binary codes $\{ - 1 , + 1 \}$ .
21
+
22
+ The idea of quantizing both weights and activations is firstly proposed by (Hubara et al., 2016a). It has shown that even 1-bit binarization can achieve reasonably good performance in some visual classification tasks. Compared with the full precision counterpart, binary weights reduce the memory by a factor of 32. And the costly arithmetic operations between weights and activations can then be replaced by cheap XNOR and bitcount operations(Hubara et al., 2016a), which potentially leads to much acceleration. Rastegari et al. (2016) further incorporate a real coefficient to compensate for the binarization error. They apply the method to the challenging ImageNet dataset and achieve better performance than pure binarization in (Hubara et al., 2016a). However, it is still of large gap compared with the full precision networks. To bridge this gap, some recent works (Hubara et al., 2016b; Zhou et al., 2016; 2017) further employ quantization with more bits and achieve plausible performance. Meanwhile, quite an amount of works, e.g., (Courbariaux et al., 2015; Li et al., 2016; Zhu et al., 2017; Guo et al., 2017), quantize the weights only. Although much memory saving can be achieved, the acceleration is very limited in modern computing devices (Rastegari et al., 2016).
23
+
24
+ Among all existing quantization works, most of them focus on convolutional neural networks (CNNs) while pay less attention to RNNs. As mentioned earlier, the latter is also very demanding. Recently, (Hou et al., 2017) showed that binarized LSTM with preconditioned coefficients can achieve promising performance in some easy tasks such as predicting the next character. However, for RNNs with large input/output, e.g., large vocabulary in language models, it is still very challenging for quantization. Both works of Hubara et al. (2016b) and Zhou et al. (2017) test the effectiveness of their multi-bit quantized RNNs to predict the next word. Although using up to 4-bits, the results with quantization still have noticeable gap with those with full precision. This motivates us to find a better method to quantize RNNs. The main contribution of this work is as follows:
25
+
26
+ (a) We formulate the multi-bit quantization as an optimization problem. The binary codes $\{ - 1 , + 1 \}$ are learned instead of rule-based. For the first time, we observe that the codes can be optimally derived by the binary search tree once the coefficients are knowns in advance, see, e.g., Algorithm 1. Thus the whole optimization is eased by removing the discrete unknowns, which are very difficult to handle.
27
+ (b) We propose to use alternating minimization to tackle the quantization problem. By separating the binary codes and real coefficients into two parts, we can solve the subproblem efficiently when one part is fixed. With proper initialization, we only need two alternating cycles to get high precision approximation, which is effective enough to even quantize the activations on-line.
28
+ (c) We systematically evaluate the effectiveness of our alternating quantization on language models. Two well-known RNN structures, i.e., LSTM and GRU, are tested with different quantization bits. Compared with the full-precision counterpart, by 2-bit quantization we can achieve ${ \sim } 1 6 \times$ memory saving and ${ \sim } 6 \times$ real inference acceleration on CPUs, with a reasonable loss on the accuracy. By 3-bit quantization, we can achieve almost no loss in accuracy or even surpass the original model with ${ \sim } 1 0 . 5 \times$ memory saving and ${ \sim } 3 \times$ real inference acceleration. Both results beat the exiting quantization works with large margins. To illustrate that our alternating quantization is very general to extend, we apply it to image classification tasks. In both RNNs and feedforward neural networks, the technique still achieves very plausible performance.
29
+
30
+ # 2 EXISTING MULTI-BIT QUANTIZATION METHODS
31
+
32
+ Before introducing our proposed multi-bit quantization, we first summarize existing works as follows:
33
+
34
+ (a) Uniform quantization method (Rastegari et al., 2016; Hubara et al., 2016b) firstly scales its value in the range $x \in [ - 1 , 1 ]$ . Then it adopts the following $k$ -bit quantization:
35
+
36
+ $$
37
+ q _ { k } ( x ) = 2 \left( { \frac { \mathrm { r o u n d } [ ( 2 ^ { k } - 1 ) ( { \frac { x + 1 } { 2 } } ) ] } { 2 ^ { k } - 1 } } - { \frac { 1 } { 2 } } \right) ,
38
+ $$
39
+
40
+ after which the method scales back to the original range. Such quantization is rule based thus is very easy to implement. The intrinsic benefit is that when computing inner product of two quantized vectors, it can employ cheap bit shift and count operations to replace costly multiplications and additions operations. However, the method can be far from optimum when quantizing non-uniform data, which is believed to be the trained weights and activations of deep neural network (Zhou et al., 2017).
41
+
42
+ ![](images/4f13881a57cb01eb9a17cb0533e6fb473bcb0ded73f5f08daa4933f07808e26a.jpg)
43
+ Figure 1: Illustration of the optimal 2-bit quantization when $\alpha _ { 1 }$ and $\alpha _ { 2 }$ ${ \bf \tilde { \alpha } } _ { 1 } \geq { \alpha _ { 2 } } , { \bf \tilde { \alpha } } _ { \bf \tilde { \alpha } } { \bf \Psi } $ ) are known in advance. The values are quantized into $- \alpha _ { 1 } - \alpha _ { 2 }$ , $- \alpha _ { 1 } + \alpha _ { 2 }$ , $\alpha _ { 1 } - \alpha _ { 2 }$ , and $\alpha _ { 1 } + \alpha _ { 2 }$ , respectively. And the partition intervals are optimally separated by the middle points of adjacent quantization codes, i.e., $- \alpha _ { 1 } , 0$ , and $\alpha _ { 1 }$ , correspondingly.
44
+
45
+ (b) Balanced quantization (Zhou et al., 2017) alleviates the drawbacks of the uniform quantization by firstly equalizing the data. The method constructs $2 ^ { k }$ intervals which contain roughly the same percentage of the data. Then it linearly maps the center of each interval to the corresponding quantization code in (1). Although sounding more reasonable than the uniform one, the affine transform on the centers can still be suboptimal. In addition, there is no guarantee that the evenly spaced partition is more suitable if compared with the non-evenly spaced partition for a specific data distribution.
46
+
47
+ (c) Greedy approximation (Guo et al., 2017) instead tries to learn the quantization by tackling the following problem:
48
+
49
+ $$
50
+ \operatorname* { m i n } _ { \{ \alpha _ { i } , \mathbf { b } _ { i } \} _ { i = 1 } ^ { k } } \left\| \mathbf { w } - \sum _ { i = 1 } ^ { k } \alpha _ { i } \mathbf { b } _ { i } \right\| ^ { 2 } , \quad \mathrm { w i t h } \quad \mathbf { b } _ { i } \in \{ - 1 , + 1 \} ^ { n } .
51
+ $$
52
+
53
+ For $k = 1$ , the above problem has a closed-form solution (Rastegari et al., 2016). Greedy approximation extends to $k$ -bit $k > 1 ,$ ) quantization by sequentially minimizing the residue. That is
54
+
55
+ $$
56
+ \operatorname* { m i n } _ { \alpha _ { i } , \mathbf { b } _ { i } } \left\| \mathbf { r } _ { i - 1 } - \alpha _ { i } \mathbf { b } _ { i } \right\| ^ { 2 } , \quad \mathrm { w i t h } \quad \mathbf { r } _ { i - 1 } = \mathbf { w } - \sum _ { j = 1 } ^ { i - 1 } \alpha _ { j } \mathbf { b } _ { j } .
57
+ $$
58
+
59
+ Then the optimal solution is given as
60
+
61
+ $$
62
+ \alpha _ { i } = { \frac { 1 } { n } } \| \mathbf { r } _ { i - 1 } \| _ { 1 } \quad { \mathrm { a n d } } \quad \mathbf { b } _ { i } = \mathrm { s i g n } ( \mathbf { r } _ { i - 1 } ) .
63
+ $$
64
+
65
+ Greedy approximation is very efficient to implement in modern computing devices. Although not able to reach a high precision solution, the formulation of minimizing quantization error is very promising.
66
+
67
+ (d) Refined greedy approximation (Guo et al., 2017) extends to further decrease the quantization error. In the $j$ -th iteration after minimizing problem (3), the method adds one extra step to refine all computed $\{ \alpha _ { i } \} _ { i = 1 } ^ { j }$ with the least squares solution:
68
+
69
+ $$
70
+ [ \alpha _ { 1 } , \ldots , \alpha _ { j } ] = \left( ( \mathbf { B } _ { j } ^ { T } \mathbf { B } _ { j } ) ^ { - 1 } \mathbf { B } _ { j } ^ { T } \mathbf { w } \right) ^ { T } , \quad \mathrm { w i t h } \quad \mathbf { B } _ { j } = [ \mathbf { b } _ { 1 } , \ldots , \mathbf { b } _ { j } ] ,
71
+ $$
72
+
73
+ In experiments of quantizing the weights of CNN, the refined approximation is verified to be better than the original greedy one. However, as we will show later, the refined method is still far from satisfactory for quantization accuracy.
74
+
75
+ Besides the general multi-bit quantization as summarized above, Li et al. (2016) propose ternary quantization by extending 1-bit binarization with one more feasible state, 0. It does quantization by tackling $\operatorname* { m i n } _ { \alpha }$ ,t $\| \mathbf { w } - \alpha \mathbf { t } \| _ { 2 } ^ { 2 }$ with $\mathbf { t } \in \{ - 1 , 0 , + 1 \} ^ { n }$ . However, no efficient algorithm is proposed in (Li et al., 2016). They instead empirically set the entries $w$ with absolute scales less than $0 . 7 / n \| \mathbf { w } \| _ { 1 }$ to 0 and binarize the left entries as (4). In fact, ternary quantization is a special case of the 2-bit quantization in (2), with an additional constraint that $\alpha _ { 1 } = \alpha _ { 2 }$ . When the binary codes are fixed, the optimal coefficient $\alpha _ { 1 }$ (or $\alpha _ { 2 }$ ) can be derived by least squares solution similar to (5).
76
+
77
+ ![](images/fa9074f4c21ef1f9c64faf20110b0ba23d97f306259495b2dc134619b2c7e9a5.jpg)
78
+ Figure 2: Illustration of binary search tree to determine the optimal quantization.
79
+
80
+ # Algorithm 1: Binary Search Tree (BST) to determine to optimal code
81
+
82
+ BST $( w , \mathbf { v } )$ $\{ w$ is the real value to be quantized} { $\mathbf { v }$ is the vector of quantization codes in ascending order} $m = \mathrm { l e n g t h } ( \mathbf { v } )$ 2 if $m = = 1$ then 3 return $\mathbf { v } _ { 1 }$ 4 end 5 if $w \ge ( v _ { m / 2 } + v _ { m / 2 + 1 } ) / 2$ then 6 BST $( w , \mathbf { v } _ { m / 2 + 1 : m } )$ ) 7 else 8 BST( w, v1:m/2) 9 end
83
+
84
+ In parallel to the binarized quantization discussed here, vector quantization is applied to compress the weights for feedforward neural networks (Gong et al., 2014; Han et al., 2016). Different from ours where all weights are directly constraint to $\{ - 1 , + 1 \}$ , vector quantization learns a small codebook by applying k-means clustering to the weights or conducting product quantization. The weights are then reconstructed by indexing the codebook. It has been shown that by such a technique, the number of parameters can be reduced by an order of magnitude with limited accuracy loss (Gong et al., 2014). It is possible that the multi-bit quantized binary weight can be further compressed by using the product quantization.
85
+
86
+ # 3 OUR ALTERNATING MULTI-BIT QUANTIZATION
87
+
88
+ Now we introduce our quantization method. We tackle the same minimization problem as (2). For simplicity, we firstly consider the problem with $k = 2$ . Suppose that $\alpha _ { 1 }$ and $\alpha _ { 2 }$ are known in advance with $\alpha _ { 1 } \geq \alpha _ { 2 } \geq 0$ , then the quantization codes are restricted to $\mathbf { v } = \{ - \alpha _ { 1 } - \alpha _ { 2 } , - \alpha _ { 1 } + \alpha _ { 2 } , \alpha _ { 1 } -$ $\alpha _ { 2 } , \alpha _ { 1 } + \alpha _ { 2 } \}$ . For any entry $w$ of w in problem (2), its quantization code is determined by the least distance to all codes. Consequently, we can partition the number axis into 4 intervals. And each interval corresponds to one particular quantization code. The common point of two adjacent intervals then becomes the middle point of the two quantization codes, i.e., $- \alpha _ { 1 } , 0$ , and $\alpha _ { 1 }$ . Fig. 1 gives an illustration.
89
+
90
+ For the general $k$ -bit quantization, suppose that $\{ \alpha _ { i } \} _ { i = 1 } ^ { k }$ are known and we have all possible codes in ascending order, i.e., $\begin{array} { r } { \mathbf { v } = \{ - \sum _ { i = 1 } ^ { k } \alpha _ { i } } \end{array}$ , . $\textstyle \ldots , \sum _ { i = 1 } ^ { k } \alpha _ { i } \}$ . Similarly, we can partition the number axis into $2 ^ { k }$ intervals, in which the boundaries are determined by the centers of two adjacent codes in $\mathbf { v }$ , i.e., $\{ ( v _ { i } + v _ { i + 1 } ) / 2 \} _ { i = 1 } ^ { 2 ^ { k } - 1 }$ . However, directly comparing per entry with all the boundaries needs $2 ^ { k }$ comparisons, which is very inefficient. Instead, we can make use of the ascending property in $\mathbf { v }$ . Hierarchically, we partition the codes of $\mathbf { v }$ evenly into two ordered sub-sets, i.e., $\mathbf { v } _ { 1 : m / 2 }$ and $\mathbf { v } _ { m / 2 + 1 : m }$ with $m$ defined as the length of $\mathbf { v }$ . If $w < ( v _ { m / 2 } + v _ { m / 2 + 1 } ) / 2$ , its feasible codes are then optimally restricted to $\mathbf { v } _ { 1 : m / 2 }$ . And if $w \ge ( v _ { m / 2 } + v _ { m / 2 + 1 } ) / 2$ , its feasible codes become $\mathbf { v } _ { m / 2 + 1 : m }$ By recursively evenly partition the ordered feasible codes, we can then efficiently determine the
91
+
92
+ # Algorithm 2: Alternating Multi-bit Quantization
93
+
94
+ Require :Ensure : on weight $\mathbf { w } \in \mathbb { R } ^ { n }$ , number of bits $k$ , total iterations $T$ $\{ \alpha _ { i } , \mathbf { \bar { b } } _ { i } \} _ { i = 1 } ^ { k }$
95
+ 1 Greedy Initialize $\{ \alpha _ { i } , \mathbf { b } _ { i } \} _ { i = 1 } ^ { k }$ as (4)
96
+ 2 for iter $ 1$ to $T$ do
97
+ 3 Update $\{ \alpha _ { i } \} _ { i = 1 } ^ { k }$ as (5)
98
+ 4 Construct $\mathbf { v }$ of all feasible codes in accending order
99
+ 5 Update $\{ { \bf b } _ { i } \} _ { i = 1 } ^ { k }$ as Algorithm 1.
100
+ 6 end
101
+
102
+ optimal code for per entry by only $k$ comparisons. The whole procedure is in fact a binary search tree. We summarize it in Algorithm 1. Note that once getting the quantization code, it is straightforward to map to the binary code b. Also, by maintaining a mask vector with the same size as w to indicate the partitions, we could operate BST for all entries simultaneously. To give a better illustration, we give a binary tree example for $k = 2$ in Fig. 2. Note that for $k = 2$ , we can even derive the optimal codes by a closed form solution, i.e., $\mathbf { b } _ { 1 } = \mathrm { s i g n } ( \mathbf { w } )$ and $\mathbf { b } _ { 2 } = \mathrm { s i g n } ( \mathbf { w } - \alpha _ { 1 } \mathbf { b } _ { 1 } )$ with $\alpha _ { 1 } \geq \alpha _ { 2 } \geq 0$ .
103
+
104
+ Under the above observation, let us reconsider the refined greedy approximation (Guo et al., 2017) introduced in Section 2. After modification on the computed $\{ \alpha _ { i } \} _ { i = 1 } ^ { j }$ as (5), $\{ { \bf b } _ { i } \} _ { i = 2 } ^ { j }$ are no longer optimal while the method keeps all of them fixed. To improve the refined greedy approximation, alternating minimizing $\{ \alpha _ { i } \} _ { i = 1 } ^ { k }$ and $\{ { \bf b } _ { i } \} _ { i = 1 } ^ { k }$ becomes a natural choice. Once getting $\{ { \bf b } _ { i } \} _ { i = 1 } ^ { k }$ as described above, we can optimize $\{ \alpha _ { i } \} _ { i = 1 } ^ { k }$ as (5). In real experiments, we find that by greedy initialization as (4), only two alternating cycles is good enough to find high precision quantization. For better illustration, we summarize our alternating minimization in Algorithm 2. For updating $\{ \alpha _ { i } \} _ { i = 1 } ^ { k }$ , we need $2 k ^ { 2 } n$ binary operations and $k n$ non-binary operations. Combining kn non-binary operations to determine the binary code, for total $T$ alternating cycles, we thus need $2 T k ^ { 2 } n$ binary operations and $2 ( T + 1 ) k n$ non-binary operations to quantize $\mathbf { w } \in \mathbb { R } ^ { n }$ into $k$ -bit, with the extra $2 k n$ corresponding to greedy initialization.
105
+
106
+ # 4 APPLY ALTERNATING MULTI-BIT QUANTIZATION TO RNNS
107
+
108
+ Implementation. We firstly introduce the implementation details for quantizing RNN. For simplicity, we consider the one layer LSTM for language model. The goal is to predict the next word indexed by $t$ in a sequence of one-hot word tokens $( y _ { 1 } ^ { * } , \dots , y _ { N } ^ { * } )$ as follows:
109
+
110
+ $$
111
+ \begin{array} { r l } & { \mathbf { x } _ { t } = \mathbf { W } _ { e } ^ { T } \mathbf { y } _ { t - 1 } ^ { * } , } \\ & { \mathbf { i } _ { t } , \mathbf { f } _ { t } , \mathbf { 0 } _ { t } , \mathbf { g } _ { t } = \sigma ( \mathbf { W } _ { i } \mathbf { x } _ { t } + \mathbf { b } _ { i } + \mathbf { W } _ { h } \mathbf { h } _ { t - 1 } + \mathbf { b } _ { h } ) , } \\ & { \mathbf { c } _ { t } = \mathbf { f } _ { t } \odot \mathbf { c } _ { t - 1 } + \mathbf { i } _ { t } \odot \mathbf { g } _ { t } , \quad \mathbf { h } _ { t } = \mathbf { o } _ { t } \odot \operatorname { t a n h } ( \mathbf { c } _ { t } ) , } \\ & { \mathbf { y } _ { t } = \operatorname { s o f t m a x } ( \mathbf { W } _ { s } \mathbf { h } _ { t } + \mathbf { b } _ { s } ) . } \end{array}
112
+ $$
113
+
114
+ where $\sigma$ represents the activation function. In the above formulation, the multiplication between the weight matrices and the vectors $\mathbf { x } _ { t }$ and $\mathbf { h } _ { t }$ occupy most of the computation. This is also where we apply quantization to. For the weight matrices, We do not apply quantization on the full but rather row by row. During the matrix vector product, we can firstly execute the binary multiplication. Then element-wisely multiply the obtained binary vector with the high precision scaling coefficients. Thus little extra computation results while much more freedom is brought to better approximate the weights. We give an illustration on the left part of Fig. 3. Due to one-hot word tokens, $\mathbf { x } _ { t }$ corresponds to one specific row in the quantized ${ \mathbf W } _ { e }$ . It needs no more quantization. Different from the weight matrices, $\mathbf { h } _ { t }$ depends on the input, which needs to be quantized on-line during inference. For consistent notation with existing work, e.g., (Hubara et al., 2016b; Zhou et al., 2017), we also call quantizing on $\mathbf { h } _ { t }$ as quantizing on activation.
115
+
116
+ For $\mathbf { W } \in \mathbb { R } ^ { m \times n }$ and $\mathbf { h } _ { t } \in \mathbb { R } ^ { n }$ , the standard matrix-vector product needs $2 m n$ operations. For the quantized product between $k _ { w }$ -bit $\mathbf { W }$ and $k _ { h }$ -bit $\mathbf { h _ { t } }$ , we have $2 k _ { w } k _ { h } m n + 4 k _ { h } ^ { 2 } n$ binary operations and $6 k _ { h } n + 2 k _ { w } k _ { h } m$ non-binary operations, where $6 k _ { h } n$ corresponds to the cost of alternating approximation $T = 2$ ) and $2 k _ { w } k _ { h } m$ corresponds to the final product with coefficients. As the binary multiplication operates in 1 bit, whereas the full precision multiplication operates in 32 bits, despite the feasible implementations, the acceleration can be $3 2 \times$ in theory. For alternating quantization here, the overall theoretical acceleration is thus computed as γ = 2mn132 (2kwkhmn+4k2nn)+6khn+2kwkhm . Suppose that LSTM has hidden states $n = 1 0 2 4$ , then we have $\mathbf { W } _ { h } \in \mathbb { R } ^ { 4 0 9 6 \times 1 0 2 4 }$ . The acceleration ratio becomes roughly $7 . 5 \times$ for $( k _ { h } , k _ { w } ) = ( 2 , 2 )$ and $3 . 5 \times$ for $( k _ { h } , k _ { w } ) = ( 3 , 3 )$ . In addition to binary operations, the acceleration in real implementations can be largely affected by the size of the matrix, where much memory reduce can result in better utilizing in the limited faster cache. We implement the binary multiplication kernel in CPUs. Compared with the much optimized Intel Math Kernel Library (MKL) on full precision matrix vector multiplication, we can roughly achieve $6 \times$ for $( k _ { h } , k _ { w } ) = ( \bar { 2 } , 2 )$ and $3 \times$ for $( \bar { k } _ { h } , k _ { w } ) = ( 3 , 3 )$ . For more details, please refer to Appendix A.
117
+
118
+ ![](images/d6c4f5454538f22da72e0dc20a0dbf4fa20423fa95de60b1cf88d1165d505936.jpg)
119
+ Figure 3: Illustration of quantized matrix vector multiplication (left part). The matrix is quantized row by row, which provides more freedom to approximate while adds little extra computation. By reformulating as the right part, we can make full use of the intrinsic parallel binary matrix vector multiplication for further acceleration.
120
+
121
+ As indicated in the left part of Fig. 3, the binary multiplication can be conducted sequentially by associativity. Although the operation is suitable for parallel computing by synchronously conducting the multiplication, this needs extra effort for parallelization. We instead concatenate the binary codes as shown in the right part of Fig. 3. Under such modification, we are able to make full use of the much optimized inner parallel matrix multiplication, which gives the possibility for further acceleration. The final result is then obtained by adding all partitioned vectors together, which has little extra computation.
122
+
123
+ Training. As firstly proposed by Courbariaux et al. (2015), during the training of quantized neural network, directly adding the moderately small gradients to quantized weights will result in no change on it. So they maintain a full precision weight to accumulate the gradients then apply quantization in every mini-batch. In fact, the whole procedure can be mathematically formulated as a bi-level optimization (Colson et al., 2007) problem:
124
+
125
+ $$
126
+ \begin{array} { r l } { \displaystyle \operatorname* { m i n } _ { \mathbf { w } , \{ \alpha _ { i } , \mathbf { b } _ { i } \} _ { i = 1 } ^ { k } } f ( \sum _ { i = 1 } ^ { k } \alpha _ { i } \mathbf { b } _ { i } ) } & { } \\ { s . t . } & { \{ \alpha _ { i } , \mathbf { b } _ { i } \} _ { i = 1 } ^ { k } = \arg \operatorname* { m i n } _ { \{ \alpha _ { i } ^ { \prime } , \mathbf { b } _ { i } ^ { \prime } \} _ { i = 1 } ^ { k } } \| \mathbf { w } - \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { \prime } \mathbf { b } _ { i } ^ { \prime } \| ^ { 2 } . } \end{array}
127
+ $$
128
+
129
+ Denote the quantized weight as $\begin{array} { r } { \hat { \mathbf { w } } = \sum _ { i = 1 } ^ { k } \alpha _ { i } \mathbf { b } _ { i } } \end{array}$ . In the forward propagation, we derive wˆ from the full precision w in the lower-level problem and apply it to the upper-level function $f ( \cdot )$ , i.e., RNN in this paper. During the backward propagation, the derivative $\frac { \partial f } { \partial \hat { \bf w } }$ is propagated back to w through the lower-level function. Due to the discreteness of $\mathbf { b } _ { i }$ , it is very hard to model the implicit dependence2015), i.e., $\hat { \mathbf { w } }$ w. So we also adopt the “straight-through estimate” as (. To compute the derivative on the quantized hidden state urbariaux et al.,, the same trick $\begin{array} { r } { \frac { \partial f } { \partial \mathbf { w } } = \frac { \partial f } { \partial \hat { \mathbf { w } } } } \end{array}$ $\mathbf { h } _ { t }$ is applied. During the training, we find the same phenomenon as Hubara et al. (2016b) that some entries of w can grow very large, which become outliers and harm the quantization. Here we simply clip w in the range of $[ - 1 , 1 ]$ .
130
+
131
+ Table 1: Measurement on the approximation of different quantization methods, e.g., Uniform (Hubara et al., 2016b), Balanced (Zhou et al., 2017), Greedy (Guo et al., 2017), Refined (Guo et al., 2017), and our Alternating method, see Section 2. We apply these methods to quantize the full precision pre-trained weight of LSTM on the PTB dataset. The best values are in bold. W-bits represents the number of weight bits and FP denotes full precision.
132
+
133
+ <table><tr><td rowspan=1 colspan=4>Relative MSE</td><td rowspan=1 colspan=4>Testing PPW</td></tr><tr><td rowspan=1 colspan=1>W-Bits</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>FP</td></tr><tr><td rowspan=1 colspan=1>Uniform</td><td rowspan=1 colspan=1>1.070</td><td rowspan=1 colspan=1>0.404</td><td rowspan=1 colspan=1>0.302</td><td rowspan=1 colspan=1>283.2</td><td rowspan=1 colspan=1>227.3</td><td rowspan=1 colspan=1>216.3</td><td rowspan=5 colspan=1>89.8</td></tr><tr><td rowspan=1 colspan=1>Balanced</td><td rowspan=1 colspan=1>0.891</td><td rowspan=1 colspan=1>0.745</td><td rowspan=1 colspan=1>0.702</td><td rowspan=1 colspan=1>10287.6</td><td rowspan=1 colspan=1>9106.4</td><td rowspan=1 colspan=1>8539.8</td></tr><tr><td rowspan=1 colspan=1>Greedy</td><td rowspan=1 colspan=1>0.146</td><td rowspan=1 colspan=1>0.071</td><td rowspan=1 colspan=1>0.042</td><td rowspan=1 colspan=1>118.9</td><td rowspan=1 colspan=1>99.4</td><td rowspan=1 colspan=1>95.0</td></tr><tr><td rowspan=1 colspan=1>Refined</td><td rowspan=1 colspan=1>0.137</td><td rowspan=1 colspan=1>0.060</td><td rowspan=1 colspan=1>0.030</td><td rowspan=1 colspan=1>105.3</td><td rowspan=1 colspan=1>95.4</td><td rowspan=1 colspan=1>93.1</td></tr><tr><td rowspan=1 colspan=1>Alternating (ours)</td><td rowspan=1 colspan=1>0.125</td><td rowspan=1 colspan=1>0.043</td><td rowspan=1 colspan=1>0.019</td><td rowspan=1 colspan=1>103.1</td><td rowspan=1 colspan=1>93.8</td><td rowspan=1 colspan=1>91.4</td></tr></table>
134
+
135
+ Table 2: Quantization on the full precision pre-trained weight of GRU on the PTB dataset.
136
+
137
+ <table><tr><td rowspan=1 colspan=4>Relative MSE</td><td rowspan=1 colspan=4>Testing PPW</td></tr><tr><td rowspan=1 colspan=1>W-Bits</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>FP</td></tr><tr><td rowspan=1 colspan=1>Uniform</td><td rowspan=1 colspan=1>6.138</td><td rowspan=1 colspan=1>3.920</td><td rowspan=1 colspan=1>3.553</td><td rowspan=1 colspan=1>3161906.6</td><td rowspan=1 colspan=1>771259.6</td><td rowspan=1 colspan=1>715781.9</td><td rowspan=5 colspan=1>92.5</td></tr><tr><td rowspan=1 colspan=1>Balanced</td><td rowspan=1 colspan=1>1.206</td><td rowspan=1 colspan=1>1.054</td><td rowspan=1 colspan=1>1.006</td><td rowspan=1 colspan=1>2980.4</td><td rowspan=1 colspan=1>3396.3</td><td rowspan=1 colspan=1>3434.1</td></tr><tr><td rowspan=1 colspan=1>Greedy</td><td rowspan=1 colspan=1>0.377</td><td rowspan=1 colspan=1>0.325</td><td rowspan=1 colspan=1>0.304</td><td rowspan=1 colspan=1>135.7</td><td rowspan=1 colspan=1>105.5</td><td rowspan=1 colspan=1>99.2</td></tr><tr><td rowspan=1 colspan=1>Refined</td><td rowspan=1 colspan=1>0.128</td><td rowspan=1 colspan=1>0.055</td><td rowspan=1 colspan=1>0.030</td><td rowspan=1 colspan=1>111.6</td><td rowspan=1 colspan=1>99.1</td><td rowspan=1 colspan=1>97.0</td></tr><tr><td rowspan=1 colspan=1>Alternating (ours)</td><td rowspan=1 colspan=1>0.120</td><td rowspan=1 colspan=1>0.044</td><td rowspan=1 colspan=1>0.021</td><td rowspan=1 colspan=1>110.3</td><td rowspan=1 colspan=1>97.3</td><td rowspan=1 colspan=1>95.2</td></tr></table>
138
+
139
+ # 5 EXPERIMENTS ON THE LANGUAGE MODELS
140
+
141
+ In this section, we conduct quantization experiments on language models. The two most well-known recurrent neural networks, i.e., LSTM (Hochreiter & Schmidhuber, 1997) and GRU (Cho et al., 2014), are evaluated. As they are to predict the next word, the performance is measured by perplexity per word (PPW) metric. For all experiments, we initialize with the pre-trained model and using vanilla SGD. The initial learning rate is set to 20. Every epoch we evaluate on the validation dataset and record the best value. When the validation error exceeds the best record, we decrease learning rate by a factor of 1.2. Training is terminated once the learning rate less than 0.001 or reaching the maximum epochs, i.e., 80. The gradient norm is clipped in the range $[ - 0 . 2 5 , 0 . 2 5 ]$ . We unroll the network for 30 time steps and regularize it with the standard dropout (probability of dropping out units equals to 0.5) (Zaremba et al., 2014). For simplicity of notation, we denote the methods using uniform, balanced, greedy, refined greedy, and our alternating quantization as Uniform, Balanced, Greedy, Refined, and Alternating, respectively.
142
+
143
+ Peen Tree Bank. We first conduct experiments on the Peen Tree Bank (PTB) corpus (Marcus et al., 1993), using the standard preprocessed splits with a 10K size vocabulary (Mikolov, 2012). The PTB dataset contains 929K training tokens, 73K validation tokens, and 82K test tokens. For fair comparison with existing works, we also use LSTM and GRU with 1 hidden layer of size 300. To have a glance at the approximation ability of different quantization methods as detailed in Section 2, we firstly conduct experiments by directly quantizing the trained full precision weight (neither quantization on activation nor retraining). Results on LSTM and GRU are shown in Table 1 and Table 2, respectively. The left parts record the relative mean squared error of quantized weight matrices with full precision one. We can see that our proposed Alternating can get much lower error across all varying bit. We also measure the testing PPW for the quantized weight as shown in the right parts of Table 1 and 2. The results are in consistent with the left part, where less errors result in lower testing PPW. Note that Uniform and Balanced quantization are rule-based and not aim at minimizing the error. Thus they can have much worse result by direct approximation. We also repeat the experiment on other datasets. For both LSTM and GRU, the results are very similar to here.
144
+
145
+ Table 3: Testing PPW of multi-bit quantized LSTM and GRU on the PTB dataset. W-Bits and A-Bits represent the number of weight and activation bits, respectively.
146
+
147
+ <table><tr><td rowspan=1 colspan=6>LSTM</td><td rowspan=1 colspan=5>GRU</td></tr><tr><td rowspan=1 colspan=1>W-Bits /A-Bits</td><td rowspan=1 colspan=1>2/2</td><td rowspan=1 colspan=1>2/3</td><td rowspan=1 colspan=1>3/3</td><td rowspan=1 colspan=1>4/4</td><td rowspan=1 colspan=1>FP/FP</td><td rowspan=1 colspan=1>2/2</td><td rowspan=1 colspan=1>2/3</td><td rowspan=1 colspan=1>3/3</td><td rowspan=1 colspan=1>4/4</td><td rowspan=1 colspan=1>FP/FP</td></tr><tr><td rowspan=1 colspan=1>Uniform</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>220</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>97</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>Balanced</td><td rowspan=1 colspan=1>126</td><td rowspan=1 colspan=1>123</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>114</td><td rowspan=1 colspan=1>107</td><td rowspan=1 colspan=1>142</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>116</td><td rowspan=1 colspan=1>100</td></tr><tr><td rowspan=1 colspan=1>Refined</td><td rowspan=1 colspan=1>100.3</td><td rowspan=1 colspan=1>95.6</td><td rowspan=1 colspan=1>91.3</td><td rowspan=1 colspan=1>二</td><td rowspan=2 colspan=1>89.8</td><td rowspan=1 colspan=1>105.1</td><td rowspan=1 colspan=1>100.3</td><td rowspan=1 colspan=1>95.9</td><td rowspan=1 colspan=1>二</td><td rowspan=2 colspan=1>92.5</td></tr><tr><td rowspan=1 colspan=1>Alternating (ours)</td><td rowspan=1 colspan=1>95.8</td><td rowspan=1 colspan=1>91.9</td><td rowspan=1 colspan=1>87.9</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>101.2</td><td rowspan=1 colspan=1>97.0</td><td rowspan=1 colspan=1>92.9</td><td rowspan=1 colspan=1>1</td></tr></table>
148
+
149
+ Table 4: Testing PPW of multi-bit quantized LSTM and GRU on the WikiText-2 dataset.
150
+
151
+ <table><tr><td rowspan=1 colspan=5>LSTM</td><td rowspan=1 colspan=4>GRU</td></tr><tr><td rowspan=1 colspan=1>W-Bits / A-Bits</td><td rowspan=1 colspan=1>2/2</td><td rowspan=1 colspan=1>2/3</td><td rowspan=1 colspan=1>3/3</td><td rowspan=1 colspan=1>FP/FP</td><td rowspan=1 colspan=1>2/2</td><td rowspan=1 colspan=1>2/3</td><td rowspan=1 colspan=1>3/3</td><td rowspan=1 colspan=1>FP/FP</td></tr><tr><td rowspan=1 colspan=1>Refined</td><td rowspan=1 colspan=1>108.7</td><td rowspan=1 colspan=1>105.8</td><td rowspan=1 colspan=1>102.2</td><td rowspan=2 colspan=1>100.1</td><td rowspan=1 colspan=1>117.2</td><td rowspan=1 colspan=1>114.1</td><td rowspan=1 colspan=1>111.8</td><td rowspan=2 colspan=1>106.7</td></tr><tr><td rowspan=1 colspan=1>Alternating (ours)</td><td rowspan=1 colspan=1>106.1</td><td rowspan=1 colspan=1>102.7</td><td rowspan=1 colspan=1>98.7</td><td rowspan=1 colspan=1>113.7</td><td rowspan=1 colspan=1>110.2</td><td rowspan=1 colspan=1>106.4</td></tr></table>
152
+
153
+ Table 5: Testing PPW of multi-bit quantized LSTM and GRU on the Text8 dataset.
154
+
155
+ <table><tr><td rowspan=1 colspan=5>LSTM</td><td rowspan=1 colspan=4>GRU</td></tr><tr><td rowspan=1 colspan=1>W-Bits / A-Bits</td><td rowspan=1 colspan=1>2/2</td><td rowspan=1 colspan=1>2/3</td><td rowspan=1 colspan=1>3/3</td><td rowspan=1 colspan=1>FP/FP</td><td rowspan=1 colspan=1>2/2</td><td rowspan=1 colspan=1>2/3</td><td rowspan=1 colspan=1>3/3</td><td rowspan=1 colspan=1>FP/FP</td></tr><tr><td rowspan=1 colspan=1>Refined</td><td rowspan=1 colspan=1>135.6</td><td rowspan=1 colspan=1>122.3</td><td rowspan=1 colspan=1>110.2</td><td rowspan=2 colspan=1>101.1</td><td rowspan=1 colspan=1>135.8</td><td rowspan=1 colspan=1>126.9</td><td rowspan=1 colspan=1>118.3</td><td rowspan=2 colspan=1>111.6</td></tr><tr><td rowspan=1 colspan=1>Alternating (ours)</td><td rowspan=1 colspan=1>108.8</td><td rowspan=1 colspan=1>105.1</td><td rowspan=1 colspan=1>98.8</td><td rowspan=1 colspan=1>124.5</td><td rowspan=1 colspan=1>118.7</td><td rowspan=1 colspan=1>114.0</td></tr></table>
156
+
157
+ We then conduct experiments by quantizing both weights and activations. We train with the batch size 20. The final result is shown in Table 3. Besides comparing with the existing works, we also conduct experiment for Refined as a competitive baseline. We do not include Greedy as it is already shown to be much inferior to the refined one, see, e.g., Table 1 and 2. As Table 3 shows, our full precision model can attain lower PPW than the existing works. However, when considering the gap between quantized model with the full precision one, our alternating quantized neural network is still far better than existing works, i.e., Uniform (Hubara et al., 2016b) and Balanced (Zhou et al., 2017). Compared with Refined, our Alternating quantization can achieve compatible performance using 1-bit less quantization on weights or activations. In other words, under the same tolerance of accuracy drop, Alternating executes faster and uses less memory than Refined. We can see that our $3 / 3$ weights/activations quantized LSTM can achieve even better performance than full precision one. A possible explanation is due to the regularization introduced by quantization (Hubara et al., 2016b).
158
+
159
+ WikiText-2 (Merity et al., 2017) is a dataset released recently as an alternative to PTB. It contains 2088K training, 217K validation, and 245K test tokens, and has a vocabulary of 33K words, which is roughly 2 times larger in dataset size, and 3 times larger in vocabulary than PTB. We train with one layer’s hidden state of size 512 and set the batch size to 100. The result is shown in Table 4. Similar to PTB, our Alternating can use 1-bit less quantization to attain compatible or even lower PPW than Refined.
160
+
161
+ Text8. In order to determine whether Alternating remains effective with a larger dataset, we perform experiments on the Text8 corpus (Mikolov et al., 2014). Here we follow the same setting as (Xie et al., 2017). The first 90M characters are used for training, the next 5M for validation, and the final 5M for testing, resulting in 15.3M training tokens, 848K validation tokens, and 855K test tokens. We also preprocess the data by mapping all words which appear 10 or fewer times to the unknown token, resulting in a 42K size vocabulary. We train LSTM and GRU with one hidden layer of size 1024 and set the batch size to 100. The result is shown in Table 5. For LSTM on the left part, Alternating achieves excellent performance. By only 2-bit quantization on weights and activations, it exceeds Refined with 3-bit. The 2-bit result is even better than that reported in (Xie et al., 2017), where LSTM adding noising schemes for regularization can only attain 110.6 testing PPW. For GRU on the right part, although Alternating is much better than Refined, the 3-bit quantization still has gap with full precision one. We attribute that to the unified setting of hyper-parameters across all experiments. With specifically tuned hyper-parameters on this dataset, one may make up for that gap.
162
+
163
+ Note that our alternating quantization is a general technique. It is not only suitable for language models here. For a comprehensive verification, we apply it to image classification tasks. In both RNNs and feedforward neural networks, our alternating quantization also achieves the lowest testing error among all compared methods. Due to space limitation, we deter the results to Appendix B.
164
+
165
+ # 6 CONCLUSIONS
166
+
167
+ In this work, we address the limitations of RNNs, i.e., large memory and high latency, by quantization. We formulate the quantization by minimizing the approximation error. Under the key observation that some parameters can be singled out when others fixed, a simple yet effective alternating method is proposed. We apply it to quantize LSTM and GRU on language models. By 2-bit weights and activations, we achieve only a reasonably accuracy loss compared with full precision one, with ${ \sim } 1 6 \times$ reduction in memory and ${ \sim } 6 \times$ real acceleration on CPUs. By 3-bit quantization, we can attain compatible or even better result than the full precision one, with ${ \sim } 1 0 . 5 \times$ reduction in memory and ${ \sim } 3 \times$ real acceleration. Both beat existing works with a large margin. We also apply our alternating quantization to image classification tasks. In both RNNs and feedforward neural networks, the method can still achieve very plausible performance.
168
+
169
+ # 7 ACKNOWLEDGEMENTS
170
+
171
+ We would like to thank the reviewers for their suggestions on the manuscript. Zhouchen Lin is supported by National Basic Research Program of China (973 Program) (grant no. 2015CB352502), National Natural Science Foundation (NSF) of China (grant nos. 61625301 and 61731018), Qualcomm, and Microsoft Research Asia. Hongbin Zha is supported by Natural Science Foundation (NSF) of China (No. 61632003).
172
+
173
+ # REFERENCES
174
+
175
+ Kyunghyun Cho, Bart Van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv:1406.1078, 2014.
176
+
177
+ Benoît Colson, Patrice Marcotte, and Gilles Savard. An overview of bilevel optimization. Annals of Operations Research, 153(1):235–256, 2007.
178
+
179
+ Tim Cooijmans, Nicolas Ballas, César Laurent, Çaglar Gülçehre, and Aaron Courville. Recurrent ˘ batch normalization. In ICLR, 2017.
180
+
181
+ Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. In NIPS, pp. 3123–3131, 2015.
182
+
183
+ Yunchao Gong, Liu Liu, Ming Yang, and Lubomir Bourdev. Compressing deep convolutional networks using vector quantization. arXiv:1412.6115, 2014.
184
+
185
+ Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In ICASSP, pp. 6645–6649. IEEE, 2013.
186
+
187
+ Yiwen Guo, Anbang Yao, Hao Zhao, and Yurong Chen. Network sketching: Exploiting binary structure in deep cnns. In CVPR, 2017.
188
+
189
+ Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In NIPS, pp. 1135–1143, 2015.
190
+
191
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. In ICLR, 2016.
192
+
193
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Computation, 9(8): 1735–1780, 1997.
194
+
195
+ Lu Hou, Quanming Yao, and James T Kwok. Loss-aware binarization of deep networks. In ICLR, 2017.
196
+
197
+ Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized neural networks. In NIPS, pp. 4107–4115. 2016a.
198
+
199
+ Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Quantized neural networks: Training neural networks with low precision weights and activations. arXiv:1609.07061, 2016b.
200
+
201
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, pp. 448–456, 2015.
202
+
203
+ Max Jaderberg, Andrea Vedaldi, and Andrew Zisserman. Speeding up convolutional neural networks with low rank expansions. arXiv:1405.3866, 2014.
204
+
205
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
206
+
207
+ Vadim Lebedev, Yaroslav Ganin, Maksim Rakhuba, Ivan Oseledets, and Victor Lempitsky. Speedingup convolutional neural networks using fine-tuned cp-decomposition. arXiv:1412.6553, 2014.
208
+
209
+ Fengfu Li, Bo Zhang, and Bin Liu. Ternary weight networks. arXiv:1605.04711, 2016.
210
+
211
+ Zefan Li, Bingbing Ni, Wenjun Zhang, Xiaokang Yang, and Wen Gao. Performance guaranteed network acceleration via high-order residual quantization. In ICCV, pp. 2584–2592, 2017.
212
+
213
+ Baoyuan Liu, Min Wang, Hassan Foroosh, Marshall Tappen, and Marianna Pensky. Sparse convolutional neural networks. In CVPR, pp. 806–814, 2015.
214
+
215
+ 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.
216
+
217
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In ICLR, 2017.
218
+
219
+ Tomáš Mikolov. Statistical Language Models Based on Neural Networks. PhD thesis, Brno University of Technology, 2012.
220
+
221
+ Tomáš Mikolov, Martin Karafiát, Lukáš Burget, Jan Cernocký, and Sanjeev Khudanpur. Recurrent ˇ neural network based language model. In INTERSPEECH, pp. 1045–1048, 2010.
222
+
223
+ Tomáš Mikolov, Armand Joulin, Sumit Chopra, Michael Mathieu, and Marc’Aurelio Ranzato. Learning longer memory in recurrent neural networks. arXiv:1412.7753, 2014.
224
+
225
+ Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. XNOR-Net: Imagenet classification using binary convolutional neural networks. In ECCV, pp. 525–542. Springer, 2016.
226
+
227
+ Tara N Sainath, Brian Kingsbury, Vikas Sindhwani, Ebru Arisoy, and Bhuvana Ramabhadran. Lowrank matrix factorization for deep neural network training with high-dimensional output targets. In ICASSP, pp. 6655–6659. IEEE, 2013.
228
+
229
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
230
+
231
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In NIPS, pp. 3104–3112, 2014.
232
+
233
+ Cheng Tai, Tong Xiao, Yi Zhang, Xiaogang Wang, and Weinan E. Convolutional neural networks with low-rank regularization. In ICLR, 2016.
234
+
235
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In CVPR, pp. 3156–3164, 2015.
236
+
237
+ Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In NIPS, pp. 2074–2082, 2016.
238
+
239
+ Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv:1609.08144, 2016.
240
+
241
+ Ziang Xie, Sida I Wang, Jiwei Li, Daniel Lévy, Aiming Nie, Dan Jurafsky, and Andrew Y Ng. Data noising as smoothing in neural network language models. In ICLR, 2017.
242
+
243
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv:1409.2329, 2014.
244
+
245
+ Shu-Chang Zhou, Yu-Zhi Wang, He Wen, Qin-Yao He, and Yu-Heng Zou. Balanced quantization: An effective and efficient approach to quantized neural networks. Journal of Computer Science and Technology, 32(4):667–682, 2017.
246
+
247
+ Shuchang Zhou, Yuxin Wu, Zekun Ni, Xinyu Zhou, He Wen, and Yuheng Zou. Dorefa-net: Training low bitwidth convolutional neural networks with low bitwidth gradients. arXiv:1606.06160, 2016.
248
+
249
+ Chenzhuo Zhu, Song Han, Huizi Mao, and William J Dally. Trained ternary quantization. In ICLR, 2017.
250
+
251
+ # APPENDIX
252
+
253
+ # A BINARY MATRIX VECTOR MULTIPLICATION IN CPUS
254
+
255
+ Table 6: Computing time of the binary matrix vector multiplication in CPUs, where Quant represents the cost to execute our alternating quantization on-line.
256
+
257
+ <table><tr><td rowspan=1 colspan=1>Weight Size</td><td rowspan=1 colspan=1>W-Bits / A-Bits</td><td rowspan=1 colspan=1>Total (ms)</td><td rowspan=1 colspan=1>Quant (ms)</td><td rowspan=1 colspan=1>Quant / Total</td><td rowspan=1 colspan=1>Acceleration</td></tr><tr><td rowspan=3 colspan=1>4096 × 1024</td><td rowspan=1 colspan=1>2/2</td><td rowspan=1 colspan=1>0.35</td><td rowspan=1 colspan=1>0.07</td><td rowspan=1 colspan=1>20%</td><td rowspan=1 colspan=1>5.6x</td></tr><tr><td rowspan=1 colspan=1>3/3</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>0.11</td><td rowspan=1 colspan=1>15%</td><td rowspan=1 colspan=1>2.7x</td></tr><tr><td rowspan=1 colspan=1>FP/FP</td><td rowspan=1 colspan=1>1.95</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>1.0×</td></tr><tr><td rowspan=3 colspan=1>42000 × 1024</td><td rowspan=1 colspan=1>2/2</td><td rowspan=1 colspan=1>3.17</td><td rowspan=1 colspan=1>0.07</td><td rowspan=1 colspan=1>2.2%</td><td rowspan=1 colspan=1>6.0×</td></tr><tr><td rowspan=1 colspan=1>3/3</td><td rowspan=1 colspan=1>6.46</td><td rowspan=1 colspan=1>0.11</td><td rowspan=1 colspan=1>1.7%</td><td rowspan=1 colspan=1>3.0x</td></tr><tr><td rowspan=1 colspan=1>FP/FP</td><td rowspan=1 colspan=1>19.10</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>1.0x</td></tr></table>
258
+
259
+ In this section, we discuss the implementation of the binary multiplication kernel in CPUs. The binary multiplication is divided into two steps: Entry-wise XNOR operation (corresponding to entry-wise product in the full precision multiplication) and bit count operation for accumulation (corresponding to compute the sum of all multiplied entries in the full precision multiplication). We test it on Intel Xeon E5-2682 v4 $@$ 2.50 GHz CPU. For the XNOR operation, we use the Single instruction, multiple data (SIMD) _mm256 _xor_ps, which can execute 256 bit simultaneously. For the bit count operation, we use the function _popcnt64 (Note that this step can further be accelerated by the up-coming instruction _mm512 _popcnt_epi64 , which can execute 512 bits simultaneously. Similarly, the XNOR operation can also be further accelerated by the up-coming _mm512 _xor_ps instruction to execute 512 bits simultaneously). We compare with the much optimized Intel Math Kernel Library (MKL) on full precision matrix vector multiplication and execute all codes in the single-thread mode. We conduct two scales of experiments: a matrix of size $4 0 9 6 \times 1 0 2 4$ multiplying a vector of size 1024 and a matrix of size $4 2 0 0 0 \times 1 0 2 4$ multiplying a vector of size 1024, which respectively correspond to the hidden state product ${ \bf W } _ { h } \mathbf h _ { t - 1 }$ and the softmax layer $\mathbf { W } _ { s } \mathbf { h } _ { t }$ for Text8 dataset during inference with batch size of 1 (See Eq. (6)). The results are shown in Table 6. We can see that our alternating quantization step only accounts for a small portion of the total executing time, especially for the larger scale matrix vector multiplication. Compared with the full precision one, the binary multiplication can roughly achieve $6 \times$ acceleration with 2-bit quantization and $3 \times$ acceleration with 3-bit quantization. Note that this is only a simple test on CPU. Our alternating quantization method can also be extended to GPU, ASIC, and FPGA.
260
+
261
+ # B IMAGE CLASSIFICATION
262
+
263
+ Sequential MNIST. As a simple illustration to show that our alternating quantization is not limited for texts, we conduct experiments on the sequential MNIST classification task (Cooijmans et al., 2017). The dataset consists of a training set of 60K and a test set of 10K $2 8 \times 2 8$ gray-scale images. Here we divide the last 5000 training images for validation. In every time, we sequentially use one row of the image as the input $( 2 8 \times 1 )$ , which results in a total of 28 time steps. We use 1 hidden layer’s LSTM of size 128 and the same optimization hyper-parameters as the language models. Besides the weights and activations, the inputs are quantized. The testing error rates for 1-bit input, 2-bit weight, and 2-bit activation are shown in 7, where our alternating quantized method still achieves plausible performance in this task.
264
+
265
+ MLP on MNIST. The alternating quantization proposed in this work is a general technique. It is not only suitable for RNNs, but also for feed-forward neural networks. As an example, we firstly conduct a classification task on MNIST and compare with existing work (Li et al., 2017). The method proposed in (Li et al., 2017) is intrinsically a greedy multi-bit quantization method. For fair comparison, we follow the same setting. We use the MLP consisting of 3 hidden layers of 4096 units and an L2-SVM output layer. No convolution, preprocessing, data augmentation or pre-training is used. We also use ADAM (Kingma & Ba, 2015) with an exponentially decaying learning rate and Batch Normalization (Ioffe & Szegedy, 2015) with a batch size 100. The testing error rates for 2-bit input, 2-bit weight, and 1-bit activation are shown in Table 8. Among all the compared multi-bit quantization methods, our alternating one achieves the lowest testing error.
266
+
267
+ Table 7: Testing error rate of LSTM on MNIST with 1-bit input, 2-bit weight, and 2-bit activation.
268
+
269
+ <table><tr><td>Methods</td><td>Testing Error Rate</td></tr><tr><td>Full Precision</td><td>1.10%</td></tr><tr><td>Refined (Guo et al., 2017)</td><td>1.39 %</td></tr><tr><td>Alternating (ours)</td><td>1.19 %</td></tr></table>
270
+
271
+ Table 8: Testing error rate of MLP on MNIST with 2-bit input, 2-bit weight, and 1-bit activation.
272
+
273
+ <table><tr><td>Methods</td><td>Testing Error Rate</td></tr><tr><td>Full Precision</td><td>0.97%</td></tr><tr><td>Greedy (reported in (Li et al., 2017))</td><td>1.25 %</td></tr><tr><td>Refined (Guo et al., 2017)</td><td>1.22 %</td></tr><tr><td>Alternating (ours)</td><td>1.13 %</td></tr></table>
274
+
275
+ Table 9: Testing error rate of CNN on CIFAR-10 with 2-bit weight and 1-bit activation.
276
+
277
+ <table><tr><td>Methods</td><td>Testing Error Rate</td></tr><tr><td>Full Precision (reported in (Hou et al., 2017))</td><td>11.90 %</td></tr><tr><td> XNOR-Net (1-bit weight &amp; activation, reported in (Hou et al., 2017))</td><td>12.62 %</td></tr><tr><td>Refined (Guo et al., 2017)</td><td>12.08 %</td></tr><tr><td>Alternating (ours)</td><td>11.70 %</td></tr></table>
278
+
279
+ CNN on CIFAR-10. We then conduct experiments on CIFAR-10 and follow the same setting as (Hou et al., 2017). That is, we use 45000 images for training, another 5000 for validation, and the remaining 10000 for testing. The images are preprocessed with global contrast normalization and ZCA whitening. We also use the VGG-like architecture (Simonyan & Zisserman, 2015):
280
+
281
+ $$
282
+ ( 2 \times 1 2 8 ~ \mathrm { C 3 } ) - \mathrm { M P 2 - ( 2 \times 2 5 6 ~ \mathrm { C 3 } ) - M P 2 - ( 2 \times 5 1 2 ~ \mathrm { C 3 } ) - M P 2 - ( 2 \times 1 0 2 4 ~ \mathrm { F C } ) - 1 0 ~ \mathrm { S V M } }
283
+ $$
284
+
285
+ where C3 is a $3 \times 3$ convolution layer, and MP2 is a $2 \times 2$ max-pooling layer. Batch Normalization, with a mini-batch size of 50, and ADAM are used. The maximum number of epochs is 200. The learning rate starts at 0.02 and decays by a factor of 0.5 after every 30 epochs. The testing error rates for 2-bit weight and 1-bit activation are shown in Table 9, where our alternating method again achieves the lowest test error rate among all compared quantization methods.
md/train/S1xiOjC9F7/S1xiOjC9F7.md ADDED
@@ -0,0 +1,405 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GRAPH MATCHING NETWORKS FOR LEARNING THE SIMILARITY OF GRAPH STRUCTURED OBJECTS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ This paper addresses the challenging problem of retrieval and matching of graph structured objects, and makes two key contributions. First, we demonstrate how Graph Neural Networks (GNN), which have emerged as an effective model for various supervised prediction problems defined on structured data, can be trained to produce embedding of graphs in vector spaces that enables efficient similarity reasoning. Second, we propose a novel Graph Matching Network model that, given a pair of graphs as input, computes a similarity score between them by jointly reasoning on the pair through a new cross-graph attention-based matching mechanism. We demonstrate the effectiveness of our models on different domains including the challenging problem of control-flow-graph based function similarity search that plays an important role in the detection of vulnerabilities in software systems. The experimental analysis demonstrates that our models are not only able to exploit structure in the context of similarity learning but they can also outperform domain-specific baseline systems that have been carefully hand-engineered for these problems.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Graphs are natural representations for encoding relational structures that are encountered in many domains. Expectedly, computations defined over graph structured data are employed in a wide variety of fields, from the analysis of molecules for computational biology and chemistry (Gilmer et al., 2017; Yan et al., 2005), to the analysis of knowledge graphs or graph structured parses for natural language understanding.
12
+
13
+ In the past few years graph neural networks (GNNs) have emerged as an effective class of models for learning representations of structured data and for solving various supervised prediction problems on graphs. Such models are invariant to permutations of graph elements by design and compute graph node representations through a propagation process which iteratively aggregates local structural information (Scarselli et al., 2009; Li et al., 2015; Gilmer et al., 2017). These node representations are then used directly for node classification, or pooled into a graph vector for graph classification. Problems beyond supervised classification or regression are relatively less well-studied for GNNs.
14
+
15
+ In this paper we study the problem of similarity learning for graph structured objects, which appears in many important real world applications, in particular similarity based retrieval in graph databases. One motivating application is the computer security problem of binary function similarity search, where given a binary which may or may not contain code with known vulnerabilities, we wish to check whether any control-flow-graph in this binary is sufficiently similar to a database of known-vulnerable functions. This helps identify vulnerable statically linked libraries in closed-source software, a recurring problem (CVE, 2010; 2018) for which no good solutions are currently available. Figure 1 shows one example from this application, where the binary functions are represented as control flow graphs annotated with assembly instructions. This similarity learning problem is very challenging as subtle differences can make two graphs be semantically very different, while graphs with different structures can still be similar. A successful model for this problem should therefore (1) exploit the graph structures, and (2) be able to reason about the similarity of graphs both from the graph structures as well as from learned semantics.
16
+
17
+ In order to solve the graph similarity learning problem, we investigate the use of GNNs in this context, explore how they can be used to embed graphs into a vector space, and learn this embedding model to make similar graphs close in the vector space, and dissimilar graphs far apart. One important property of this model is that, it maps each graph independently to an embedding vector, and then all the similarity computation happens in the vector space. Therefore, the embeddings of graphs in a large database can be precomputed and indexed, which enables efficient retrieval with fast nearest neighbor search data structures like k-d trees (Bentley, 1975) or locality sensitive hashing (Gionis et al., 1999).
18
+
19
+ We further propose an extension to GNNs which we call Graph Matching Networks (GMNs) for similarity learning. Instead of computing graph representations independently for each graph, the GMNs compute a similarity score through a cross-graph attention mechanism to associate nodes across graphs and identify differences. By making the graph representation computation dependent on the pair, this matching model is more powerful than the embedding model, providing a nice accuracy-computation trade-off.
20
+
21
+ ![](images/9e7225813589a8cf201b5c4b38bc3bf6d40968e6b4043da81e648958769e7427.jpg)
22
+ Figure 1: The binary function similarity learning problem. Checking whether two graphs are similar requires reasoning about both the structure as well as the semantics of the graphs. Here the left two control flow graphs correspond to the same function compiled with different compilers (and therefore similar), while the graph on the right corresponds to a different function.
23
+
24
+ We evaluate the proposed models and baselines
25
+ on three tasks: a synthetic graph edit-distance learning task which captures structural similarity only, and two real world tasks - binary function similarity search and mesh retrieval, which require reasoning about both the structural and semantic similarity. On all tasks, the proposed approaches outperform established baselines and structure agnostic models; in more detailed ablation studies, we found that the Graph Matching Networks consistently outperform the graph embedding model and Siamese networks.
26
+
27
+ To summarize, the contributions of this paper are: (1) we demonstrate how GNNs can be used to produce graph embeddings for similarity learning; (2) we propose the new Graph Matching Networks that computes similarity through cross-graph attention-based matching; (3) empirically we show that the proposed graph similarity learning models achieve good performance across a range of applications, outperforming structure agnostic models and established hand-engineered baselines.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ Graph Neural Networks and Graph Representation Learning The history of graph neural networks (GNNs) goes back to at least the early work by Gori et al. (2005) and Scarselli et al. (2009), who proposed to use a propagation process to learn node representations. These models have been further developed by incorporating modern deep learning components (Li et al., 2015; Velickovi ˇ c´ et al., 2017; Bruna et al., 2013). A separate line of work focuses on generalizing convolutions to graphs (Bruna et al., 2013; Bronstein et al., 2017). Popular graph convolutional networks also compute node updates by aggregating information in local neighborhoods (Kipf & Welling, 2016), making them the same family of models as GNNs. GNNs have been successfully used in many domains (Kipf & Welling, 2016; Velickovi ˇ c et al., 2017; Battaglia et al., 2016; 2018; Niepert et al., ´ 2016; Duvenaud et al., 2015; Gilmer et al., 2017; Dai et al., 2017; Li et al., 2018; Wang et al., 2018a;b). Most of the previous work on GNNs focus on supervised prediction problems (with exceptions like (Dai et al., 2017; Li et al., 2018; Wang et al., 2018a)). The graph similarity learning problem we study in this paper and the new graph matching model can be good additions to this family of models.
32
+
33
+ Graph Similarity Search and Graph Kernels Graph similarity search has been studied extensively in database and data mining communities (Yan et al., 2005; Dijkman et al., 2009). The similarity is typically defined by either exact matches (full-graph or sub-graph isomorphism) (Berretti et al., 2001; Shasha et al., 2002; Yan et al., 2004; Srinivasa & Kumar, 2003) or some measure of structural similarity, e.g. in terms of graph edit distances (Willett et al., 1998; Raymond et al., 2002). Most of the approaches proposed in this direction are not learning-based, and focus on efficiency.
34
+
35
+ Graph kernels are kernels on graphs designed to capture the graph similarity, and can be used in kernel methods for e.g. graph classification (Vishwanathan et al., 2010; Shervashidze et al., 2011). Popular graph kernels include those that measure the similarity between walks or paths on graphs (Borgwardt & Kriegel, 2005; Kashima et al., 2003; Vishwanathan et al., 2010), kernels based on limited-sized substructures (Horváth et al., 2004; Shervashidze et al., 2009) and kernels based on sub-tree structures (Shervashidze & Borgwardt, 2009; Shervashidze et al., 2011). Graph kernels are usually used in models that may have learned components, but the kernels themselves are handdesigned and motivated by graph theory. They can typically be formulated as first computing the feature vectors for each graph (the kernel embedding), and then take inner product between these vectors to compute the kernel value. One exception is (Yanardag & Vishwanathan, 2015) where the co-occurrence of graph elements (substructures, walks, etc.) are learned, but the basic elements are still hand-designed. Compared to these approaches, our graph neural network based similarity learning framework learns the similarity metric end-to-end.
36
+
37
+ Distance Metric Learning Learning a distance metric between data points is the key focus of the area of metric learning. Most of the early work on metric learning assumes that the data already lies in a vector space, and only a linear metric matrix is learned to properly measure the distance in this space to group similar examples together and dissimilar examples to be far apart (Xing et al., 2003; Weinberger & Saul, 2009; Davis et al., 2007). More recently the ideas of distance metric learning and representation learning have been combined in applications like face verification, where deep convolutional neural networks are learned to map similar images to similar representation vectors (Chopra et al., 2005; Hu et al., 2014; Sun et al., 2014). In this paper, we focus on representation and similarity metric learning for graphs, and our graph matching model goes one step beyond the typical representation learning methods by modeling the cross-graph matchings.
38
+
39
+ Siamese Networks Siamese networks (Bromley et al., 1994; Baldi & Chauvin, 1993) are a family of neural network models for visual similarity learning. These models typically consist of two networks with shared parameters applied to two input images independently to compute representations, a small network is then used to fuse these representations and compute a similarity score. They can be thought of as learning both the representations and the similarity metric. Siamese networks have achieved great success in many visual recognition and verification tasks (Bromley et al., 1994; Baldi & Chauvin, 1993; Koch et al., 2015; Bertinetto et al., 2016; Zagoruyko & Komodakis, 2015). In the experiments we adapt Siamese networks to handle graphs, but found our graph matching networks to be more powerful as they do cross-graph computations and therefore fuse information from both graphs early in the computation process. Independent of our work, recently (Shyam et al., 2017) proposed a cross-example attention model for visual similarity as an alternative to Siamese networks based on similar motivations and achieved good results.
40
+
41
+ # 3 DEEP GRAPH SIMILARITY LEARNING
42
+
43
+ Given two graphs $G _ { 1 } = ( V _ { 1 } , E _ { 1 } )$ and $G _ { 2 } = ( V _ { 2 } , E _ { 2 } )$ , we want a model that produces the similarity score $s ( G _ { 1 } , G _ { 2 } )$ between them. Each graph $G = ( V , E )$ is represented as sets of nodes $V$ and edges $E$ , optionally each node $i \in V$ can be associated with a feature vector $\mathbf { x } _ { i }$ , and each edge $( i , j ) \in E$ associated with a feature vector $\mathbf { x } _ { i j }$ . These features can represent, e.g. type of a node, direction of an edge, etc. If a node or an edge does not have any associated features, we set the corresponding vector to a constant vector of 1s. We propose two models for graph similarity learning: a model based on standard GNNs for learning graph embeddings, and the new and more powerful GMNs. The two models are illustrated in Figure 2.
44
+
45
+ # 3.1 GRAPH EMBEDDING MODELS
46
+
47
+ Graph embedding models embed each graph into a vector, and then use a similarity metric in that vector space to measure the similarity between graphs. Our GNN embedding model comprises 3 parts: (1) an encoder, (2) propagation layers, and (3) an aggregator.
48
+
49
+ ![](images/65584d1e56fbd621110b6ab4af106377ea3ca09c6528543dfddad7e6ff636d03.jpg)
50
+ Figure 2: Illustration of the graph embedding (left) and matching models (right).
51
+
52
+ Encoder The encoder maps the node and edge features to initial node and edge vectors through separate MLPs:
53
+
54
+ $$
55
+ \mathbf { h } _ { i } ^ { ( 0 ) } = \mathrm { M L P } _ { \mathrm { n o d e } } ( \mathbf { x } _ { i } ) , \quad \forall i \in V \qquad \mathbf { e } _ { i j } = \mathrm { M L P } _ { \mathrm { e d g e } } ( \mathbf { x } _ { i j } ) , \quad \forall ( i , j ) \in E .
56
+ $$
57
+
58
+ Propagation Layers A propagation layer maps a set of node representations $\{ \mathbf { h } _ { i } ^ { ( t ) } \} _ { i \in V }$ to new node representations $\{ \mathbf { h } _ { i } ^ { ( t + 1 ) } \} _ { i \in V }$ , as the following:
59
+
60
+ $$
61
+ \mathbf { m } _ { j \to i } = f _ { \mathrm { m e s s a g e } } ( \mathbf { h } _ { i } ^ { ( t ) } , \mathbf { h } _ { j } ^ { ( t ) } , \mathbf { e } _ { i j } ) , \qquad \mathbf { h } _ { i } ^ { ( t + 1 ) } = f _ { \mathrm { n o d e } } \left( \mathbf { h } _ { i } ^ { ( t ) } , \sum _ { j : ( j , i ) \in E } \mathbf { m } _ { j \to i } \right)
62
+ $$
63
+
64
+ Here $f _ { \mathrm { m e s s a g e } }$ is typically an MLP on the concatenated inputs, and $f _ { \mathrm { n o d e } }$ can be either an MLP or a recurrent neural network core, e.g. RNN, GRU or LSTM (Li et al., 2015). To aggregate the messages, we use a simple sum which may be alternatively replaced by other commutative operators such as mean, max or the attention-based weighted sum (Velickovi ˇ c et al., 2017). Through multiple layers of ´ propagation, the representation for each node will accumulate information in its local neighborhood.
65
+
66
+ Aggregator After a certain number $T$ rounds of propagations, an aggregator takes the set of node representations $\{ \mathbf { h } _ { i } ^ { ( T ) } \}$ as input, and computes a graph level representation ${ \bf h } _ { G } = f _ { G } ( \{ { \bf h } _ { i } ^ { ( T ) } \} )$ , as
67
+
68
+ $$
69
+ \mathbf { h } _ { G } = \mathrm { M L P } _ { G } \left( \sum _ { i \in V } \sigma ( \mathrm { M L P } _ { \mathrm { g a t e } } ( \mathbf { h } _ { i } ^ { ( T ) } ) ) \odot \mathrm { M L P } ( \mathbf { h } _ { i } ^ { ( T ) } ) \right) ,
70
+ $$
71
+
72
+ which transforms node representations and then uses a weighted sum with gating vectors to aggregate across nodes. The weighted sum can focus only on the important nodes, it is more powerful than a simple sum and also works significantly better empirically.
73
+
74
+ After the graph representations $\mathbf { h } _ { G _ { 1 } }$ and $\mathbf { h } _ { G _ { 2 } }$ are computed for the pair $( G _ { 1 } , G _ { 2 } )$ , we compute the similarity between them using a similarity metric in the vector space, for example the Euclidean, cosine or Hamming similarities.
75
+
76
+ Note that without the propagation layers (or with 0 propagation steps), this model becomes an instance of the Deep Set (Zaheer et al., 2017) or PointNet (Qi et al., 2017), which does computation on the individual nodes, and then pool the node representations into a representation for the whole graph. Such a model, however, ignores the structure and only treats the data as a set of independent nodes.
77
+
78
+ # 3.2 GRAPH MATCHING NETWORKS
79
+
80
+ Graph matching networks take a pair of graphs as input and compute a similarity score between them. Compared to the embedding models, these matching models compute the similarity score jointly on the pair, rather than first independently mapping each graph to a vector. Therefore these models are potentially stronger than the embedding models, at the cost of some extra computation efficiency.
81
+
82
+ We propose the following graph matching network, which changes the node update module in each propagation layer to take into account not only the aggregated messages on the edges for each graph as before, but also a cross-graph matching vector which measures how well a node in one graph can
83
+
84
+ be matched to one or more nodes in the other:
85
+
86
+ $$
87
+ \begin{array} { r l } & { \mathbf { m } _ { j \to i } = f _ { \mathrm { m e s s a g e } } ( \mathbf { h } _ { i } ^ { ( t ) } , \mathbf { h } _ { j } ^ { ( t ) } , \mathbf { e } _ { i j } ) , \quad \forall ( i , j ) \in E _ { 1 } \cup E _ { 2 } } \\ & { \mu _ { j \to i } = f _ { \mathrm { m a t c h } } ( \mathbf { h } _ { i } ^ { ( t ) } , \mathbf { h } _ { j } ^ { ( t ) } ) , \quad \forall i \in V _ { 1 } , j \in V _ { 2 } , \mathrm { o r } i \in V _ { 2 } , j \in V _ { 1 } } \\ & { \mathbf { h } _ { i } ^ { ( t + 1 ) } = f _ { \mathrm { n o d e } } \left( \mathbf { h } _ { i } ^ { ( t ) } , \displaystyle \sum _ { j } \mathbf { m } _ { j \to i } , \displaystyle \sum _ { j ^ { \prime } } \mu _ { j ^ { \prime } \to i } \right) } \\ & { \mathbf { h } _ { G _ { 1 } } = f _ { G } ( \{ \mathbf { h } _ { i } ^ { ( T ) } \} _ { i \in V _ { 1 } } ) , \quad \mathbf { h } _ { G _ { 2 } } = f _ { G } ( \{ \mathbf { h } _ { i } ^ { ( T ) } \} _ { i \in V _ { 2 } } ) , \quad s = f _ { s } ( \mathbf { h } _ { G _ { 1 } } , \mathbf { h } _ { G _ { 2 } } ) . } \end{array}
88
+ $$
89
+
90
+ Here $f _ { s }$ is a standard vector space similarity between $\mathbf { h } _ { G _ { 1 } }$ and $\mathbf { h } _ { G _ { 2 } }$ . $f _ { \mathrm { m a t c h } }$ is a function that communicates cross-graph information, which we propose to use an attention-based module:
91
+
92
+ $$
93
+ \begin{array} { l } { { \displaystyle a _ { j \to i } = \frac { \exp \bigl ( s _ { h } ( { \bf h } _ { i } ^ { ( t ) } , { \bf h } _ { j } ^ { ( t ) } ) \bigr ) } { \sum _ { j ^ { \prime } } \exp \bigl ( s _ { h } ( { \bf h } _ { i } ^ { ( t ) } , { \bf h } _ { j ^ { \prime } } ^ { ( t ) } ) \bigr ) } , \qquad \mu _ { j \to i } = a _ { j \to i } \bigl ( { \bf h } _ { i } ^ { ( t ) } - { \bf h } _ { j } ^ { ( t ) } \bigr ) \quad \mathrm { a n d ~ t h e r e f o r e } } } \\ { { \displaystyle \sum _ { j } \mu _ { j \to i } = \sum _ { j } a _ { j \to i } \bigl ( { \bf h } _ { i } ^ { ( t ) } - { \bf h } _ { j } ^ { ( t ) } \bigr ) = { \bf h } _ { i } ^ { ( t ) } - \sum _ { j } a _ { j \to i } { \bf h } _ { j } ^ { ( t ) } } . } \end{array}
94
+ $$
95
+
96
+ $s _ { h }$ is again a vector space similarity metric, like Euclidean or cosine similarity, $a _ { j \to i }$ are the attention weights, and $\textstyle \sum _ { j } \mu _ { j \to i }$ intuitively measures the difference between $\mathbf { h } _ { i } ^ { ( t ) }$ and its closest neighbor in the other graph. Note that because of the normalization in $a _ { j \to i }$ , the function $f _ { \mathrm { m a t c h } }$ implicitly depends on the whole set of $\{ \mathbf { h } _ { j } ^ { ( t ) } \}$ , which we omitted in Eq. 8 for a cleaner notation. Since attention weights are required for every pair of nodes across two graphs, this operation has a computation cost of $O ( | V _ { 1 } | | V _ { 2 } | )$ , while for the GNN embedding model the cost for each round of propagation is $O ( | V | + | E | )$ . The extra power of the GMNs comes from utilizing the extra computation.
97
+
98
+ Note By construction, the attention module has a nice property that, when the two graphs can be perfectly matched, and when the attention weights are peaked at the exact match, we have $\textstyle \sum _ { j } { \pmb { \mu } } _ { j \to i } = { \bf 0 }$ , which means the cross-graph communications will be reduced to zero vectors, and the two graphs will continue to compute identical representations in the next round of propagation. On the other hand, the differences across graphs will be captured in the cross-graph matching vector $\textstyle \sum _ { j } \mu _ { j \to i }$ , which will be amplified through the propagation process, making the matching model more sensitive to these differences.
99
+
100
+ Compared to the graph embedding model, the matching model has the ability to change the representation of the graphs based on the other graph it is compared against. The model will adjust graph representations to make them become more different if they do not match.
101
+
102
+ # 3.3 LEARNING
103
+
104
+ The proposed graph similarity learning models can be trained on a set of example pairs or triplets. Pairwise training requires us to have a dataset of pairs labeled as positive (similar) or negative (dissimilar), while triplet training only needs relative similarity, i.e. whether $G _ { 1 }$ is closer to $G _ { 2 }$ or $G _ { 3 }$ . We describe the losses on pairs and triplets we used below, which are then optimized with gradient descent based algorithms.
105
+
106
+ When using Euclidean similarity, we use the following margin-based pairwise loss:
107
+
108
+ $$
109
+ L _ { \mathrm { p a i r } } = \mathbb { E } _ { ( G _ { 1 } , G _ { 2 } , t ) } [ \operatorname* { m a x } \{ 0 , \gamma - t ( 1 - d ( G _ { 1 } , G _ { 2 } ) ) \} ] ,
110
+ $$
111
+
112
+ where $t \in \{ - 1 , 1 \}$ is the label for this pair, $\gamma > 0$ is a margin parameter, and $d ( G _ { 1 } , G _ { 2 } ) =$ $\| \mathbf { h } _ { G _ { 1 } } - \mathbf { h } _ { G _ { 2 } } \| ^ { 2 }$ is the Euclidean distance. This loss encourages $d ( G _ { 1 } , G _ { 2 } ) < 1 - \gamma$ when the pair is similar $\mathit { t } = 1$ ), and $d ( G _ { 1 } , G _ { 2 } ) > 1 + \gamma$ when $t = - 1$ . Given triplets where $G _ { 1 }$ and $G _ { 2 }$ are closer than $G _ { 1 }$ and $G _ { 3 }$ , we optimize the following margin-based triplet loss:
113
+
114
+ $$
115
+ L _ { \mathrm { t r i p l e t } } = \mathbb { E } _ { ( G _ { 1 } , G _ { 2 } , G _ { 3 } ) } [ \operatorname* { m a x } \{ 0 , d ( G _ { 1 } , G _ { 2 } ) - d ( G _ { 1 } , G _ { 3 } ) + \gamma \} ] .
116
+ $$
117
+
118
+ This loss encourages $d ( G _ { 1 } , G _ { 2 } )$ to be smaller than $d ( G _ { 1 } , G _ { 3 } )$ by at least a margin $\gamma$ .
119
+
120
+ For applications where it is necessary to search through a large database of graphs with low latency, it is beneficial to have the graph representation vectors be binary, i.e. $\mathbf { h } _ { G } ^ { - } \in \{ - 1 , 1 \} ^ { H }$ , so that efficient nearest neighbor search algorithms (Gionis et al., 1999) may be applied. In such cases, we can minimize the Hamming distance of positive pairs and maximize it for negative pairs. With this restriction the graph vectors can no longer freely occupy the whole Euclidean space, but we gain the efficiency for fast retrieval and indexing. To achieve this we propose to pass the $\mathbf { h } _ { G }$ vectors through a tanh transformation, and optimize the following pair and triplet losses:
121
+
122
+ $$
123
+ \begin{array} { r l } & { \quad L _ { \mathrm { p a i r } } = \mathbb { E } _ { ( G _ { 1 } , G _ { 2 } , t ) } [ ( t - s ( G _ { 1 } , G _ { 2 } ) ) ^ { 2 } ] / 4 , \quad \mathrm { a n d } } \\ & { \quad L _ { \mathrm { t r i p l e t } } = \mathbb { E } _ { ( G _ { 1 } , G _ { 2 } , G _ { 3 } ) } [ ( s ( G _ { 1 } , G _ { 2 } ) - 1 ) ^ { 2 } + ( s ( G _ { 1 } , G _ { 3 } ) + 1 ) ^ { 2 } ] / 8 , } \end{array}
124
+ $$
125
+
126
+ where $\begin{array} { r } { s ( G _ { 1 } , G _ { 2 } ) = \frac { 1 } { H } \sum _ { i = 1 } ^ { H } \operatorname { t a n h } ( h _ { G _ { 1 } { i } } ) \cdot \operatorname { t a n h } ( h _ { G _ { 2 } { i } } ) } \end{array}$ is the approximate average Hamming similarity. Both losses are bounded in $[ 0 , 1 ]$ , and they push positive pairs to have Hamming similarity close to 1, and negative pairs to have similarity close to -1. We found these losses to be a bit more stable than margin based losses for Hamming similarity.
127
+
128
+ # 4 EXPERIMENTS
129
+
130
+ In this section, we evaluate the graph similarity learning (GSL) framework and the graph embedding (GNNs) and graph matching networks (GMNs) on three tasks and compare these models with other competing methods. Overall the empirical results demonstrate that the GMNs excel on graph similarity learning, consistently outperforming all other approaches.
131
+
132
+ # 4.1 LEARNING GRAPH EDIT DISTANCES
133
+
134
+ Problem Background Graph edit distance between graphs $G _ { 1 }$ and $G _ { 2 }$ is defined as the minimum number of edit operations needed to transform $G _ { 1 }$ to $G _ { 2 }$ . Typically the edit operations include add/remove/substitute nodes and edges. Graph edit distance is naturally a measure of similarity between graphs and has many applications in graph similarity search (Dijkman et al., 2009; Zeng et al., 2009; Gao et al., 2010). However computing the graph edit distance is NP-hard in general (Zeng et al., 2009), therefore approximations have to be used. Through this experiment we show that the GSL models can learn structural similarity between graphs on very challenging problems.
135
+
136
+ Training Setup We generated training data by sampling random binomial graphs $G _ { 1 }$ with $n$ nodes and edge probability $p$ (Erdös & Rényi, 1959), and then create positive example $G _ { 2 }$ by randomly substituting $k _ { p }$ edges from $G _ { 1 }$ with new edges, and negative example $G _ { 3 }$ by substituting $k _ { n }$ edges from $G _ { 1 }$ , where $k _ { p } < k _ { n } ^ { \phantom { } 1 }$ . A model needs to predict a higher similarity score for positive pair $( G _ { 1 } , G _ { 2 } )$ than negative pair $\left( G _ { 1 } , G _ { 3 } \right)$ . Throughout the experiments we fixed the dimensionality of node vectors to 32, and the dimensionality of graph vectors to 128 without further tuning. We also tried different number of propagation steps $T$ from 1 to 5, and observed consistently better performance with increasing $T$ . The results reported in this section are all with $T = 5$ unless stated otherwise. More details are included in Appendix B.1.
137
+
138
+ Baseline We compare our models with the popular Weisfeiler Lehman (WL) kernel (Shervashidze et al., 2011), which has been shown to be very competitive on graph classification tasks and the Weisfeiler Lehman algorithm behind this kernel is a strong method for checking graph isomorphism (edit distance of 0), a closely related task (Weisfeiler & Lehman, 1968; Shervashidze et al., 2011).
139
+
140
+ Evaluation The performance of different models are evaluated using two metrics: (1) pair AUC - the area under the ROC curve for classifying pairs of graphs as similar or not on a fixed set of 1000 pairs and (2) triplet accuracy - the accuracy of correctly assigning higher similarity to the positive pair in a triplet than the negative pair on a fixed set of 1000 triplets.
141
+
142
+ Results We trained and evaluated the GSL models on graphs of a few specific distributions with different $n , p .$ , with $k _ { p } = 1$ and $k _ { n } = 2$ fixed. The evaluation results are shown in Table 1. We can see that by learning on graphs of specific distributions, the GSL models are able to do better than generic baselines, and the GMNs consistently outperform the embedding model (GNNs).
143
+
144
+ For the GMNs, we can visualize the cross-graph attention to gain further insight into how it is working. Figure 3 shows two examples of this for a matching model trained with $n$ sampled from [20, 50],
145
+
146
+ <table><tr><td>Graph Distribution</td><td>WL kernel</td><td>GNN</td><td>GMN</td></tr><tr><td>n= 20,p=0.2</td><td>80.8/83.2</td><td>88.8/94.0</td><td>95.0/95.6</td></tr><tr><td>n= 20,p= 0.5</td><td>74.5 / 78.0</td><td>92.1 /93.4</td><td>96.6 /98.0</td></tr><tr><td>n= 50,p 二 0.2</td><td>93.9 /97.8</td><td>95.9 /97.2</td><td>97.4 /97.6</td></tr><tr><td>n = 50,p = 0.5</td><td>82.3 / 89.0</td><td>88.5 /91.0</td><td>93.8 / 92.6</td></tr></table>
147
+
148
+ Table 1: Comparing the graph embedding (GNN) and matching (GMN) models trained on graphs from different distributions with the baseline, measuring pair AUC / triplet accuracy $( \times 1 0 0 )$ .
149
+
150
+ ![](images/c83ceeda3457d9b386a8e617206399f3aba89b3c9ef41cc902ee98bae62102fe.jpg)
151
+ Figure 3: Visualization of cross-graph attention for GMNs after 5 propagation layers. In each pair of graphs the left figure shows the attention from left graph to the right, the right figure shows the opposite.
152
+
153
+ tested on graphs of 10 nodes. The cross-graph attention weights are shown in green, with the scale of the weights shown as the transparency of the green edges. We can see that the attention weights can align nodes well when the two graphs match, and tend to focus on nodes with higher degrees when they don’t. However the pattern is not as interpretable as in standard attention models.
154
+
155
+ More experiments on generalization capabilities of these models (train on small graphs, test on larger graphs, train on graphs with some $k _ { p } , k _ { n }$ combinations, test on others) are included in Appendix B.1.
156
+
157
+ # 4.2 CONTROL FLOW GRAPH BASED BINARY FUNCTION SIMILARITY SEARCH
158
+
159
+ Problem Background Binary function similarity search is an important problem in computer security. The need to analyze and search through binaries emerges when we do not have access to the source code, for example when dealing with commercial or embedded software or suspicious executables. Combining a disassembler and a code analyzer, we can extract a control-flow graph (CFG) which contains all the information in a binary function in a structured format. See Figure 1 and Appendix B.2 for a few example CFGs. In a CFG, each node is a basic block of assembly instructions, and the edges between nodes represent the control flow, indicated by for example a jump or a return instruction used in branching, loops or function calls. In this section, we target the vulnerability search problem, where a piece of binary known to have some vulnerabilities is used as the query, and we search through a library to find similar binaries that may have the same vulnerabilities.2 Accurate identification of similar vulnerabilities enables security engineers to quickly narrow down the search space and apply patches.
160
+
161
+ In the past the binary function similarity search problem has been tackled with classical graph theoretical matching algorithms (Eschweiler et al., 2016; Pewny et al., 2015), and Xu et al. (2017) and Feng et al. (2016) proposed to learn embeddings of CFGs and do similarity search in the embedding space. Xu et al. (2017) in particular proposed an embedding method based on graph neural networks, starting from some hand selected feature vectors for each node. Here we study further the performance of graph embedding and matching models, with pair and triplet training, different number of propagation steps, and learning node features from the assembly instructions.
162
+
163
+ Training Setup and Baseline We train and evaluate our model on data generated by compiling the popular open source video processing software ffmpeg using different compilers gcc and clang, and different compiler optimization levels, which results in 7940 functions and roughly 8 CFGs per function. The average size of the CFGs is around 55 nodes per graph, with some larger graphs having up to a few thousand nodes (see Appendix B.2 for more detailed statistics). Different compiler optimization levels result in CFGs of very different sizes for the same function. We split the data and used $80 \%$ functions and the associated CFGs for training, $10 \%$ for validation and $10 \%$ for testing. The models were trained to learn a similarity metric on CFGs such that the CFGs for the same function have high similarity, and low similarity otherwise. Once trained, this similarity metric can be used to search through library of binaries and be invariant to compiler type and optimization levels.
164
+
165
+ ![](images/af414ae2d5002694a07136f9a0949cb2518203a5f57033ce039d41d5a1726232.jpg)
166
+ Figure 4: Performance $\times 1 0 0 $ ) of different models on the binary function similarity search task.
167
+
168
+ We compare our graph embedding and matching models with Google’s open source function similarity search tool (Dullien, 2018), which has been used to successfully find vulnerabilities in binaries in the past. This tool computes representations of CFGs through a hand-engineered graph hashing process which encodes the neighborhood structure of each node by hashing the degree sequence from a traversal of a 3-hop neighborhood, and also encodes the assembly instructions for each basic block by hashing the trigrams of assembly instruction types. These features are then combined by using a SimHash-style (Charikar, 2002) algorithm with learned weights to form a 128-dimensional binary code. An LSH-based search index is then used to perform approximate nearest neighbor search using hamming distance.
169
+
170
+ Following (Dullien, 2018), we also map the CFGs to 128-dimensional binary vectors, and use the Hamming similarity formulation described in Section 3 for training. We further studied two variants of the data, one that only uses the graph structure, and one that uses both the graph structure and the assembly instructions with learned node features. When assembly instructions are available, we embed each instruction type into a vector, and then sum up all the embedding vectors for instructions in a basic block as the initial representation vector (the $\mathbf { x } _ { i }$ ’s) for each node, these embeddings are learned jointly with the rest of the model.
171
+
172
+ Results Figure 4 shows the performance of different models with different number of propagation steps and in different data settings. We again evaluate the performance of these models on pair AUC and triplet accuracy on fixed sets of pairs and triplets from the test set. It is clear from results that: (1) the performance of both the graph embedding and matching models consistently go up with more propagation steps, and in particular significantly outperforming the structure agnostic model special case which uses 0 propagation steps; (2) the graph embedding model is consistently better than the baselines with enough propagation steps; and (3) graph matching models outperforms the embedding models across all settings and propagation steps. Additionally, we have tried the WL kernel on this task using only the graph structure, and it achieved 0.619 AUC and $2 4 . 5 \%$ triplet accuracy. This is not surprising as the WL kernel is not designed for solving this task, while our models learn the features useful for the task of interest, and can achieve better performance than generic similarity metrics.
173
+
174
+ # 4.3 MORE BASELINES AND ABLATION STUDIES
175
+
176
+ In this section, we carefully examine the effects of the design decisions we made in the GMN model and compare it against a few more alternatives. In particular, we evaluate the popular Graph Convolutional Network (GCN) model by Kipf & Welling (2016) as an alternative to our GNN model, and Siamese versions of the GNN/GCN embedding models. The GCN model replaces the message passing in Eq. 2 with graph convolutions, and the Siamese model predicts a distance value by concatenating two graph vectors and then pass through a 2 layer MLP. The comparison with Siamese networks can in particular show the importance of the cross-graph attention early on in the similarity computation process, as Siamese networks fuse the representations for 2 graphs only at the very end.
177
+
178
+ We focus on the function similarity search task, and also conduct experiments on an extra COILDEL mesh graph dataset (Riesen & Bunke, 2008), which contains 100 classes of mesh graphs corresponding to 100 types of objects. We treat graphs in the same class as similar, and used identical setup as the function similarity search task for training and evaluation.
179
+
180
+ <table><tr><td>Model</td><td>Pair AUC</td><td>Triplet Acc</td></tr><tr><td>Baseline</td><td>96.09</td><td>96.35</td></tr><tr><td>GCN</td><td>96.67</td><td>96.57</td></tr><tr><td>Siamese-GCN</td><td>97.54</td><td>97.51</td></tr><tr><td>GNN</td><td>97.71</td><td>97.83</td></tr><tr><td>Siamese-GNN</td><td>97.76</td><td>97.58</td></tr><tr><td>GMN</td><td>99.28</td><td>99.18</td></tr></table>
181
+
182
+ Function Similarity Search
183
+
184
+ <table><tr><td>Model</td><td>Pair AUC</td><td>Triplet Acc</td></tr><tr><td>GCN</td><td>94.80</td><td>94.95</td></tr><tr><td>Siamese-GCN</td><td>95.90</td><td>96.10</td></tr><tr><td>GNN</td><td>98.58</td><td>98.70</td></tr><tr><td>Siamese-GNN</td><td>98.76</td><td>98.55</td></tr><tr><td>GMN</td><td>98.97</td><td>98.80</td></tr></table>
185
+
186
+ COIL-DEL
187
+
188
+ Table 2: More results on the function similarity search task and the extra COIL-DEL dataset.
189
+
190
+ Table 2 summarizes the experiment results, which clearly show that: (1) the GNN embedding model is a competitive model (more powerful than the GCN model); (2) using Siamese network architecture to learn similarity on top of graph representations is better than using a prespecified similarity metric (Euclidean, Hamming etc.); (3) the GMNs outperform the Siamese models showing the importance of cross-graph information communication early in the computation process.
191
+
192
+ # 5 CONCLUSIONS AND DISCUSSION
193
+
194
+ In this paper we studied the problem of graph similarity learning using graph neural networks. Compared to standard prediction problems for graphs, similarity learning poses a unique set of challenges and potential benefits. For example, the graph embedding models can be learned through a classification setting when we do have a set of classes in the dataset, but formulating it as a similarity learning problem can handle cases where we have a very large number of classes and only very few examples for each class. The representations learned from the similarity learning setting can also easily generalize to data from classes unseen during training (zero-shot generalization).
195
+
196
+ We proposed the new graph matching networks as a stronger alternative to the graph embedding models. The added power for the graph matching models comes from the fact that they are not independently mapping each graph to an embedding, but rather doing comparisons at all levels across the pair of graphs, in addition to the embedding computation. The model can then learn to properly allocate capacity toward the embedding part or the matching part. The price to pay for this expressivity is the added computation cost in two aspects: (1) since each cross-graph matching step requires the computation of the full attention matrices, which requires at least $O ( | V _ { 1 } | | V _ { 2 } | )$ time, this may be expensive for large graphs; (2) the matching models operate on pairs, and cannot directly be used for indexing and searching through large graph databases. Therefore it is best to use the graph matching networks when we (1) only care about the similarity between individual pairs, or (2) use them in a retrieval setting together with a faster filtering model like the graph embedding model or standard graph similarity search methods, to narrow down the search to a smaller candidate set, and then use the more expensive matching model to rerank the candidates to improve precision.
197
+
198
+ Developing neural models for graph similarity learning is an important research direction with many applications. There are still many interesting challenges to resolve, for example to improve the efficiency of the matching models, study different matching architectures, adapt the GNN capacity to graphs of different sizes, and applying these models to new application domains. We hope our work can spur further research in this direction.
199
+
200
+ # REFERENCES
201
+
202
+ CVE-2010-0188. Available from MITRE, CVE-ID CVE-2010-0188., 2010. URL https://cve. mitre.org/cgi-bin/cvename.cgi?name $: =$ cve-2010-0188.
203
+
204
+ CVE-2018-0986. Available from MITRE, CVE-ID CVE-2018-0986., 2018. URL https://cve.mitre.org/cgi-bin/cvename.cgi?name $=$ CVE-2018-0986.
205
+
206
+ Pierre Baldi and Yves Chauvin. Neural networks for fingerprint recognition. Neural Computation, 5 (3):402–418, 1993.
207
+
208
+ Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, and Koray Kavukcuoglu. Interaction networks for learning about objects, relations and physics. In Advances in neural information processing systems, pp. 4502–4510, 2016.
209
+
210
+ Peter W. Battaglia, Jessica B. Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, Caglar Gulcehre, Francis Song, Andrew Ballard, Justin Gilmer, George Dahl, Ashish Vaswani, Kelsey Allen, Charles Nash, Victoria Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matt Botvinick, Oriol Vinyals, Yujia Li, and Razvan Pascanu. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
211
+
212
+ Jon Louis Bentley. Multidimensional binary search trees used for associative searching. Communications of the ACM, 18(9):509–517, 1975.
213
+
214
+ Stefano Berretti, Alberto Del Bimbo, and Enrico Vicario. Efficient matching and indexing of graph models in content-based retrieval. IEEE Transactions on Pattern Analysis and Machine Intelligence, 23(10):1089–1105, 2001.
215
+
216
+ Luca Bertinetto, Jack Valmadre, Joao F Henriques, Andrea Vedaldi, and Philip HS Torr. Fullyconvolutional siamese networks for object tracking. In European conference on computer vision, pp. 850–865. Springer, 2016.
217
+
218
+ Karsten M Borgwardt and Hans-Peter Kriegel. Shortest-path kernels on graphs. In Data Mining, Fifth IEEE International Conference on, pp. 8–pp. IEEE, 2005.
219
+
220
+ Jane Bromley, Isabelle Guyon, Yann LeCun, Eduard Säckinger, and Roopak Shah. Signature verification using a" siamese" time delay neural network. In Advances in Neural Information Processing Systems, pp. 737–744, 1994.
221
+
222
+ Michael M Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. Geometric deep learning: going beyond euclidean data. IEEE Signal Processing Magazine, 34(4):18–42, 2017.
223
+
224
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. arXiv preprint arXiv:1312.6203, 2013.
225
+
226
+ Moses S. Charikar. Similarity estimation techniques from rounding algorithms. In Proceedings of the Thiry-fourth Annual ACM Symposium on Theory of Computing, STOC ’02, pp. 380–388, New York, NY, USA, 2002. ACM. ISBN 1-58113-495-9. doi: 10.1145/509907.509965. URL http://doi.acm.org/10.1145/509907.509965.
227
+
228
+ Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In Computer Vision and Pattern Recognition, 2005. CVPR 2005. IEEE Computer Society Conference on, volume 1, pp. 539–546. IEEE, 2005.
229
+
230
+ 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.
231
+
232
+ Jason V Davis, Brian Kulis, Prateek Jain, Suvrit Sra, and Inderjit S Dhillon. Information-theoretic metric learning. In Proceedings of the 24th international conference on Machine learning (ICML), pp. 209–216, 2007.
233
+
234
+ Remco Dijkman, Marlon Dumas, and Luciano García-Bañuelos. Graph matching algorithms for business process model similarity search. In International Conference on Business Process Management, pp. 48–63. Springer, 2009.
235
+
236
+ Thomas Dullien. functionsimsearch. https://github.com/google/ functionsimsearch, 2018. Accessed: 2018-05-14.
237
+
238
+ David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alán 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.
239
+
240
+ Paul Erdös and Alfréd Rényi. On random graphs, i. Publicationes Mathematicae (Debrecen), 6: 290–297, 1959.
241
+
242
+ Sebastian Eschweiler, Khaled Yakdan, and Elmar Gerhards-Padilla. discovre: Efficient crossarchitecture identification of bugs in binary code. In NDSS, 2016.
243
+
244
+ Qian Feng, Rundong Zhou, Chengcheng Xu, Yao Cheng, Brian Testa, and Heng Yin. Scalable graph-based bug search for firmware images. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, pp. 480–491. ACM, 2016.
245
+
246
+ Xinbo Gao, Bing Xiao, Dacheng Tao, and Xuelong Li. A survey of graph edit distance. Pattern Analysis and applications, 13(1):113–129, 2010.
247
+
248
+ 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.
249
+
250
+ Aristides Gionis, Piotr Indyk, Rajeev Motwani, et al. Similarity search in high dimensions via hashing. In Vldb, pp. 518–529, 1999.
251
+
252
+ Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In IEEE International Joint Conference on Neural Networks (IJCNN), volume 2, pp. 729–734. IEEE, 2005.
253
+
254
+ Tamás Horváth, Thomas Gärtner, and Stefan Wrobel. Cyclic pattern kernels for predictive graph mining. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 158–167. ACM, 2004.
255
+
256
+ Junlin Hu, Jiwen Lu, and Yap-Peng Tan. Discriminative deep metric learning for face verification in the wild. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1875–1882, 2014.
257
+
258
+ Hisashi Kashima, Koji Tsuda, and Akihiro Inokuchi. Marginalized kernels between labeled graphs. In Proceedings of the 20th international conference on machine learning (ICML-03), pp. 321–328, 2003.
259
+
260
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
261
+
262
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
263
+
264
+ Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov. Siamese neural networks for one-shot image recognition. In ICML Deep Learning Workshop, volume 2, 2015.
265
+
266
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
267
+
268
+ Yujia Li, Oriol Vinyals, Chris Dyer, Razvan Pascanu, and Peter Battaglia. Learning deep generative models of graphs. arXiv preprint arXiv:1803.03324, 2018.
269
+
270
+ Mathias Niepert, Mohamed Ahmed, and Konstantin Kutzkov. Learning convolutional neural networks for graphs. In International conference on machine learning, pp. 2014–2023, 2016.
271
+
272
+ Jannik Pewny, Behrad Garmany, Robert Gawlik, Christian Rossow, and Thorsten Holz. Crossarchitecture bug search in binary executables. In IEEE Symposium on Security and Privacy (SP), pp. 709–724. IEEE, 2015.
273
+
274
+ Charles R. Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
275
+
276
+ John W Raymond, Eleanor J Gardiner, and Peter Willett. Rascal: Calculation of graph similarity using maximum common edge subgraphs. The Computer Journal, 45(6):631–644, 2002.
277
+
278
+ Kaspar Riesen and Horst Bunke. Iam graph database repository for graph based pattern recognition and machine learning. In Joint IAPR International Workshops on Statistical Techniques in Pattern Recognition (SPR) and Structural and Syntactic Pattern Recognition (SSPR), pp. 287–297. Springer, 2008.
279
+
280
+ 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.
281
+
282
+ Dennis Shasha, Jason TL Wang, and Rosalba Giugno. Algorithmics and applications of tree and graph searching. In Proceedings of the twenty-first ACM SIGMOD-SIGACT symposium on Principles of database systems, pp. 39–52. ACM, 2002.
283
+
284
+ Nino Shervashidze and Karsten M Borgwardt. Fast subtree kernels on graphs. In Advances in neural information processing systems, pp. 1660–1668, 2009.
285
+
286
+ Nino Shervashidze, SVN Vishwanathan, Tobias Petri, Kurt Mehlhorn, and Karsten Borgwardt. Efficient graphlet kernels for large graph comparison. In Artificial Intelligence and Statistics, pp. 488–495, 2009.
287
+
288
+ Nino Shervashidze, Pascal Schweitzer, Erik Jan van Leeuwen, Kurt Mehlhorn, and Karsten M Borgwardt. Weisfeiler-lehman graph kernels. Journal of Machine Learning Research, 12(Sep): 2539–2561, 2011.
289
+
290
+ Pranav Shyam, Shubham Gupta, and Ambedkar Dukkipati. Attentive recurrent comparators. arXiv preprint arXiv:1703.00767, 2017.
291
+
292
+ Srinath Srinivasa and Sujit Kumar. A platform based on the multi-dimensional data model for analysis of bio-molecular structures. In Proceedings of the VLDB Conference, pp. 975–986. Elsevier, 2003.
293
+
294
+ Yi Sun, Yuheng Chen, Xiaogang Wang, and Xiaoou Tang. Deep learning face representation by joint identification-verification. In Advances in neural information processing systems, pp. 1988–1996, 2014.
295
+
296
+ 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.
297
+
298
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
299
+
300
+ S Vichy N Vishwanathan, Nicol N Schraudolph, Risi Kondor, and Karsten M Borgwardt. Graph kernels. Journal of Machine Learning Research, 11(Apr):1201–1242, 2010.
301
+
302
+ Tingwu Wang, Renjie Liao, Jimmy Ba, and Sanja Fidler. Nervenet: Learning structured policy with graph neural networks. In ICLR, 2018a.
303
+
304
+ Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E Sarma, Michael M Bronstein, and Justin M Solomon. Dynamic graph cnn for learning on point clouds. arXiv preprint arXiv:1801.07829, 2018b.
305
+
306
+ Kilian Q Weinberger and Lawrence K Saul. Distance metric learning for large margin nearest neighbor classification. Journal of Machine Learning Research, 10(Feb):207–244, 2009.
307
+
308
+ Boris Weisfeiler and AA Lehman. A reduction of a graph to a canonical form and an algebra arising during this reduction. Nauchno-Technicheskaya Informatsia, 2(9):12–16, 1968.
309
+
310
+ Peter Willett, John M Barnard, and Geoffrey M Downs. Chemical similarity searching. Journal of chemical information and computer sciences, 38(6):983–996, 1998.
311
+
312
+ Eric P Xing, Michael I Jordan, Stuart J Russell, and Andrew Y Ng. Distance metric learning with application to clustering with side-information. In Advances in neural information processing systems, pp. 521–528, 2003.
313
+
314
+ Xiaojun Xu, Chang Liu, Qian Feng, Heng Yin, Le Song, and Dawn Song. Neural network-based graph embedding for cross-platform binary code similarity detection. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, pp. 363–376. ACM, 2017.
315
+
316
+ Xifeng Yan, Philip S Yu, and Jiawei Han. Graph indexing: a frequent structure-based approach. In Proceedings of the ACM SIGMOD international conference on Management of data, pp. 335–346. ACM, 2004.
317
+
318
+ Xifeng Yan, Philip S Yu, and Jiawei Han. Substructure similarity search in graph databases. In Proceedings of the ACM SIGMOD international conference on Management of data, pp. 766–777, 2005.
319
+
320
+ Pinar Yanardag and SVN Vishwanathan. Deep graph kernels. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1365–1374, 2015.
321
+
322
+ Sergey Zagoruyko and Nikos Komodakis. Learning to compare image patches via convolutional neural networks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4353–4361. IEEE, 2015.
323
+
324
+ Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Ruslan R Salakhutdinov, and Alexander J Smola. Deep sets. In Advances in Neural Information Processing Systems, pp. 3394–3404, 2017.
325
+
326
+ Zhiping Zeng, Anthony KH Tung, Jianyong Wang, Jianhua Feng, and Lizhu Zhou. Comparing stars: On approximating graph edit distance. Proceedings of the VLDB, 2(1):25–36, 2009.
327
+
328
+ # A EXTRA DETAILS ON MODEL ARCHITECTURES
329
+
330
+ In the propagation layers of the graph embedding and matching models, we used an MLP with one hidden layer as the $f _ { \mathrm { m e s s a g e } }$ module, with a ReLU nonlinearity on the hidden layer. For node state vectors (the $\mathbf { h } _ { i } ^ { ( t ) }$ vectors) of dimension $D$ , the size of the hidden layer and the output is set to $2 D$ . We found it to be beneficial to initialize the weights of this $f _ { \mathrm { m e s s a g e } }$ module to be small, which helps stablizing training. We used the standard Glorot initialization with an extra scaling factor of 0.1. When not using this small scaling factor, at the begining of training the message vectors when summed up can have huge scales, which is bad for learning.
331
+
332
+ One extra thing to note about the propagation layers is that we can make all the propagation layers share the same set of parameters, which can be useful if this is a suitable inductive bias to have.
333
+
334
+ We tried different $f _ { \mathrm { n o d e } }$ modules in both experiments, and found GRUs to generally work better than one-hidden layer MLPs, and all the results reported uses GRUs as $f _ { \mathrm { n o d e } }$ , with the sum over edge messages $\textstyle \sum _ { j } \mathbf { m } _ { j \to i }$ treated as the input to the GRU for the embedding model, and the concatenation of $\begin{array} { r } { \sum _ { j } \mathbf { m } _ { j i } } \end{array}$ and $\textstyle \sum _ { j ^ { \prime } } \pmb { \mu } _ { j ^ { \prime } i }$ as the input to the GRU for the matching model.
335
+
336
+ In the aggregator module, we used a single linear layer for the node transformation MLP and the gating $\mathrm { M L P _ { g a t e } }$ in Eq.3. The output of this linear layer has a dimensionality the same as the required dimensionality for the graph vectors. $\begin{array} { r } { \sigma ( x ) = \frac { 1 } { 1 + e ^ { - x } } } \end{array}$ is the logistic sigmoid function, and $\odot$ is the element-wise product. After the weighted sum, another MLP with one hidden layers is used to further transform the graph vector. The hidden layer has the same size as the output, with a ReLU nonlinearity.
337
+
338
+ For the matching model, the attention weights are computed as
339
+
340
+ $$
341
+ a _ { j i } = \frac { \exp ( s _ { h } ( \mathbf { h } _ { i } ^ { ( t ) } , \mathbf { h } _ { j } ^ { ( t ) } ) ) } { \sum _ { j ^ { \prime } } \exp ( s _ { h } ( \mathbf { h } _ { i } ^ { ( t ) } , \mathbf { h } _ { j ^ { \prime } } ^ { ( t ) } ) ) } .
342
+ $$
343
+
344
+ We have tried the Euclidean similarity $s _ { h } ( \mathbf { h } _ { i } , \mathbf { h } _ { j } ) = - \| \mathbf { h } _ { i } - \mathbf { h } _ { j } \| ^ { 2 }$ for $s _ { h }$ , as well as the dot-product similarity $s _ { h } ( \mathbf h _ { i } , \mathbf h _ { j } ) = \mathbf h _ { i } ^ { \top } \mathbf h _ { j }$ , and they perform similarly without significant difference.
345
+
346
+ # B EXTRA EXPERIMENT DETAILS
347
+
348
+ We fixed the node state vector dimensionality to 32, and graph vector dimensionality to 128 throughout both the graph edit distance learning and binary function similarity search tasks. We tuned this initially on the function similarity search task, which clearly performs better than smaller models. Increasing the model size however leads to overfitting for that task. We directly used the same setting for the edit distance learning task without further tuning. Using larger models there should further improve model performance.
349
+
350
+ # B.1 LEARNING GRAPH EDIT DISTANCES
351
+
352
+ In this task the nodes and edges have no extra features associated with them, we therefore initialized the $\mathbf { x } _ { i }$ and $\mathbf { x } _ { i j }$ vectors as vectors of 1s, and the encoder MLP in Eq.1 is simply a linear layer for the nodes and an identity mapping for the edges.
353
+
354
+ We searched through the following hyperparameters: (1) triplet vs pair training; (2) number of propagation layers; (3) share parameters on different propagation layers or not. Learning rate is fixed at 0.001 for all runs and we used the Adam optimizer Kingma & Ba (2014). Overall we found: (1) triplet and pair training performs similarly, with pair training slightly better, (2) using more propagation layers consistently helps, and increasing the number of propagation layers $T$ beyond 5 may help even more, (3) sharing parameters is useful for performance more often than not.
355
+
356
+ Intuitively, the baseline WL kernel starts by labeling each node by its degree, and then iteratively updates a node’s representation as the histogram of neighbor node patterns, which is effectively also a graph propagation process. The kernel value is then computed as a dot product of graph representation vectors, which is the histogram of different node representations. When using the kernel with $T$ iterations of computation, a pair of graphs of size $| V |$ can have as large as a $2 \bar { | V | } T$
357
+
358
+ <table><tr><td>Eval Graphs</td><td>WL kernel</td><td>GNN</td><td>GMN</td></tr><tr><td>n=100,p=0.2</td><td>98.5 /99.4</td><td>96.6/96.8</td><td>96.8/97.7</td></tr><tr><td>n= :100,p=0.5</td><td>86.7 /97.0</td><td>79.8 / 81.4</td><td>83.1 / 83.6</td></tr><tr><td>n= 200,p=( :0.2</td><td>99.9 / 100.0</td><td>88.7 /88.5</td><td>89.4 /90.0</td></tr><tr><td>n= 200,p=0.5</td><td>93.5 /99.2</td><td>72.0 / 72.3</td><td>68.3 / 70.1</td></tr></table>
359
+
360
+ Table 3: Generalization performance on large graphs for the GSL models trained on small graphs with $2 0 \leq n \leq 5 0$ and $0 . 2 \leq p \leq 0 . 5$ .
361
+
362
+ dimensional representation vector for each graph, and these sets of effective ‘feature’ types are different for different pairs of graphs as the node patterns can be very different. This is an advantage for WL kernel over our models as we used a fixed sized graph vector regardless of the graph size. We evaluate WL kernel for $T$ up to 5 and report results for the best $T$ on the evaluation set.
363
+
364
+ In addition to the experiments presented in the main paper, we have also tested the generalization capabilities of the proposed models, and we present the extra results in the following.
365
+
366
+ Train on small graphs, generalize to large graphs. In this experiment, we trained the GSL models on graphs with $n$ sampled uniformly from 20 to 50, and $p$ sampled from range [0.2, 0.5] to cover more variability in graph sizes and edge density for better generalization, and we again fix $k _ { p } = 1 , k _ { n } = 2$ . For evaluation, we tested the best embedding models and matching models on graphs with $n = 1 0 0$ , 200 and $p = 0 . 2 , 0 . 5$ , with results shown in Table 3. We can see that for this task the GSL models trained on small graphs can generalize to larger graphs than they are trained on. The performance falls off a bit on much larger graphs with much more nodes and edges. This is also partially caused by the fact that we are using a fixed sized graph vector throughout the experiments , but the WL kernel on the other hand has much more effective ‘features’ to use for computing similarity. On the other hand, as shown before, when trained on graphs from distributions we care about, the GSL models can adapt and perform much better.
367
+
368
+ Train on some $k _ { p } , k _ { n }$ combinations, test on other combinations. We have also tested the model trained on graphs with $n \in [ 2 0 , 5 0 ]$ , $p \in [ 0 . 2 , 0 . 5 ]$ , $k _ { p } = 1 , k _ { n } = 2$ , on graphs with different $k _ { p }$ and $k _ { n }$ combinations. In particular, when evaluated on $\bar { k _ { p } } = 1 , k _ { n } = 4$ , the models perform much better than on $k _ { p } = 1 , k _ { n } = 2$ , reaching 1.0 AUC and $100 \%$ triplet accuracy easily, as this is considerably simpler than the $k _ { p } = 1 , k _ { n } = 2$ setting. When evaluated on graphs with $k _ { p } = 2 , k _ { n } = 3$ , the performance is workse than $k _ { p } = 1 , k _ { n } = 2$ as this is a harder setting.
369
+
370
+ In addition, we have also tried training on the more difficult setting $k _ { p } = 2 , k _ { n } = 3$ , and evaluate the models on graphs with $k _ { p } = 1 , k _ { n } = 2$ and $n \in [ 2 0 , 5 0 ] , p \in [ 0 . 2 , 0 . 5 ]$ . The performance of the models on these graphs are actually be better than the models trained on this setting of $k _ { p } = 1 , k _ { n } = 2$ , which is surprising and clearly demonstrates the value of good training data. However, in terms of generalizing to larger graphs models trained on $k _ { p } = 2 , k _ { n } = 3$ does not have any significant advantages.
371
+
372
+ # B.2 BINARY FUNCTION SIMILARITY SEARCH
373
+
374
+ In this task the edges have no extra features so we initialize them to constant vectors of 1s, and the encoder MLP for the edges is again just an identity mapping. When using the CFG graph structure only, the nodes are also initialized to constant vectors of 1s, and the encoder MLP is a linear layer. In the case when using assembly instructions, we have a list of assembly code associated with each node. We extracted the operator type (e.g. add, mov, etc.) from each instruction, and then embeds each operator into a vector, the initial node representation is a sum of all operator embeddings.
375
+
376
+ We searched through the following hyperparameters: (1) triplet or pair training, (2) learning rate in $\lbrace 1 0 ^ { - 3 } , 1 0 ^ { - 4 } \rbrace$ , (3) number of propagation layers; (4) share propagation layer parameters or not; (5) GRU vs one-layer MLP for the $f _ { \mathrm { n o d e } }$ module.
377
+
378
+ Overall we found that (1) triplet training performs slightly better than pair training in this case; (2) both learning rates can work but the smaller learning rate is more stable; (3) increasing number of propagation layers generally helps; (4) using different propagation layer parameters perform better than using shared parameters; (5) GRUs are more stable than MLPs and performs overall better.
379
+
380
+ ![](images/593899a902ab852a2843b54ce2b3265206c74babd8a7390dfb46dede3315c18f.jpg)
381
+ Figure 5: Example control flow graphs for the same binary function, compiled with different compilers (clang for the leftmost one, gcc for the others) and optimization levels. Note that each node in the graphs also contains a set of assembly instructions which we also take into account when computing similarity using learned features.
382
+
383
+ In addition to the results reported in the main paper, we have also tried the same models on another dataset obtained by compiling the compression software unrar with different compilers and optimization levels. Our graph similarity learning methods also perform very well on the unrar data, but this dataset is a lot smaller, with around 400 functions only, and overfitting is therefore a big problem for any learning based model, so the results on this dataset are not very reliable to draw any conclusions.
384
+
385
+ A few more control-flow graph examples are shown in Figure 5. The distribution of graph sizes in the training set is shown in Figure 6.
386
+
387
+ # C EXTRA ATTENTION VISUALIZATIONS
388
+
389
+ A few more attention visualizations are included in Figure 7, Figure 8 and Figure 9. Here the graph matching model we used has shared parameters for all the propagation and matching layers and was trained with 5 propagation layers. Therefore we can use a number $T$ different from the number of propagation layers the model is being trained on to test the model’s performance. In both visualizations, we unrolled the propagation for up to 9 steps and the model still computes sensible attention maps even with $T > 5$ .
390
+
391
+ ![](images/8657a3e5631d8bd6ee1f6dc76ac824725490c4acac7510eb78f3f751399c367e.jpg)
392
+ Figure 6: Control flow graph size distribution in the training set. In this plot the graphs are sorted by size on the $\mathbf { X }$ axis, each point in the figure corresponds to the size of one graph.
393
+
394
+ Note that the attention maps do not converge to very peaked distributions. This is partially due to the fact that we used the node state vectors both to carry information through the propagation process, as well as in the attention mechanism as is. This makes it hard for the model to have very peaked attention as the scale of these node state vectors won’t be very big. A better solution is to compute separate key, query and value vectors for each node as done in the tensor2tensor self-attention formulation Vaswani et al. (2017), which may further improve the performance of the matching model.
395
+
396
+ Figure 7 shows another possibility where the attention maps do not converge to very peaked distributions because of in-graph symmetries. Such symmetries are very typical in graphs. In this case even though the attention maps are not peaked, the cross graph communication vectors $\mu$ are still zero, and the two graphs will still have identical representation vectors.
397
+
398
+ ![](images/f69e60bd25ae00a37a03bd4120248e00d16c02d8c27bf6cf1d1155a28faa1217.jpg)
399
+ Figure 7: The change of cross-graph attention over propagation layers. Here the two graphs are two isomorphic chains and there are some in-graph symmetries. Note that in the end the nodes are matched to two corresponding nodes with equal weight, except the one at the center of the chain which can only match to a single other node.
400
+
401
+ ![](images/5bdf0211064fb6cc7078e04b791f4eb52b50e9dd5275d0e3abac2e6f046e5e4c.jpg)
402
+ Figure 8: The change of cross-graph attention over propagation layers. Here the two graphs are isomorphic, with graph edit distance 0. Note that in the end a lot of the matchings concentrated on the correct match.
403
+
404
+ ![](images/7abeb45f8c7ff4e0d7cc0be473c7585f5ba2fb4d7fb80b63d7d6a4e0bc6c8519.jpg)
405
+ Figure 9: The change of cross-graph attention over propagation layers. The edit distance between these two graphs is 1.
md/train/SJgdnAVKDH/SJgdnAVKDH.md ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # REVISITING SELF-TRAINING FOR NEURAL SEQUENCE GENERATION
2
+
3
+ Junxian He∗ Carnegie Mellon University junxianh@cs.cmu.edu
4
+
5
+ Jiatao $\mathbf { G u } ^ { * }$ , Jiajun Shen, Marc’Aurelio Ranzato Facebook AI Research, New York, NY {jgu,jiajunshen,ranzato}@fb.com
6
+
7
+ # ABSTRACT
8
+
9
+ Self-training is one of the earliest and simplest semi-supervised methods. The key idea is to augment the original labeled dataset with unlabeled data paired with the model’s prediction (i.e. the pseudo-parallel data). While self-training has been extensively studied on classification problems, in complex sequence generation tasks (e.g. machine translation) it is still unclear how self-training works due to the compositionality of the target space. In this work, we first empirically show that selftraining is able to decently improve the supervised baseline on neural sequence generation tasks. Through careful examination of the performance gains, we find that the perturbation on the hidden states (i.e. dropout) is critical for self-training to benefit from the pseudo-parallel data, which acts as a regularizer and forces the model to yield close predictions for similar unlabeled inputs. Such effect helps the model correct some incorrect predictions on unlabeled data. To further encourage this mechanism, we propose to inject noise to the input space, resulting in a “noisy” version of self-training. Empirical study on standard machine translation and text summarization benchmarks shows that noisy self-training is able to effectively utilize unlabeled data and improve the performance of the supervised baseline by a large margin.1
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Deep neural networks often require large amounts of labeled data to achieve good performance. However, acquiring labels is a costly process, which motivates research on methods that can effectively utilize unlabeled data to improve performance. Towards this goal, semi-supervised learning (Chapelle et al., 2009) methods that take advantage of both labeled and unlabeled data are a natural starting point. In the context of sequence generation problems, semi-supervised approaches have been shown to work well in some cases. For example, back-translation (Sennrich et al., 2015) makes use of the monolingual data on the target side to improve machine translation systems, latent variable models (Kingma et al., 2014) are employed to incorporate unlabeled source data to facilitate sentence compression (Miao & Blunsom, 2016) or code generation (Yin et al., 2018).
14
+
15
+ In this work, we revisit a much older and simpler semi-supervised method, self-training (ST, Scudder (1965)), where a base model trained with labeled data acts as a “teacher” to label the unannotated data, which is then used to augment the original small training set. Then, a “student” model is trained with this new training set to yield the final model. Originally designed for classification problems, common wisdom suggests that this method may be effective only when a good fraction of the predictions on unlabeled samples are correct, otherwise mistakes are going to be reinforced (Zhu & Goldberg, 2009). In the field of natural language processing, some early work have successfully applied self-training to word sense disambiguation (Yarowsky, 1995) and parsing (McClosky et al., 2006; Reichart & Rappoport, 2007; Huang & Harper, 2009).
16
+
17
+ However, self-training has not been studied extensively when the target output is natural language. This is partially because in language generation applications (e.g. machine translation) hypotheses are often very far from the ground-truth target, especially in low-resource settings. It is natural to
18
+
19
+ # Algorithm 1 Classic Self-training
20
+
21
+ 1: Train a base model $f _ { \theta }$ on $L = \{ \pmb { x } _ { i } , \pmb { y } _ { i } \} _ { i = 1 } ^ { l }$
22
+ 2: repeat
23
+ 3: Apply $f _ { \theta }$ to the unlabeled instances $U$
24
+ 4: Select a subset $S \subset \{ ( x , f _ { \pmb \theta } ( \pmb x ) ) | \pmb x \in U \}$
25
+ 5: Train a new model $f _ { \theta }$ on $S \cup L$
26
+ 6: until convergence or maximum iterations are reached
27
+
28
+ ask whether self-training can be useful at all in this case. While Ueffing (2006) and Zhang & Zong (2016) explored self-training in statistical and neural machine translation, only relatively limited gains were reported and, to the best of our knowledge, it is still unclear what makes self-training work. Moreover, Zhang & Zong (2016) did not update the decoder parameters when using pseudo parallel data noting that “synthetic target parts may negatively influence the decoder model of NMT”.
29
+
30
+ In this paper, we aim to answer two questions: (1) How does self-training perform in sequence generation tasks like machine translation and text summarization? Are “bad” pseudo targets indeed catastrophic for self-training? (2) If self-training helps improving the baseline, what contributes to its success? What are the important ingredients to make it work?
31
+
32
+ Towards this end, we first evaluate self-training on a small-scale machine translation task and empirically observe significant performance gains over the supervised baseline (§3.2), then we perform a comprehensive ablation analysis to understand the key factors that contribute to its success (§3.3). We find that the decoding method to generate pseudo targets accounts for part of the improvement, but more importantly, the perturbation of hidden states – dropout (Hinton et al., 2012) – turns out to be a crucial ingredient to prevent self-training from falling into the same local optimum as the base model, and this is responsible for most of the gains. To understand the role of such noise in self-training, we use a toy experiment to analyze how noise effectively propagates labels to nearby inputs, sometimes helping correct incorrect predictions $( \ S 4 . 1 )$ . Motivated by this analysis, we propose to inject additional noise by perturbing also the input. Comprehensive experiments on machine translation and text summarization tasks demonstrate the effectiveness of noisy self-training.
33
+
34
+ # 2 SELF-TRAINING
35
+
36
+ Formally, in conditional sequence generation tasks like machine translation, we have a parallel dataset $L = \{ \pmb { x } _ { i } , \pmb { y } _ { i } \} _ { i = 1 } ^ { l }$ and a large unlabeled dataset $\boldsymbol { U } = \{ \mathbf { x } _ { j } \} _ { j = l + 1 } ^ { l + u }$ , where $| U | > | L |$ in most cases. As shown in Algorithm 1, classic self-training starts from a base model trained with parallel data $L$ , and iteratively applies the current model to obtain predictions on unlabeled instances $U$ , then it incorporates a subset of the pseudo parallel data $S$ to update the current model.
37
+
38
+ There are two key factors: (1) Selection of the subset $S$ . $S$ is usually selected based on some confidence scores (e.g. log probability) (Yarowsky, 1995) but it is also possible for $S$ to be the whole pseudo parallel data (Zhu & Goldberg, 2009). (2) Combination of real and pseudo parallel data. A new model is often trained on the two datasets jointly as in back-translation, but this introduces an additional hyper-parameter to weigh the importance of the parallel data relative to the pseudo data (Edunov et al., 2018). Another way is to treat them separately – first we train the model on pseudo parallel data $S$ , and then fine-tune it on real data $L$ . In our preliminary experiments, we find that the separate training strategy with the whole pseudo parallel dataset (i.e. $\mathbf { \bar { \nabla } } S = \{ ( \mathbf { { \boldsymbol { x } } } , f _ { \theta } ( \mathbf { { \boldsymbol { x } } } ) ) | \mathbf { { \boldsymbol { x } } } \in U \} )$ produces better or equal performance for neural sequence generation while being simpler. Therefore, in the remainder of this paper we use this simpler setting. We include quantitative comparison regarding joint training, separate training, and pseudo-parallel data filtering in Appendix $\mathbf { B }$ , where separate training is able to match (or surpass) the performance of joint training.
39
+
40
+ In self-training, the unsupervised loss $\mathcal { L } _ { U }$ from unlabeled instances is defined as:
41
+
42
+ $$
43
+ \begin{array} { r } { \mathcal { L } _ { U } = - \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } \mathbb { E } _ { { \pmb y } \sim p _ { \pmb \theta ^ { * } } ( { \pmb y } | { \pmb x } ) } \log p _ { \pmb \theta } ( { \pmb y } | { \pmb x } ) , } \end{array}
44
+ $$
45
+
46
+ where $p ( { \pmb x } )$ is the empirical data distribution approximated with samples from $S$ , $p _ { \pmb { \theta } } ( \pmb { y } | \pmb { x } )$ is the conditional distribution defined by the model. $\pmb { \theta } ^ { * }$ is the parameter from the last iteration (initially it
47
+
48
+ <table><tr><td>Methods</td><td>PT</td><td>FT</td></tr><tr><td>baseline</td><td>1</td><td>15.6</td></tr><tr><td>ST (scratch)</td><td>16.8</td><td>17.9</td></tr><tr><td>ST (baseline)</td><td>16.5</td><td>17.5</td></tr></table>
49
+
50
+ ![](images/da636825754350288176394216a5f9a294d7de4d224c9b3ed76e0b57cc613735.jpg)
51
+ Figure 1: BLEU on WMT100K dataset from the supervised baseline and different self-training variants. We plot the results over 3 iterations. “ST” denotes self-training while “NST” denotes noisy self training.
52
+
53
+ Table 1: Test tokenized BLEU on WMT100K. Self-training results are from the first iteration. “Scratch” denotes that the system is initialized randomly and trained from scratch, while “baseline” means it is initialized with the baseline model.
54
+
55
+ is set as the parameter of the supervised baseline), and fixed within the current iteration. Eq. 1 reveals the connection between self-training and entropy regularization (Grandvalet & Bengio, 2005). In the context of classification, self-training can be understood from the view of entropy regularization (Lee, 2013), which favors a low-density separation between classes, a commonly assumed prior for semi-supervised learning (Chapelle & Zien, 2005).
56
+
57
+ # 3 A CASE STUDY ON MACHINE TRANSLATION
58
+
59
+ To examine the effectiveness of self-training on neural sequence generation, we start by analyzing a machine translation task. We then perform ablation analysis to understand the contributing factors of the performance gains.
60
+
61
+ # 3.1 SETUP
62
+
63
+ We work with the standard WMT 2014 English-German dataset consisting of about 3.9 million training sentence pairs after filtering long and imbalanced pairs. Sentences are encoded using 40K byte-pair codes (Sennrich et al., 2016). As a preliminary experiment, we randomly sample 100K sentences from the training set to train the model and use the remaining English sentences as the unlabeled monolingual data. For convenience, we refer to this dataset as WMT100K. Such synthetic setting allows us to have high-quality unlabeled data to verify the performance of self-training. We train with the Base Transformer architecture (Vaswani et al., 2017) and dropout rate at 0.3. Full training and optimization parameters can be found in Appendix A.1. All experiments throughout this paper including the transformer implementation are based on the fairseq toolkit (Ott et al., 2019), and all results are in terms of case-sensitive tokenized BLEU (Papineni et al., 2002). We use beam search decoding (beam size 5) to create the pseudo targets and to report BLEU on test set.
64
+
65
+ # 3.2 OBSERVATIONS
66
+
67
+ In Figure 1, we use green bars to show the result of applying self-training for three iterations. We include both (1) pseudo-training $( P T )$ : the first step of self-training where we train a new model (from scratch) using only the pseudo parallel data generated by the current model, and (2) finetuning $( F T )$ : the fine-tuned system using real parallel data based on the pretrained model from the PT step. Note that in the fine-tuning step the system is re-initialized from scratch. Surprisingly, we find that the pseudo-training step at the first iteration is able to improve BLEU even if the model is only trained on its own predictions, and fine-tuning further boosts the performance. The test BLEU keeps improving over the first three iterations, until convergence to outperform the initial baseline by 3 BLEU points.
68
+
69
+ <table><tr><td>Methods</td><td>PT</td><td>FT</td></tr><tr><td>baseline baseline (w/o dropout)</td><td>1</td><td>15.6 5.2</td></tr><tr><td>ST (beam search,w/ dropout)</td><td>1 16.5</td><td>17.5</td></tr><tr><td>ST (sampling, w/ dropout)</td><td>16.1</td><td>17.0</td></tr><tr><td>ST (beam search,w/o dropout)</td><td>15.8</td><td>16.3</td></tr><tr><td>ST (sampling, w/o dropout)</td><td>15.5</td><td>16.0</td></tr><tr><td>Noisy ST (beam search, w/o dropout)</td><td></td><td>17.9</td></tr><tr><td>Noisy ST (beam search, w/ dropout)</td><td>15.8 16.6</td><td>19.3</td></tr></table>
70
+
71
+ Table 2: Ablation study on WMT100K data. For ST and noisy ST, we initialize the model with the baseline and results are from one single iteration. Dropout is varied only in the PT step, while dropout is always applied in FT step. Different decoding methods refer to the strategy used to create the pseudo target. At test time we use beam search decoding for all models.
72
+
73
+ This behaviour is unexpected because no new information seems to be injected during this iterative process – target sentences of the monolingual data are from the base model’s predictions, thus translation errors are likely to remain, if not magnified. This is different from back-translation where new knowledge may originate from an additional backward translation model and real monolingual targets may help the decoder generate more fluent sentences.
74
+
75
+ One straightforward hypothesis is that the added pseudo-parallel data might implicitly change the training trajectory towards a (somehow) better local optimum, given that we train a new model from scratch at each iteration. To rule out this hypothesis, we perform an ablation experiment and initialize $\pmb { \theta }$ from the last iteration (i.e. $\pmb { \theta } ^ { * }$ ). Formally, based on Eq. 1 we have:
76
+
77
+ $$
78
+ \nabla _ { \pmb { \theta } } \mathcal { L } _ { U } | _ { \pmb { \theta = \theta } ^ { \ast } } = - \mathbb { E } _ { \pmb { x } \sim p ( \pmb { x } ) } \left[ \nabla _ { \pmb { \theta } } \mathbb { E } _ { \pmb { y } \sim p _ { \theta ^ { \ast } } ( \pmb { y } | \pmb { x } ) } \log p _ { \theta } ( \pmb { y } | \pmb { x } ) | _ { \pmb { \theta = \theta } ^ { \ast } } \right] = 0 ,
79
+ $$
80
+
81
+ because the conditional log likelihood is maximized when $p _ { \pmb { \theta } } ( \pmb { y } | \pmb { x } )$ matches the underlying data distribution $p _ { \pmb { \theta } ^ { \ast } } ( \pmb { y } | \pmb { x } )$ . Therefore, the parameter $\pmb \theta$ should not (at least not significantly) change if we initialize it with $\pmb { \theta } ^ { * }$ from the last iteration.
82
+
83
+ Table 1 shows the comparison results of these two initialization schemes at the first iteration. Surprisingly, continuing training from the baseline model also yields an improvement of 1.9 BLEU points, comparable to initializing from random. While stochastic optimization introduces randomness in the training process, it is startling that continuing training gives such a non-trivial improvement. Next, we investigate the underlying reasons for this.
84
+
85
+ # 3.3 THE SECRET BEHIND SELF-TRAINING
86
+
87
+ To understand why continuing training contradicts Eq. 2 and improves translation performance, we examine possible discrepancies between our assumptions and the actual implementation, and formulate two new hypotheses:
88
+
89
+ H1. Decoding Strategy. According to this hypothesis, the gains come from the use of beam search for decoding unlabeled data. Since our focus is a sequence generation task, we decode $\textbf { { y } }$ with beam search to approximate the expectation in $\mathbb { E } _ { { \pmb { y } } \sim p _ { \pmb { \theta } ^ { * } } ( { \pmb { y } } | { \pmb x } ) } \log { \bar { p } _ { \pmb { \theta } } ( { \pmb { y } } | { \pmb x } ) }$ , yielding a biased estimate, while sampling decoding would result in an unbiased Monte Carlo estimator. The results in Table 2 demonstrate that the performance drops by 0.5 BLEU when we change the decoding strategy to sampling, which implies that beam search does contribute a bit to the performance gains. This phenomenon makes sense intuitively since beam search tends to generate higher-quality pseudo targets than sampling, and the subsequent cross-entropy training might benefit from implicitly learning the decoding process. However, the decoding strategy hypothesis does not fully explain it, as we still observe a gain of 1.4 BLEU points over the baseline from sampling decoding with dropout.
90
+
91
+ H2. Dropout (Hinton et al., 2012). Eq. 1 and Eq. 2 implicitly ignore a (seemingly) small difference between the model used to produce the pseudo targets and the model used for training: at test/decoding time the model does not use dropout while at training time dropout noise is injected in the model hidden states. At training time, the model is forced to produce the same (pseudo) targets given the same set of inputs and the same parameter set but various noisy versions of the hidden states. The conjecture is that the additional expectation over dropout noise renders Eq. 2 false. To verify this, we remove dropout in the pseudo training step2. The results in Table 2 indicate that without dropout the performance of beam search decoding drops by 1.2 BLEU, just 0.7 BLEU higher than the baseline. Moreover, the pseudo-training performance of sampling without dropout is almost the same as the baseline, which finally agrees with our intuitions from Eq. 2.
92
+
93
+ In summary, Table 2 suggests that beam-search decoding contributes only partially to the performance gains, while the implicit perturbation – dropout – accounts for most of it. However, it is still mysterious why such perturbation results in such large performance gains. If dropout is meant to avoid overfitting and fit the target distribution better in the pseudo-training step, why does it bring advantages over the baseline given that the target distribution is from the baseline model itself ? This is the subject of the investigation in the next section.
94
+
95
+ # 4 NOISE IN SELF-TRAINING
96
+
97
+ # 4.1 THE ROLE OF NOISE
98
+
99
+ One hypothesis as to why noise (perturbation) is beneficial for self-training, is that it enforces local smoothness for this task, that is, semantically similar inputs are mapped to the same or similar targets. Since the assumption that similar input should ideally produce similar target largely holds for most tasks in practice, this smoothing effect of pseudo-training step may provide a favorable regularization for the subsequent finetuning step. Unlike standard regularization in supervised training which is local to the real parallel data, self-training smooths the data space covered by the additional and much larger monolingual data.
100
+
101
+ Table 3: Results on the toy sum dataset. For ST and noisy ST, smoothness (↓) and symmetric (↓) results are from the pseudo-training step, while test errors (↓) are from fine-tuning, all at the first iteration.
102
+
103
+ <table><tr><td>Methods</td><td>smoothness</td><td>symmetric</td><td>error</td></tr><tr><td>baseline</td><td>9.1</td><td>9.8</td><td>7.6</td></tr><tr><td>ST</td><td>8.2</td><td>9.0</td><td>6.2</td></tr><tr><td>noisy ST</td><td>7.3</td><td>8.2</td><td>4.5</td></tr></table>
104
+
105
+ To verify this hypothesis more easily, we work with the toy task of summing two integers in the range 0 to 99. We concatenate the two integers and view them as a sequence of digits, the sum is also predicted at the digit level, thus this is still a sequence to sequence task. There are 10000 possible data points in the entire space, and we randomly sample 250 instances for training,3 100 for validation, 5000 for test, and 4000 as the unlabeled data. Test errors are computed as the absolute difference between the predicted integer and the ground-truth integer. We use an LSTM model to tackle this task. We perform self-training for one iteration on this toy sum dataset and initialize the model with the base model to rule out differences due to the initialization. Setup details are in Appendix A.1.
106
+
107
+ For any integer pair $( x _ { 1 } , x _ { 2 } )$ , we measure local smoothness as the standard deviation of the predictions in a $3 \times 3$ neighborhood of $( x _ { 1 } , x _ { 2 } )$ . These values are averaged over all the 10000 points to obtain the overall smoothness. We compare smoothness between baseline and ST pseudo-training in Table 3. To demonstrate the effect of smoothing on the fine-tuning step, we also report test errors after fine-tuning. We observe that ST pseudo-training attains better smoothness, which helps reducing test errors in the subsequent fine-tuning step.
108
+
109
+ One natural question is whether we could further improve performance by encouraging even lower smoothness value, although there is a clear trade-off, as a totally smooth model that outputs a constant value is also a bad predictor. One way to decrease smoothness is by increasing the dropout probability in the pseudo-training step, but a large dropout (like 0.5) makes the model too unstable and slow at converging. Therefore, we consider a simple model-agnostic perturbation process – perturbing the input, which we refer to as noisy self-training (noisy ST).
110
+
111
+ ![](images/5d0d65d405c12883f059b336b7d310b3cef8725e1bfc459455866d0394e0bdcb.jpg)
112
+ Figure 2: Two examples of error heat map on the toy sum dataset that shows the effect of smoothness. The left panel of each composition is from the baseline, and the right one is from the pseudo-training step at the first iteration. $x$ and $y$ axes represent the two input integers. Deeper color represent larger errors.
113
+
114
+ # 4.2 NOISY SELF-TRAINING
115
+
116
+ If we perturb the input during the pseudo-training step, then Eq. 1 would be modified to:
117
+
118
+ $$
119
+ \begin{array} { r } { \mathcal { L } _ { U } = - \mathbb { E } _ { { \pmb x } ^ { \prime } \sim g ( { \pmb x } ) , { \pmb x } \sim p ( { \pmb x } ) } \mathbb { E } _ { { \pmb y } \sim p _ { \theta ^ { * } } ( { \pmb y } | { \pmb x } ) } \log p _ { \theta } ( { \pmb y } | { \pmb x } ^ { \prime } ) , } \end{array}
120
+ $$
121
+
122
+ where $g ( { \pmb x } )$ is a perturbation function. Note that we apply both input perturbation and dropout in the pseudo-training step for noisy ST throughout the paper, but include ablation analysis in $\ S 4 . 3$ . We first validate noisy ST in the toy sum task. We shuffle the two integers in the input as the perturbation function. Such perturbation is suitable for this task since it would help the model learn the commutative law as well. To check that, we also measure the symmetry of the output space. Specifically, for any point $( x _ { 1 } , x _ { 2 } )$ , we compute $| f ( x _ { 1 } , x _ { 2 } ) - f ( x _ { 2 } , x _ { 1 } ) |$ and average it over all the points. Both smoothness and symmetry values are reported in Table 3. While we do not explicitly perturb the input at nearby integers, the shuffling perturbation greatly improves the smoothness metric as well. Furthermore, predictions are more symmetric and test errors are reduced.
123
+
124
+ In order to illustrate the effect of smoothness, in Figure 2 we show two examples of error heat map.4 When a point with large error is surrounded by points with small errors, the labels might propagate due to smoothing and its error is likely to become smaller, resulting in a “self-correcting” behaviour, as demonstrated in the left example of Figure 2. However, the prediction of some points might become worse due to the opposite phenomenon too, as shown in the right example of Figure 2. Therefore, the smoothing effect by itself does not guarantee a performance gain in the pseudotraining step, but fine-tuning benefits from it and seems to consistently improve the baseline in all datasets we experiment with.
125
+
126
+ # 4.3 OBSERVATIONS ON MACHINE TRANSLATION
127
+
128
+ Next, we apply noisy self-training to the more realistic WMT100 translation task. We try two different perturbation functions: (1) Synthetic noise as used in unsupervised MT (Lample et al., 2018), where the input tokens are randomly dropped, masked, and shuffled. We use the default noising parameters as in unsupervised MT but study the influence of noise level in $\ S 5 . 4$ . (2) Paraphrase. We translate the source English sentences to German and translate it back to obtain a paraphrase as the perturbation. Figure 1 shows the results over three iterations. Noisy ST (NST) greatly outperforms the supervised baseline by over 6 BLEU points and normal ST by 3 BLEU points, while synthetic noise does not exhibit much difference from paraphrasing. Since synthetic noise is much simpler and more general, in the remaining experiments we use synthetic noise unless otherwise specified.
129
+
130
+ Next, we report an ablation analysis of noisy ST when removing dropout at the pseudo-training step in Table 2. Noisy ST without dropout improves the baseline by 2.3 BLEU points and is comparable to normal ST with dropout. When combined together, noisy ST with dropout produces another 1.4 BLEU improvement, indicating that the two perturbations are complementary.
131
+
132
+ <table><tr><td rowspan="2">Methods</td><td colspan="2">WMT English-German</td><td colspan="3">FloRes English-Nepali</td></tr><tr><td>100K (+3.8M mono)</td><td>3.9M (+20M mono)</td><td>En-Origin</td><td>Ne-Origin</td><td>Overall</td></tr><tr><td>baseline</td><td>15.6</td><td>28.3</td><td>6.7</td><td>2.3</td><td>4.8</td></tr><tr><td>BT</td><td>20.5</td><td>1</td><td>8.2</td><td>4.5</td><td>6.5</td></tr><tr><td>noisy ST</td><td>21.4</td><td>29.3</td><td>8.9</td><td>3.5</td><td>6.5</td></tr></table>
133
+
134
+ Table 4: Results on two machine translation datasets. For WMT100K, we use the remaining 3.8M English and German sentences from training data as unlabeled data for noisy ST and BT, respectively.
135
+
136
+ # 5 EXPERIMENTS
137
+
138
+ Our experiments below are designed to examine whether the noisy self-training is generally useful across different sequence generation tasks and resource settings. To this end, we conduct experiments on two machine translation datasets and one text summarization dataset to test the effectiveness under both high-resource and low-resource settings.
139
+
140
+ # 5.1 GENERAL SETUP
141
+
142
+ We run noisy self-training for three iterations or until performance converges. The model is trained from scratch in the pseudo-training step at each iteration since we found this strategy to work slightly better empirically. Full model and training details for all the experiments can be found in Appendix A.1. In some settings, we also include back-translation (BT, Sennrich et al., 2015) as a reference point, since this is probably the most successful semi-supervised learning method for machine translation. However, we want to emphasize that BT is not directly comparable to ST since they use different resources (ST utilizes the unlabeled data on the source side while BT leverages target monolingual data) and use cases. For example, BT is not very effective when we translate English to extremely low-resource languages where there is almost no in-domain target monolingual data available. We follow the practice in (Edunov et al., 2018) to implement BT where we use unrestricted sampling to translate the target data back to the source. Then, we train the real and pseudo parallel data jointly and tune the upsampling ratio of real parallel data.
143
+
144
+ # 5.2 MACHINE TRANSLATION
145
+
146
+ We test the proposed noisy self-training on a high-resource translation benchmark: WMT14 EnglishGerman and a low-resource translation benchmark: FloRes English-Nepali.
147
+
148
+ • WMT14 English-German: In addition to WMT100K, we also report results with all 3.9M
149
+ training examples. For WMT100K we use the Base Transformer architecture, and the remaining parallel data as the monolingual data. For the full setting, we use the Big Transformer architecture (Vaswani et al., 2017) and randomly sample 20M English sentences from the News Crawl corpus for noisy ST.
150
+ FloRes English-Nepali: We evaluate noisy self-training on a low-resource machine translation dataset FloRes (Guzman et al., 2019) from English (en) to Nepali (ne), where we have 560K train- ´ ing pairs and a very weak supervised system that attains BLEU smaller than 5 points. For this dataset we have 3.6M Nepali monolingual instances in total (for BT) but 68M English Wikipedia
151
+ sentences.5 We randomly sample 5M English sentences for noisy ST. We use the same transformer architecture as in (Guzman et al., 2019). ´
152
+
153
+ The overall results are shown in Table 4. For almost all cases in both datasets, the noisy ST outperforms the baselines by a large margin $\mathrm { . 1 \sim 5 }$ BLEU scores), and we see that noisy ST still improves the baseline even when this is very weak.
154
+
155
+ Effect of Domain Mismatch. Test sets of the FloRes benchmark were built with mixed originaltranslationese – some sentences are from English sources and some are from Nepali sources. Intuitively, English monolingual data should be more in-domain with English-origin sentences and
156
+
157
+ <table><tr><td rowspan="2">Methods</td><td colspan="3">100K (+3.7M mono)</td><td colspan="3">640K (+3.2M mono)</td><td colspan="3">3.8M(+4M mono)</td></tr><tr><td>R1</td><td>R2</td><td>RL</td><td>R1</td><td>R2</td><td>RL</td><td>R1</td><td>R2</td><td>RL</td></tr><tr><td>MASS (Song et al., 2019)*</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>38.7</td><td>19.7</td><td>36.0</td></tr><tr><td>baseline</td><td>30.4</td><td>12.4</td><td>27.8</td><td>35.8</td><td>17.0</td><td>33.2</td><td>37.9</td><td>19.0</td><td>35.2</td></tr><tr><td>BT</td><td>32.2</td><td>13.8</td><td>29.6</td><td>37.3</td><td>18.4</td><td>34.6</td><td>1</td><td>一</td><td>一</td></tr><tr><td>noisy ST</td><td>34.1</td><td>15.6</td><td>31.4</td><td>36.6</td><td>18.2</td><td>33.9</td><td>38.6</td><td>19.5</td><td>35.9</td></tr></table>
158
+
159
+ Table 5: Rouge scores on Gigaword datasets. For the 100K setting we use the remaining 3.7M training data as unlabeled instances for noisy ST and BT. In the $3 . 8 \mathbf { M }$ setting we use 4M unlabeled data for noisy ST. Stared entry $( * )$ denotes that the system uses a much larger dataset for pretraining.
160
+
161
+ ![](images/b08dfd4e8a0d8b7b4ecf148a482647b43eb4bd984377e7fded1224f6a549cbc2.jpg)
162
+ Figure 3: Analysis of noisy self-training on WMT English-German dataset, demonstrating the effect of parallel data size, monolingual data size, and noise level.
163
+
164
+ Nepali monolingual data should help more for Nepali-origin sentences. To demonstrate this possible domain-mismatch effect, in Table 4 we report BLEU on the two different test sets separately.6 As expected, ST is very effective when the source sentences originate from English.
165
+
166
+ Comparison to Back-Translation. Table 4 shows that noisy ST is able to beat BT on WMT100K and on the en-origin test set of FloRes. In contrast, BT is more effective on the ne-origin test set according to BLEU, which is not surprising as the ne-origin test is likely to benefit more from Nepali than English monolingual data.
167
+
168
+ # 5.3 TEXT SUMMARIZATION
169
+
170
+ We further evaluate noisy self-training on the Gigaword summarization dataset (Rush et al., 2015) that has $3 . 8 \mathbf { M }$ training sentences. We encode the data with 30K byte-pair codes and use the Base Transformer architecture. Similar to the setting of WMT100K, for Gigaword we create two settings where we sample 100K or 640K training examples and use the remaining as unlabeled data to compare with BT. We also consider the setting where all the 3.8M parallel samples are used and we mine in-domain monolingual data by revisiting the original preprocessing procedure7 and using the ${ \sim } 4 \mathbf { M }$ samples that Rush et al. (2015) disregarded because they had low-quality targets. We report ROUGE scores (Lin, 2004) in Table 5. Noisy ST consistently outperforms the baseline in all settings, sometimes by a large margin (100K and 640K). It outperforms BT with 100K parallel data but underperforms with 640K parallel data. We conjecture that BT is still effective in this case because the task is still somewhat symmetric as Gigaword mostly contains short sentences and their compressed summaries. Notably, noisy ST in the full setting approaches the performance of state-of-the-art systems which use much larger datasets for pretraining (Song et al., 2019).
171
+
172
+ # 5.4 ANALYSIS
173
+
174
+ In this section, we focus on the WMT English-German dataset to examine the effect of three factors on noisy self-training: the size of the parallel dataset, the size of the monolingual dataset, and the noise level. All the noisy ST results are after the fine-tuning step.
175
+
176
+ Parallel data size. We fix the monolingual data size as 20M from News Crawl dataset, and vary the parallel data size as shown in Figure 3(a). We use a small LSTM model for 10K, Base Transformer for 100K/640K, and Big Transformer for 3.9M.8 Noisy ST is repeated for three iterations. We see that in all cases noisy ST is able to improve upon the baseline, while the performance gain is larger for intermediate value of the size of the parallel dataset, as expected.
177
+
178
+ Monolingual data size. We fix the parallel data size to 100K samples, and use the rest 3.8M English sentences from the parallel data as monolingual data. We sample from this set 100K, 500K, 1.5M, and $3 . 8 \mathbf { M }$ sentences. We also include another point that uses 20M monolingual sentences from a subset of News Crawl dataset. We report performance at the first iteration of noisy ST. Figure 3(b) illustrates that the performance keeps improving as the monolingual data size increases, albeit with diminishing returns.
179
+
180
+ Noise level. We have shown that noisy ST outperforms ST, but intuitively larger noise must not always be better since at some point it may destroy all the information present in the input. We adopt the WMT100K setting with 100K parallel data and 3.8M monolingual data, and set the word blanking probability in the synthetic noise (Lample et al., 2018) to 0.2 (default number), 0.4, 0.6, and 0.8. We also include the baseline ST without any synthetic noise. Figure 3(c) demonstrates that performance is quite sensitive to noise level, and that intermediate values work best. It is still unclear how to select the noise level a priori, besides the usual hyper-parameter search to maximize BLEU on the validation set.
181
+
182
+ # 5.5 NOISE PROCESS ON PARALLEL DATA ONLY
183
+
184
+ In this section, we justify whether the proposed noisy self-training process would help the supervised baseline alone without the help of any monolingual data. Similar to the training process on the monolingual data, we first train the model on the noisy source data (pseudo-training), and then finetune it on clean parallel data. Different from using monolingual data, there are two variations here in the “pseudo-training” step: we can either train with the fake target predicted by the model as on monolingual data, or train with the real target paired with noisy source. We denote them as “parallel $^ +$ fake target” and “parallel $^ +$ real target” respectively, and report the performance on WMT100K in Table 6. We use the same synthetic noise as used in previous experiments.
185
+
186
+ When applying the same noise process to parallel data using fake target, the smoothing effect is not significant since it is restricted into the limited parallel data space, producing marginal improvement over the baseline $( + 0 . 4$ BLEU). As a comparison, 100K monolingual data produces $+ 1 . 0$ BLEU and the effect is enhanced when we increase the monolingual data to $3 . 8 \mathbf { M }$ , which leads to $+ 3 . 7$ BLEU. Interestingly, pairing the noisy source with real target results in much worse performance than the baseline (-4.3 BLEU), which implies that the use of fake target predicted by the model (i.e. distillation) instead of real target is important for the success of noisy self-training, at least in the case where parallel data size is small. Intuitively, the distilled fake target is simpler and relatively easy for the model to fit, but the real target paired with noisy source makes learning even harder than training with real target and real source, which might lead to a bad starting point for fine-tuning. This issue would be particularly severe when the parallel data size is small, in that case the model would have difficulties to fit real target even with clean source.
187
+
188
+ # 6 RELATED WORK
189
+
190
+ Self-training belongs to a broader class of “pseudo-label” semi-supervised learning approaches. These approaches all learn from pseudo labels assigned to unlabelled data, with different methods on how to assign such labels. For instance, co-training (Blum & Mitchell, 1998) learns models on two independent feature sets of the same data, and assigns confident labels to unlabeled data from one of the models. Co-training reduces modeling bias by taking into account confidence scores from two models. In the same spirit, democratic co-training (Zhou & Goldman, 2004) or tri-training (Zhou & Li, 2005) trains multiple models with different configurations on the same data feature set, and a subset of the models act as teachers for others.
191
+
192
+ <table><tr><td>Methods</td><td>PT</td><td>FT</td></tr><tr><td> parallel baseline</td><td>1</td><td>15.6</td></tr><tr><td>noisy ST,100K mono + fake target</td><td>10.2</td><td>16.6</td></tr><tr><td> noisy ST, 3.8M mono + fake target</td><td>16.6</td><td>19.3</td></tr><tr><td>noisy ST,100K parallel +real target noisy ST,10OK parallel + fake target</td><td>6.7 10.4</td><td>11.3 16.0</td></tr></table>
193
+
194
+ Table 6: Results on WMT100K data. All results are from one single iteration. “Parallel $^ +$ real/fake target” denotes the noise process applied on parallel data but using real/fake target in the “pseudotraining” step. “Mono $^ +$ fake target” is the normal noisy self-training process described in previous sections.
195
+
196
+ Another line of more recent work perturb the input or feature space of the student’s inputs as data augmentation techniques. Self-training with dropout or noisy self-training can be viewed as an instantiation of this. These approaches have been very successful on classification tasks (Rasmus et al., 2015; Miyato et al., 2017; Laine & Aila, 2017; Miyato et al., 2018; Xie et al., 2019) given that a reasonable amount of predictions of unlabeled data (at least the ones with high confidence) are correct, but their effect on language generation tasks is largely unknown and poorly understood because the pseudo language targets are often very different from the ground-truth labels. Recent work on sequence generation employs auxiliary decoders (Clark et al., 2018) when processing unlabeled data, overall showing rather limited gains.
197
+
198
+ # 7 CONCLUSION
199
+
200
+ In this paper we revisit self-training for neural sequence generation, and show that it can be an effective method to improve generalization, particularly when labeled data is scarce. Through a comprehensive ablation analysis and synthetic experiments, we identify that noise injected during self-training plays a critical role for its success due to its smoothing effect. To encourage this behaviour, we explicitly perturb the input to obtain a new variant of self-training, dubbed noisy selftraining. Experiments on machine translation and text summarization demonstrate the effectiveness of this approach in both low and high resource settings.
201
+
202
+ # ACKNOWLEDGEMENTS
203
+
204
+ We want to thank Peng-Jen Chen for helping set up the FloRes experiments, and Michael Auli, Kyunghyun Cho, and Graham Neubig for insightful discussion about this project.
205
+
206
+ # REFERENCES
207
+
208
+ Avrim Blum and Tom Mitchell. Combining labeled and unlabeled data with co-training. In Proceedings of the eleventh annual conference on Computational learning theory, pp. 92–100. Citeseer, 1998.
209
+
210
+ Olivier Chapelle and Alexander Zien. Semi-supervised classification by low density separation. In Proceedings of AISTATS, 2005.
211
+
212
+ Olivier Chapelle, Bernhard Scholkopf, and Alexander Zien. Semi-supervised learning (chapelle, o. et al., eds.; 2006)[book reviews]. IEEE Transactions on Neural Networks, 20(3):542–542, 2009.
213
+
214
+ Kevin Clark, Minh-Thang Luong, Christopher D Manning, and Quoc V Le. Semi-supervised sequence modeling with cross-view training. In Proceedings of EMNLP, 2018.
215
+
216
+ Sergey Edunov, Myle Ott, Michael Auli, and David Grangier. Understanding back-translation at scale. In Proceedings of EMNLP, 2018.
217
+
218
+ Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In Proceedings of NeurIPS, 2005.
219
+
220
+ Francisco Guzman, Peng-Jen Chen, Myle Ott, Juan Pino, Guillaume Lample, Philipp Koehn, ´ Vishrav Chaudhary, and Marc’Aurelio Ranzato. The FLoRes evaluation datasets for low-resource machine translation: Nepali-english and sinhala-english. In Proceedings of EMNLP, 2019.
221
+
222
+ Geoffrey E Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan R Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580, 2012.
223
+
224
+ Zhongqiang Huang and Mary Harper. Self-training pcfg grammars with latent annotations across languages. In Proceedings of EMNLP, 2009.
225
+
226
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
227
+
228
+ Durk P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Proceedings of NeurIPS, 2014.
229
+
230
+ Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. In Proceedings of ICLR, 2017.
231
+
232
+ Guillaume Lample, Myle Ott, Alexis Conneau, Ludovic Denoyer, et al. Phrase-based & neural unsupervised machine translation. In Proceedings of EMNLP, 2018.
233
+
234
+ Dong-Hyun Lee. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on Challenges in Representation Learning, ICML, 2013.
235
+
236
+ Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pp. 74–81, 2004.
237
+
238
+ David McClosky, Eugene Charniak, and Mark Johnson. Effective self-training for parsing. In Proceedings of NAACL, 2006.
239
+
240
+ Yishu Miao and Phil Blunsom. Language as a latent variable: Discrete generative models for sentence compression. In Proceedings of EMNLP, 2016.
241
+
242
+ Takeru Miyato, Andrew M Dai, and Ian Goodfellow. Adversarial training methods for semisupervised text classification. In Proceedings of ICLR, 2017.
243
+
244
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 41(8):1979–1993, 2018.
245
+
246
+ Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of NAACL (Demo Track), 2019.
247
+
248
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. BLEU: a method for automatic evaluation of machine translation. In Proceedings of ACL, 2002.
249
+
250
+ Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semisupervised learning with ladder networks. In Proceedings of NeurIPS, 2015.
251
+
252
+ Roi Reichart and Ari Rappoport. Self-training for enhancement and domain adaptation of statistical parsers trained on small datasets. In Proceedings of ACL, 2007.
253
+
254
+ Alexander M Rush, Sumit Chopra, and Jason Weston. A neural attention model for abstractive sentence summarization. In Proceedings of EMNLP, 2015.
255
+
256
+ H Scudder. Probability of error of some adaptive pattern-recognition machines. IEEE Transactions on Information Theory, 11(3):363–371, 1965.
257
+
258
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Improving neural machine translation models with monolingual data. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pp. 86–96, 2015.
259
+
260
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of ACL, 2016.
261
+
262
+ Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, and Tie-Yan Liu. MASS: Masked sequence to sequence pre-training for language generation. In Proceedings of ICML, 2019.
263
+
264
+ Nicola Ueffing. Using monolingual source-language data to improve mt performance. In IWSLT, 2006.
265
+
266
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of NeurIPS, 2017.
267
+
268
+ Qizhe Xie, Zihang Dai, Eduard Hovy, Minh-Thang Luong, and Quoc V Le. Unsupervised data augmentation. arXiv preprint arXiv:1904.12848, 2019.
269
+
270
+ David Yarowsky. Unsupervised word sense disambiguation rivaling supervised methods. In Proceedings of ACL, 1995.
271
+
272
+ Pengcheng Yin, Chunting Zhou, Junxian He, and Graham Neubig. StructVAE: Tree-structured latent variable models for semi-supervised semantic parsing. In Proceedings of EMNLP, 2018.
273
+
274
+ Jiajun Zhang and Chengqing Zong. Exploiting source-side monolingual data in neural machine translation. In Proceedings of EMNLP, 2016.
275
+
276
+ Yan Zhou and Sally Goldman. Democratic co-learning. In 16th IEEE International Conference on Tools with Artificial Intelligence, pp. 594–602. IEEE, 2004.
277
+
278
+ Zhi-Hua Zhou and Ming Li. Tri-training: Exploiting unlabeled data using three classifiers. IEEE Transactions on Knowledge & Data Engineering, (11):1529–1541, 2005.
279
+
280
+ Xiaojin Zhu and Andrew B Goldberg. Introduction to semi-supervised learning. Synthesis lectures on artificial intelligence and machine learning, 3(1):1–130, 2009.
281
+
282
+ # A EXPERIMENTS DETAILS
283
+
284
+ # A.1 SETUP DETAILS
285
+
286
+ For all experiments, we optimize with Adam (Kingma & Ba, 2014) using $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 8 , \epsilon =$ $1 e - 8$ . All implementations are based on fairseq (Ott et al., 2019), and we basically use the same learning rate schedule and label smoothing as in fairseq examples to train the transformers.9 Except for the toy sum dataset which we runs on a single GPU and each batch contains 32 examples, all other experiments are run on 8 GPUs with an effective batch size of 33K tokens. All experiments are validated with loss on the validation set. For self-training or noisy self-training, the pseudo-training takes 300K synchronous updates while the fine-tuning step takes 100K steps.
287
+
288
+ We use the downloading and preprocessing scripts in fairseq to obtain the WMT 2014 EnglishGerman dataset,10 which hold out a small fraction of the original training data as the validation set.
289
+
290
+ The model architecture for the toy sum dataset is a single-layer LSTM with word embedding size 32, hidden state size 32, and dropout rate 0.3. The model architecture of WMT10K baseline in Figure 3(a) is a single layer LSTM with word embeddings size 256, hidden state size 256, and dropout rate 0.3.
291
+
292
+ # A.2 JUSTIFICATION OF THE WMT100K BASELINE
293
+
294
+ We provide more details and evidence to show that our baseline model on WMT100K dataset is trained properly. In all the experiments on WMT100K dataset including baseline and self-training ones, we use Adam optimizer with learning rate 0.0005, which is defaulted in fairseq. We do not use early stop during training but select the best model in terms of the validation loss. We train with 30K update steps for the baseline model and (300K pseudo-training $+ \ 1 0 0 \mathrm { K }$ fine-tuning) update steps for self-training. In both cases we verified that the models are trained sufficiently to fully converge through observing the increase of validation loss. Figure 4 shows the validation curve of the baseline model. Note that the model starts to overfit, and we select the model checkpoint at the lowest point. We also varied the learning rate hyperparameter as 0.0002, 0.0005, and 0.001, which produced BLEU score 15.0, 15.6 (reported in the paper), and 15.5 respectively – our baseline model in previous sections obtained the best performance.
295
+
296
+ ![](images/7a6d6c0d2f3cc5244202f60ed24576279f112c5a9c6ce03d28e3facf38384455.jpg)
297
+ Figure 4: Validation loss v.s. number of update steps, for the baseline model on WMT100K dataset.
298
+
299
+ B COMPARISON REGARDING SEPARATE TRAINING, JOINT TRAINING, AND FILTERING
300
+
301
+ In the paper we perform self-training with separate pseudo-training and fine-tuning steps and always use all monolingual data. However, there are other variants such as joint training or iteratively adding confident examples. Here we compare these variants on WMT100K dataset, noisy self-training uses paraphrase as the perturbation function. For joint training, we tune the upsampling ratio of parallel data just as in back-translation (Edunov et al., 2018). We perform noisy self-training for 3 iterations, and for filtering experiments we iteratively use the most confident 2.5M, 3M, and $3 . 8 \mathbf { M }$ monolingual data respectively in these 3 iterations. Table 7 shows that the filtering process helps joint training but still underperforms separate-training methods by over 1.5 BLEU points. Within separate training filtering produces comparable results to using all data. Since separate training with all data is the simplest method and produces the best performance, we stick to this version in the paper.
302
+
303
+ Table 7: Ablation analysis on WMT100K dataset.
304
+
305
+ <table><tr><td>Methods</td><td>BLEU</td></tr><tr><td>baseline</td><td>15.6</td></tr><tr><td>noisy ST (separate training,all data)</td><td>21.8</td></tr><tr><td>noisy ST (separate training, filtering)</td><td>21.6</td></tr><tr><td>noisy ST (joint training,all data)</td><td>18.8</td></tr><tr><td>noisy ST (joint training, filtering)</td><td>20.0</td></tr></table>
306
+
307
+ # C ADDITIONAL RESULTS ON THE TOY SUM DATASET
308
+
309
+ We additionally show the error heat maps of the entire data space on the toy sum datasets for the first two iterations. Here the model at pseudo-training step is initialized as the model from last iteration to clearly examine how the decodings change due to injected noise. As shown in Figure 5, for each iteration the pseudo-training step smooths the space and fine-tuning step benefits from it and greatly reduces the errors
310
+
311
+ ![](images/b22e220951af42f1586b41b8a9cd7905b6e3b987a0106d8ef8ab83b3694ee505.jpg)
312
+ 0024681242242283323484042464505254586062468772488246822946
313
+ (a) baseline
314
+
315
+ ![](images/d12d4c5d60111fbdf243a8a0afb346c75e2d6bd234209349af3e1f79fd955218.jpg)
316
+ 024681012461820224262832453840424645052458605246加24802846880246
317
+
318
+ (b) noisy ST (PT, iter=1)
319
+
320
+ ![](images/845ce1e77a3b2e292799b4411d25abdb8445b8418524b79bd2575daa7a8b0cfa.jpg)
321
+
322
+ ![](images/b1fbdbc0dc427a84e2259316715686904477a46f5522d668ab9ec0d0d8994290.jpg)
323
+ 002468101246820224262830234334042464850525458602468024802846802468
324
+
325
+ (d) noisy ST (PT, iter=2)
326
+
327
+ ![](images/369d8293b4654b92b101ce4c5914c527d705e7163689e0466ededb797700c5de.jpg)
328
+ Figure 5: Error heat maps on the toy sum dataset over the first two iterations. Deeper color represent larger errors.
md/train/SJzvDjAcK7/SJzvDjAcK7.md ADDED
@@ -0,0 +1,484 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # INTRIGUING PROPERTIES OF LEARNED REPRESENTA-TIONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ A key feature of neural networks, particularly deep convolutional neural networks, is their ability to “learn” useful representations from data. The very last layer of a neural network is then simply a linear model trained on these “learned” representations. Despite their numerous applications in other tasks such as classification, retrieval, clustering etc., a.k.a. transfer learning, not much work has been published that investigates the structure of these representations or indeed whether structure can be imposed on them during the training process.
8
+
9
+ In this paper, we study the effective dimensionality of the learned representations by models that have proved highly successful for image classification. We focus on ResNet-18, ResNet-50 and VGG-19 and observe that when trained on CIFAR10 or CIFAR100, the learned representations exhibit a fairly low rank structure. We propose a modification to the training procedure, which further encourages low rank structure on learned activations. Empirically, we show that this has implications for robustness to adversarial examples and compression.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Among the many successes of deep (convolutional) neural networks, an intriguing aspect has been their ability to generate representations of raw data that are useful in several tasks, usually known as representation learning. In the early days of deep learning, it was common to use unsupervised learning models, e.g. auto-encoders or Restricted Boltzmann machines, to learn useful representations of complex data (Hinton & Salakhutdinov, 2006; Vincent et al., 2010); more recently, it has been observed that hidden layers of neural networks trained in a completely supervised fashion can also be used as learned representations Zeiler & Fergus (2014); Sermanet et al. (2014); Donahue et al. (2014).
14
+
15
+ Essentially, for most models trained in a supervised fashion, the vector of activations in the penultimate layer (or at least in a layer close to the output) is a learned representation of the raw (for the purposes of this paper image) data. The final layer of a neural network is typically simply a multi-class logistic regression model. In this work, we mostly focus on the ResNet-18 and ResNet-50 (He et al., 2016), though we also report some results on VGG-networks (Simonyan & Zisserman, 2014). Although, several aspects of architectures of neural networks have been widely studied in the recent years, there has been little work on understanding the nature of these learned representations.
16
+
17
+ The learned representations have often been used in other tasks related to classification, retrieval, clustering etc. (often unrelated to the original classification problem) with a good degree of success (a.k.a. transfer learning) (Kiros et al., 2014; Lin & Parikh, 2015). Classically, representation learning has focused on finding low-dimensional structures or independent components through various models, from component analysis to auto-encoders. However, while hidden layers of neural networks are widely used as representations, as far as we are aware, not much work has been published on studying their structure. The current work studies these learned representations; our focus has been on the effective dimensionality, (as opposed to the actual dimension) of these learned representations. A ResNet-18/50 network consists of four ResNet blocks (each of which includes several convolutional layers and skip connections). We consider the dimensionality of the activations obtained at the end of the third and fourth ResNet block. Each data point $\mathbf { x }$ maps to a vector $\mathbf { a } \in \mathbb { R } ^ { m }$ , where $m$ is the number of units in one of the aforementioned layers; this vector is a learned representation of $\mathbf { x }$ .
18
+
19
+ We propose a modification to the training procedure to specifically make the activations (approximately) lie in a low rank space; more precisely, we add a term to the loss that encourages the activations in certain layers to lie in a low-rank affine subspace. The modified training process results in essentially no loss in accuracy (in some cases even shows modest gains) and further enhances the low-rank nature of the learned representations. The modification “adds” virtual low-rank layers to the model that ensure that the learned representations roughly lie in a low-rank space. The modified objective function is optimized using an alternate minimization approach, reminiscent of that used in iterative hard thresholding (Blumensath & Davies, 2009) or singular value projection (Jain et al., 2010). Using a na¨ıve singular value thresholding approach would render the training intractable for all practical purposes; we use a column sampling based Nystrom method (Williams & Seeger, 2001; ¨ Halko et al., 2011) to achieve significant speed-up, though at the cost of not getting the optimal low rank projections. One can view this modified training process as a way to constrain the neural network, though in a way that is very different to the widely used sparsity inducing methods (eg. (Anwar et al., 2017; Wen et al., 2016)) or structurally constrained methods (eg. (Moczulski et al., 2015; Liu et al., 2015)) that seek to tackle the problem of over-parameterization.
20
+
21
+ Finally, we also investigate the benefits of learning low-rank representations. One obvious benefit is the ability to compress the embeddings when they are used in other applications. The fact that these learned representations (approximately) lie in a low-dimensional (affine) space yields a natural (lossy) compression scheme. Furthermore, we investigate the robustness of networks trained in this fashion to adversarial attacks (Szegedy et al., 2013). Our experimental evaluation shows that networks trained in this fashion are substantially more robust to adversarial attacks than the standard architectures. In our experiments we look at gradient sign methods, its variants (Kurakin et al., 2016; 2017) and DeepFool (Moosavi-Dezfooli et al., 2016). We further perform empirical evaluation showing that when we train SVM classifiers on learned representations (or their low rank projections), the networks trained according to our modified procedure yield significantly more accurate predictions, especially when using very low rank projections of the learned representations, and are in general more robust to adversarial attacks.
22
+
23
+ Related Work: Empirical work by Oyallon (2017) suggests that conditioned on the class, these representations seem to (approximately) lie in a low-rank (affine) space; his work focuses on a different network architecture. Recent (and parallel) work by Lezama et al. (2017) promotes classconditional low rank embeddings and orthogonality between classes within a single mini-batch to create better discriminative models. They use nuclear norm as a relaxation of rank of a matrix and a loss reminiscent of Qiu & Sapiro (2015) to achieve this and due to their focus on mini-batches, it is unclear if the data as a whole exhibits low-rank structure. Their experiments do not consider adversarial robustness or compression.
24
+
25
+ From the point of view compression, it is natural to look at methods considering low rank approximations of model parameters (Jaderberg et al., 2014; Denton et al., 2014) as possible alternatives to our algorithm. However, low rank weights do not necessarily create low rank activations due to the non-linearities in neural networks. For similar reasons, reconstructions using auto-encoders also does not exhibit a low-rank structure (See Appendix A).
26
+
27
+ Organisation. The rest of the paper is organized as follows. Section 2 describes the relevant notation, the basic optimization problem and our training procedure. In Section 3, we list our results demonstrating the benefits of the modified training procedure to obtain better low-rank representations and in Section 4, we present results that demonstrate our network’s robustness to adversarial attacks.
28
+
29
+ # 2 LOW RANK PRIOR ON ACTIVATIONS
30
+
31
+ We define the activation matrix, $A _ { \ell }$ , of our network after a certain layer $\ell$ ; $A _ { \ell } \in \mathbb { R } ^ { n \times m }$ , where $n$ is the number of examples in our training set and $m$ is the dimension of the activation vector after the $\ell ^ { t h }$ layer. By imposing a low rank prior on this matrix, we enforce that the matrix $A _ { \ell }$ is approximately low rank.
32
+
33
+ We observe that even though enforcing a rank constraint on $A _ { \ell }$ does not obviously increase the sparsity of the model, if we consider a rank $r$ approximation, where $r \ll m$ , then there is no need to have more than $r$ units in the subsequent layer. Thus, having an (approximately) low rank representation allows us to compress both the model and the representations with little to no loss in accuracy (as our experimental results demonstrate).
34
+
35
+ Optimization problem: We impose a low rank prior by adding an extra rank regularizor as part of the training objective. We do not regularize the model parameters directly. Instead, we impose constraints on intermediate model outputs as a part of the optimization problem.
36
+
37
+ Let the neural network be represented by the function $f ( \cdot )$ , let $X = \left[ \mathbf { x } _ { 1 } , \cdots , \mathbf { x } _ { n } \right] ^ { \top }$ be the set of training inputs to the model and $Y = \left[ y _ { 1 } \cdots y _ { n } \right] ^ { \top }$ be the desired outputs. Consider the network to be composed of two networks, one consisting of layers before the $\ell ^ { t h }$ layer and the other after, i.e. $f ( \mathbf { x } _ { i } ) \doteq f _ { \ell } ^ { + } \left( f _ { \ell } ^ { - } ( \mathbf { x } _ { i } ) \right)$ . Here $f _ { \ell } ^ { + } ( \cdot )$ represents the network after the $\ell ^ { t h }$ activation layer and $f _ { \ell } ^ { - } ( \cdot )$ represents the network that produces the $\ell ^ { t h }$ activation layer. Let $f _ { \ell } ^ { - } ( X ) = A _ { \ell } = \left[ \mathbf { a } _ { 1 } \cdot \cdot \cdot \mathbf { a } _ { n } \right] ^ { \top } \in$ $\mathbb { R } ^ { \times m }$ represent the activation matrix of $n$ data points where $m$ is the dimension of the hidden layer. Our additional low rank constraint requires that rank $( A _ { \ell } ) = r \ll m$ .
38
+
39
+ Let $\mathcal { L } ( \theta , \phi ; X , Y )$ be the loss function where $f , X , Y$ are as defined above and $f _ { \ell } ^ { + } ( \cdot )$ and $f _ { \ell } ^ { - } ( \cdot )$ are parameterized by $\theta$ and $\phi$ respectively. The optimization problem can be written as follows:
40
+
41
+ $$
42
+ \theta , \phi = \operatorname * { a r g m i n } _ { \theta , \phi } \mathcal { L } \big ( \theta , \phi ; X , Y \big ) \qquad \mathrm { s . t . } \quad \operatorname { r a n k } \big ( f _ { \ell } ^ { - } \big ( X ; \phi \big ) \big ) = r
43
+ $$
44
+
45
+ A natural approach to this (non-convex) problem would be an alternate minimization algorithm, where the two parts $\mathcal { L } ( \theta , \phi ; X , Y )$ and rank $\left( f _ { \ell } ^ { - } ( X ; \phi ) \right)$ are optimized alternately. The first of these steps is typically a non-convex optimization problem while the second is a projection step onto a non-convex set which can be solved by performing a singular value decomposition. However, in practice, this approach is infeasible because:
46
+
47
+ (i) $f _ { \ell } ^ { - } \left( X ; \phi \right)$ is a large matrix and minimizing its rank at every iteration using a singular value decomposition is extremely costly, if not infeasible. (The dimension of this matrix can be as large as $5 0 , 0 0 0 \times 1 6 ,$ 384 in one of our experimental settings, but in each case is at least $5 0 , 0 0 0 \times 5 1 2 .$ ) $( i i )$ Minimizing the rank of the corresponding matrix for mini-batches i.e. $f _ { \ell } ^ { - } \left( X _ { 1 : b } ; \phi \right)$ does not guarantee that the rank of $f _ { \ell } ^ { - } \left( X _ { 1 : n } \right)$ will also be small.
48
+
49
+ Below, we discuss an efficient approach to solve the optimization problem (OPT) by considering some approximations, augmentations and sampling.
50
+
51
+ Augmented optimization problem: To avoid the aforementioned problems, we augment the optimization problem (OPT) by introducing an auxiliary low rank parameter $W \in \mathbb { R } ^ { m \times m }$ and a bias term $\mathbf { b } \in \mathbb { R } ^ { m \times 1 }$ . A rank regularizor term is added to the objective to shift the rank constraint from the activation matrix $A _ { \ell }$ to these auxiliary parameters as explained below. The new augmented optimization problem is as follows:
52
+
53
+ $$
54
+ \theta , \phi , W , \boldsymbol { \mathbf { b } } = \operatorname * { a r g m i n } _ { \theta , \phi , W , \boldsymbol { \mathbf { b } } } \mathcal { L } ( \theta , \phi ; X , Y ) + \lambda _ { 1 } \mathcal { L } _ { c } ( W , \boldsymbol { \mathbf { b } } ; A ) + \lambda _ { 2 } \mathcal { L } _ { N } ( A )
55
+ $$
56
+
57
+ $$
58
+ \begin{array} { r } { \mathrm { e } , \quad W \in \mathbb { R } ^ { m \times m } , \operatorname { r a n k } \left( W \right) = r , \mathrm { \bf ~ b } \in \mathbb { R } ^ { m } , A = f _ { \ell } ^ { - } ( X ; \phi ) } \end{array}
59
+ $$
60
+
61
+ $$
62
+ \mathcal { L } _ { c } ( W , \mathbf { b } ; A ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left\| \mathbf { W } ^ { \top } ( \mathbf { a _ { i } } + \mathbf { b } ) - ( \mathbf { a _ { i } } + \mathbf { b } ) \right\| _ { 2 } ^ { 2 } , \quad \mathcal { L } _ { N } ( A ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left| 1 - \left\| \mathbf { a _ { i } } \right\| \right| _ { 2 } ^ { 2 } ,
63
+ $$
64
+
65
+ The projection loss $\mathcal { L } _ { c }$ is used to minimize the distance between the activation matrix $A _ { \ell }$ and its affine low rank projection. The bias $\mathbf { b }$ allows for the activation matrix to be translated before projection. The intuition behind $\mathcal { L } _ { c }$ is that if $\mathbf { a } _ { i } \in \mathbb { R } ^ { n }$ lies in a (low) $r$ -dimensional subspace of $\mathbb { R } ^ { n }$ , then there is a rank- $r$ matrix $W$ such that $W$ is the identity map on the subspace and maps the rest of $\mathbb { R } ^ { n }$ to 0. $\mathcal { L } _ { c }$ is a soft version of this and also allows translation by $\mathbf { b }$ , i.e. if $A$ is the matrix of activation vectors and $W$ is low-rank, then $W A$ is low-rank; imposing the constraint that $A \approx W A$ forces $A$ itself to be close to low-rank. This is closely related to online PCA. However, setting $A + \mathbf { b }$ close to zero trivially minimizes $\mathcal { L } _ { c } ( W , \mathbf { b } ; A )$ , especially when the activation dimension is large. To prevent this, $\mathcal { L } _ { N } ( \cdot )$ , which acts as a norm constraint on the activation vector, is introduced to keep the activations sufficiently large.
66
+
67
+ Implementing the low rank prior: Algorithm 1 in Appendix B.1 describes how to apply this low rank regularizor by adding a virtual layer called LR-layer after the $\ell ^ { t h }$ layer. This layer is virtual in the sense that it only affects the parameter $W$ and $\mathbf { b }$ which are not directly used to make predictions, but nonetheless the corresponding loss term $\mathcal { L } _ { c }$ does affect the network model parameters through gradient updates. This layer finds the closest affine low rank approximation of $A$ online by estimating a matrix $W$ that minimizes $\mathcal { L } _ { c }$ subject to rank $( W ) = r$ .
68
+
69
+ The rank projection step in Line 16 in Algorithm 1 is executed by a hard thresholding operator $\Pi _ { r } ^ { \mathrm { r a n k } } ( W ) ^ { - }$ , which finds the best $r$ -rank approximation of $W$ . Essentially, $\Pi _ { r } ^ { \mathrm { r a n k } } ( W )$ solves the following optimization problem, which can be solved using a singular value decomposition (SVD).
70
+
71
+ $$
72
+ \Pi _ { r } ^ { \mathrm { r a n k } } ( W ) = \underset { \mathrm { r a n k } ( Z ) = r } { \mathrm { a r g m i n } } \left. \mathrm { W } - \mathrm { Z } \right. _ { F } ^ { 2 }
73
+ $$
74
+
75
+ Handling large activation matrices: Singular Value Projection (SVP) introduced in Jain et al. (2010) is an algorithm for rank minimization under affine constraints. In each iteration, the algorithm performs gradient descent on the affine constraints alternated with a rank- $\mathbf { \nabla } \cdot \mathbf { k }$ projection of the parameters and it provides recovery guarantees under weak isometry conditions. However, the algorithm has a complexity of $O ( m n \bar { r } )$ where $m , n$ are the dimensions of the matrix and $r$ is the desired low rank. Faster methods for SVD for sparse matrices are not applicable as the matrices in our case are not necessarily sparse. We use the ensembled Nystrom method (Williams & Seeger, 2001; Halko ¨ et al., 2011; Kumar et al., 2009a) to boost our computational speed at the cost of accuracy of the low rank approximation. It is essentially a sampling based low rank approximation to a matrix. The algorithm is described in detail in the Appendix B.2. Though the overall complexity for projecting $W$ still remains $O ( m ^ { 2 } r )$ , the complexity of the hard-to-parallelize SVD step is now ${ \cal O } ( \bar { r } ^ { 3 } )$ , while the rest is due to matrix multiplication.
76
+
77
+ The theoretical guarantees of Nystrom hold only when the weight matrix of the ¨ LR-layer is symmetric and positive semi-definite (PSD) before each $\bar { \Pi } _ { r } ^ { \mathrm { r a n k } } ( \cdot )$ operation; this restricts the projections allowed in our optimization, but empirically this does not seem to matter. We know that a symmetric diagonally dominant real matrix with non-negative diagonal entries is PSD. With this motivation, the matrix $W$ is smoothened by repeatedly adding $0 . 0 1 \mathcal { T }$ until the SVD algorithm converges1. This is a heuristic to make the matrix well conditioned (as well as diagonally dominant) and it helps in the convergence of the algorithm empirically.
78
+
79
+ Symmetric Low Rank Layer: The Nystrom method requires the matrix ¨ $W$ of the LR-layer to be symmetric and PSD (SPSD), however, gradient updates may make the matrix parameter nonSPSD, even if we start with an SPSD matrix. Reparametrizing the LR-layer fixes this issue; the layer is parameterized using $W _ { s }$ (to which gradient updates are applied), but the layer projects using $\dot { W } = ( W _ { s } + W _ { s } ^ { \top } ) / 2$ . After the rank projection is applied to the (smoothed version of) $W$ $W _ { s } : = \Pi _ { r } ^ { \mathrm { r a n k } } ( W )$ is an SPSD matrix (using Lemma 1 in Appendix B.3). As a result the updated $W$ is also SPSD. This layer also has a bias vector $\mathbf { b }$ to be able to translate the activation matrix before performing the low rank projection.
80
+
81
+ Model Compression: As a consequence of forcing the activations of the $\ell ^ { t h }$ layer of the model to lie in a very low dimensional subspace with minimal reconstruction error and loss in accuracy, our experiments suggest that a simpler model can replace the latter parts of the original model without significant reduction in accuracy. Essentially, we can replace $f _ { \ell } ^ { + } : \mathbb { R } ^ { m } \mathbb { R } ^ { c }$ with $g : \mathbb { R } ^ { m ^ { \prime } } \mathbb { R } ^ { c }$ where $m ^ { \prime } \ll m$ and $g$ is a much smaller model than $f _ { \ell } ^ { + }$ . Our experiments in Table 2 show empirical evidence of this.
82
+
83
+ # 3 EXPERIMENTS
84
+
85
+ In this section we look at experimental validation of the various properties of our networks. As our primary training objective is to reduce the rank of the activations, we use the variance ratio, defined as $\begin{array} { r } { \mathsf { V R } _ { r } \left( A \right) = \frac { \sum _ { i = 1 } ^ { r } \sigma _ { i } ^ { 2 } } { \sum _ { i = 1 } ^ { p } \sigma _ { i } ^ { 2 } } } \end{array}$ , where $\sigma _ { 1 } , \ldots , \sigma _ { p }$ are the singular values of $A$ in non-increasing order, to estimate the variance captured by the first $r$ out of $p$ singular values.
86
+
87
+ We consider the following models in our experiments:
88
+
89
+ (a) ResNet 1-LR - This model contains one LR-layer, located immediately before the last fully connected (FC) layer. For a ResNet-18, the incoming activations have 512 units whereas for a ResNet-50 the incoming activations has a dimension of 2048.
90
+
91
+ (b) ResNet 2-LR - This model contains two LR-layers. The first LR-layer is positioned before the fourth ResNet block, where the incoming activations have a dimension of 16, 384 and the second LR-layer is before the FC layer as in ResNet 1-LR.
92
+
93
+ (c) VGG19 2-LR - This includes two LR-layers in the VGG-19 model. The VGG model has three FCs after 16 convolution layers with the LR-layers present before the first and the third FC layers in the model.
94
+
95
+ (d) X-MAXG - This is a hybrid model where learned representations are generated for the input using the model “X” and then a maximum margin classifier is learned on these representations. The particular layer from which the representation is extracted will be clear from the context.
96
+
97
+ (e) Bottle-LR - This model has a bottle neck layer which is essentially a fully connected layer without any non-linear activation. Moreover, the weight matrix of the $\mathbf { W } \in \mathbb { R } ^ { m \times m }$ is parametrized by $\mathbf { W } _ { l } \in \mathbb { R } ^ { m \times r }$ where $\mathbf { W } = \mathbf { W } _ { l } \mathbf { W } _ { l } ^ { \top }$ such that it is always low rank by definition.
98
+
99
+ Some other models that are comparable to this work are listed in Appendix A. While one of the main objectives has been to design an augmentation to the training algorithm instead of changing the model itself (note that the extra weight matrices can be removed from the model after training is complete), we also consider Bottle-LR which includes an extra layer. The Bottle-LR layers have the same dimensions and are placed at the same position as the LR layers. As the experiments below suggest, the Bottle-LR model does not show the same benefits our LR model shows and performs no better than the N-LR model (indeed worse sometimes). One of the main difference in the training dynamics between this model and our model is that an explicit bottleneck layer has a multiplicative effect on the gradients propagated backward in the network, whereas, in our approach they only have an additive effect. Although this is somewhat speculative at this stage, we believe the relative “smoothness” of our approach is the reason why it seems to have better performance on these other tasks.
100
+
101
+ In this paper, we used the datasets CIFAR10 and CIFAR100. As a side note, we observed that the target rank is not an essential hyper-parameter as the training enforces a much lower rank than what is set. Further details on the training procedure and the X-MAXG model is provided in Appendix C. Apart from these, we use the term N-LR to represent models without LR-layers.
102
+
103
+ We perform three kinds of experiments in this section, with additional experiments in Appendix C.3 and C.4. We first show that our imposed constraints do not have any significant impact on the test accuracy of the model. Then we go on to verify that our training indeed achieves its objective of developing a stronger low rank structure. Finally we demonstrate that our training algorithm provides a natural scheme for compressing our models and that low dimensional projections of our embeddings, with a size of less than $2 \%$ of the original embeddings, can be used for classification with a significantly higher accuracy than similar sized projections of embeddings from an N-LR model. In Section 4, we provide empirical evidence in support of adversarial robustness of our models.
104
+
105
+ Impact on test accuracy: In this experiment, we check if the additional constraints on the training method have any significant effect on the performance of the model. We observe, as listed in Table 1, that the additional penalties impose no significant loss in accuracy. In some cases, we even observe small gains in performance.
106
+
107
+ (a) ResNet18 on CIFAR-10
108
+
109
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=1>Test Accuracy</td></tr><tr><td rowspan=1 colspan=1>ResNet 1-LR</td><td rowspan=1 colspan=1>92.8</td></tr><tr><td rowspan=1 colspan=1>ResNet 2-LR</td><td rowspan=1 colspan=1>92</td></tr><tr><td rowspan=1 colspan=1>VGG192-LR</td><td rowspan=1 colspan=1>89.8</td></tr><tr><td rowspan=1 colspan=1>ResNet N-LR</td><td rowspan=1 colspan=1>92.5</td></tr><tr><td rowspan=1 colspan=1>VGG19N-LR</td><td rowspan=1 colspan=1>89.1</td></tr><tr><td rowspan=1 colspan=1>Bottle-2LR</td><td rowspan=1 colspan=1>92</td></tr></table>
110
+
111
+ Table 1: Test Accuracy
112
+
113
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=1>Coarse Label</td><td rowspan=1 colspan=1>Fine Label</td><td rowspan=1 colspan=1>VR20()</td></tr><tr><td rowspan=1 colspan=1>ResNet 1-LR</td><td rowspan=1 colspan=1>78.1%</td><td rowspan=1 colspan=1>48%</td><td rowspan=1 colspan=1>0.97</td></tr><tr><td rowspan=1 colspan=1>ResNet N-LR</td><td rowspan=1 colspan=1>75.6%</td><td rowspan=1 colspan=1>52%</td><td rowspan=1 colspan=1>0.90</td></tr><tr><td rowspan=1 colspan=1>Bottle-1LR</td><td rowspan=1 colspan=1>76%</td><td rowspan=1 colspan=1>38%</td><td rowspan=1 colspan=1>NA</td></tr></table>
114
+
115
+ (b) ResNet50 on CIFAR-100
116
+
117
+ To see whether the learned representations can be used in a different task, we conduct a transfer learning exercise where embeddings generated from a ResNet-50 model, trained on the coarse labels of CIFAR-100, are used to predict the fine labels of CIFAR-100. A set of ResNet-50-MAXG classifiers are trained for this purpose on these embeddings. (see Appendix C.1 for further details). We can see in Table 1(b) that the LR model suffers a small loss of $4 \%$ in accuracy as compared to the N-LR model when it’s embeddings are used to train a max margin classifier for the task of predicting the fine labels. However, it is to be noted that the accuracy of the LR model actually increases when the max margin classifier is trained on it to do the original task i.e. classifying the coarse labels. On the other hand, the Bottle-LR model suffers a loss of $1 4 \%$ in accuracy compared to N-LR model and does not show any advantage in the original task either.
118
+
119
+ ![](images/242bc25b740db31dcb6f2e118a1519b965e002e82bffcfa400093f86ed03e7cc.jpg)
120
+ Figure 1: Variance Ratio captured by varying number of Singular Values
121
+
122
+ Effective rank of activations: Figure 1(a) shows the variance ratio captured by varying numbers of singular values in the activations before the last FC layer. In this case, every model shows that the effective rank of the activations is 10 as there is a sharp elbow in the plot after 10 singular values. However, the LR-model has almost negligible leakage of variance compared to the N-LR model. Similar experiments for VGG is found in the appendix (Figure 5). .
123
+
124
+ Figure 1(b) shows the variance ratio captured by varying numbers of singular values for the activations before the fourth ResNet block. In this case the activation vector has a dimension of 16, 384 and the use of Nystrom method is necessary for computational feasibility. ResNet 2-LR is the only model ¨ that has a LR-layer in that position and Figure 1(b) shows that it is the only model that shows a low rank structure on that layer.
125
+
126
+ While there are various techniques developed that induce sparsity on weights or activations in neural networks, it is important to point out that sparsity doesn’t necessarily lead to low rank eg. an identity matrix. Empirically, in ResNet 1-LR, the activations before the $\dot { 4 } ^ { t h }$ ResNet block are much less explained by a small number of singular values despite the high level of sparsity $( 3 9 \% )$ whereas the activations after the 4th ResNet block are explained by about 10 singular values though it is $9 5 \%$ dense.
127
+
128
+ Validity of low dimensional embeddings: The previous experiment shows that our training algorithm introduces a low rank structure in the activations. However, it does not show any evidence of the discriminative power of these low rank embeddings. In these experiments, we use both CIFAR-10 and CIFAR-100 with ResNet-18 and ResNet-50 respectively to show that these embeddings and their projections onto low dimensional spaces are effective at discriminative tasks and are better at it than models without the LR-layer.
129
+
130
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Emb-dim</td><td rowspan=1 colspan=1>Acc</td></tr><tr><td rowspan=1 colspan=1>ResNet-50-LR</td><td rowspan=1 colspan=1>2048</td><td rowspan=1 colspan=1>78.1</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>2048</td><td rowspan=1 colspan=1>75.6</td></tr><tr><td rowspan=1 colspan=1>ResNet-50-LR</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>76.5</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>68.4</td></tr><tr><td rowspan=1 colspan=1>ResNet-50-LR</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>72</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>48</td></tr></table>
131
+
132
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Emb-dim</td><td rowspan=1 colspan=1>Acc</td></tr><tr><td rowspan=1 colspan=1>ResNet18-2-LR</td><td rowspan=1 colspan=1>16,384</td><td rowspan=1 colspan=1>91.14%</td></tr><tr><td rowspan=1 colspan=1>ResNet18</td><td rowspan=1 colspan=1>16,384</td><td rowspan=1 colspan=1>90.7%</td></tr><tr><td rowspan=1 colspan=1>ResNet18-2-LR</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>88.5%</td></tr><tr><td rowspan=1 colspan=1>ResNet18</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>76.9%</td></tr><tr><td rowspan=1 colspan=1>ResNet18-2-LR</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>75%</td></tr><tr><td rowspan=1 colspan=1>ResNet18</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>61.7 %</td></tr></table>
133
+
134
+ (b) Representation from before the last ResNet block of ResNet-18 trained on CIFAR-10.
135
+
136
+ (a) Representation from before the FC layer of a ResNet-50 trained on CIFAR-100.
137
+
138
+ Table 2: Accuracy of low dimensional projections of learned representations at discriminative tasks.
139
+
140
+ Table 2(a) shows that even with decreasing embedding dimension, the LR model is able to preserve its accuracy better than the N-LR model. Even with a 5-dimensional embedding, the LR model looses only $6 \%$ in accuracy, but the N-LR model looses $2 7 \%$ .
141
+
142
+ The results of the next experiment, listed in Table 2(b), show the capability of our algorithm to compress the model itself. The entire fourth ResNet block along with the last FC layer (referred to as $f _ { \ell } ^ { + }$ and containing 8.4M parameters) can be replaced by a smaller linear model which has only 0.02 times the number of parameters as $f _ { \ell } ^ { + }$ . This yields a significant reduction in model size in exchange for a slight drop in accuracy $( < 1 \% )$ ). The second benefit is that as the low dimensional embeddings still retain most of the discriminative information, the inputs fed to the linear model have a small number of features.
143
+
144
+ # 4 ADVERSARIAL ATTACKS
145
+
146
+ (Szegedy et al., 2013) showed that adding adversarial perturbations to inputs to machine learning models, that otherwise perform well on a test set, can often make them suffer a high misclassification rate. To express this formally, consider a machine learning model $M : X Y$ where $X$ is the input space and $Y$ is the target label space. It is possible to add an adversarial noise $\delta$ to $\mathbf { x } _ { i } \in X$ such that though $M ( \mathbf { x } _ { i } )$ predict $\mathbf { y } _ { i }$ , but $M ( \mathbf { x } _ { i } + \delta )$ predicts a label other than $\mathbf { y } _ { i }$ with high confidence, despite $\mathbf { x } _ { i }$ and $\mathbf { x } _ { i } + \delta$ being perceptually indistinguishable to a human. Various methods (Szegedy et al., 2013; Goodfellow et al., 2014; Kurakin et al., 2017; Moosavi-Dezfooli et al., 2016) have been proposed in recent years for constructing adversarial perturbations. In this section, our experiments show that LR models are more robust than N-LR models against these adversarial perturbations.
147
+
148
+ In this section, $\mathbf { x } _ { d }$ refers to an example drawn from the data distribution and $\mathbf { x } _ { a }$ denotes the adversarially perturbed version of $\mathbf { x } _ { d }$ . For vectors $\mathbf { z }$ and $\mathbf { x }$ , let $\mathrm { c l i p } _ { { \bf x } , \epsilon } ( { \bf z } )$ denote the element-wise clipping of $\mathbf { z }$ , with $z _ { i }$ clipped to the range $[ x _ { i } - \epsilon , x _ { i } + \epsilon ]$ .
149
+
150
+ Adversarial attacks: We look at three different attacks in our experiments: (i) Iterative Fast Sign Gradient Method (Iter-FSGM) (Kurakin et al., 2016; Madry et al., 2018) (ii) The Iterative Least Likely Class Method (Iter-LL-FSGM) (Kurakin et al., 2017) (iii) DeepFool (Moosavi-Dezfooli et al., 2016). The reader may refer to Appendix D.1 for further details on the attacks. The iterative fast sign gradient method (Iter-FSGM) is essentially equivalent to the Projected Gradient Descent Method on the negative loss function (PGD, Madry et al. (2018)).
151
+
152
+ Further, due to the low rank constraints, the model could implicitly be enforcing gradient masking, which might result in the construction of weaker attacks. Hence, to be fair in our comparison, we also consider black box versions of each of the aforementioned attacks. While the adversarial noise in a white box attack is constructed using the model being attacked, the noise in a black box attack is constructed using a different model (in our case the N-LR model). We use the standard normalized $L _ { 2 }$ dissimilarity measure $\begin{array} { r } { \rho = \sum _ { i } \frac { \| \mathbf { x } _ { \mathrm { a } } - \mathbf { x } _ { \mathrm { d } } \| _ { 2 } } { \| \mathbf { x } _ { \mathrm { d } } \| _ { 2 } } } \end{array}$ to measure the magnitude of this noise.
153
+
154
+ # Robustness to Adversarial Attacks:
155
+
156
+ ![](images/bf15042ec1eb07b881f5768ed520c436d909e33030ee5a9adcf589f7aa6d1df8.jpg)
157
+ Figure 2: Adversarial accuracy plotted against magnitude of perturbation (measured with $\rho$ ).
158
+
159
+ Here we compare across models, the change in accuracy of classifying adversarial examples with respect to the amount of noise added. In line with the experiments in Kurakin et al. (2017), the noise is added for a pre-determined number of steps. Figure 2 shows that as the noise increases, the accuracy of N-LR models decrease much faster than the LR models.
160
+
161
+ Specifically, to reach an adversarial mis-classification rate of $5 0 \%$ , our models require about twice the noise as a normal model or Bottle-LR model. We also observe that black box attacks are not very successful when multi-step (i.e. iterative) attacks are performed 2. In short, for all kinds of attacks we tried, LR models consistently perform better than N-LR models.
162
+
163
+ Our next experiment is in line with the experiments conducted in Moosavi-Dezfooli et al. (2016). Table 3 lists the average minimum perturbation (measured with $\rho$ ) required to make the classifier mis-classify more than $9 9 \%$ of the adversarial examples, constructed from a uniformly sampled subset of the test set. Appendix D.2 describes the setup in further detail.
164
+
165
+ Table 3: Perturbation required for Adversarial Misclassification
166
+
167
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>p[DeepFool]</td><td rowspan=1 colspan=1>ρ[Iter-LL-FSGM]</td><td rowspan=1 colspan=1>ρ [Iter-FSGM]</td></tr><tr><td rowspan=3 colspan=1>White Box</td><td rowspan=1 colspan=1>ResNet N-LR</td><td rowspan=1 colspan=1>1.6×10-2</td><td rowspan=1 colspan=1>2.4×10-2</td><td rowspan=1 colspan=1>2.1×10-2</td></tr><tr><td rowspan=1 colspan=1>ResNet1-LR</td><td rowspan=1 colspan=1>1.7 ×10-1</td><td rowspan=1 colspan=1>1.1 ×10-1</td><td rowspan=1 colspan=1>6.0×10-2</td></tr><tr><td rowspan=1 colspan=1>ResNet 2-LR</td><td rowspan=1 colspan=1>1.8 × 10-1</td><td rowspan=1 colspan=1>9.8×10-2</td><td rowspan=1 colspan=1>7.6 ×10-2</td></tr><tr><td rowspan=2 colspan=1>Black Box</td><td rowspan=1 colspan=1>ResNet 1-LR</td><td rowspan=1 colspan=1>4.7×10-2</td><td rowspan=1 colspan=1>1.8×10-1</td><td rowspan=1 colspan=1>5.6×10-2</td></tr><tr><td rowspan=1 colspan=1>ResNet 2-LR</td><td rowspan=1 colspan=1>5.5×10-2</td><td rowspan=1 colspan=1>2.0×10-1</td><td rowspan=1 colspan=1>7.5 × 10-2</td></tr></table>
168
+
169
+ An interesting observation is that the values of $\rho$ , here in Table 3, are lower than in Figure 2 though the attacks have a higher rate of success. To explain this behaviour, we show empirical evidence to indicate that an attack that adds noise for a fixed number of steps (Kurakin et al., 2017; 2016) to the input is significantly weaker than one that stops on successful misclassification (See Appendix D.3). However, even under this scheme of attacks, our models perform better than N-LR models as LR models require 4 to 11 times the amount of noise required by N-LR models to be fooled by adversarial attacks.
170
+
171
+ We also look at some of the adversarial images generated by DeepFool in Figure 3. We observe that it is immediately clear that the adversarial images are different from the original images in the case of LR models whereas it is not so apparent in the case of N-LR models.
172
+
173
+ ![](images/fc1fdb8509de2085264f853cf5c0c10e6fb36bb732ec4e55a4f1477648027e04.jpg)
174
+ Figure 3: For each model, original images are on the top row and the images generated by DeepFool are below.
175
+
176
+ In order to gain some intuition into this behaviour of robustness against adversarial attacks, we look into the property of noise stability of networks towards adversarial noise. Arora et al. (2018) gives empirical evidence for deep networks being stable towards injected Gaussian noise and uses a variation of this noise stability property to derive more realistic generalization bounds. We believe that learning a model that zeroes out irrelevant directions in the learned representations reduces the ability to find adversarial perturbations that can affect the output of the model. In Figure 4, we show empirically that LR networks are more noise-stable to adversarial noise than non-LR networks. On the $x$ -axis is the normalized $L _ { 2 }$ dissimilarity score in the input space i.e. $\| \mathbf { x } + \eta \| ^ { 2 } / \| \mathbf { x } \| ^ { 2 }$ and on the $y$ -axis the corresponding quantity in the representation space i.e. $\left. \mathrm { f } _ { \ell } ^ { - } \left( \mathbf { x } + \eta \right) \right. ^ { 2 } / \left. \mathrm { f } _ { \ell } ^ { - } \left( \mathbf { x } \right) \right. ^ { 2 }$ . The representations here are taken from before the last fully connected and softmax layer. As our experiments suggest, the LR model significantly attenuates the adversarial perturbation in the representation space thus making it harder to fool the softmax classifier.
177
+
178
+ ![](images/a06b06c7030b977b3253c4ae852e644952dc7d44691c926da6220b638538fb23.jpg)
179
+ Figure 4: Adversarial Perturbation in Input Space and Perturbation in Representation Space
180
+
181
+ Max Margin Classifiers: Finally, we show that X-MAXG models are significantly more robust to adversarial attacks than the corresponding “X” models. Also, as seen in Table 4, X-MAXG models with LR-layers are more robust than X-MAXG models without LR-layers against adversarial attacks. Our experimental setup is explained in detail in Appendix D.4. We can see that a X-MAXG model with a LR-layer correctly classifies $5 0 \%$ of the examples that had fooled the original classifier while for a similar amount of noise, the X-MAXG model without the LR-layer has negligible accuracy.
182
+
183
+ Table 4: Accuracy of classification of adversarial examples by Max Margin Classifiers.
184
+
185
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>DeepFool</td><td rowspan=1 colspan=1>Iter-LL-FSGM</td><td rowspan=1 colspan=1>Iter-FSGM</td></tr><tr><td rowspan=3 colspan=1>White Box</td><td rowspan=1 colspan=1>ResNet18 N-LR-MAXG</td><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>0.04</td><td rowspan=1 colspan=1>0.02</td></tr><tr><td rowspan=1 colspan=1>ResNet 1-LR-MAXG</td><td rowspan=1 colspan=1>0.38</td><td rowspan=1 colspan=1>0.35</td><td rowspan=1 colspan=1>0.48</td></tr><tr><td rowspan=1 colspan=1>ResNet2-LR-MAXG</td><td rowspan=1 colspan=1>0.43</td><td rowspan=1 colspan=1>0.55</td><td rowspan=1 colspan=1>0.55</td></tr><tr><td rowspan=2 colspan=1>Black Box</td><td rowspan=1 colspan=1>ResNet 2-LR-MAXG</td><td rowspan=1 colspan=1>0.29</td><td rowspan=1 colspan=1>0.31</td><td rowspan=1 colspan=1>0.33</td></tr><tr><td rowspan=1 colspan=1>ResNet 1-LR-MAXG</td><td rowspan=1 colspan=1>0.44</td><td rowspan=1 colspan=1>0.50</td><td rowspan=1 colspan=1>0.48</td></tr></table>
186
+
187
+ # 5 CONCLUSION
188
+
189
+ In this paper, we designed an algorithm that encourages the learned representations obtained by training deep neural networks for supervised tasks to lie in an approximately low rank (affine) subspace. This is achieved by augmenting the networks with virtual LR-layers and modifying the training objective. In order to make our algorithm computationally feasible for large networks, we proposed and implemented certain approximation techniques. Our experiments show that our algorithm successfully enforces an approximate low rank behaviour and that these learned representations have some intriguing properties. We conducted a wide range of experiments to investigate these properties and report, among other things, that (i) max-margin classifiers trained on these representations have more discriminatory power than ones trained on representation from models without LR-layers, (ii) our models are more robust to a variety of adversarial attacks than models without LR-layers, and (iii) LR models significantly attenuate the effects of perturbations introduced in the input space on the representation space (iv) replacing large parts of our models with smaller models results in a negligible drop in accuracy, thereby providing a compression scheme, It is commonly believed that large sparse feature spaces are better for deep models. What we propose here is the idea that while the features themselves need not be sparse, the existence of a basis in which the feature vectors have a sparse representation can provide benefits. To the best of our knowledge, investigating properties of representations learned from deep supervised NNs, and the possibility of modifying training procedures to obtain desirable properties in said representations, has remained relatively unexplored. This work shows that these representations possess some intriguing properties, which may well be worthy of further investigation.
190
+
191
+ # REFERENCES
192
+
193
+ Sajid Anwar, Kyuyeon Hwang, and Wonyong Sung. Structured Pruning of Deep Convolutional Neural Networks. J. Emerg. Technol. Comput. Syst., 13(3):32:1—-32:18, feb 2017. ISSN 1550-4832. doi: 10.1145/3005348. URL http://doi.acm.org/10.1145/3005348.
194
+
195
+ Sanjeev Arora, Rong Ge, Behnam Neyshabur, and Yi Zhang. Stronger generalization bounds for deep nets via a compression approach. 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. 254–263, Stockholmsmassan, Stockholm Sweden, 10–15 Jul 2018. PMLR. ¨ URL http://proceedings.mlr.press/v80/arora18b.html.
196
+
197
+ Thomas Blumensath and Mike E Davies. Iterative hard thresholding for compressed sensing. Applied and computational harmonic analysis, 27(3):265–274, 2009.
198
+
199
+ Emily Denton, Wojciech Zaremba, Joan Bruna, Yann LeCun, and Rob Fergus. Exploiting Linear Structure Within Convolutional Networks for Efficient Evaluation. In Advances in neural information processing systems, pp. 1269—-1277, apr 2014. URL http://arxiv.org/abs/1404. 0736.
200
+
201
+ Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. DeCAF: A Deep Convolutional Activation Feature for Generic Visual Recognition. In International Conference on Machine Learning, pp. 647–655, oct 2014. URL http://arxiv. org/abs/1310.1531.
202
+
203
+ Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and Harnessing Adversarial Examples. arXiv preprint arXiv:1412.6572, dec 2014. URL http://arxiv.org/abs/1412. 6572.
204
+
205
+ Nathan Halko, Per-Gunnar Martinsson, and Joel A Tropp. Finding structure with randomness: Probabilistic algorithms for constructing approximate matrix decompositions. SIAM review, 53(2): 217–288, 2011.
206
+
207
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778. IEEE, jun 2016. ISBN 978-1-4673-8851-1. doi: 10.1109/CVPR.2016.90. URL http://ieeexplore.ieee.org/document/7780459/.
208
+
209
+ G E Hinton and R R Salakhutdinov. Reducing the dimensionality of data with neural networks. Science (New York, N.Y.), 313(5786):504–7, jul 2006. ISSN 1095-9203. doi: 10.1126/science. 1127647. URL http://www.ncbi.nlm.nih.gov/pubmed/16873662.
210
+
211
+ Max Jaderberg, Andrea Vedaldi, and Andrew Zisserman. Speeding up Convolutional Neural Networks with Low Rank Expansions. In Proceedings of the British Machine Vision Conference. BMVA Press, 2014.
212
+
213
+ Prateek Jain, Raghu Meka, and Inderjit S Dhillon. Guaranteed rank minimization via singular value projection. In Advances in Neural Information Processing Systems, pp. 937–945, 2010.
214
+
215
+ Ryan Kiros, Ruslan Salakhutdinov, and Richard S Zemel. Unifying visual-semantic embeddings with multimodal neural language models. arXiv preprint arXiv:1411.2539, 2014.
216
+
217
+ Sanjiv Kumar, Mehryar Mohri, and Ameet Talwalkar. Ensemble nystrom method. In Advances in Neural Information Processing Systems, pp. 1060–1068, 2009a.
218
+
219
+ Sanjiv Kumar, Mehryar Mohri, and Ameet Talwalkar. Sampling techniques for the nystrom method. In International Conference on Artificial Intelligence and Statistics, pp. 304–311, 2009b.
220
+
221
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
222
+
223
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. International Conference on Learning Representations (ICLR), 2017.
224
+
225
+ Jose Lezama, Qiang Qiu, Pablo Mus ´ e, and Guillermo Sapiro. OL ´ \’E: Orthogonal Low-rank Embedding, A Plug and Play Geometric Loss for Deep Learning. Computer Vision And Pattern Recognition, dec 2017. URL http://arxiv.org/abs/1712.01727.
226
+
227
+ Xiao Lin and Devi Parikh. Don’t just listen, use your imagination: Leveraging visual common sense for non-visual tasks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2984–2993, 2015.
228
+
229
+ Baoyuan Liu, Min Wang, Hassan Foroosh, Marshall Tappen, and Marianna Pensky. Sparse convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 806–814, 2015.
230
+
231
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ rJzIBfZAb.
232
+
233
+ Carl D Meyer (ed.). Matrix Analysis and Applied Linear Algebra. Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 2000. ISBN 0-89871-454-0.
234
+
235
+ Marcin Moczulski, Misha Denil, Jeremy Appleyard, and Nando de Freitas. ACDC: A Structured Efficient Linear Layer. In International Conference on Learning Representations (ICLR), nov 2015. URL http://arxiv.org/abs/1511.05946.
236
+
237
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. DeepFool: $\{ \mathrm { A } \}$ Simple and Accurate Method to Fool Deep Neural Networks. In CVPR, pp. 2574–2582. {IEEE} Computer Society, 2016.
238
+
239
+ Edouard Oyallon. Analyzing and Introducing Structures in Deep Convolutional Neural Networks. PhD thesis, de l’Universite de recherche Paris Sciences et Lettres PSL Research University, 2017. ´
240
+
241
+ Qiang Qiu and Guillermo Sapiro. Learning transformations for clustering and classification. The Journal of Machine Learning Research, 16(1):187–225, 2015.
242
+
243
+ Pierre Sermanet, David Eigen, Xiang Zhang, Michael Mathieu, Rob Fergus, and Yann LeCun. OverFeat: Integrated Recognition, Localization and Detection using Convolutional Networks. In International Conference on Learning Representations (ICLR), dec 2014. URL http://arxiv. org/abs/1312.6229.
244
+
245
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
246
+
247
+ 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.
248
+
249
+ Pascal Vincent, Hugo Larochelle, Isabelle Lajoie, Yoshua Bengio, and Pierre-Antoine Manzagol. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. Journal of Machine Learning Research, 11(Dec):3371–3408, 2010.
250
+
251
+ Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In Advances in Neural Information Processing Systems, pp. 2074–2082, 2016.
252
+
253
+ Christopher K I Williams and Matthias Seeger. Using the Nystrom method to speed up kernel ¨ machines. In Advances in neural information processing systems, pp. 682–688, 2001.
254
+
255
+ Matthew D Zeiler and Rob Fergus. Visualizing and Understanding Convolutional Networks. In David Fleet, Tomas Pajdla, Bernt Schiele, and Tinne Tuytelaars (eds.), Computer Vision – ECCV 2014, pp. 818–833, Cham, 2014. Springer International Publishing. ISBN 978-3-319-10590-1.
256
+
257
+ # A ALTERNATIVE ALGORITHMS
258
+
259
+ # LOW RANK WEIGHTS
260
+
261
+ With respect to compression, it is natural to look at low rank approximations of network parameters (Denton et al., 2014; Jaderberg et al., 2014). By factorizing the weight matrix/tensor $W$ , for input $x$ , we can get low rank pre-activations $W x$ . This however does not lead to low rank activations as demonstrated both mathematically (by the counter-example below) and empirically.
262
+
263
+ Mathematical Counter-Example: Consider a rank 1 pre-activation matrix $A$ and its corresponding post-activation(ReLU) matrix as below. It is easy to see that the rank of post-activation has increased to 2.
264
+
265
+ $$
266
+ A = { \left[ \begin{array} { l l l } { } & { 1 } & { - 1 } & { 1 } \\ { - 1 } & { 1 } & { - 1 } \end{array} \right] } \qquad { \mathrm { R e l u } } ( A ) = { \left[ \begin{array} { l l l } { } & { 1 } & { 0 } & { 1 } \\ { 0 } & { 1 } & { 0 } \end{array} \right] }
267
+ $$
268
+
269
+ Empirical Result: In order to see if techniques for low rank approximation of network parameters like Denton et al. (2014) would have produced low rank activations, we conducted an experiment by explicitly making the pre-activations low-rank using SVD. Our experiments showed that inspite of setting a rank of 100 to the pre-activation matrix, the post-activation matrix had full rank. Though all but the first hundred singular values of the pre-activation matrix were set to zero, the post-activation matrix’s $1 0 1 ^ { s t }$ and $1 0 0 \overline { { 0 } } ^ { t h }$ singular values were 49 and 7.9 respectively, and its first 100 singular values explained only $9 4 \%$ of the variance.
270
+
271
+ We try to explain the above empirical results as follows: Theoretically, a bounded activation function lowers the Frobenius norm of the pre-activation matrix i.e. the sum of the squared singular values. However, it also causes a smoothening of the singular values by making certain 0 singular values non-zero to compensate for the significant decrease in the larger singular values. This leads to an increase in rank of the post-activation matrix.
272
+
273
+ # BOTTLENECK LR LAYER
274
+
275
+ Bottleneck Layer: It is easy to see that the effective dimension of the representation of an input, obtained after passing through a bottleneck layer (like an auto-encoder), will not be greater than the dimension of the bottleneck layer itself. However, due to the various non-linearities present in the network, while the representation is guaranteed to lie in a low dimensional manifold it is not guaranteed to lie in a low rank (affine) subspace.
276
+
277
+ LR bottleneck: Another alternative is to include the low-rank projection and reconstruction as part of the network instead of as a regularizor so that the LR-layer is an actual layer and not a virtual layer. We have indeed experimented with this setup and observed that this often made the training very unstable. Also, if one were to add this bottleneck as a fine-tuning process, the test accuracy of the network decreases by a much higher extent than it does for our method.
278
+
279
+ # B ALGORITHMIC DETAILS
280
+
281
+ B.1 ALGORITHM FOR LR LAYER
282
+
283
+ Algorithm 1 below lists the forward and the backpropagation rules of the LR-layer.
284
+
285
+ # Algorithm 1 LR Layer
286
+
287
+ <table><tr><td colspan="3">Input: Activation Matrix A,Grad_input g</td></tr><tr><td>1: 2:</td><td></td><td></td></tr><tr><td>3:</td><td>Forward Propagation</td><td></td></tr><tr><td>4:</td><td>Z ←WT(A+b)³</td><td> Compute the affine Low rank projection</td></tr><tr><td>5:</td><td>Output : A</td><td> Output the original activations for the next layer</td></tr><tr><td>6:</td><td></td><td></td></tr><tr><td>7:</td><td>Backward Propagation</td><td></td></tr><tr><td>8:</td><td>D1←Z-(A+b)² n</td><td>Computes the reconstruction loss Lc</td></tr><tr><td>9:</td><td>∑- D2← 2 |1- ||ai n</td><td>&gt; Computes the loss for the norm constraint LN</td></tr><tr><td>10:</td><td>D←D+D2 aD n-1aD</td><td></td></tr><tr><td>11: 12:</td><td>gw↑</td><td>&gt; Outputs the gradient to be passed to the layer before</td></tr><tr><td>13:</td><td>Output : 9i</td><td></td></tr><tr><td>14:</td><td>Update Step</td><td></td></tr><tr><td>15:</td><td>W ←W-Xgw</td><td>&gt; Updates the weight with the gradient from D.</td></tr><tr><td></td><td>16: W ← Irank(W)</td><td>Hard thresholds the rank of W</td></tr><tr><td></td><td></td><td></td></tr></table>
288
+
289
+ # B.2 ENSEMBLED NYSTROM¨ METHOD
290
+
291
+ Let $W \in \mathbb { R } ^ { m \times m }$ be a symmetric positive semidefinite matrix (SPSD). We want to generate a matrix $W _ { r }$ which is a r-rank approximation of $W$ without performing SVD on the full matrix $W$ but only on a principal submatrix4 $\dot { Z } \in \mathbb { R } ^ { l \times l }$ of $W$ , where $l \ll m$ . We sample $l$ indices from the set $\{ 1 \cdots m \}$ and select the corresponding columns from $W$ to form a matrix $\bar { C } \in \mathbb { R } ^ { m \times l }$ . In a similar way, selecting the $l$ rows from $C$ we get $Z \in \mathbb { R } ^ { l \times l }$ . We can rearrange the columns of $W$ so that
292
+
293
+ $$
294
+ W = \left[ \begin{array} { c c } { { Z } } & { { W _ { 2 1 } ^ { T } } } \\ { { W _ { 2 1 } } } & { { W _ { 2 2 } } } \end{array} \right] \qquad C = \left[ \begin{array} { c } { { Z } } \\ { { W _ { 2 1 } } } \end{array} \right]
295
+ $$
296
+
297
+ According to the Nystrom approximation, the low rank approximation of ¨ $W$ can be written as
298
+
299
+ $$
300
+ W _ { r } = C Z _ { r } ^ { + } C ^ { T }
301
+ $$
302
+
303
+ where $Z _ { r } ^ { + }$ is the pseudo-inverse of the best $r$ rank approximation of $Z$ . Hence, the entire algorithm is as follows.
304
+
305
+ • Compute $C$ and $Z$ as stated above.
306
+ • Compute the top $r$ singular vectors and values of $Z : U _ { r } , \Sigma _ { r } , V _ { r }$ .
307
+ • Invert each element of $\Sigma _ { r }$ as this is used to get the Moore pseudo-inverse of $Z _ { r }$ .
308
+ • Compute $Z _ { r } ^ { + } = U _ { r } \Sigma _ { r } ^ { - 1 } V _ { r }$ and $W _ { r } = C Z _ { r } ^ { + } C ^ { T }$ .
309
+
310
+ Though by trivial computation, the complexity of the algorithm seems to be $O ( l ^ { 2 } r + m l ^ { 2 } + m ^ { 2 } l ) =$ $O ( m ^ { \bar { 2 } } r )$ (In our experiments $l = 2 r$ ), it must be noted that the complexity of the SVD step is only $O ( k ^ { 3 } )$ which is much lesser than $O ( m ^ { 2 } r )$ and while matrix multiplication is easily parallelizable, parallelization of SVD is highly non-trivial and inefficient.
311
+
312
+ To improve the accuracy of the approximation, we use the ensembled Nystrom sampling based ¨ methods (Kumar et al., 2009a) by averaging the outputs of $t$ runs of the Nystrom method. The ¨ $l$ indices for selecting columns and rows are sampled from an uniform distribution and it has been shown (Kumar et al., 2009b) that uniform sampling performs better than most sampling methods. Theorem 3 in Kumar et al. (2009a) provides a probabilistic bound on the Frobenius norm of the difference between the exact best r-rank approximation and the Nystrom sampled r-rank ¨ approximation.
313
+
314
+ # B.3 LEMMA 1
315
+
316
+ Lemma 1. If $\boldsymbol { X } \in \mathbb { R } ^ { m \times m }$ is a SPSD matrix and $X _ { r } \in \mathbb { R } ^ { m \times m }$ is the best Nystrom ensembled, ¨ column sampled $r$ -rank approximation of $X$ , then $X _ { r }$ is SPSD as well. (Proof in Appendix B.3)
317
+
318
+ Proof. By the Construction of the Nystrom SVD algorithm, we know that ¨ $X _ { r } = C W _ { r } ^ { + } C ^ { T }$ . We will first show that $W _ { r } ^ { + }$ is a symmetric matrix.
319
+
320
+ We know that $X$ is SPSD. Let $I$ be a sorted list of distinct indices such that $| I | = l$ . Then by construction of $W$ ,
321
+
322
+ $$
323
+ W _ { i , j } = X _ { I [ i ] , I [ j ] }
324
+ $$
325
+
326
+ Hence, as $X _ { I [ i ] , I [ j ] } = X _ { I [ j ] , I [ i ] } , W$ is symmetric.
327
+
328
+ At this step, our algorithm adds $\delta \cdot I$ to $W$ where $\delta \geq 0$ . It is easy to observe that $W + \delta \cdot \mathcal { T }$ is positive semidefinite.
329
+
330
+ Consider a vector $a \in \mathbb { R } ^ { | X | }$ . Create a vector $\bar { a } \in \mathbb { R } ^ { m }$ where
331
+
332
+ $$
333
+ { \bar { a } } _ { i } = { \left\{ \begin{array} { l l } { 0 } & { { \mathrm { i f ~ } } i \notin I } \\ { a _ { i } } & { { \mathrm { o . w . } } } \end{array} \right. }
334
+ $$
335
+
336
+ $$
337
+ \begin{array} { r } { \boldsymbol { a } ^ { \top } \left( \boldsymbol { W } + \boldsymbol { \delta } \cdot \boldsymbol { \mathcal { T } } \right) \boldsymbol { a } = \bar { \boldsymbol { a } } ^ { \top } \boldsymbol { X } \bar { \boldsymbol { a } } + \boldsymbol { \delta } \cdot \boldsymbol { a } ^ { \top } \boldsymbol { \mathcal { Z } } \boldsymbol { a } \geq 0 + \boldsymbol { \delta } \| \mathbf { a } \| ^ { 2 } \geq 0 } \end{array}
338
+ $$
339
+
340
+ Let $W + \delta \mathcal { T }$ be the new $W$ and (3) shows that $W$ is positive semidefinite.
341
+
342
+ Now we will show that $X _ { r }$ is symmetric as well. As $W$ is symmetric, there exists an orthogonal matrix $Q$ and a non-negative diagonal matrix $\Lambda$ such that
343
+
344
+ $$
345
+ W = Q \Lambda Q ^ { T }
346
+ $$
347
+
348
+ We know that $W _ { r } = Q _ { [ 1 : r ] } \Lambda _ { [ 1 : r ] } Q _ { [ 1 : r ] } ^ { T }$ and $W _ { r } ^ { + } = Q _ { [ 1 : r ] } \Lambda _ { [ 1 : r ] } ^ { - 1 } Q _ { [ 1 : r ] } ^ { T } ,$ Hence,
349
+
350
+ $$
351
+ \begin{array} { r l } & { X _ { r } = C W _ { r } ^ { + } C ^ { T } } \\ & { \quad \quad \quad = C Q _ { [ 1 : r ] } \Lambda _ { [ 1 : r ] } ^ { - 1 } Q _ { [ 1 : r ] } ^ { T } C ^ { T } } \\ & { X _ { r } ^ { T } = ( C Q _ { [ 1 : r ] } \Lambda _ { [ 1 : r ] } ^ { - 1 } Q _ { [ 1 : r ] } ^ { T } C ^ { T } ) ^ { T } } \\ & { \quad \quad \quad = C Q _ { [ 1 : r ] } \Lambda _ { [ 1 : r ] } ^ { - 1 } Q _ { [ 1 : r ] } ^ { T } C ^ { T } } \\ & { \quad \quad \quad = X _ { r } } \end{array}
352
+ $$
353
+
354
+ ∴ $X _ { r }$ is symmetric. We can also see that the $X _ { r } ^ { T }$ is positive semi definite by pre-multiplying and post multiplying it with a non-zero vector and using the fact that $W _ { r } ^ { + }$ is positive semi-definite.
355
+
356
+ # C EXPERIMENTAL DETAILS
357
+
358
+ We used a single NVIDIA Tesla P40 GPU for training our networks. All our experiments were run with a learning rate of 0.01 for 500 epochs with a batch size of 512. The hyper-parameter $l$ in the Nystrom method was set to double of the target rank. The model was pre-trained with SGD until the ¨ training accuracy reached $6 5 \%$ and then Algorithm 1 was applied. The rank cutting operation was performed every 10 iterations.
359
+
360
+ The target rank for the LR-layers, which were placed before the FC layers was set to 50 while the target rank for the LR-layer before the last ResNet block was set to 1000. However, experiments suggest that this hyper-parameter is not very crucial to the training process as the training procedure converged the effective rank of the activation matrix to a value lesser than the designated target ranks.
361
+
362
+ The linear classifier in X-MAXG is trained using SGD with hinge loss and $L _ { 2 }$ regularization with a coefficient of 0.01. The learning rate is decreased per iteration as $\begin{array} { r } { \eta _ { t } = \frac { \eta _ { 0 } } { \left( 1 + \alpha t \right) } } \end{array}$ where $\eta _ { 0 }$ and $\alpha$ are set by certain heuristics 5.
363
+
364
+ # C.1 IMPACT ON TEST ACCURACY
365
+
366
+ Table 1(b) shows the result of a transfer learning exercise where we trained two sets of ResNet50-MAXG classifiers. First, two ResNet-50 models were trained with and without the LR-layer respectively on the coarse labels of CIFAR-100. Then, 2048 dimensional embeddings were extracted from after the fourth ResNet block using the train set and the test set of CIFAR 100. The embeddings from the train set were used to train two groups (each group having two classifiers- one for each ResNet-50 model) of max-margin linear classifiers with the same hyper-parameters as described above. While the first group was trained on the coarse labels of CIFAR-100, the second set was trained on the fine labels. The test accuracy of these four classifiers are then reported in Table 1(b) on the corresponding labels.
367
+
368
+ ![](images/75d5cf8374f8b5009d17f2601ad98a8cd4245b05ebcc85415e5efeb4e6b0dc69.jpg)
369
+ Figure 5: Variance Ratio captured by varying number of Singular Values
370
+
371
+ # Effective rank of activations for VGG:
372
+
373
+ # C.2 VALIDITY OF LOW DIMENSIONAL EMBEDDINGS
374
+
375
+ In the first experiment, reported in Table 2(a), we trained two ResNet-50-MAXG models -with and without the LR-layer respectively- on the 20 super-classes of CIFAR-100. As our objective here is to see if the embeddings and their low dimensional projections could be effectively used for discriminative tasks, we used PCA, with standard pre-processing of scaling the input, to project the embeddings onto a low dimensional space before training a linear maximum margin classifier on it.
376
+
377
+ The experiments in Table 2(b) were run with ResNet-18 on CIFAR-10. Two ResNet-18-MAXG classifiers - with and without the LR-layer respectively- were trained on CIFAR-10. The representations were obtained from before the fourth ResNet block and had a dimension of 16,384. Similar to the previous experiment, we used PCA, with standard pre-processing, to gather low dimensional projections before training linear max margin classifiers on it.
378
+
379
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Emb-dim</td><td rowspan=1 colspan=1>Acc</td></tr><tr><td rowspan=1 colspan=1>VGG19-2LR</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>89.8</td></tr><tr><td rowspan=1 colspan=1>VGG19-NLR</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>89.7</td></tr><tr><td rowspan=1 colspan=1>VGG19-2LR</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>89.85</td></tr><tr><td rowspan=1 colspan=1>VGG19-NLR</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>89.78</td></tr><tr><td rowspan=1 colspan=1>VGG19-2LR</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>89.79</td></tr><tr><td rowspan=1 colspan=1>VGG19-NLR</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>89.65</td></tr></table>
380
+
381
+ Table 5: Representation from before the third last FC layer of a VGG19trained on CIFAR-10.
382
+
383
+ As expected, the difference in accuracy here is less stark than the case of ResNet. This is because of two reasons - 1. The dimension of the activation layer in ResNet before the last ResNet block is 16,384 whereas the activations before the third last FC layer is only 512. 2. Figure 5 shows that the difference in the variance ratio between the LR and the N-LR network is much smaller as compared to Figure 1 for ResNets.
384
+
385
+ # C.3 CLASS WISE VARIANCE
386
+
387
+ ![](images/222371ba1c92ead2d81e5b9215a3ae70eadd8ba4ad16fda890b47b98f7769025.jpg)
388
+
389
+ (a) 512 dimensional activations from after last ResNet block.
390
+
391
+ ![](images/57ace73a9ea065379fb5e38ec349e93c08018e0274c9128f470966673e5ff797.jpg)
392
+ (b) $1 6 k$ dimensional activations from before last ResNet block.
393
+
394
+ Figure 6: Class wise variance ratio of one singular values for the activations before the last ResNet block.
395
+
396
+ In this experiment, we plot $\mathsf { V R } _ { 1 } \left( \cdot \right)$ for embeddings of examples restricted to individual classes. Figure 6(a) shows the variance ratio captured by the largest singular value for the activations before the last FC layer while Figure 6(b) shows the variance ratio captured by the largest singular value for the activations before the last ResNet block. These experiments give us some idea about the extent to which the set of basis vectors assigned to individual classes are intersecting.
397
+
398
+ # C.4 CLUSTERS OF LOW DIMENSIONAL EMBEDDINGS
399
+
400
+ Figure 7 shows the two dimensional projections of the 2048 dimensional embeddings obtained from ResNet-50-LR and ResNet-50-N-LR. The coloring is done according to the coarse labels of the input. We can see that the clusters are more separable in the case of the model with LR-layer than the model without, which gives some insight into why a max-margin classifier performs better for the LR model than the N-LR model.
401
+
402
+ ![](images/ba6886981a2dc01f0c977d8fcc3e3843eb4ada4782e73dcab9ac65e0f3c9d7fa.jpg)
403
+ Figure 7: PCA plot for super-class labels in CIFAR 100. Plot on the left shows embeddings from the LR trained model on ResNet-50 while the plot on the right represents a normal ResNet-50 model. Both of them are trained in a similar way. Each color represents a different class.
404
+
405
+ # D ADVERSARIAL ATTACKS
406
+
407
+ D.1 TYPES OF ATTACKS
408
+
409
+ • Iter-FSGM- The Fast Sign Gradient Method (FSGM) Goodfellow et al. (2014) was proposed as the existing methods (Szegedy et al. (2013)) of the time were slow. FSGM tries to maximize the loss function by perturbing the input slightly. Iterative Fast Sign Gradient method (Iter-FSGM) is a simple extension of FSGM that follows the following simple iterative step.
410
+
411
+ $$
412
+ \begin{array} { r l } & { \mathbf { x } _ { a } ^ { 0 } = \mathbf { x } _ { d } , } \\ & { \mathbf { x } _ { a } ^ { n + 1 } = \mathrm { c l i p } _ { \mathbf { x } , \epsilon } ( \mathbf { x } _ { a } ^ { n } + \boldsymbol { \alpha } \cdot \mathrm { s i g n } ( \nabla _ { \mathbf { x } _ { a } ^ { n } } \mathcal { L } ( \mathbf { x } _ { a } ^ { n } , \mathbf { y } _ { t } ) ) ) } \end{array}
413
+ $$
414
+
415
+ • Iter-LL-FSGM- Iter-FSGM is an untargeted attack. Iterative less likely fast sign gradient method (Iter-LL-FSGM) (Kurakin et al., 2017) is a way to choose the target label wisely. Consider $\mathbb { P } _ { M } ( \mathbf { y } | \mathbf { x } )$ to be the probability assigned to the label $\mathbf { y }$ , for the example $\mathbf { x }$ , by the model $M$ . In this attack, the target is set as $\mathbf { y } _ { t } ^ { n } = \operatorname { a r g m i n } _ { \mathbf { y } \in \mathcal { Y } } \mathbb { P } _ { M } ( \mathbf { y } | \mathbf { x } ^ { n } )$ and the following iterative update steps are performed.
416
+
417
+ $$
418
+ \begin{array} { r l } & { \mathbf { x } _ { a } ^ { 0 } = \mathbf { x } _ { d } , } \\ & { \mathbf { x } _ { a } ^ { n + 1 } = \mathrm { c l i p } _ { \mathbf { x } , \epsilon } ( \mathbf { x } _ { a } ^ { n } - \alpha \cdot \mathrm { s i g n } ( \nabla _ { \mathbf { x } _ { a } ^ { n } } \mathcal { L } ( \mathbf { x } _ { a } ^ { n } , \mathbf { y } _ { t } ^ { n } ) ) ) } \end{array}
419
+ $$
420
+
421
+ Intuitively, this method picks the least likely class in each iteration and then tries to increase the probability of predicting that class. In both of these methods, $\alpha$ was set to 1 as was done in Kurakin et al. (2017).
422
+
423
+ • DeepFool- Moosavi-Dezfooli et al. (2016) describes the DeepFool procedure to find the optimal (smallest) perturbation for the input $\mathbf { x }$ that can fool the classifier. In the case of affine classifiers, DeepFool finds the closest hyper-plane of the boundary of the region where the classifier returns the same label as $\mathbf { x }$ and then adds a small perturbation to cross the hyper-plane in that direction.
424
+
425
+ As deep net classifiers are not affine, the partitions of the input space where the classifier outputs the same label are not not polyhedrons. Hence, the algorithm takes an iterative approach. Specifically, the algorithm assumes a linerization of the classifier around $\mathbf { x }$ to approximate the polyhedron and then it takes a step towards the closest boundary. For a more detailed explanation please look at Moosavi-Dezfooli et al. (2016).
426
+
427
+ # D.2 MINIMUM PERTURBATION FOR A SUCCESSFUL ATTACK
428
+
429
+ Table 3 lists the minimum perturbation required to fool the classifier under the particular attack scheme. For Iter-FSGM and Iter-LL-FSGM, there are essentially three hyper-parameters $( t , \alpha , \epsilon )$ in the experiments as can be seen below.
430
+
431
+ Iter-FSGM
432
+
433
+ Repeat $t$ times
434
+
435
+ $$
436
+ \begin{array} { r l } & { \mathbf { x } _ { a } ^ { 0 } = \mathbf { x } _ { d } , } \\ & { \mathbf { x } _ { a } ^ { n + 1 } = \mathrm { c l i p } _ { \mathbf { x } , \epsilon } ( \mathbf { x } _ { a } ^ { n } + \boldsymbol { \alpha } \cdot \mathrm { s i g n } ( \nabla _ { \mathbf { x } _ { a } ^ { n } } \mathcal { L } ( \mathbf { x } _ { a } ^ { n } , \mathbf { y } _ { t } ) ) ) } \end{array}
437
+ $$
438
+
439
+ Iter-LL-FSGM
440
+
441
+ Repeat $t$ times
442
+
443
+ $$
444
+ \begin{array} { r l } & { \mathbf { x } _ { a } ^ { 0 } = \mathbf { x } _ { d } , } \\ & { \mathbf { x } _ { a } ^ { n + 1 } = \mathrm { c l i p } _ { \mathbf { x } , \epsilon } ( \mathbf { x } _ { a } ^ { n } - \alpha \cdot \mathrm { s i g n } ( \nabla _ { \mathbf { x } _ { a } ^ { n } } \mathcal { L } ( \mathbf { x } _ { a } ^ { n } , \mathbf { y } _ { t } ^ { n } ) ) ) } \end{array}
445
+ $$
446
+
447
+ Following the convention of Kurakin et al. (2017), we set $\alpha = 1$ . We tuned the hyper-parameter $\epsilon$ function to obtain the smallest $\epsilon$ that resulted in over $9 9 \%$ misclassification accuracy for some $t$ and then repeated the experiments until such a $t$ was achieved. Finally $\rho$ was calculated.
448
+
449
+ Algorithm 2 in Moosavi-Dezfooli et al. (2016) gives details about the DeepFool algorithm for multi-class classifiers. The algorithm returns the minimum perturbation $r ( \mathbf { x } )$ required to make the classifier misclassify the instance $\mathbf { x }$ . The $L _ { 2 }$ dissimilarity is obtained by calculating $\begin{array} { r } { \rho = \frac { r ( \mathbf { x } ) } { \| \mathbf { x } \| _ { 2 } } } \end{array}$
450
+
451
+ For the benefit of reproducibility of experiments, we list the values of $\epsilon$ for Iter-LL-FSGM and Iter-FSGM in Table 6 corresponding to the values in Table 3 . For DeepFool, we used the publicly available code 6.
452
+
453
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>e[Iter-LL-FSGM]</td><td rowspan=1 colspan=1>ɕ[Iter-FSGM]</td></tr><tr><td rowspan=3 colspan=1>White Box</td><td rowspan=1 colspan=1>ResNet 2-LR</td><td rowspan=1 colspan=1>0.04</td><td rowspan=1 colspan=1>0.02</td></tr><tr><td rowspan=1 colspan=1>ResNet 1-LR</td><td rowspan=1 colspan=1>0.06</td><td rowspan=1 colspan=1>0.01</td></tr><tr><td rowspan=1 colspan=1>ResNet N-LR</td><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>0.01</td></tr><tr><td rowspan=2 colspan=1>Black Box</td><td rowspan=1 colspan=1>ResNet 1-LR</td><td rowspan=1 colspan=1>0.08</td><td rowspan=1 colspan=1>0.01</td></tr><tr><td rowspan=1 colspan=1>ResNet 2-LR</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>0.01</td></tr></table>
454
+
455
+ Table 6: Value for $\epsilon$ required for Adversarial Misclassification corresponding to Table 3.
456
+
457
+ # D.3 UNSTABILITY OF ADVERSARIAL ATTACKS
458
+
459
+ The essential difference between the attacks in Figure 2 and Table 3 is in the number of iterations for which the updates (Step 6 and Step 7) are executed. In Figure 2, the step is executed $t$ times whereas in Table 3, the updates are executed until the classifier makes a mistake.
460
+
461
+ It would be natural to expect that once a classifier has misclassified an example, adding more adversarial perturbation will surely not make the classifier classify it correctly. However, Figure 8 suggests that a misclassified example can be classified correctly upon further addition of noise.
462
+
463
+ Let $y _ { a } ( \mathbf { x } ; k )$ be the label given to $\mathbf { x }$ after adding adversarial perturbation to $\mathbf { x }$ for $k$ steps. We define instantaneous accuracy $( a _ { \mathcal { T } } ( k ) )$ and cumulative accuracy $( a _ { C } ( k ) )$ as
464
+
465
+ $$
466
+ a _ { \mathcal { T } } ( \boldsymbol { k } ) = 1 - \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \mathcal { T } _ { 0 , 1 } \left\{ y _ { a } ( \mathbf { x } ; \boldsymbol { k } ) \neq y _ { a } ( \mathbf { x } ; 0 ) \right\}
467
+ $$
468
+
469
+ $$
470
+ a _ { \mathcal { C } } ( k ) = 1 - \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \operatorname* { m a x } _ { 1 \leq j \leq k } \left\{ \mathcal { T } _ { 0 , 1 } \left\{ y _ { a } ( \mathbf { x } ; j ) \neq y _ { a } ( \mathbf { x } ; 0 ) \right\} \right\}
471
+ $$
472
+
473
+ ![](images/eebb2fe1783ba29b76c87a3e28cc202595ecb30f088ea9867e0ff2b2a5dd39ed.jpg)
474
+ Figure 8: This shows that an adversarial example that has successfully fooled the classifier in a previous step can be classified correctly upon adding more perturbation. Figure ?? and ?? refers to the two attack schemes - Iter-LL-FSGM and Iter-FSGM respectively.
475
+
476
+ In Figure 8, we see the instantaneous accuracy and the cumulative accuracy for ResNet 1-LR where $\alpha = 0 . 0 1 , \epsilon = 0 . 1$ and $t$ is plotted in the $\mathbf { X }$ -axis. The cumulative accuracy is by definition a non-increasing sequence. However, surprisingly the instantaneous accuracy is not monotonic and has a lower rate of decrease than the cumulative accuracy. It also appears to stabilize at a value much higher than the cumulative accuracy.
477
+
478
+ # D.4 ADVERSARIAL ATTACK ON MAXIMUM MARGIN MODEL
479
+
480
+ Here, we train max-margin classifiers on representations of images obtained from different ResNet models and see whether the representations of adversarial images, that had successfully fooled the ResNet model, could fool the max-margin classifier as well. We train a variety of X-MAXG models - ResNet18-1-LR-MAXG, ResNet18-2-LR-MAXG, ResNet18-N-LR-MAXG and black box versions of the same.
481
+
482
+ Once, these classifiers are trained, adversarial examples were generated for the three attacks (both black box and white box) on ResNet18-1-LR, ResNet18 2-LR and ResNet18-N-LR by the techniques described in Section D.2. The accuracy of the MAXG models are listed in Table 4.
483
+
484
+ To perform a fair comparison with ResNet18-N-LR-MAXG, it is essential to add a similar amount of noise to generate the examples for ResNet18-N-LR-MAXG as is added in ResNet18-1-LR-MAXG. The adversarial examples are hence generated by obtaining the gradient using ResNet18-N-LR but stopping the iteration only when the adversarial example could fool ResNet18-1-LR. This is, in-fact, the black box attack on ResNet18-1-LR. As Table 4 suggests, our models create representations that are more robust to adversarial perturbations than a normal model.
md/train/SkxW23NtPH/SkxW23NtPH.md ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GDP: GENERALIZED DEVICE PLACEMENT FOR DATAFLOW GRAPHS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Runtime and scalability of large neural networks can be significantly affected by the placement of operations in their dataflow graphs on suitable devices. With increasingly complex neural network architectures and heterogeneous device characteristics, finding a reasonable placement is extremely challenging even for domain experts. Most existing automated device placement approaches are impractical due to the significant amount of compute required and their inability to generalize to new, previously held-out graphs. To address both limitations, we propose an efficient end-to-end method based on a scalable sequential attention mechanism over a graph neural network that is transferable to new graphs. On a diverse set of representative deep learning models, including Inception-v3, AmoebaNet, Transformer-XL, and WaveNet, our method on average achieves $16 \%$ improvement over human experts and $9 . 2 \%$ improvement over the prior art with $1 5 \times$ faster convergence. To further reduce the computation cost, we pre-train the policy network on a set of dataflow graphs and use a superposition network to fine-tune it on each individual graph, achieving state-of-the-art performance on large hold-out graphs with over 50k nodes, such as an 8-layer GNMT.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Neural networks have demonstrated remarkable scalability–improved performance can usually be achieved by training a larger model on a larger dataset (Hestness et al., 2017; Shazeer et al., 2017; Jozefowicz et al., 2016; Mahajan et al., 2018; Radford et al.). Training such large models efficiently while meeting device constraints, like memory limitations, necessitate partitioning of the underlying dataflow graphs for the models across multiple devices. However, devising a good partitioning and placement of the dataflow graphs requires deep understanding of the model architecture, optimizations performed by domain-specific compilers, as well as the device characteristics, and is therefore extremely hard even for experts.
12
+
13
+ ML practitioners often rely on their understanding of model architecture to determine a reasonable partitioning and placement for graphs. However, relying solely on the model architecture while ignoring the effect of the partitioning on subsequent compiler optimizations like op-fusion can lead to sub-optimal placements and consequently under-utilization of available devices. The goal of automated device placement is to find the optimal assignment of operations to devices such that the end-to-end execution time for a single step is minimized and all device constraints like memory limitations are satisfied. Since this objective function is non-differentiable, prior approaches (Mirhoseini et al., 2017; 2018; Gao et al., 2018) have explored solutions based on reinforcement learning (RL). However, these RL policies are usually not transferable and require training a new policy from scratch for each individual graph. This makes such approaches impractical due to the significant amount of compute required for the policy search itself, at times offsetting gains made by the reduced step time.
14
+
15
+ In this paper, we propose an end-to-end deep RL method for device placement where the learned policy is generalizable to new graphs. Specifically, the policy network consists of a graph-embedding network that encodes operation features and dependencies into a trainable graph representation, followed by a scalable sequence-to-sequence placement network based on an improved Transformer (Vaswani et al., 2017; Dai et al., 2019). The placement network transforms the graph representations into a placement decision with soft attention, removing hard constraints such as hierarchical grouping of operations (Mirhoseini et al., 2018) or co-location heuristics (to reduce the placement complexity) (Mirhoseini et al., 2017). Both of our graph-embedding network and placement network can be jointly trained in an end-to-end fashion using a supervised reward, without the need to manipulate the loss functions at multiple levels. We empirically show that the network learns flexible placement policies at a per-node granularity and can scale to problems over 50,000 nodes.
16
+
17
+ To generalize to arbitrary and held-out graphs, our policy is trained jointly over a set of dataflow graphs (instead of one at a time) and then fine-tuned on each graph individually. By transferring the learned graph embeddings and placement policies, we are able to achieve faster convergence and thus use less resources to obtain high-quality placements. We also use super-positioning, i.e., a feature conditioning mechanism based on the input graph embeddings, to effectively orchestrate the optimization dynamics of graphs with drastically different sizes in the same batch.
18
+
19
+ Our contributions can be summarized as follows:
20
+
21
+ 1. An end-to-end device placement network that can generalize to arbitrary and held-out graphs. This is enabled by jointly learning a transferable graph neural network along with the placement network.
22
+ 2. A scalable placement network with an efficient recurrent attention mechanism, which eliminates the need for an explicit grouping stage before placement. The proposed end-to-end network provides $1 5 \times$ faster convergence as compared to the hierarchical LSTM model used in earlier works (Mirhoseini et al., 2017; 2018).
23
+ 3. A new batch pre-training and fine-tuning strategy based on network superposition, which leads to improved transferability, better placements especially for larger graphs, and $1 0 \times$ reduction in policy search time as compared to training individual graphs from scratch.
24
+ 4. Superior performance over a wide set of workloads, including InceptionV3 (Szegedy et al., 2015), AmoebaNet (Real et al., 2018), RNNs, GNMT (Wu et al., 2016), Transformer-XL (Dai et al., 2019), WaveNet (van den Oord et al., 2016), and more.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Device Placement Reinforcement learning has been used for device placement of a given dataflow graph (Mirhoseini et al., 2017) and demonstrated run time reduction over human crafted placement and conventional heuristics. For improved scalability, a hierarchical device placement strategy (HDP) (Mirhoseini et al., 2018) has been proposed that clusters operations into groups before placing the operation groups onto devices. Spotlight (Gao et al., 2018) applies proximal policy optimization and cross-entropy minimization to lower training overhead. Both HDP and Spotlight rely on LSTM controllers that are difficult to train and struggle to capture very long-term dependencies over large graphs. In addition, both methods are restricted to process only a single graph at a time, and cannot generalize to arbitrary and held-out graphs. Placeto (Addanki et al., 2019) represents the first attempt to generalize device placement using a graph embedding network. But like HDP, Placeto also relies on hierarchical grouping and only generates placement for one node at each time step. Our approach (GDP) leverages a recurrent attention mechanism and generates the whole graph placement at once. This significantly reduces the training time for the controller. We also demonstrate the generalization ability of GDP over a wider set of important workloads.
29
+
30
+ Parallelization Strategy Mesh-TensorFlow is a language that provides a general class of distributed tensor computations. While data-parallelism can be viewed as splitting tensors and operations along the “batch” dimension, in Mesh-TensorFlow the user can specify any tensor-dimensions to be split across any dimensions of a multi-dimensional mesh of processors. FlexFlow (Jia et al., 2018) introduces SOAP, a more comprehensive search space of parallelization strategies for DNNs which allows parallelization of a DNN in the Sample, Operator, Attribute, and Parameter dimensions. It uses guided randomized search of the SOAP space to find a parallelization strategy for a specific parallel machine. GPipe (Huang et al., 2018) proposed pipeline parallelism, by partitioning a model across different accelerators and automatically splitting a mini-batch of training examples into smaller micro-batches. By pipelining the execution across micro-batches, accelerators can operate in parallel. Our GDP focuses on a general deep RL method for automating device placement on arbitrary graphs, and is therefore orthogonal to existing parallelization strategies.
31
+
32
+ ![](images/6d7904fbfb076cc23f86cea14773c4e42f598efb830a695fdc7196d067a40a91.jpg)
33
+ Figure 1: Overview of GDP: An end-to-end placement network that combines graph embedding and sequential attention. $N$ : Number of Nodes, h: Hidden Size, $d$ : Number of Devices.
34
+
35
+ Compiler Optimization REGAL (Paliwal et al., 2019) uses deep RL to optimize the execution cost of computation graphs in a static compiler. The method leverages the policy’s ability to transfer to new graphs to improve the quality of the genetic algorithm for the same objective budget. However, REGAL only targets peak memory minimization while GDP focuses on graph run time and scalability while also meeting the peak memory constraints of the devices. Specifically, we generalize graph partitioning and placement into a single end-to-end problem, with and without simulation, which can handle graphs with over 50,000 nodes.
36
+
37
+ # 3 END-TO-END PLACEMENT POLICY
38
+
39
+ Given a dataflow graph $G ( V , E )$ where $V$ represents atomic computational operations (ops) and $E$ represents the data dependency, our goal is to learn a policy $\pi : \mathcal { G } \mapsto \mathcal { D }$ that assigns a placement $D \in { \mathcal { D } }$ for all the ops in the given graph $G \in { \mathcal { G } }$ , to maximize the reward $r _ { G , D }$ defined based on the run time. $\mathcal { D }$ is the allocated devices that can be a mixture of CPUs and GPUs. In this work, we represent policy $\pi _ { \theta }$ as a neural network parameterized by $\theta$ .
40
+
41
+ Unlike prior works that focus on a single graph only, the RL objective in GDP is defined to simultaneously reduce the expected runtime of the placements over a set of $N$ dataflow graphs:
42
+
43
+ $$
44
+ J ( \theta ) = \mathbb { E } _ { G \sim \mathcal { G } , D \sim \pi _ { \theta } ( G ) } [ r _ { G , D } ] \approx \frac { 1 } { N } \sum _ { G } \mathbb { E } _ { D \sim \pi _ { \theta } ( G ) } [ r _ { G , D } ]
45
+ $$
46
+
47
+ In the following, we refer to the case when $N = 1$ as individual training and the case when $N > 1$ as batch training. We optimize the objective above using Proximal Policy Optimization (PPO) (Schulman et al., 2017) for improved sample efficiency.
48
+
49
+ Figure 1 shows an overview of the proposed end-to-end device placement network. Our proposed policy network $\pi _ { \theta }$ consists a graph embedding network that learns the graphical representation of any dataflow graph, and a placement network that learns a placement strategy over the given graph embeddings. The two components are jointly trained in an end-to-end fashion. The policy $p ( a | G )$ is applied to make a set of decisions at each node. These decisions, denoted as $a _ { v }$ for each $v \in V$ across all nodes, form one action $a = \{ a _ { v \in V } \}$ . One decision corresponds to playing one arm of a multi-bandit problem, and specifying the entire $a$ corresponds to playing several arms together in a single shot. Note the architecture is designed to be invariant over the underlying graph topology, enabling us to apply the same learned policy to a wide set of input graphs with different structures.
50
+
51
+ # 3.1 GRAPH EMBEDDING NETWORK
52
+
53
+ We leverage graph neural networks (GNNs) (Hamilton et al., 2017; Xu et al., 2019; You et al., 2018) to capture the topological information encoded in the dataflow graph. Most graph embedding frameworks are inherently transductive and can only generate embeddings for a given fixed graph. These transductive methods do not efficiently extrapolate to handle unseen nodes (e.g., in evolving graphs), and cannot learn to generalize to unseen graphs. GraphSAGE (Hamilton et al., 2017) is an inductive framework that leverages node attribute information to efficiently generate representations on previously unseen data. While our proposed framework is generic, we adopt the feature aggregation scheme proposed in GraphSAGE to model the dependencies between the operations and build a general, end-to-end device placement method for a wide set of dataflow graphs.
54
+
55
+ In GDP, nodes and edges in the dataflow graph are represented as the concatenation of their meta features (e.g., operation type, output shape, adjacent node ids) and are further encoded by the graph embedding network into a trainable representation. The graph embedding process consists of multiple iterations, and the computation procedure for the $l$ -th iteration can be outlined as follows:
56
+
57
+ First, each node $v \in V$ aggregates the feature representations of its neighbors, $\{ h _ { u } ^ { ( l ) } , \forall u \in \mathcal { N } ( v ) \}$ , into a single vector h(l)N (v). This aggregation outcome is a function of all previously generated representations, including the initial representations defined based on the input node features. In this work, we use the following aggregation function with max pooling:
58
+
59
+ $$
60
+ h _ { \mathcal { N } ( v ) } ^ { ( l ) } = \operatorname* { m a x } ( \sigma ( W ^ { ( l ) } h _ { u } ^ { ( l ) } + b ^ { ( l ) } ) , \forall u \in \mathcal { N } ( v ) )
61
+ $$
62
+
63
+ where $( W ^ { ( l ) } , b ^ { ( l ) } )$ define an affine transform and $\sigma$ stands for the sigmoid activation function. We then concatenate the node’s current representation, $h _ { v } ^ { ( l ) }$ , with the aggregated neighborhood vector, $h _ { \mathcal { N } ( v ) } ^ { ( l ) }$ , and feed this concatenated vector through a fully connected layer $f ^ { ( l + 1 ) }$ ei
64
+
65
+ $$
66
+ h _ { v } ^ { ( l + 1 ) } = f ^ { ( l + 1 ) } ( \mathrm { c o n c a t } ( h _ { v } ^ { ( l ) } , h _ { \mathcal { N } ( v ) } ^ { ( l ) } ) )
67
+ $$
68
+
69
+ Different from GraphSAGE, parameters in our graph embedding network are trained jointly with a placement network via stochastic gradient descent with PPO, in a supervised fashion, as described in Section 3. That is, we replace the unsupervised loss with our task-specific objective.
70
+
71
+ # 3.2 PLACEMENT NETWORK
72
+
73
+ The graph neural network works as a feature aggregation network that learns a trainable feature representation for the computational graph, we still need a policy network that produces actions on a per node basis. Given $h _ { v }$ ’s, the policy network produces $a _ { v }$ ’s through conditionally independent predictions, where the prediction for one node $v$ does not depend on the prediction of other nodes.
74
+
75
+ $$
76
+ p ( a | G ) = \prod _ { v } p ( a _ { v } | G ) = \prod _ { v } p ( a _ { v } | f ( h _ { v } ) )
77
+ $$
78
+
79
+ While $f$ can be represented using multilayer perceptrons (MLPs), where the MLPs is shared across all nodes for prediction the placement output distributions. However, MPLs lack a dependency tracking mechanism across nodes. In practise, the placement of one node can be determined by the placement of another node, where the placed node may consume a large size of data produced by the other node. Intuitively, an attention network can learn this dependency and the relative importance of dependencies across an entire graph. Therefore, we decide to use an attention-based placement network to better track inter-node placement-related dependencies.
80
+
81
+ Designing a scalable placement network that can generalize to graphs with thousands of nodes is challenging, as the conventional GNMT models proposed for language tasks usually target a shorter sequence length. Hierarchical placement (Mirhoseini et al., 2018) has been proposed to address this issue,however, the proposed grouper network comes with limited flexibility and generality. For example, the grouper network leverages an aggregated feature representation by averaging feature vectors for nodes within the same group. The non-differentiable grouping procedure prevents training the graph-embedding and placement networks end-to-end.
82
+
83
+ To remove the two-stage hierarchical workflow in HDP for improved scalability, we propose to use a Transformer-based attentive network to generate operation placements in an end-to-end fashion. As the graph embedding already contains spatial (topological) information for each node, we remove the positional embedding in the original transformer to prevent the model from overfitting node identifications. To capture long-term dependencies efficiently among a large set of nodes, we adopt segment-level recurrence introduced in Transformer-XL (Dai et al., 2019; Dai, 2019), where hidden states computed for the previous set of nodes are cached (with gradient flows disabled) and reused as an extended context during the training of the next segment. Besides achieving extra long context, we empirically find the segment-level recurrent attention much faster than a conventional LSTMbased GNMT model. In our experimental evaluation, we compare both the performance and speed up of our placement network with that of the LSTM-based hierarchical device placement.
84
+
85
+ # 3.3 BATCH TRAINING WITH PARAMETER SUPERPOSITION
86
+
87
+ Since the parameterization for the architecture of the end-to-end policy is designed to be invariant over input graphs with different topologies, the same placement policy can be shared across a wide set of workloads. We therefore propose a batch training strategy, and further enhance the aforementioned architecture to handle such generalization across graphs.
88
+
89
+ Na¨ıve batch training is challenging in our context as different dataflow graphs contain different number of operations connected in different topologies. In addition, unlike previous device placement methods, GDP aims to handle graphs from potentially different application domains (e.g. computer vision, language, and speech), where the number of operations can range from a few thousand to one million. These graphs have drastically different network architecture, in terms of computational operations, data shape, and network topology. As an example, recurrent networks have completely different operation types and connections compared to multi-branch convolutional networks that are widely used in computer vision. It would be highly desirable to train a single shared network that maximizes information sharing across these heterogeneous tasks, without hurting the performance on each of them due to their distinct learning dynamics.
90
+
91
+ Along a similar direction of multi-task learning and few-shot learning (Oreshkin et al., 2018), we propose a feature conditioning mechanism similar to parameter superposition (Cheung et al., 2019). The idea is to train one shared policy, but condition its parameters based on the input features to mitigate the potentially undesirable interference among different input graphs. Since dense layers (affine transforms followed by nonlinearity) serve as the fundamental building blocks in all of our network components, we introduce an additional conditioning layer to enable superposition in all dense layers the placement network:
92
+
93
+ $$
94
+ x ^ { ( l + 1 ) } = g ^ { ( l ) } ( c ( x ^ { ( 0 ) } ) \odot x ^ { ( l ) } )
95
+ $$
96
+
97
+ where $g ^ { ( l ) }$ stands for a dense layer in our policy network, $c$ stands for the feature conditioning layer, and $x ^ { ( 0 ) }$ denotes the feature representation of the input graph generated by the graph-embedding network. The feature conditioning layer is implemented with minimum overhead by adding an additional transformer layer to our placement network.
98
+
99
+ # 4 EXPERIMENT
100
+
101
+ # 4.1 EXPERIMENT SETUP
102
+
103
+ In this section, we evaluate our training strategy on widely used machine learning models in computer vision, natural language processing, and speech domains. We compare our approach to human expert placement, TensorFlow METIS placement, and hierarchical device placement (HDP) (Mirhoseini et al., 2018). Our experiments are run on machines with one Intel Broadwell CPU and up to eight Nvidia P100 GPUs. Note that the prior work (Mirhoseini et al., 2017; 2018; Gao et al., 2018) were evaluated on different GPU devices, preventing direct comparison of results. Therefore, we re-evaluate HDP on our own system environment and report those numbers.
104
+
105
+ The performance of a placement is evaluated by the resulted training step time (run time) of the neural network. We use the negative square root of the normalized run time as the reward, where the run time is normalized with the best run time from a baseline. We use the average reward of all the previous trials as a bias term. The advantage value is computed by subtracting the reward by the average reward. During the search, we apply a large negative reward (-10) for invalid placements (e.g. a violation of co-location constraint, out of memory, etc.). For operation scheduling, we rely on the Tensorflow default FIFO scheduling.
106
+
107
+ # 4.2 PERFORMANCE ON INDIVIDUAL GRAPHS
108
+
109
+ We evaluate GDP by training the model separately on six important graphs, including RNN Language Modeling, GNMT (Sutskever et al., 2014), Transformer-XL, Inception, AmoebaNet, and
110
+
111
+ Table 1: Run time comparison between GDP-one, human expert, Tensorflow METIS, and hierarchical device placement (HDP) on six graphs (RNNLM, GNMT, Transformer-XL, Inception, AmoebaNet, and WaveNet). Graph runtime speed up is compared with Human Placement (HP) and Hierarchical Device Placement (HDP). Search speed up is the policy network training time speed up compared to HDP (reported values are averages of six runs).
112
+
113
+ <table><tr><td>Model (#devices)</td><td>GDP-one (s)</td><td>HP (s)</td><td>METIS (s)</td><td>HDP (s)</td><td>Run time speed up over HP/HDP</td><td>Search speed up</td></tr><tr><td>2-layer RNNLM (2)</td><td>0.234</td><td>0.257</td><td>0.355</td><td>0.243</td><td>9.8% /4%</td><td>2.95x</td></tr><tr><td>4-layer RNNLM (4) 2-layer GNMT (2)</td><td>0.409 0.301</td><td>0.48 0.384</td><td>OOM OOM</td><td>0.490 0.376</td><td>17.4% /19.8% 27.6% /24.9%</td><td>1.76x 30x</td></tr><tr><td>4-layer GNMT (4)</td><td>0.409</td><td>0.469</td><td>0OM</td><td>0.520</td><td>14.7% / 27.1%</td><td>58.8x</td></tr><tr><td>8-layer GNMT (8)</td><td>0.649</td><td>0.610</td><td>OOM</td><td>0.693</td><td>-6% /6.8%</td><td>7.35x</td></tr><tr><td>2-layer Transformer-XL (2)</td><td>0.386</td><td>0.473</td><td>0OM</td><td>0.435</td><td>22.5% / 12.7%</td><td>40x</td></tr><tr><td>4-layer Transformer-XL (4)</td><td>0.580</td><td>0.641</td><td>0OM</td><td>0.621</td><td>11.4% / 7.1%</td><td>26.7x</td></tr><tr><td>8-layer</td><td>0.748</td><td>0.813</td><td>0OM</td><td>0.789</td><td>8.9% /5.5%</td><td>16.7x</td></tr><tr><td>Transformer-XL (8) Inception (2)</td><td>0.405</td><td>0.418</td><td>0.423</td><td>0.417</td><td>3.2% /3%</td><td>13.5x</td></tr><tr><td>AmoebaNet (4)</td><td>0.394</td><td>0.44</td><td>0.426</td><td>0.418</td><td>26.1% /6.1%</td><td>58.8x</td></tr><tr><td>2-stack 18-layer WaveNet (2)</td><td>0.317</td><td>0.376</td><td>00M</td><td>0.354</td><td>18.6% /11.7%</td><td>6.67x</td></tr><tr><td>4-stack 36-layer</td><td>0.659</td><td>0.988</td><td>0OM</td><td>0.721</td><td></td><td></td></tr><tr><td>WaveNet (4) GEOMEAN</td><td></td><td></td><td></td><td></td><td>50% /9.4%</td><td>20x</td></tr><tr><td></td><td>1</td><td>-</td><td>1</td><td>1</td><td>16% /9.2%</td><td>15x</td></tr></table>
114
+
115
+ WaveNet. We name this approach GDP-one. For all the tasks, GDP-one consistently outperforms human expert placement, TensorFlow METIS (Karypis & Kumar, 1998) placement, and HDP. For extremely large graphs, GDP-one is only $6 \%$ worse on 8-layer NMT (over $6 0 \mathrm { k }$ nodes), compared to human placement, but is $6 . 8 \%$ better than HDP. Overall, GDP-one achieves on average more than $16 \%$ run time reduction across the evaluated 12 graphs, compared to human expert placement. Compared to hierarchical device placement, GDP-one achieves an average $9 . 2 \%$ speed up, and scales better to large graphs such as 8-layer NMT and 4-layer RNNLM. Importantly, with the efficient end-to-end training and sample efficient reinforcement learning algorithm, GDP-one has a $1 5 \mathrm { x }$ speed up in convergence time of the placement network over HDP.
116
+
117
+ # 4.3 GENERALIZATION
118
+
119
+ GDP enables the training of multiple heterogeneous graphs in a single batch, sharing parameters in the graph-embedding network and the placement network. We name this training strategy GDPbatch. We empirically show that GDP-batch generates better placements for many workloads such as transformer-XL $( 7 . 6 \% )$ , WaveNet $( 1 5 \% )$ , and 8-layer GNMT $( 8 \% )$ . Table 2 compares the run time of 11 tasks using GDP-batch, with the same end-to-end architecture as described in section 4.2. GDP-batch yields slightly better run time compared to GDP-one in majority of the tasks, while being only slightly worse on AmoebaNet. Compared to training graphs separately, GDP-batch reduces network parameters and enables transfer learning among different graphs.
120
+
121
+ We further evaluate the effect of transfer learning by mixing redundant tasks in a batch. We find that mixing different graphs such as RNNLM and GNMT models with different number of layers results in both faster and better learning for RNNLM and GNMT with large number of layers (8- layer). As a matter of fact, both Placeto (Addanki et al., 2019) and HDP had problems matching human placement performance for 8-layer GNMT or 8-layer RNNLM. With batch training, GDP is the first device placement work to match human expert performance for both 8-layer GNMT and 8-layer RNNLM. We also for the first time show that GDP-batch not only improves the search time (since we do not retrain the policy for every new graph), it can also improve the performance of the found placements. More detailed results are shown in Appendix Table 5.
122
+
123
+ Table 2: Run time comparison on GDP-batch vs. GDP-one.
124
+
125
+ <table><tr><td>Model</td><td>Speed up</td><td>Model</td><td>Speed up</td></tr><tr><td>2-layer RNNLM</td><td>0</td><td>Inception</td><td>0</td></tr><tr><td>4-layer RNNLM</td><td>5%</td><td>AmoebaNet</td><td>-5%</td></tr><tr><td>2-layer GNMT</td><td>0</td><td>4-stack 36-layer WaveNet</td><td>3.3 %</td></tr><tr><td>4-layer GNMT</td><td>0</td><td>2-stack18-layer WaveNet</td><td>15%</td></tr><tr><td>2-layer Transformer-XL 4-layer Transformer-XL</td><td>7.6% 3%</td><td>8-layer Transformer-XL</td><td>1.5%</td></tr></table>
126
+
127
+ Generalization to hold-out graphs: Here we show another set of experiments where we treat GDPbatch as a pre-training strategy and remove the target graph from the batch training dataset. We then fine-tune the pre-trained model on the hold-out graphs for fewer than 50 steps, which takes less than one minute. We name this GDP-generalization+finetune. Figure 2 shows that GDP fine-tuning for hold-out graphs outperforms human expert placement and HDP consistently on all six batch training datasets, and performs only slightly worse than GDP-one. 2-layer RNNLM and 2-stack WaveNet almost match the performance of GDP-one. We also run inference (generate placement) directly on the pre-trained model for the target hold-out graphs, and name this GDP-generalization-zeroshot. We find that GDP-generalization-zeroshot only marginally hurts performance as compared to GDPgeneralization+finetune, while being slightly better than human placement and HDP. This indicates that both graph embedding and the learned policies transfer and generalize to the unseen data.
128
+
129
+ ![](images/5c9f10f415f26c1d76aeae0118c9dc7049201690e0d379df3c50b56bbbbba3f9.jpg)
130
+ Figure 2: Finetuning on hold-out graphs.
131
+
132
+ Comparisons with other generalized placement approaches: Placeto (Addanki et al., 2019), to our knowledge, is the only other method beside GDP that shows true (and non-simulated) generalized device placement results. Direct comparison is not possible since Placeto uses a different hardware platform and different input graphs (Inception-V3, NMT, and NASNet). Placeto’s search time is on average $2 . 6 5 \mathrm { x }$ faster than HDP, while GDP is on average $1 5 \mathrm { x }$ faster than HDP on our larger set of graphs. Apart from search time speed up, Placeto on average reduces placed graph run time by $3 \%$ (for its different graphs and hardware) while GDP on average reduces placed graph run time by $9 . 2 \%$ , compared to HDP. One advantage of GDP over Placeto is that it does not rely on any initial feasible placement. Providing a reasonable initial placement is often non-trivial for domain experts, especially for larger graphs such as 8-layer GNMT. As such, we are the first to report superhuman results on 8-layer GNMT (with GDP-batch).
133
+
134
+ # 4.4 ABLATION STUDIES
135
+
136
+ Attention and Superposition. We did an ablation study on the attention and the superposition layer in the transformer-XL placer network. We find that attention improves placement run time by an average of $18 \%$ compared to a placer network with no attention, and superposition improves placement run time by an average of $6 . 5 \%$ where all the graphs are trained in a single batch as described in Section 4.3. Without superposition network, batch training fails for AmoebaNet and Inception when mixing with larger RNNLM or GNMT models (4-layer).
137
+
138
+ Pre-training graph embeddings. We also evaluate a fine-tuning strategy by pre-training the graph embedding and placement network and fine-tuning the network on the down stream tasks. The difference here compared to Section 4.3 is that we also include the target graphs in the pre-training dataset. When GDP-batch is used as a pre-training strategy, the graph embedding and placement network assimilate meaningful graph representations and placement policies from a wide set of graphs, thus can be used as a strong baseline network for fine-tuning on downstream tasks. We compare the generated placement run time and the placement search time, normalized to GDP-one. We find that fine-tuning further reduces the the placed graph run time by an average of $5 \%$ and placement search time by an average of $86 \%$ , compared to GDP-one.
139
+
140
+ ![](images/952a5f0142edf3158aea8b7c617b28fb0db5a0c93b43763249bcfb0b239a35b0.jpg)
141
+ Figure 3: Ablation Study on Attention and Superposition of the Placement Network.
142
+
143
+ ![](images/8f18a2f28c32a61bb76c1776235f135ec173371660b93fddcedc426ab84fd863.jpg)
144
+ Figure 4: Normalized run time (step time for the generated placement) and normalized training time (search time) for fine-tuning. Time is normalized to GDP-one.
145
+
146
+ # 5 CONCLUSION
147
+
148
+ In this paper, we present a generalized device placement strategy that uses a graph neural network and super-positioning to generalize to arbitrary and held out graphs. Through experimental evaluation over a wide set of representative graphs from different domains including computer vision, speech, and NLP, we demonstrated over 15 times faster convergence while achieving a $16 \%$ and $9 . 2 \%$ reductions in step time over human expert placement and HDP, respectively.
149
+
150
+ # ACKNOWLEDGMENTS
151
+
152
+ # 6 APPENDIX
153
+
154
+ # 6.1 PROXIMAL POLICY OPTIMIZATION
155
+
156
+ In device placement, the objective is to minimize the training step time of a given computational graph or a batch of dataflow graphs for a target system configuration (e.g. a 8-GPU cluster or a TPU pod), by placing operations onto different devices to enable model-level parallelism. This process corresponds to maximizing the expected performance in the MDP. For better sample efficiency, we adopted a Proximal Policy Optimization (PPO) (Schulman et al., 2017) algorithm. The objective is to maximize a surrogate objective:
157
+
158
+ $$
159
+ L _ { \pi } = E _ { a _ { [ 0 : n ] } \sim \pi } [ \frac { q \prime \left( a _ { n } | s _ { n } \right) } { q ( a _ { n } | s _ { n } ) } A _ { \pi } ( s _ { n } , a _ { n } ) ]
160
+ $$
161
+
162
+ $$
163
+ L _ { \pi } = \operatorname* { m a x } _ { \pi ^ { \prime } } \frac { 1 } { N } \sum _ { n = 0 , a _ { n } \sim \pi } ^ { N - 1 } [ \operatorname* { m i n } ( \frac { q \prime ( a _ { n } | s _ { n } ) } { q ( a _ { n } | s _ { n } ) } ( R - \overline { { R } } ) , c l i p ( \frac { q \prime ( a _ { n } | s _ { n } ) } { q ( a _ { n } | s _ { n } ) } , 1 - \epsilon , 1 + \epsilon ) ( R - \overline { { R } } ) ) ]
164
+ $$
165
+
166
+ Within a loop, GDP PPO continuously samples placements from the distribution and evaluates their training times in real systems. For a rollout of $K$ , we perform a minimatch of $m$ stochastic gradient ascent steps with respective to the objective of proximal policy optimization, which makes incremental policy improvements. The rollout steps $K$ and minibatch size $m$ are hyper parameters for PPO. We find a set of optimized hyper parameters and keep them fixed for all the experiments presented. As the rewards are generated on-the-fly based on real system measurements, we no longer need to re-evaluate the placement solutions in a separate phase.
167
+
168
+ # 6.2 HYPERPARAMETERS
169
+
170
+ In this section, we list out all the selected hyperparameters in our experiments for reproducibility in Table 3 and Table 4.
171
+
172
+ Table 3: Hyperparameters for Policy Network. gs layers: GraphSAGE layers, gs knn: GraphSAGE maximum neighbors, trf d model: Dimension of the TransformerXL model, trf n head: Number of attention heads, tr $f$ layers: Number of TransformerXL layers, trf d heads: Dimension of each attention head, tr $f$ d inner: Dimension of inner hidden size in positionwise feedforward.
173
+
174
+ <table><tr><td>Parameters</td><td>Value</td><td>Parameters</td><td>Value</td></tr><tr><td>gs_layers</td><td>4</td><td>gs_dim</td><td>128</td></tr><tr><td>gs_knn</td><td>5</td><td>trf_layers</td><td>2</td></tr><tr><td>trf_d_model</td><td>128</td><td>trf_n_head</td><td>5</td></tr><tr><td>trf_d_head</td><td>25</td><td>trf_d_inner</td><td>256</td></tr></table>
175
+
176
+ Table 4: Hyperparameters for PPO.
177
+
178
+ <table><tr><td>Parameters</td><td>Value</td><td>Parameters</td><td>Value</td></tr><tr><td>learing rate</td><td>0.5</td><td>num of rollouts</td><td>400</td></tr><tr><td>minibatches</td><td>40</td><td>epochs</td><td>5</td></tr><tr><td>epsilon</td><td>0.2</td><td>entropy</td><td>0.05</td></tr></table>
179
+
180
+ # 6.3 INPUT GRAPHS
181
+
182
+ We used a variety of widely used workloads from computer vision, speech, and NLP. In this section, we give a detailed explanation on the selected models and hyperparameters.
183
+
184
+ # 6.3.1 INCEPTION-V3
185
+
186
+ Inception-V3 (Szegedy et al., 2015) is a multi-branch convolutional network used for a variery of computer vision tasks, including classification, recognition, or generation. The network consists of blocks made of multiple branches of concolutional and pooling operations. Within a block, the branches of ops can be executed in parallel. However, the model is mostly sequential as the outputs of each block are concatenated together to form the input to the next block. We use a batch size of 64. The Tensorflow graph of this model contains 24,713 operations.
187
+
188
+ # 6.3.2 AMOEBANET
189
+
190
+ AmoebaNet (Real et al., 2018) is an automatically designed neural network that yields SoTA performance on ImageNet. Similar to Inception-V3, it contains Inception-like blocks called cells, which receives a direct input from the previous cell and a skip input from the cell before it. The network is made of redundant cells stacked together, therefore is more modular than Inception-V3. We use a batch size of 64. The Tensorflow graphs contains 9,430 operations.
191
+
192
+ # 6.3.3 RNNLM
193
+
194
+ Recurrent Neural Network Language Model (Zaremba et al., 2014; Jozefowicz et al., 2016) is made of many LSTM cells organized in a grid structure. The processing of each LSTM cell only depends on the results of 2 other cells (from the previous layer, and from the previous time step), which make the concurrent execution of many LSTM cells possible given enough hardware resources. We use batch size 64 and a hidden size of 2048. The corresponding TensorFlow graph contains 9,021 operations for a 2-layer model. The number of ops grow roughly proportional with the number of layers.
195
+
196
+ # 6.3.4 GNMT
197
+
198
+ Neural Machine Translation with attention mechanism (Bahdanau et al., 2015; Wu et al., 2016) has an architecture similar to that of RNNLM, but its many hidden states make it far more computationally expensive than RNNLM. To reduce the training time, prior work (Wu et al., 2016) propose placing each LSTM layer, as well as the attention and the softmax layer, on a separate device. This strategy demonstrates early success in human placement, we show that GDP can find significantly better placements. We use batch size 64. The original 2-layer encoder-decoder consisting of 28,044 operations. An extended 4-layer version consisting of 46,600 operations, An even larger 8-layer version consisting of 83,712 operations.
199
+
200
+ # 6.3.5 TRANSFORMER-XL
201
+
202
+ Transformer-XL (Dai et al., 2019) is an modified version of Transformer (Vaswani et al., 2017) that supports segement-level recurrence and a novel positional encoding scheme. This innovation enables learning dependency that is $80 \%$ longer than RNNs, and $450 \%$ longer than vanilla Transformers. We use a transformer-XL with batch size of 64, sequence length of 256, segment length of 64, model hidden dimension of 500 and feed forward hidden dimension of 1000, 10 heads, and head dimension of 50. The 2-layer Transformer-XL contains 2,618 operations. The number of ops grow roughly proportional with the number of layers.
203
+
204
+ # 6.3.6 WAVENET
205
+
206
+ WaveNet (van den Oord et al., 2016) is a generative model for speech synthesis. The model is fully probabilistic and autoregressive, with the predictive ditribution for each audio sample conditioned on all previous ones. Architecturally, WaveNet uses causal convolutions with dilations, to obtain a large receptive field. We use a WaveNet model with batch size 64 and a receptive field size of 2048 (9-layers per stack). An 5-stack WaveNet contains 4,374 operations and a 10-stack WaveNet contains 8,516 operations.
207
+
208
+ Table 5: Run time comparison on GDP batch training vs. the best of related methods (human expert, METIS, HDP, and GDP no batch training).
209
+
210
+ <table><tr><td>Batch Setting</td><td>Model</td><td>speed up (s)</td></tr><tr><td rowspan="6">Batch 2</td><td>Inception</td><td>0</td></tr><tr><td>AmoebaNet</td><td>-4.5%</td></tr><tr><td>2-layer RNNLM</td><td>0</td></tr><tr><td>2-layer GNMT</td><td>0</td></tr><tr><td>2-layer Transformer-XL</td><td>6.5%</td></tr><tr><td>2-stack 18-layer Wavenet</td><td>4%</td></tr><tr><td rowspan="6">Batch 3</td><td>2-layer RNNLM</td><td>0</td></tr><tr><td>4-layer RNNLM</td><td>0</td></tr><tr><td>8-layer RNNLM</td><td>4.5%</td></tr><tr><td>2-layer GNMT</td><td>0</td></tr><tr><td>4-layer GNMT</td><td></td></tr><tr><td>8-layer GNMT</td><td>0 8%</td></tr><tr><td>Batch 4</td><td>3x8-layer GNMT</td><td>5.1%</td></tr><tr><td>Batch 5</td><td>3x8-layer RNNLM</td><td>4.5%</td></tr></table>
211
+
212
+ # REFERENCES
213
+
214
+ Ravichandra Addanki, Shaileshh Bojja Venkatakrishnan, Shreyan Gupta, Hongzi Mao, and Mohammad Alizadeh. Placeto: Learning generalizable device placement algorithms for distributed machine learning. CoRR, abs/1906.08879, 2019. URL http://arxiv.org/abs/1906. 08879.
215
+
216
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR 2015. 2015. URL https://arxiv.org/abs/ 1409.0473.
217
+
218
+ Brian Cheung, Alex Terekhov, Yubei Chen, Pulkit Agrawal, and Bruno A. Olshausen. Superposition of many models into one. CoRR, abs/1902.05522, 2019. URL http://arxiv.org/abs/ 1902.05522.
219
+
220
+ Zihang Dai. Improving deep generative modeling with applications. 2019. https:// zihangdai.github.io/docs/proposal.pdf.
221
+
222
+ Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G. Carbonell, Quoc V. Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. ACL, 2019. URL http://arxiv.org/abs/1901.02860.
223
+
224
+ Yuanxiang Gao, Li Chen, and Baochun Li. Spotlight: Optimizing device placement for training deep neural networks. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 1676–1684, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http: //proceedings.mlr.press/v80/gao18a.html.
225
+
226
+ William L. Hamilton, Rex Ying, and Jure Leskovec. Inductive representation learning on large graphs. NIPS, 2017. URL http://arxiv.org/abs/1706.02216.
227
+
228
+ Joel Hestness, Sharan Narang, Newsha Ardalani, Gregory Diamos, Heewoo Jun, Hassan Kianinejad, Md. Mostofa Ali Patwary, Yang Yang, and Yanqi Zhou. Deep learning scaling is predictable, empirically. arXiv preprint arXiv:1712.00409, 2017.
229
+
230
+ Yanping Huang, Yonglong Cheng, Dehao Chen, HyoukJoong Lee, Jiquan Ngiam, Quoc V. Le, and Zhifeng Chen. Gpipe: Efficient training of giant neural networks using pipeline parallelism. CoRR, abs/1811.06965, 2018. URL http://arxiv.org/abs/1811.06965.
231
+
232
+ Zhihao Jia, Matei Zaharia, and Alex Aiken. Beyond data and model parallelism for deep neural networks. SysML, 2018. URL http://arxiv.org/abs/1807.05358.
233
+
234
+ Rafal Jozefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of language modeling. arXiv preprint arXiv:1602.02410, 2016.
235
+
236
+ George Karypis and Vipin Kumar. A fast and high quality multilevel scheme for partitioning irregular graphs. SIAM J. Sci. Comput., 20(1):359–392, December 1998. ISSN 1064-8275. doi: 10.1137/S1064827595287997. URL http://dx.doi.org/10.1137/ S1064827595287997.
237
+
238
+ Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens van der Maaten. Exploring the limits of weakly supervised pretraining. In Proceedings of the European Conference on Computer Vision (ECCV), 2018.
239
+
240
+ Azalia Mirhoseini, Hieu Pham, Quoc V. Le, Benoit Steiner, Rasmus Larsen, Yuefeng Zhou, Naveen Kumar, Mohammad Norouzi, Samy Bengio, and Jeff Dean. Device placement optimization with reinforcement learning. ICML, 2017. URL http://arxiv.org/abs/1706.04972.
241
+
242
+ Azalia Mirhoseini, Anna Goldie, Hieu Pham, Benoit Steiner, Quoc V. Le, and Jeff Dean. A hierarchical model for device placement. ICLR, 2018.
243
+
244
+ Boris N. Oreshkin, Pau Rodr´ıguez Lopez, and Alexandre Lacoste. TADAM: task dependent adaptive ´ metric for improved few-shot learning. CoRR, abs/1805.10123, 2018. URL http://arxiv. org/abs/1805.10123.
245
+
246
+ Aditya Paliwal, Felix Gimeno, Vinod Nair, Yujia Li, Miles Lubin, Pushmeet Kohli, and Oriol Vinyals. REGAL: transfer learning for fast optimization of computation graphs. KDD, 2019. URL http://arxiv.org/abs/1905.02494.
247
+
248
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners.
249
+
250
+ Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V. Le. Regularized evolution for image classifier architecture search. CoRR, abs/1802.01548, 2018. URL http://arxiv.org/abs/ 1802.01548.
251
+
252
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017. URL http://arxiv.org/abs/ 1707.06347.
253
+
254
+ Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. arXiv preprint arXiv:1701.06538, 2017.
255
+
256
+ Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. CoRR, abs/1409.3215, 2014. URL http://arxiv.org/abs/1409.3215.
257
+
258
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. CoRR, abs/1512.00567, 2015. URL http://arxiv.org/abs/1512.00567.
259
+
260
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, ¨ Nal Kalchbrenner, Andrew W. Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. CoRR, abs/1609.03499, 2016. URL http://arxiv.org/abs/1609.03499.
261
+
262
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 5998–6008. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/7181-attention-is-all-you-need.pdf.
263
+
264
+ 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.
265
+
266
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? ICLR, 2019. URL http://arxiv.org/abs/1810.00826.
267
+
268
+ Jiaxuan You, Bowen Liu, Rex Ying, Vijay S. Pande, and Jure Leskovec. Graph convolutional policy network for goal-directed molecular graph generation. CoRR, abs/1806.02473, 2018. URL http://arxiv.org/abs/1806.02473.
269
+
270
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. CoRR, abs/1409.2329, 2014. URL http://arxiv.org/abs/1409.2329.
md/train/SyQq185lg/SyQq185lg.md ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LATENT SEQUENCE DECOMPOSITIONS
2
+
3
+ William Chan∗ Carnegie Mellon University williamchan@cmu.edu
4
+
5
+ Yu Zhang∗
6
+ Massachusetts Institute of Technology
7
+ yzhang87@mit.edu
8
+
9
+ Quoc V. Le, Navdeep Jaitly Google Brain {qvl,ndjaitly}@google.com
10
+
11
+ # ABSTRACT
12
+
13
+ Sequence-to-sequence models rely on a fixed decomposition of the target sequences into a sequence of tokens that may be words, word-pieces or characters. The choice of these tokens and the decomposition of the target sequences into a sequence of tokens is often static, and independent of the input, output data domains. This can potentially lead to a sub-optimal choice of token dictionaries, as the decomposition is not informed by the particular problem being solved. In this paper we present Latent Sequence Decompositions (LSD), a framework in which the decomposition of sequences into constituent tokens is learnt during the training of the model. The decomposition depends both on the input sequence and on the output sequence. In LSD, during training, the model samples decompositions incrementally, from left to right by locally sampling between valid extensions. We experiment with the Wall Street Journal speech recognition task. Our LSD model achieves $12 . 9 \%$ WER compared to a character baseline of $1 4 . 8 \%$ WER. When combined with a convolutional network on the encoder, we achieve a WER of $9 . 6 \%$ .
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Sequence-to-sequence (seq2seq) models (Sutskever et al., 2014; Cho et al., 2014) with attention (Bahdanau et al., 2015) have been successfully applied to many applications including machine translation (Luong et al., 2015; Jean et al., 2015), parsing (Vinyals et al., 2015a), image captioning (Vinyals et al., 2015b; Xu et al., 2015) and Automatic Speech Recognition (ASR) (Chan et al., 2016; Bahdanau et al., 2016a).
18
+
19
+ Previous work has assumed a fixed deterministic decomposition for each output sequence. The output representation is usually a fixed sequence of words (Sutskever et al., 2014; Cho et al., 2014), phonemes (Chorowski et al., 2015), characters (Chan et al., 2016; Bahdanau et al., 2016a) or even a mixture of characters and words (Luong & Manning, 2016). However, in all these cases, the models are trained towards one fixed decomposition for each output sequence.
20
+
21
+ We argue against using fixed deterministic decompositions of a sequence that has been defined a priori. Word segmented models (Luong et al., 2015; Jean et al., 2015) often have to deal with large softmax sizes, rare words and Out-of-Vocabulary (OOV) words. Character models (Chan et al., 2016; Bahdanau et al., 2016a) overcome the OOV problem by modelling the smallest output unit, however this typically results in long decoder lengths and computationally expensive inference. And even with mixed (but fixed) character-word models (Luong & Manning, 2016), it is unclear whether such a predefined segmentation is optimal. In all these examples, the output decomposition is only a function of the output sequence. This may be acceptable for problems such as translations, but inappropriate for tasks such as speech recognition, where segmentation should also be informed by the characteristics of the inputs, such as audio.
22
+
23
+ We want our model to have the capacity and flexibility to learn a distribution of sequence decompositions. Additionally, the decomposition should be a sequence of variable length tokens as deemed most probable. For example, language may be more naturally represented as word pieces (Schuster & Nakajima, 2012) rather than individual characters. In many speech and language tasks, it is probably more efficient to model “qu” as one output unit rather than $\mathrm { ^ 6 q ^ { 9 } + \mathrm { ^ 6 u ^ { 9 } } }$ as separate output units (since in English, “q” is almost always followed by “u”). Word piece models also naturally solve rare word and OOV problems similar to character models.
24
+
25
+ The output sequence decomposition should be a function of both the input sequence and the output sequence (rather than output sequence alone). For example, in speech, the choice of emitting “ing” as one word piece or as separate tokens of “ $[ { } ^ { 5 } + { } ^ { 6 } { } ^ { 5 } + { } ^ { 6 } { } ^ { 5 }$ should be a function of the current output word as well as the audio signal (i.e., speaking style).
26
+
27
+ We present the Latent Sequence Decompositions (LSD) framework. LSD does not assume a fixed decomposition for an output sequence, but rather learns to decompose sequences as function of both the input and the output sequence. Each output sequence can be decomposed to a set of latent sequence decompositions using a dictionary of variable length output tokens. The LSD framework produces a distribution over the latent sequence decompositions and marginalizes over them during training. During test inference, we find the best decomposition and output sequence, by using beam search to find the most likely output sequence from the model.
28
+
29
+ # 2 LATENT SEQUENCE DECOMPOSITIONS
30
+
31
+ In this section, we describe LSD more formally. Let $\mathbf { x }$ be our input sequence, $\mathbf { y }$ be our output sequence and $\mathbf { z }$ be a latent sequence decomposition of $\mathbf { y }$ . The latent sequence decomposition $\mathbf { z }$ consists of a sequence of $z _ { i } \in { \mathcal { Z } }$ where $\mathcal { Z }$ is the constructed token space. Each token $z _ { i }$ need not be the same length, but rather in our framework, we expect the tokens to have different lengths. Specifically, ${ \mathcal { Z } } \subseteq \cup _ { i = 1 } ^ { n } { \mathcal { C } } ^ { i }$ where $\mathcal { C }$ is the set of singleton tokens and $n$ is the length of the largest output token. In ASR , $\mathcal { C }$ would typically be the set of English characters, while $\mathcal { Z }$ would be word pieces (i.e., $n$ -grams of characters).
32
+
33
+ To give a concrete example, consider a set of tokens {“a”, “b”, “c”, “at”, “ca”, “cat” $\}$ . With this set of tokens, the word “cat” may be represented as the sequence $\ " { } _ { \mathrm { c } } \cdot \ \mathrm { : }$ , “a”, “t”, or the sequence “ca”, “t”, or alternatively as the single token “cat”. Since the appropriate decomposition of the word “cat” is not known a priori, the decomposition itself is latent.
34
+
35
+ Note that the length $\left| \mathbf { z } _ { a } \right|$ of a decomposition ${ \bf z } _ { a }$ need not be the same as the length of the output sequence, $| \mathbf { y } |$ (for example “ca”, “t” has a length of 2, whereas the sequence is 3 characters long). Similarly, a different decomposition $\mathbf { z } _ { b }$ (for example the 3-gram token “cat”) of the same sequence may be of a different length (in this case 1).
36
+
37
+ Each decomposition, collapses to the target output sequence using a trivial collapsing function $\mathbf { y } =$ collapse $\mathbf { \tau } ( \mathbf { z } )$ . Clearly, the set of decompositions, $\{ \mathbf { z } : \mathrm { c o l l a p s e } ( \mathbf { z } ) = \mathbf { y } \}$ , of a sequence, $\mathbf { y }$ , using a non-trivial token set, $\mathcal { Z }$ , can be combinatorially large.
38
+
39
+ If there was a known, unique, correct segmentation $\mathbf { z } ^ { \ast }$ for a given pair, $\displaystyle ( \mathbf { x } , \mathbf { y } )$ , one could simply train the model to output the fixed deterministic decomposition $\mathbf { z } ^ { \ast }$ . However, in most problems, we do not know the best possible decomposition $\mathbf { z } ^ { \ast }$ ; indeed it may be possible that the output can be correctly decomposed into multiple alternative but valid segmentations. For example, in end-to-end ASR we typically use characters as the output unit of choice (Chan et al., 2016; Bahdanau et al., 2016a) but word pieces may be better units as they more closely align with the acoustic entities such as syllables. However, the most appropriate decomposition $\mathbf { z } ^ { \ast }$ for a given is $\displaystyle ( \mathbf { x } , \mathbf { y } )$ pair is often unknown. Given a particular y, the best $\mathbf { z } ^ { \ast }$ could even change depending on the input sequence $\mathbf { x }$ (i.e., speaking style).
40
+
41
+ In LSD, we want to learn a probabilistic segmentation mapping from $\textbf { x } \to \textbf { z } \to \textbf { y }$ . The model produces a distribution of decompositions, $\mathbf { z }$ , given an input sequence $\mathbf { x }$ , and the objective is to maximize the log-likelihood of the ground truth sequence y. We can accomplish this by factorizing and marginalizing over all possible $\mathbf { z }$ latent sequence decompositions under our model $p ( \mathbf { z } | \mathbf { x } ; \theta )$ with parameters $\theta$ :
42
+
43
+ $$
44
+ \begin{array} { l } { { \displaystyle \log p ( { \bf y } | { \bf x } ; \boldsymbol { \theta } ) = \log \sum _ { { \bf z } } p ( { \bf y } , { \bf z } | { \bf x } ; \boldsymbol { \theta } ) } \ ~ } \\ { { \displaystyle ~ = \log \sum _ { { \bf z } } p ( { \bf y } | { \bf z } , { \bf x } ) p ( { \bf z } | { \bf x } ; \boldsymbol { \theta } ) } \ ~ } \\ { { \displaystyle ~ = \log \sum _ { { \bf z } } p ( { \bf y } | { \bf z } ) p ( { \bf z } | { \bf x } ; \boldsymbol { \theta } ) } } \end{array}
45
+ $$
46
+
47
+ where $p ( \mathbf { y } | \mathbf { z } ) = \mathbb { 1 } ( \mathrm { c o l l a p s e } ( \mathbf { z } ) = \mathbf { y } )$ captures path decompositions $\mathbf { z }$ that collapses to y. Due to the exponential number of decompositions of $\mathbf { y }$ , exact inference and search is intractable for any nontrivial token set $\mathcal { Z }$ and sequence length $| \mathbf { y } |$ . We describe a beam search algorithm to do approximate inference decoding in Section 4.
48
+
49
+ Similarly, computing the exact gradient is intractable. However, we can derive a gradient estimator by differentiating w.r.t. to $\theta$ and taking its expectation:
50
+
51
+ $$
52
+ \begin{array} { l } { \displaystyle \frac { \partial } { \partial \theta } \log p ( \mathbf { y } | \mathbf { x } ; \theta ) = \frac { 1 } { p ( \mathbf { y } | \mathbf { x } ; \theta ) } \frac { \partial } { \partial \theta } \displaystyle \sum _ { z } p ( \mathbf { y } | \mathbf { x } , \mathbf { z } ) p ( \mathbf { z } | \mathbf { x } ; \theta ) } \\ { \displaystyle = \frac { 1 } { p ( \mathbf { y } | \mathbf { x } ; \theta ) } \sum _ { z } p ( \mathbf { y } | \mathbf { x } , \mathbf { z } ) \nabla _ { \theta } p ( \mathbf { z } | \mathbf { x } ; \theta ) } \\ { \displaystyle = \frac { 1 } { p ( \mathbf { y } | \mathbf { x } ; \theta ) } \sum _ { z } p ( \mathbf { y } | \mathbf { x } , \mathbf { z } ) p ( \mathbf { z } | \mathbf { x } ; \theta ) \nabla _ { \theta } \log p ( \mathbf { z } | \mathbf { x } ; \theta ) } \\ { \displaystyle = \mathbb { E } _ { \mathbf { z } \sim p ( \mathbf { z } | \mathbf { x } , \mathbf { y } ; \theta ) } \left[ \nabla _ { \theta } \log p ( \mathbf { z } | \mathbf { x } ; \theta ) \right] } \end{array}
53
+ $$
54
+
55
+ Equation 6 uses the identity $\nabla _ { \theta } f _ { \theta } ( x ) = f _ { \theta } ( x ) \nabla _ { \theta } \log f _ { \theta } ( x )$ assuming $f _ { \theta } ( x ) \ \ne \ 0 \ \forall \ x$ . Equation 7 gives us an unbiased estimator of our gradient. It tells us to sample some latent sequence decomposition $\mathbf { z } \sim p ( \mathbf { z } | \mathbf { y } , \mathbf { x } ; \theta )$ under our model’s posterior, where $\mathbf { z }$ is constraint to be a valid sequence that collapses to $\mathbf { y }$ , i.e. $\mathbf { z } \in \{ \mathbf { z } ^ { \prime } : \mathrm { c o l l a p s e } ( \mathbf { z } ^ { \prime } ) = \mathbf { y } \}$ . To train the model, we sample $\mathbf { z } \ { \overset { \cdot } { \sim } } \ p ( \mathbf { z } | \mathbf { y } , \mathbf { x } ; \theta )$ and compute the gradient of $\nabla _ { \boldsymbol { \theta } } \log p ( \mathbf { z } | \mathbf { x } ; \boldsymbol { \theta } )$ using backpropagation. However, sampling $\mathbf { z } \sim p ( \mathbf { z } | \mathbf { y } , \mathbf { x } ; \theta )$ is difficult. Doing this exactly is computationally expensive, because it would require sampling correctly from the posterior – it would be possible to do this using a particle filtering like algorithm, but would require a full forward pass through the output sequence to do this.
56
+
57
+ Instead, in our implementation we use a heuristic to sample $\mathbf { z } \sim p ( \mathbf { z } | \mathbf { y } , \mathbf { x } ; \theta )$ . At each output time step $t$ when producing tokens $z _ { 1 } , z _ { 2 } \cdots z _ { ( t - 1 ) }$ , we sample from $z _ { t } \sim p \left( z _ { t } | \mathbf x , \mathbf y , \mathbf z _ { < t } , \theta \right)$ in a left-toright fashion. In other words, we sample valid extensions at each time step $t$ . At the start of the training, this left-to-right sampling procedure is not a good approximation to the posterior, since the next step probabilities at a time step include probabilities of all future paths from that point.
58
+
59
+ For example, consider the case when the target word is “cat”, and the vocabulary includes all possible characters and the tokens “ca”, and “cat”. At time step 1, when the valid next step options are “c”, “ca”, “cat”, their relative probabilities reflect all possible sequences “c\*”, “ca\*”, “cat\*” respectively, that start from the first time step of the model. These sets of sequences include sequences other than the target sequence “cat”. Thus sampling from the distribution at step 1 is a biased procedure.
60
+
61
+ However, as training proceeds the model places more and more mass only on the correct hypotheses, and the relative probabilities that the model produces between valid extensions gets closer to the posterior. In practice, we find that the when the model is trained with this method, it quickly collapses to using single character targets, and never escapes from this local minima1. Thus, we follow an $\epsilon$ -greedy exploration strategy commonly found in reinforcement learning literature (Sutton & Barto, 1998) – we sample $z _ { t }$ from a mixture of a uniform distribution over valid next tokens and $p \left( z _ { t } | \mathbf { x } , \mathbf { y } , \mathbf { z } _ { < t } , \theta \right)$ . The relative probability of using a uniform distribution vs. $p \left( \cdot | \mathbf { x } , \mathbf { y } , \mathbf { z } _ { < t } , \theta \right)$ is varied over training. With this modification the model learns to use the longer n-grams of characters appropriately, as shown in later sections.
62
+
63
+ # 3 MODEL
64
+
65
+ In this work, we model the latent sequence decompositions $p ( \mathbf { z } | \mathbf { x } )$ with an attention-based seq2seq model (Bahdanau et al., 2015). Each output token $z _ { i }$ is modelled as a conditional distribution over all previously emitted tokens $\mathbf { z } _ { < i }$ and the input sequence $\mathbf { x }$ using the chain rule:
66
+
67
+ $$
68
+ p ( \mathbf { z } | \mathbf { x } ; \theta ) = \prod _ { i } p ( z _ { i } | \mathbf { x } , \mathbf { z } _ { < i } )
69
+ $$
70
+
71
+ The input sequence $\mathbf { x }$ is processed through an EncodeRNN network. The EncodeRNN function transforms the features $\mathbf { x }$ into some higher level representation $\mathbf { h }$ . In our experimental implementation EncodeRNN is a stacked Bidirectional LSTM (BLSTM) (Schuster & Paliwal, 1997; Graves et al., 2013) with hierarchical subsampling (Hihi & Bengio, 1996; Koutnik et al., 2014):
72
+
73
+ $$
74
+ \mathbf { h } = \mathrm { E n c o d e R N N } ( \mathbf { x } )
75
+ $$
76
+
77
+ The output sequence $\mathbf { z }$ is generated with an attention-based transducer (Bahdanau et al., 2015) one $z _ { i }$ token at a time:
78
+
79
+ $$
80
+ \begin{array} { c } { s _ { i } = \mathrm { D e c o d e R N N } ( [ z _ { i - 1 } , c _ { i - 1 } ] , s _ { i - 1 } ) } \\ { c _ { i } = \mathrm { A t t e n t i o n C o n t e x t } ( s _ { i } , \mathbf { h } ) } \\ { p ( z _ { i } | \mathbf { x } , \mathbf { z } _ { < i } ) = \mathrm { T o k e n D i s t r i b u t i o n } ( s _ { i } , c _ { i } ) } \end{array}
81
+ $$
82
+
83
+ The DecodeRNN produces a transducer state $s _ { i }$ as a function of the previously emitted token $z _ { i - 1 }$ , previous attention context $c _ { i - 1 }$ and previous transducer state $s _ { i - 1 }$ . In our implementation, DecodeRNN is a LSTM (Hochreiter & Schmidhuber, 1997) function without peephole connections.
84
+
85
+ The AttentionContext function generates $c _ { i }$ with a content-based MLP attention network (Bahdanau et al., 2015). Energies $e _ { i }$ are computed as a function of the encoder features $\mathbf { h }$ and current transducer state $s _ { i }$ . The energies are normalized into an attention distribution $\alpha _ { i }$ . The attention context $c _ { i }$ is created as a $\alpha _ { i }$ weighted linear sum over $\mathbf { h }$ :
86
+
87
+ $$
88
+ \begin{array} { l } { { \displaystyle e _ { i , j } = \langle v , \operatorname { t a n h } _ { { \bf ( \phi _ { i } , h _ { j } ) } } ) \rangle } } \\ { { \displaystyle \alpha _ { i , j } = \frac { \exp ( e _ { i , j } ) } { \sum _ { j ^ { \prime } } \exp ( e _ { i , j ^ { \prime } } ) } } } \\ { { \displaystyle c _ { i } = \sum _ { j } \alpha _ { i , j } h _ { j } } } \end{array}
89
+ $$
90
+
91
+ where $\phi$ is linear transform function. TokenDistribution is a MLP function with softmax outputs modelling the distribution $p ( z _ { i } | \mathbf { x } , \mathbf { z } _ { < i } )$ .
92
+
93
+ # 4 DECODING
94
+
95
+ During inference we want to find the most likely word sequence given the input acoustics:
96
+
97
+ $$
98
+ \hat { \mathbf { y } } = \arg \operatorname* { m a x } _ { \mathbf { y } } \sum _ { \mathbf { z } } \log p ( \mathbf { y } | \mathbf { z } ) p ( \mathbf { z } | \mathbf { x } )
99
+ $$
100
+
101
+ however this is obviously intractable for any non-trivial token space and sequence lengths. We simply approximate this by decoding for the best word piece sequence $\hat { \mathbf { z } }$ and then collapsing it to its corresponding word sequence $\hat { \mathbf { y } }$ :
102
+
103
+ $$
104
+ \begin{array} { r } { \hat { \mathbf { z } } = \underset { \mathbf { z } } { \arg \operatorname* { m a x } } \log p ( \mathbf { z } | \mathbf { x } ) } \\ { \hat { \mathbf { y } } = \mathrm { c o l l a p s e } ( \hat { \mathbf { z } } ) } \end{array}
105
+ $$
106
+
107
+ We approximate for the best $\hat { \mathbf { z } }$ sequence by doing a left-to-right beam search (Chan et al., 2016).
108
+
109
+ Table 1: Wall Street Journal test eval92 Word Error Rate (WER) varying the $n$ sized word piece vocabulary without any dictionary or language model. We compare Latent Sequence Decompositions (LSD) versus the Maximum Extension (MaxExt) decomposition. The LSD models all learn better decompositions compared to the baseline character model, while the MaxExt decomposition appears to be sub-optimal.
110
+
111
+ <table><tr><td>n</td><td>LSD WER MaxExtWER</td></tr><tr><td>Baseline</td><td>14.76</td></tr><tr><td>2</td><td>13.15 15.56</td></tr><tr><td>3</td><td>13.08 15.61</td></tr><tr><td>4</td><td>12.88 14.96</td></tr><tr><td>5</td><td>13.52 15.03</td></tr></table>
112
+
113
+ # 5 EXPERIMENTS
114
+
115
+ We experimented with the Wall Street Journal (WSJ) ASR task. We used the standard configuration of train si284 dataset for training, dev93 for validation and eval92 for test evaluation. Our input features were 80 dimensional filterbanks computed every $1 0 \mathrm { m s }$ with delta and delta-delta acceleration normalized with per speaker mean and variance as generated by Kaldi (Povey et al., 2011). The EncodeRNN function is a 3 layer BLSTM with 256 LSTM units per-direction (or 512 total) and $4 = 2 ^ { 2 }$ time factor reduction. The DecodeRNN is a 1 layer LSTM with 256 LSTM units. All the weight matrices were initialized with a uniform distribution $\mathcal { U } ( - 0 . 0 7 5 , 0 . 0 7 5 )$ and bias vectors to 0. Gradient norm clipping of 1 was used, gaussian weight noise $\mathcal { N } ( 0 , 0 . 0 7 5 )$ and L2 weight decay 1e−5 (Graves, 2011). We used ADAM with the default hyperparameters described in (Kingma & Ba, 2015), however we decayed the learning rate from $\mathrm { 1 e { - 3 } }$ to 1e−4. We used 8 GPU workers for asynchronous SGD under the TensorFlow framework (Abadi et al., 2015). We monitor the dev93 Word Error Rate (WER) until convergence and report the corresponding eval92 WER. The models took around 5 days to converge.
116
+
117
+ We created our token vocabulary $\mathcal { Z }$ by looking at the $n$ -gram character counts of the training dataset. We explored $n \in \{ 2 , 3 , 4 , 5 \}$ and took the top $\{ 2 5 6 , 5 1 2 , 1 0 2 4 \}$ tokens based on their count frequencies (since taking the full $n$ -cartesian exponent of the unigrams would result in an intractable number of tokens for $n > 2$ ). We found very minor differences in WER based on the vocabulary size, for our $n = \{ 2 , 3 \}$ word piece experiments we used a vocabulary size of 256 while our $n = \{ \bar { 4 } , 5 \}$ word piece experiments used a vocabulary size of 512. Additionally, we restrict $\langle { \mathrm { s p a c e } } \rangle$ to be a unigram token and not included in any other word pieces, this forces the decompositions to break on word boundaries.
118
+
119
+ Table 1 compares the effect of varying the $n$ sized word piece vocabulary. The Latent Sequence Decompositions (LSD) models were trained with the framework described in Section 2 and the (Maximum Extension) MaxExt decomposition is a fixed decomposition. MaxExt is generated in a left-to-right fashion, where at each step the longest word piece extension is selected from the vocabulary. The MaxExt decomposition is not the shortest $| \mathbf { z } |$ possible sequence, however it is a deterministic decomposition that can be easily generated in linear time on-the-fly. We decoded these models with simple n-best list beam search without any external dictionary or Language Model (LM).
120
+
121
+ The baseline model is simply the unigram or character model and achieves $1 4 . 7 6 \%$ WER. We find the LSD $n = 4$ word piece vocabulary model to perform the best at $1 2 . 8 8 \%$ WER or yielding a $12 . 7 \%$ relative improvement over the baseline character model. None of our MaxExt models beat our character model baseline, suggesting the maximum extension decomposition to be a poor decomposition choice. However, all our LSD models perform better than the baseline suggesting the LSD framework is able to learn a decomposition better than the baseline character decomposition.
122
+
123
+ We also look at the distribution of the characters covered based on the word piece lengths during inference across different $n$ sized word piece vocabulary used in training. We define the distribution of the characters covered as the percentage of characters covered by the set of word pieces with the same length across the test set, and we exclude hspacei in this statistic. Figure 1 plots the distribution of the $\{ 1 , 2 , 3 , 4 , 5 \}$ -ngram word pieces the model decides to use to decompose the sequences. When the model is trained to use the bigram word piece vocabulary, we found the model to prefer bigrams $5 5 \%$ of the characters emitted) over characters $45 \%$ of the characters emitted) in the LSD decomposition. This suggest that a character only vocabulary may not be the best vocabulary to learn from. Our best model, LSD with $n = 4$ word piece vocabulary, covered the word characters with $4 2 . 1 6 \%$ , $3 9 . 3 5 \%$ , $1 4 . 8 3 \%$ and $3 . 6 6 \%$ of the time using 1, 2, 3, 4 sized word pieces respectively. In the $n = 5$ word piece vocabulary model, the LSD model uses the $n = 5$ sized word pieces to cover approximately $2 \%$ of the characters. We suspect if we used a larger dataset, we could extend the vocabulary to cover even larger $n \geq 5$ .
124
+
125
+ ![](images/d315567119fae66b1dd54fcff128763633e5ba03ef1d73ab832cd94667c61e7c.jpg)
126
+ Distribution of the Characters covered by the Word Pieces for LSD and MaxExt Models
127
+ Figure 1: Distribution of the characters covered by the n-grams of the word piece models. We train Latent Sequence Decompositions (LSD) and Maximum Extension (MaxExt) models with $n \in$ $\{ 2 , 3 , 4 , 5 \}$ sized word piece vocabulary and measure the distribution of the characters covered by the word pieces. The bars with the solid fill represents the LSD models, and the bars with the star hatch fill represents the MaxExt models. Both the LSD and MaxExt models prefer to use $n \geq 2$ sized word pieces to cover the majority of the characters. The MaxExt models prefers longer word pieces to cover characters compared to the LSD models.
128
+
129
+ The MaxExt model were trained to greedily emit the longest possible word piece, consequently this prior meant the model will prefer to emit long word pieces over characters. While this decomposition results in the shorter $| \mathbf { z } |$ length, the WER is slightly worse than the character baseline. This suggest the much shorter decompositions generated by the MaxExt prior may not be best decomposition. This falls onto the principle that the best $\mathbf { z } ^ { \ast }$ decomposition is not only a function of $\mathbf { y } ^ { * }$ but as a function of $\left( \mathbf { x } , \mathbf { y } ^ { * } \right)$ . In the case of ASR, the segmentation is a function of the acoustics as well as the text.
130
+
131
+ Table 2 compares our WSJ results with other published end-to-end models. The best CTC model achieved $2 7 . 3 \%$ WER with REINFORCE optimization on WER (Graves & Jaitly, 2014). The previously best reported basic seq2seq model on WSJ WER achieved $1 8 . 0 \%$ WER (Bahdanau et al., 2016b) with Task Loss Estimation (TLE). Our baseline, also a seq2seq model, achieved $1 4 . 8 \%$ WER. Main differences between our models is that we did not use convolutional locational-based priors and we used weight noise during training. The deep CNN model with residual connections, batch normalization and convolutions achieved a WER of $1 1 . 8 \%$ (Zhang et al., 2017) 2.
132
+
133
+ Table 2: Wall Street Journal test eval92 Word Error Rate (WER) results across Connectionist Temporal Classification (CTC) and Sequence-to-sequence (seq2seq) models. The Latent Sequence Decomposition (LSD) models use a $n = 4$ word piece vocabulary (LSD4). The Convolutional Neural Network (CNN) model is with deep residual connections, batch normalization and convolutions. The best end-to-end model is $\mathrm { s e q 2 s e q + L S D + C N N }$ at $9 . 6 \%$ WER.
134
+
135
+ <table><tr><td>Model</td><td>WER</td></tr><tr><td>Graves &amp; Jaitly (2014) CTC</td><td>30.1</td></tr><tr><td>CTC + WER</td><td>27.3</td></tr><tr><td>Hannun et al. ( (2014) CTC</td><td>35.8</td></tr><tr><td>Bahdanau et al. (2016a) seq2seq Bahdanau et al. (2016b)</td><td>18.6</td></tr><tr><td>seq2seq + TLE Zhang et al. (2017)</td><td>18.0</td></tr><tr><td>seq2seq + CNN 2</td><td>11.8</td></tr><tr><td>Our Work</td><td></td></tr><tr><td>seq2seq</td><td>14.8</td></tr><tr><td>seq2seq + LSD4 seq2seq + LSD4 + CNN</td><td>12.9 9.6</td></tr></table>
136
+
137
+ Our LSD model using a $n = 4$ word piece vocabulary achieves a WER of $12 . 9 \%$ or $12 . 7 \%$ relatively better over the baseline seq2seq model. If we combine our LSD model with the CNN (Zhang et al., 2017) model, we achieve a combined WER of $9 . 6 \%$ WER or $3 5 . 1 \%$ relatively better over the baseline seq2seq model. These numbers are all reported without the use of any language model.
138
+
139
+ Please see Appendix A for the decompositions generated by our model. The LSD model learns multiple word piece decompositions for the same word sequence.
140
+
141
+ # 6 RELATED WORK
142
+
143
+ Singh et al. (2002); McGraw et al. (2013); Lu et al. (2013) built probabilistic pronunciation models for Hidden Markov Model (HMM) based systems. However, such models are still constraint to the conditional independence and Markovian assumptions of HMM-based systems.
144
+
145
+ Connectionist Temporal Classification (CTC) (Graves et al., 2006; Graves & Jaitly, 2014) based models assume conditional independence, and can rely on dynamic programming for exact inference. Similarly, Ling et al. (2016) use latent codes to generate text, and also assume conditional independence and leverage on dynamic programming for exact maximum likelihood gradients. Such models can not learn the output language if the language distribution is multimodal. Our seq2seq models makes no such Markovian assumptions and can learn multimodal output distributions. Collobert et al. (2016) and Zweig et al. (2016) developed extensions of CTC where they used some word pieces. However, the word pieces are only used in repeated characters and the decompositions are fixed.
146
+
147
+ Word piece models with seq2seq have also been recently used in machine translation. Sennrich et al. (2016) used word pieces in rare words, while $\mathrm { W u }$ et al. (2016) used word pieces for all the words, however the decomposition is fixed and defined by heuristics or another model. The decompositions in these models are also only a function of the output sequence, while in LSD the decomposition is a function of both the input and output sequence. The LSD framework allows us to learn a distribution of decompositions rather than learning just one decomposition defined by a priori.
148
+
149
+ Vinyals et al. (2016) used seq2seq to outputs sets, the output sequence is unordered and used fixed length output units; in our decompositions we maintain ordering use variable lengthed output units. Reinforcement learning (i.e., REINFORCE and other task loss estimators) (Sutton & Barto, 1998; Graves & Jaitly, 2014; Ranzato et al., 2016) learn different output sequences can yield different task losses. However, these methods don’t directly learn different decompositions of the same sequence. Future work should incorporate LSD with task loss optimization methods.
150
+
151
+ # 7 CONCLUSION
152
+
153
+ We presented the Latent Sequence Decompositions (LSD) framework. LSD allows us to learn decompositions of sequences that are a function of both the input and output sequence. We presented a biased training algorithm based on sampling valid extensions with an $\epsilon$ -greedy strategy, and an approximate decoding algorithm. On the Wall Street Journal speech recognition task, the sequenceto-sequence character model baseline achieves $1 4 . 8 \%$ WER while the LSD model achieves $1 2 . 9 \%$ . Using a a deep convolutional neural network on the encoder with LSD, we achieve $9 . 6 \%$ WER.
154
+
155
+ # ACKNOWLEDGMENTS
156
+
157
+ We thank Ashish Agarwal, Philip Bachman, Dzmitry Bahdanau, Eugene Brevdo, Jan Chorowski, Jeff Dean, Chris Dyer, Gilbert Leung, Mohammad Norouzi, Noam Shazeer, Xin Pan, Luke Vilnis, Oriol Vinyals and the Google Brain team for many insightful discussions and technical assistance.
158
+
159
+ # REFERENCES
160
+
161
+ Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mané, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viégas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/. Software available from tensorflow.org.
162
+
163
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural Machine Translation by Jointly Learning to Align and Translate. In International Conference on Learning Representations, 2015.
164
+
165
+ Dzmitry Bahdanau, Jan Chorowski, Dmitriy Serdyuk, Philemon Brakel, and Yoshua Bengio. Endto-end Attention-based Large Vocabulary Speech Recognition. In IEEE International Conference on Acoustics, Speech, and Signal Processing, 2016a.
166
+
167
+ Dzmitry Bahdanau, Dmitriy Serdyuk, Philemon Brakel, Nan Rosemary Ke, Jan Chorowski, Aaron Courville, and Yoshua Bengio. Task Loss Estimation for Sequence Prediction. In International Conference on Learning Representations Workshop, 2016b.
168
+
169
+ William Chan, Navdeep Jaitly, Quoc Le, and Oriol Vinyals. Listen, Attend and Spell: A Neural Network for Large Vocabulary Conversational Speech Recognition. In IEEE International Conference on Acoustics, Speech, and Signal Processing, 2016.
170
+
171
+ Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwen, and Yoshua Bengio. Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation. In Conference on Empirical Methods in Natural Language Processing, 2014.
172
+
173
+ Jan Chorowski, Dzmitry Bahdanau, Dmitriy Serdyuk, Kyunghyun Cho, and Yoshua Bengio. Attention-Based Models for Speech Recognition. In Neural Information Processing Systems, 2015.
174
+
175
+ Ronan Collobert, Christian Puhrsch, and Gabriel Synnaeve. Wav2Letter: an End-to-End ConvNetbased Speech Recognition System. In arXiv:1609.03193, 2016.
176
+
177
+ Alex Graves. Practical Variational Inference for Neural Networks. In Neural Information Processing Systems, 2011.
178
+
179
+ Alex Graves and Navdeep Jaitly. Towards End-to-End Speech Recognition with Recurrent Neural Networks. In International Conference on Machine Learning, 2014.
180
+
181
+ Alex Graves, Santiago Fernandez, Faustino Gomez, and Jurgen Schmiduber. Connectionist Temporal Classification: Labelling Unsegmented Sequence Data with Recurrent Neural Networks. In International Conference on Machine Learning, 2006.
182
+
183
+ Alex Graves, Navdeep Jaitly, and Abdel-rahman Mohamed. Hybrid Speech Recognition with Bidirectional LSTM. In Automatic Speech Recognition and Understanding Workshop, 2013.
184
+
185
+ Awni Hannun, Andrew Maas, Daniel Jurafsky, and Andrew Ng. First-Pass Large Vocabulary Continuous Speech Recognition using Bi-Directional Recurrent DNNs. In arXiv:1408.2873, 2014.
186
+
187
+ Salah Hihi and Yoshua Bengio. Hierarchical Recurrent Neural Networks for Long-Term Dependencies. In Neural Information Processing Systems, 1996.
188
+
189
+ Sepp Hochreiter and Jurgen Schmidhuber. Long Short-Term Memory. Neural Computation, 9(8): 1735–1780, November 1997.
190
+
191
+ Sebastien Jean, Kyunghyun Cho, Roland Memisevic, and Yoshua Bengio. On Using Very Large Target Vocabulary for Neural Machine Translation. In Association for Computational Linguistics, 2015.
192
+
193
+ Diederik Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. In International Conference on Learning Representations, 2015.
194
+
195
+ Jan Koutnik, Klaus Greff, Faustino Gomez, and Jurgen Schmidhuber. A Clockwork RNN. In International Conference on Machine Learning, 2014.
196
+
197
+ Wang Ling, Edward Grefenstette, Karl Moritz Hermann, Tomas Kocisky, Andrew Senior, FUmin Wang, and Phil Blunsom. Latent Predictor Networks for Code Generation. In Association for Computational Linguistics, 2016.
198
+
199
+ Liang Lu, Arnab Ghoshal, and Steve Renals. Acoustic data-driven pronunciation lexicon for large vocabulary speech recognition. In Automatic Speech Recognition and Understanding Workshop, 2013.
200
+
201
+ Minh-Thang Luong and Christopher Manning. Achieving Open Vocabulary Neural Machine Translation with Hybrid Word-Character Models. In Association for Computational Linguistics, 2016.
202
+
203
+ Minh-Thang Luong, Ilya Sutskever, Quoc V. Le, Oriol Vinyals, and Wojciech Zaremba. Addressing the Rare Word Problem in Neural Machine Translation. In Association for Computational Linguistics, 2015.
204
+
205
+ Ian McGraw, Ibrahim Badr, and James Glass. Learning Lexicons From Speech Using a Pronunciation Mixture Model. IEEE Transactions on Audio, Speech, and Language Processing, 21(2), 2013.
206
+
207
+ Daniel Povey, Arnab Ghoshal, Gilles Boulianne, Lukas Burget, Ondrej Glembek, Nagendra Goel, Mirko Hannenmann, Petr Motlicek, Yanmin Qian, Petr Schwarz, Jan Silovsky, Georg Stemmer, and Karel Vesely. The Kaldi Speech Recognition Toolkit. In Automatic Speech Recognition and Understanding Workshop, 2011.
208
+
209
+ Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence Level Training with Recurrent Neural Networks. In International Conference on Learning Representations, 2016.
210
+
211
+ Mike Schuster and Kaisuke Nakajima. Japanese and Korean Voice Search. In IEEE International Conference on Acoustics, Speech and Signal Processing, 2012.
212
+
213
+ Mike Schuster and Kuldip Paliwal. Bidirectional Recurrent Neural Networks. IEEE Transactions on Signal Processing, 45(11), 1997.
214
+
215
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural Machine Translation of Rare Words with Subword Units. In Association for Computational Linguistics, 2016.
216
+
217
+ Rita Singh, Bhiksha Raj, and Richard Stern. Automatic generation of subword units for speech recognition systems. IEEE Transactions on Speech and Audio Processing, 10(2), 2002.
218
+
219
+ Ilya Sutskever, Oriol Vinyals, and Quoc Le. Sequence to Sequence Learning with Neural Networks. In Neural Information Processing Systems, 2014.
220
+
221
+ Richard Sutton and Andrew Barto. Reinforcement Learning: An Introduction. MIT Press, 1998.
222
+
223
+ Oriol Vinyals, Lukasz Kaiser, Terry Koo, Slav Petrov, Ilya Sutskever, and Geoffrey E. Hinton. Grammar as a foreign language. In Neural Information Processing Systems, 2015a.
224
+
225
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and Tell: A Neural Image Caption Generator. In IEEE Conference on Computer Vision and Pattern Recognition, 2015b.
226
+
227
+ Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order Matters: Sequence to sequence for sets. In International Conference on Learning Representations, 2016.
228
+
229
+ 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. In arXiv:1609.08144, 2016.
230
+
231
+ Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhutdinov, Richard Zemel, and Yoshua Bengio. Show, Attend and Tell: Neural Image Caption Generation with Visual Attention. In International Conference on Machine Learning, 2015.
232
+
233
+ Yu Zhang, William Chan, and Navdeep Jaitly. Very deep convolutional networks for end-to-end speech recognition. In IEEE International Conference on Acoustics, Speech and Signal Processing, 2017.
234
+
235
+ Geoffrey Zweig, Chengzhu Yu, Jasha Droppo, and Andreas Stolcke. Advances in All-Neural Speech Recognition. In arXiv:1609.05935, 2016.
236
+
237
+ # A LEARNING THE DECOMPOSITIONS
238
+
239
+ We give the top 8 hypothesis generated by a baseline seq2seq character model, a Latent Sequence Decompositions (LSD) word piece model and a Maximum Extension (MaxExt) word piece model. We note that “shamrock’s” is an out-of-vocabulary word while “shamrock” is in-vocabulary. The ground truth is “shamrock’s pretax profit from the sale was one hundred twenty five million dollars a spokeswoman said”. Note how the LSD model generates multiple decompostions for the same word sequence, this does not happen with the MaxExt model.
md/train/SyZI0GWCZ/SyZI0GWCZ.md ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DECISION-BASED ADVERSARIAL ATTACKS: RELIABLE ATTACKS AGAINST BLACK-BOX MACHINE LEARNING MODELS
2
+
3
+ Wieland Brendel∗, Jonas Rauber∗ & Matthias Bethge Werner Reichardt Centre for Integrative Neuroscience, Eberhard Karls University Tubingen, Germany ¨ {wieland,jonas,matthias}@bethgelab.org
4
+
5
+ # ABSTRACT
6
+
7
+ Many machine learning algorithms are vulnerable to almost imperceptible perturbations of their inputs. So far it was unclear how much risk adversarial perturbations carry for the safety of real-world machine learning applications because most methods used to generate such perturbations rely either on detailed model information (gradient-based attacks) or on confidence scores such as class probabilities (score-based attacks), neither of which are available in most real-world scenarios. In many such cases one currently needs to retreat to transfer-based attacks which rely on cumbersome substitute models, need access to the training data and can be defended against. Here we emphasise the importance of attacks which solely rely on the final model decision. Such decision-based attacks are (1) applicable to real-world black-box models such as autonomous cars, (2) need less knowledge and are easier to apply than transfer-based attacks and (3) are more robust to simple defences than gradient- or score-based attacks. Previous attacks in this category were limited to simple models or simple datasets. Here we introduce the Boundary Attack, a decision-based attack that starts from a large adversarial perturbation and then seeks to reduce the perturbation while staying adversarial. The attack is conceptually simple, requires close to no hyperparameter tuning, does not rely on substitute models and is competitive with the best gradient-based attacks in standard computer vision tasks like ImageNet. We apply the attack on two black-box algorithms from Clarifai.com. The Boundary Attack in particular and the class of decision-based attacks in general open new avenues to study the robustness of machine learning models and raise new questions regarding the safety of deployed machine learning systems. An implementation of the attack is available as part of Foolbox (https://github.com/bethgelab/foolbox).
8
+
9
+ ![](images/29bebf96fcff48a12bde8b3b7384b02342998228447068b194f990d2e47a7930.jpg)
10
+ Figure 1: (Left) Taxonomy of adversarial attack methods. The Boundary Attack is applicable to realworld ML algorithms because it only needs access to the final decision of a model (e.g. class-label or transcribed sentence) and does not rely on model information like the gradient or the confidence scores. (Right) Application to the Clarifai Brand Recognition Model.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Many high-performance machine learning algorithms used in computer vision, speech recognition and other areas are susceptible to minimal changes of their inputs (Szegedy et al., 2013). As a concrete example, a modern deep neural network like VGG-19 trained on object recognition might perfectly recognize the main object in an image as a tiger cat, but if the pixel values are only slightly perturbed in a specific way then the prediction of the very same network is drastically altered (e.g. to bus). These so-called adversarial perturbations are ubiquitous in many machine learning models and are often imperceptible to humans. Algorithms that seek to find such adversarial perturbations are generally denoted as adversarial attacks.
15
+
16
+ Adversarial perturbations have drawn interest from two different sides. On the one side, they are worrisome for the integrity and security of deployed machine learning algorithms such as autonomous cars or face recognition systems. Minimal perturbations on street signs (e.g. turning a stop-sign into a $2 0 0 \mathrm { k m / h }$ speed limit) or street lights (e.g. turning a red into a green light) can have severe consequences. On the other hand, adversarial perturbations provide an exciting spotlight on the gap between the sensory information processing in humans and machines and thus provide guidance towards more robust, human-like architectures.
17
+
18
+ Adversarial attacks can be roughly divided into three categories: gradient-based, score-based and transfer-based attacks (cp. Figure 1). Gradient-based and score-based attacks are often denoted as white-box and oracle attacks respectively, but we try to be as explicit as possible as to what information is being used in each category1. A severe problem affecting attacks in all of these categories is that they are surprisingly straight-forward to defend against:
19
+
20
+ • Gradient-based attacks. Most existing attacks rely on detailed model information including the gradient of the loss w.r.t. the input. Examples are the Fast-Gradient Sign Method (FGSM), the Basic Iterative Method (BIM) (Kurakin et al., 2016), DeepFool (MoosaviDezfooli et al., 2015), the Jacobian-based Saliency Map Attack (JSMA) (Papernot et al., 2015), Houdini (Cisse et al., 2017) and the Carlini & Wagner attack (Carlini & Wagner, 2016a).
21
+
22
+ Defence: A simple way to defend against gradient-based attacks is to mask the gradients, for example by adding non-differentiable elements either implicitly through means like defensive distillation (Papernot et al., 2016) or saturated non-linearities (Nayebi & Ganguli, 2017), or explicitly through means like non-differentiable classifiers (Lu et al., 2017).
23
+
24
+ • Score-based attacks. A few attacks are more agnostic and only rely on the predicted scores (e.g. class probabilities or logits) of the model. On a conceptual level these attacks use the predictions to numerically estimate the gradient. This includes black-box variants of JSMA (Narodytska & Kasiviswanathan, 2016) and of the Carlini & Wagner attack (Chen et al., 2017) as well as generator networks that predict adversarials (Hayes & Danezis, 2017).
25
+
26
+ Defence: It is straight-forward to severely impede the numerical gradient estimate by adding stochastic elements like dropout into the model. Also, many robust training methods introduce a sharp-edged plateau around samples (Tramer et al., 2017) which not only masks gradients themselves but also their numerical estimate.
27
+
28
+ • Transfer-based attacks. Transfer-based attacks do not rely on model information but need information about the training data. This data is used to train a fully observable substitute model from which adversarial perturbations can be synthesized (Papernot et al., 2017a). They rely on the empirical observation that adversarial examples often transfer between models. If adversarial examples are created on an ensemble of substitute models the success rate on the attacked model can reach up to $100 \%$ in certain scenarios (Liu et al., 2016).
29
+
30
+ Defence: A recent defence method against transfer attacks (Tramer et al., 2017), which is based on robust training on a dataset augmented by adversarial examples from an ensemble of substitute models, has proven highly successful against basically all attacks in the 2017 Kaggle Competition on Adversarial Attacks2.
31
+
32
+ The fact that many attacks can be easily averted makes it often extremely difficult to assess whether a model is truly robust or whether the attacks are just too weak, which has lead to premature claims of robustness for DNNs (Carlini & Wagner, 2016b; Brendel & Bethge, 2017).
33
+
34
+ This motivates us to focus on a category of adversarial attacks that has so far received fairly little attention:
35
+
36
+ • Decision-based attacks. Direct attacks that solely rely on the final decision of the model (such as the top-1 class label or the transcribed sentence).
37
+
38
+ The delineation of this category is justified for the following reasons: First, compared to score-based attacks decision-based attacks are much more relevant in real-world machine learning applications where confidence scores or logits are rarely accessible. At the same time decision-based attacks have the potential to be much more robust to standard defences like gradient masking, intrinsic stochasticity or robust training than attacks from the other categories. Finally, compared to transferbased attacks they need much less information about the model (neither architecture nor training data) and are much simpler to apply.
39
+
40
+ There currently exists no effective decision-based attack that scales to natural datasets such as ImageNet and is applicable to deep neural networks (DNNs). The most relevant prior work is a variant of transfer attacks in which the training set needed to learn the substitute model is replaced by a synthetic dataset (Papernot et al., 2017b). This synthetic dataset is generated by the adversary alongside the training of the substitute; the labels for each synthetic sample are drawn from the black-box model. While this approach works well on datasets for which the intra-class variability is low (such as MNIST) it has yet to be shown that it scales to more complex natural datasets such as CIFAR or ImageNet. Other decision-based attacks are specific to linear or convex-inducing classifiers (Dalvi et al., 2004; Lowd & Meek, 2005; Nelson et al., 2012) and are not applicable to other machine learning models. The work by (Biggio et al., 2013) basically stands between transfer attacks and decision-based attacks in that the substitute model is trained on a dataset for which the labels have been observed from the black-box model. This attack still requires knowledge about the data distribution on which the black-box models was trained on and so we don’t consider it a pure decision-based attack. Finally, some naive attacks such as a line-search along a random direction away from the original sample can qualify as decision-based attacks but they induce large and very visible perturbations that are orders of magnitude larger than typical gradient-based, score-based or transfer-based attacks.
41
+
42
+ Throughout the paper we focus on the threat scenario in which the adversary aims to change the decision of a model (either targeted or untargeted) for a particular input sample by inducing a minimal perturbation to the sample. The adversary can observe the final decision of the model for arbitrary inputs and it knows at least one perturbation, however large, for which the perturbed sample is adversarial.
43
+
44
+ The contributions of this paper are as follows:
45
+
46
+ • We emphasise decision-based attacks as an important category of adversarial attacks that are highly relevant for real-world applications and important to gauge model robustness. We introduce the first effective decision-based attack that scales to complex machine learning models and natural datasets. The Boundary Attack is (1) conceptually surprisingly simple, (2) extremely flexible, (3) requires little hyperparameter tuning and (4) is competitive with the best gradient-based attacks in both targeted and untargeted computer vision scenarios.
47
+ We show that the Boundary Attack is able to break previously suggested defence mechanisms like defensive distillation. We demonstrate the practical applicability of the Boundary Attack on two black-box machine learning models for brand and celebrity recognition available on Clarifai.com.
48
+
49
+ # 1.1 NOTATION
50
+
51
+ Throughout the paper we use the following notation: $^ o$ refers to the original input (e.g. an image), $\begin{array} { r } { y = \bar { F } ( o ) } \end{array}$ refers to the full prediction of the model $F ( \cdot )$ (e.g. logits or probabilities), $y _ { m a x }$ is the
52
+
53
+ predicted label (e.g. class-label). Similarly, $\tilde { o }$ refers to the adversarially perturbed image, $\tilde { o } ^ { k }$ refers to the perturbed image at the $k$ -th step of an attack algorithm. Vectors are denoted in bold.
54
+
55
+ # 2 BOUNDARY ATTACK
56
+
57
+ The basic intuition behind the boundary attack algorithm is depicted in Figure 2: the algorithm is initialized from a point that is already adversarial and then performs a random walk along the boundary between the adversarial and the non-adversarial region such that (1) it stays in the adversarial region and (2) the distance towards the target image is reduced. In other words we perform rejection sampling with a suitable proposal distribution $\mathcal { P }$ to find progressively smaller adversarial perturbations according to a given adversarial criterion $c ( . )$ . The basic logic of the algorithm is described in Algorithm 1, each individual building block is detailed in the next subsections.
58
+
59
+ Data: original image o, adversarial criterion $c ( . )$ , decision of model $d ( . )$
60
+ Result: adversarial example $\tilde { o }$ such that the distance $d ( \pmb { o } , \tilde { \pmb { o } } ) = \lVert \pmb { o } - \tilde { \pmb { o } } \rVert _ { 2 } ^ { 2 }$ is minimized
61
+ initialization: $k = 0$ , $\tilde { \sigma } ^ { 0 } \sim \mathcal { U } ( 0 , 1 )$ s.t. $\tilde { \bullet } ^ { 0 }$ is adversarial;
62
+ while $k <$ maximum number of steps do draw random perturbation from proposal distribution $\eta _ { k } \sim \mathcal { P } ( \tilde { o } ^ { k - 1 } )$ ; if $\tilde { o } ^ { k - 1 } + \eta _ { k }$ is adversarial then set $\tilde { \pmb { o } } ^ { k } = \tilde { \pmb { o } } ^ { k - 1 } + \eta _ { k }$ ; else set $\tilde { o } ^ { k } = \tilde { o } ^ { k - 1 }$ ; end $k = k + 1$
63
+ end
64
+
65
+ Algorithm 1: Minimal version of the Boundary Attack.
66
+
67
+ # 2.1 INITIALISATION
68
+
69
+ The Boundary Attack needs to be initialized with a sample that is already adversarial3. In an untargeted scenario we simply sample from a maximum entropy distribution given the valid domain of the input. In the computer vision applications below, where the input is constrained to a range of [0, 255] per pixel, we sample each pixel in the initial image $\mathbf { \tilde { o } ^ { 0 } }$ from a uniform distribution $\mathcal { U } ( 0 , \bar { 2 } 5 5 )$ . We reject samples that are not adversarial. In a targeted scenario we start from any sample that is classified by the model as being from the target class.
70
+
71
+ # 2.2 PROPOSAL DISTRIBUTION
72
+
73
+ The efficiency of the algorithm crucially depends on the proposal distribution $\mathcal { P }$ , i.e. which random directions are explored in each step of the algorithm. The optimal proposal distribution will generally depend on the domain and / or model to be attacked, but for all vision-related problems tested here a very simple proposal distribution worked surprisingly well. The basic idea behind this proposal distribution is as follows: in the $k$ -th step we want to draw perturbations $\eta ^ { k }$ from a maximum entropy distribution subject to the following constraints:
74
+
75
+ 1. The perturbed sample lies within the input domain,
76
+
77
+ $$
78
+ \tilde { o } _ { i } ^ { k - 1 } + \eta _ { i } ^ { k } \in [ 0 , 2 5 5 ] .
79
+ $$
80
+
81
+ 2. The perturbation has a relative size of $\delta$ ,
82
+
83
+ $$
84
+ \left\| \pmb { \eta } ^ { k } \right\| _ { 2 } = \delta \cdot d ( \mathbf { o } , \tilde { \mathbf { o } } ^ { \mathbf { k } - \mathbf { 1 } } ) .
85
+ $$
86
+
87
+ 3. The perturbation reduces the distance of the perturbed image towards the original input by a relative amount $\epsilon$ ,
88
+
89
+ $$
90
+ d ( { \bf o } , \tilde { \bf o } ^ { { \bf k } - 1 } ) - d ( { \bf o } , \tilde { \bf o } ^ { { \bf k } - 1 } + \eta ^ { k } ) = \epsilon \cdot d ( { \bf o } , \tilde { \bf o } ^ { { \bf k } - 1 } ) .
91
+ $$
92
+
93
+ ![](images/c9a81d4b166c0bc0a33a374cca7d988a2eea34ac136d9734d6e84454672850a0.jpg)
94
+ Figure 2: (Left) In essence the Boundary Attack performs rejection sampling along the boundary between adversarial and non-adversarial images. (Center) In each step we draw a new random direction by (#1) drawing from an iid Gaussian and projecting on a sphere, and by (#2) making a small move towards the target image. (Right) The two step-sizes (orthogonal and towards the original input) are dynamically adjusted according to the local geometry of the boundary.
95
+
96
+ In practice it is difficult to sample from this distribution, and so we resort to a simpler heuristic: first, we sample from an iid Gaussian distribution $\eta _ { i } ^ { k } \sim \mathcal { N } ( 0 , 1 )$ and then rescale and clip the sample such that (1) and (2) hold. In a second step we project $\eta ^ { k }$ onto a sphere around the original image $^ o$ such that $d ( o , \tilde { o } ^ { k - 1 } + \eta ^ { k } ) = d ( o , \tilde { o } ^ { k - 1 } )$ and (1) hold. We denote this as the orthogonal perturbation and use it later for hyperparameter tuning. In the last step we make a small movement towards the original image such that (1) and (3) hold. For high-dimensional inputs and small $\delta , \epsilon$ the constraint (2) will also hold approximately.
97
+
98
+ # 2.3 ADVERSARIAL CRITERION
99
+
100
+ A typical criterion by which an input is classified as adversarial is misclassification, i.e. whether the model assigns the perturbed input to some class different from the class label of the original input. Another common choice is targeted misclassification for which the perturbed input has to be classified in a given target class. Other choices include top-k misclassification (the top-k classes predicted for the perturbed input do not contain the original class label) or thresholds on certain confidence scores. Outside of computer vision many other choices exist such as criteria on the worderror rates. In comparison to most other attacks, the Boundary Attack is extremely flexible with regards to the adversarial criterion. It basically allows any criterion (including non-differentiable ones) as long as for that criterion an initial adversarial can be found (which is trivial in most cases).
101
+
102
+ # 2.4 HYPERPARAMETER ADJUSTMENT
103
+
104
+ The Boundary Attack has only two relevant parameters: the length of the total perturbation $\delta$ and the length of the step $\epsilon$ towards the original input (see Fig. 2). We adjust both parameters dynamically according to the local geometry of the boundary. The adjustment is inspired by Trust Region methods. In essence, we first test whether the orthogonal perturbation is still adversarial. If this is true, then we make a small movement towards the target and test again. The orthogonal step tests whether the step-size is small enough so that we can treat the decision boundary between the adversarial and the non-adversarial region as being approximately linear. If this is the case, then we expect around $50 \%$ of the orthogonal perturbations to still be adversarial. If this ratio is much lower, we reduce the step-size $\delta$ , if it is close to $50 \%$ or higher we increase it. If the orthogonal perturbation is still adversarial we add a small step towards the original input. The maximum size of this step depends on the angle of the decision boundary in the local neighbourhood (see also Figure 2). If the success rate is too small we decrease $\epsilon$ , if it is too large we increase it. Typically, the closer we get to the original image, the flatter the decision boundary becomes and the smaller $\epsilon$ has to be to still make progress. The attack is converged whenever $\epsilon$ converges to zero.
105
+
106
+ # 3 COMPARISON WITH OTHER ATTACKS
107
+
108
+ We quantify the performance of the Boundary Attack on three different standard datasets: MNIST (LeCun et al., 1998), CIFAR-10 (Krizhevsky & Hinton, 2009) and ImageNet-1000 (Deng et al., 2009). To make the comparison with previous results as easy and transparent as possible, we here use the same MNIST and CIFAR networks as Carlini & Wagner (2016a)4. In a nutshell, both the MNIST and CIFAR model feature nine layers with four convolutional layers, two max-pooling layers and two fully-connected layers. For all details, including training parameters, we refer the reader to (Carlini & Wagner, 2016a). On ImageNet we use the pretrained networks VGG-19 (Simonyan & Zisserman, 2014), ResNet-50 (He et al., 2015) and Inception-v3 (Szegedy et al., 2015) provided by Keras5.
109
+
110
+ We evaluate the Boundary Attack in two settings: an (1) untargeted setting in which the adversarial perturbation flips the label of the original sample to any other label, and a (2) targeted setting in which the adversarial flips the label to a specific target class. In the untargeted setting we compare the Boundary Attack against three gradient-based attack algorithms:
111
+
112
+ • Fast-Gradient Sign Method (FGSM). FGSM is among the simplest and most widely used untargeted adversarial attack methods. In a nutshell, FGSM computes the gradient ${ \textbf { 0 } } =$ $\nabla _ { o } \mathcal { L } ( o , c )$ that maximizes the loss $\mathcal { L }$ for the true class-label $c$ and then seeks the smallest $\epsilon$ for which $\mathbf { \omega } _ { o + \epsilon } . \mathbf { \omega } _ { g }$ is still adversarial. We use the implementation in Foolbox 0.10.0 (Rauber et al., 2017). DeepFool. DeepFool is a simple yet very effective attack. In each iteration it computes for each class $\ell \neq \ell _ { 0 }$ the minimum distance $d ( \ell , \ell _ { 0 } )$ that it takes to reach the class boundary by approximating the model classifier with a linear classifier. It then makes a corresponding step in the direction of the class with the smallest distance. We use the implementation in Foolbox 0.10.0 (Rauber et al., 2017). Carlini & Wagner. The attack by Carlini & Wagner (Carlini & Wagner, 2016a) is essentially a refined iterative gradient attack that uses the Adam optimizer, multiple starting points, a tanh-nonlinearity to respect box-constraints and a max-based adversarial constraint function. We use the original implementation provided by the authors with all hyperparameters left at their default values4.
113
+
114
+ To evaluate the success of each attack we use the following metric: let $\pmb { \eta } _ { A , M } ( \pmb { o } _ { i } ) \in \mathbb { R } ^ { N }$ be the adversarial perturbation that the attack $A$ finds on model $M$ for the $i$ -th sample $\mathbf { o } _ { i }$ . The total score $\mathcal { S } _ { A }$ for $A$ is the median squared L2-distance across all samples,
115
+
116
+ $$
117
+ \mathcal { S } _ { A } ( M ) = \mathrm { m e d i a n } \left( \frac { 1 } { N } \left. \pmb { \eta } _ { A , M } ( \pmb { o } _ { i } ) \right. _ { 2 } ^ { 2 } \right) .
118
+ $$
119
+
120
+ For MNIST and CIFAR we evaluate 1000 randomly drawn samples from the validation set, for ImageNet we use 250 images.
121
+
122
+ # 3.1 UNTARGETED ATTACK
123
+
124
+ In the untargeted setting an adversarial is any image for which the predicted label is different from the label of the original image. We show adversarial samples synthesized by the Boundary Attack for each dataset in Figure 3. The score (4) for each attack and each dataset is as follows:
125
+
126
+ ImageNet
127
+
128
+ <table><tr><td></td><td>Attack Type</td><td>MNIST</td><td>CIFAR</td><td>VGG-19</td><td>ResNet-50</td><td>Inception-v3</td></tr><tr><td>FGSM</td><td>gradient-based</td><td>4.2e-02</td><td>2.5e-05</td><td>1.0e-06</td><td>1.0e-06</td><td>9.7e-07</td></tr><tr><td>DeepFool</td><td>gradient-based</td><td>4.3e-03</td><td>5.8e-06</td><td>1.9e-07</td><td>7.5e-08</td><td>5.2e-08</td></tr><tr><td>Carlini &amp; Wagner</td><td>gradient-based</td><td>2.2e-03</td><td>7.5e-06</td><td>5.7e-07</td><td>2.2e-07</td><td>7.6e-08</td></tr><tr><td>Boundary (ours)</td><td>decision-based</td><td>3.6e-03</td><td>5.6e-06</td><td>2.9e-07</td><td>1.0e-07</td><td>6.5e-08</td></tr></table>
129
+
130
+ ![](images/eeb7e498a6f3dda6b80f2fdd07715a54125dc071e8a27bf1b9e1a9682e877d9e.jpg)
131
+ Figure 3: Adversarial examples generated by the Boundary Attack for an MNIST, CIFAR and ImageNet network. For MNIST, the difference shows positive (blue) and negative (red) changes. For CIFAR and ImageNet, we take the norm across color channels. All differences have been scaled up for improved visibility.
132
+
133
+ ![](images/224fd7d916d70367db5cbec645c4cb5aa8c9276b5fe4430a32d62d409dd41f11.jpg)
134
+ Figure 4: Example of an untargeted attack. Here the goal is to synthesize an image that is as close as possible (in L2-metric) to the original image while being misclassified (the original image is correctly classified). For each image we report the total number of model calls (predictions) until that point (above the image) and the mean squared error between the adversarial and the original (below the image).
135
+
136
+ Despite its simplicity the Boundary Attack is competitive with gradient-based attacks in terms of the minimal adversarial perturbations and very stable against the choice of the initial point (Figure 5). This finding is quite remarkable given that gradient-based attacks can fully observe the model whereas the Boundary Attack is severely restricted to the final class prediction. To compensate for this lack of information the Boundary Attack needs many more iterations to converge. As a rough measure for the run-time of an attack independent of the quality of its implementation we tracked the number of forward passes (predictions) and backward passes (gradients) through the network requested by each of the attacks to find an adversarial for ResNet-50: averaged over 20 samples and under the same conditions as before, DeepFool needs about 7 forward and 37 backward passes, the Carlini & Wagner attack requires 16.000 forward and the same number of backward passes, and the Boundary Attack uses 1.200.000 forward passes but zero backward passes. While that (unsurprisingly) makes the Boundary Attack more expensive to run it is important to note that the Boundary Attacks needs much fewer iterations if one is only interested in imperceptible perturbations, see figures 4 and 6.
137
+
138
+ # 3.2 TARGETED ATTACK
139
+
140
+ We can also apply the Boundary Attack in a targeted setting. In this case we initialize the attack from a sample of the target class that is correctly identified by the model. A sample trajectory from the starting point to the original sample is shown in Figure 7. After around $1 0 ^ { 4 }$ calls to the model the perturbed image is already clearly identified as a cat by humans and contains no trace of the Dalmatian dog, as which the image is still classified by the model.
141
+
142
+ ![](images/a182715ad2d667ed65ca2ebb2779a3bcb68058efa6b45bdb4d123f50179eb937.jpg)
143
+ Figure 5: Adversarial perturbation (difference between the adversarial and the original image) for ten repetitions of the Boundary Attack on the same image. There are basically two different minima with similar distance (first row and second row) to which the Boundary Attack converges.
144
+
145
+ ![](images/c6a777ffa8fb8799bffa6b639846bc5e2222923e9088233bf6dffdd0db0a6b1f.jpg)
146
+ Figure 6: Distance between adversarial and original image over number of model calls for 12 different images (until convergence). Very few steps are already sufficient to get almost imperceptible perturbations.
147
+
148
+ ![](images/3762b35219c7d357b48af44610d0275cae626e52f01443af83b519d540c06334.jpg)
149
+ Figure 7: Example of a targeted attack. Here the goal is to synthesize an image that is as close as possible (in L2-metric) to a given image of a tiger cat (2nd row, right) but is classified as a dalmatian dog. For each image we report the total number of model calls (predictions) until that point.
150
+
151
+ In order to compare the Boundary Attack to Carlini & Wagner we define the target target label for each sample in the following way: on MNIST and CIFAR a sample with label $\ell$ gets the target label $\ell + 1$ modulo 10. On ImageNet we draw the target label randomly but consistent across attacks. The results are as follows:
152
+
153
+ <table><tr><td></td><td>Attack Type</td><td>MNIST</td><td>CIFAR</td><td>VGG-19</td></tr><tr><td>Carlini &amp;Wagner</td><td>gradient-based</td><td>4.8e-03</td><td>3.0e-05</td><td>5.7e-06</td></tr><tr><td>Boundary (ours)</td><td>decision-based</td><td>6.5e-03</td><td>3.3e-05</td><td>9.9e-06</td></tr></table>
154
+
155
+ # 4 THE IMPORTANCE OF DECISION-BASED ATTACKS TO EVALUATE MODEL ROBUSTNESS
156
+
157
+ As discussed in the introduction, many attack methods are straight-forward to defend against. One common nuisance is gradient masking in which a model is implicitely or explicitely modified to yield masked gradients. An interesting example is the saturated sigmoid network (Nayebi & Ganguli, 2017) in which an additional regularization term leads the sigmoid activations to saturate, which in turn leads to vanishing gradients and failing gradient-based attacks (Brendel & Bethge, 2017).
158
+
159
+ Another example is defensive distillation (Papernot et al., 2016). In a nutshell defensive distillation uses a temperature-augmented softmax of the type
160
+
161
+ $$
162
+ s o f t m a x ( x , T ) _ { i } = \frac { e ^ { x _ { i } / T } } { \sum _ { j } e ^ { x _ { j } / T } }
163
+ $$
164
+
165
+ and works as follows:
166
+
167
+ 1. Train a teacher network as usual but with temperature $T$ .
168
+ 2. Train a distilled network—with the same architecture as the teacher—on the softmax outputs of the teacher. Both the distilled network and the teacher use temperature $T$ .
169
+ 3. Evaluate the distilled network at temperature $T = 1$ at test time.
170
+
171
+ Initial results were promising: the success rate of gradient-based attacks dropped from close to $100 \%$ down to $0 . 5 \%$ . It later became clear that the distilled networks only appeared to be robust because they masked their gradients of the cross-entropy loss (Carlini & Wagner, 2016b): as the temperature of the softmax is decreased at test time, the input to the softmax increases by a factor of $T$ and so the probabilities saturate at 0 and 1. This leads to vanishing gradients of the cross-entropy loss w.r.t. to the input on which gradient-based attacks rely. If the same attacks are instead applied to the logits the success rate recovers to almost $1 0 0 \%$ (Carlini & Wagner, 2016a).
172
+
173
+ Decision-based attacks are immune to such defences. To demonstrate this we here apply the Boundary Attack to two distilled networks trained on MNIST and CIFAR. The architecture is the same as in section 3 and we use the implementation and training protocol by (Carlini & Wagner, 2016a) which is available at https://github.com/carlini/nn_robust_attacks. Most importantly, we do not operate on the logits but provide only the class label with maximum probability to the Boundary Attack. The results are as follows:
174
+
175
+ <table><tr><td rowspan="2"></td><td rowspan="2">Attack Type</td><td colspan="2">MNIST</td><td colspan="2">CIFAR</td></tr><tr><td>standard</td><td>distilled</td><td>standard</td><td>distilled</td></tr><tr><td>FGSM</td><td>gradient-based</td><td>4.2e-02</td><td>fails</td><td>2.5e-05</td><td>fails</td></tr><tr><td>Boundary (ours)</td><td>decision-based</td><td>3.6e-03</td><td>4.2e-03</td><td>5.6e-06</td><td>1.3e-05</td></tr></table>
176
+
177
+ The size of the adversarial perturbations that the Boundary Attack finds is fairly similar for the distilled and the undistilled network. This demonstrates that defensive distillation does not significantly increase the robustness of network models and that the Boundary Attack is able to break defences based on gradient masking.
178
+
179
+ # 5 ATTACKS ON REAL-WORLD APPLICATIONS
180
+
181
+ In many real-world machine learning applications the attacker has no access to the architecture or the training data but can only observe the final decision. This is true for security systems (e.g. face identification), autonomous cars or speech recognition systems like Alexa or Cortana.
182
+
183
+ In this section we apply the Boundary Attack to two models of the cloud-based computer vision API by Clarifai6. The first model identifies brand names in natural images and recognizes over 500 brands. The second model identifies celebrities and can recognize over 10.000 individuals. Multiple identifications per image are possible but we only consider the one with the highest confidence score. It is important to note that Clarifai does provide confidence scores for each identified class (but not for all possible classes). However, in our experiments we do not provide this confidence score to the Boundary Attack. Instead, our attack only receives the name of the identified object (e.g. Pepsi or Verizon in the brand-name detection task).
184
+
185
+ We selected several samples of natural images with clearly visible brand names or portraits of celebrities. We then make a square crop and resize the image to $1 0 0 \times 1 0 0$ pixels. For each sample we make sure that the brand or the celebrity is clearly visible and that the corresponding Clarifai model correctly identifies the content. The adversarial criterion was misclassification, i.e. Clarifai should report a different brand / celebrity or None on the adversarially perturbed sample.
186
+
187
+ ![](images/e7839d3f976c5105c19b1e4c52f53e928122f89340e84a1444ce3924a0bbd7dd.jpg)
188
+ Figure 8: Adversarial examples generated by the Boundary Attack for two black-box models by Clarifai for brand-detection (left side) and celebrity detection (right side).
189
+
190
+ We show five samples for each model alongside the adversarial image generated by the Boundary Attack in Figure 8. We generally observed that the Clarifai models were more difficult to attack than ImageNet models like VGG-19: while for some samples we did succeed to find adversarial perturbations of the same order $( 1 e ^ { - 7 } )$ as in section 3 (e.g. for Shell or $S A P$ ), most adversarial perturbations were on the order of $1 e ^ { - 2 }$ to $1 e ^ { - 3 }$ resulting in some slightly noticeable noise in some adversarial examples. Nonetheless, for most samples the original and the adversarial image are close to being perceptually indistinguishable.
191
+
192
+ # 6 DISCUSSION & OUTLOOK
193
+
194
+ In this paper we emphasised the importance of a mostly neglected category of adversarial attacks— decision-based attacks—that can find adversarial examples in models for which only the final decision can be observed. We argue that this category is important for three reasons: first, attacks in this class are highly relevant for many real-world deployed machine learning systems like autonomous cars for which the internal decision making process is unobservable. Second, attacks in this class do not rely on substitute models that are trained on similar data as the model to be attacked, thus making real-world applications much more straight-forward. Third, attacks in this class have the potential to be much more robust against common deceptions like gradient masking, intrinsic stochasticity or robust training.
195
+
196
+ We also introduced the first effective attack in this category that is applicable to general machine learning algorithms and complex natural datasets: the Boundary Attack. At its core the Boundary Attack follows the decision boundary between adversarial and non-adversarial samples using a very simple rejection sampling algorithm in conjunction with a simple proposal distribution and a dynamic step-size adjustment inspired by Trust Region methods. Its basic operating principle— starting from a large perturbation and successively reducing it—inverts the logic of essentially all previous adversarial attacks. Besides being surprisingly simple, the Boundary attack is also extremely flexible in terms of the possible adversarial criteria and performs on par with gradient-based attacks on standard computer vision tasks in terms of the size of minimal perturbations.
197
+
198
+ The mere fact that a simple constrained iid Gaussian distribution can serve as an effective proposal perturbation for each step of the Boundary attack is surprising and sheds light on the brittle information processing of current computer vision architectures. Nonetheless, there are many ways in which the Boundary attack can be made even more effective, in particular by learning a suitable proposal distribution for a given model or by conditioning the proposal distribution on the recent history of successful and unsuccessful proposals.
199
+
200
+ Decision-based attacks will be highly relevant to assess the robustness of machine learning models and to highlight the security risks of closed-source machine learning systems like autonomous cars. We hope that the Boundary attack will inspire future work in this area.
201
+
202
+ # ACKNOWLEDGMENTS
203
+
204
+ This work was supported by the Carl Zeiss Foundation (0563-2.8/558/3), the Bosch Forschungsstiftung (Stifterverband, T113/30057/17), the International Max Planck Research School for Intelligent Systems (IMPRS-IS), the German Research Foundation (DFG, CRC 1233, Robust Vision: Inference Principles and Neural Mechanisms) and the Intelligence Advanced Research Projects Activity (IARPA) via Department of Interior/Interior Business Center (DoI/IBC) contract number D16PC00003. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright annotation thereon. Disclaimer: The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of IARPA, DoI/IBC, or the U.S. Government.
205
+
206
+ # REFERENCES
207
+
208
+ Battista Biggio, Igino Corona, Davide Maiorca, Blaine Nelson, Nedim Srndi ˇ c, Pavel Laskov, Gior- ´ gio Giacinto, and Fabio Roli. Evasion attacks against machine learning at test time. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 387– 402. Springer, 2013.
209
+
210
+ Wieland Brendel and Matthias Bethge. Comment on “biologically inspired protection of deep networks from adversarial attacks”. CoRR, abs/1704.01547, 2017. URL http://arxiv.org/ abs/1704.01547.
211
+
212
+ Nicholas Carlini and David A. Wagner. Towards evaluating the robustness of neural networks. CoRR, abs/1608.04644, 2016a. URL http://arxiv.org/abs/1608.04644.
213
+
214
+ Nicholas Carlini and David A. Wagner. Defensive distillation is not robust to adversarial examples. CoRR, abs/1607.04311, 2016b. URL http://arxiv.org/abs/1607.04311.
215
+
216
+ Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. CoRR, abs/1708.03999, 2017. URL http://arxiv.org/abs/1708.03999.
217
+
218
+ Moustapha Cisse, Yossi Adi, Natalia Neverova, and Joseph Keshet. Houdini: Fooling deep structured prediction models. CoRR, abs/1707.05373, 2017. URL http://arxiv.org/abs/ 1707.05373.
219
+
220
+ Nilesh Dalvi, Pedro Domingos, Mausam, Sumit Sanghai, and Deepak Verma. Adversarial classification. In Proceedings of the Tenth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’04, pp. 99–108, New York, NY, USA, 2004. ACM. ISBN 1-58113-888-1. doi: 10.1145/1014052.1014066. URL http://doi.acm.org/10.1145/ 1014052.1014066.
221
+
222
+ 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.
223
+
224
+ Jamie Hayes and George Danezis. Machine learning as an adversarial service: Learning blackbox adversarial examples. CoRR, abs/1708.05207, 2017. URL http://arxiv.org/abs/ 1708.05207.
225
+
226
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015. URL http://arxiv.org/abs/1512.03385.
227
+
228
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
229
+
230
+ Alexey Kurakin, Ian J. Goodfellow, and Samy Bengio. Adversarial examples in the physical world. CoRR, abs/1607.02533, 2016. URL http://arxiv.org/abs/1607.02533.
231
+
232
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
233
+
234
+ Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. CoRR, abs/1611.02770, 2016. URL http://arxiv.org/abs/ 1611.02770.
235
+
236
+ Daniel Lowd and Christopher Meek. Adversarial learning. In Proceedings of the Eleventh ACM SIGKDD International Conference on Knowledge Discovery in Data Mining, KDD ’05, pp. 641– 647, New York, NY, USA, 2005. ACM. ISBN 1-59593-135-X. doi: 10.1145/1081870.1081950. URL http://doi.acm.org/10.1145/1081870.1081950.
237
+
238
+ Jiajun Lu, Theerasit Issaranon, and David A. Forsyth. Safetynet: Detecting and rejecting adversarial examples robustly. CoRR, abs/1704.00103, 2017. URL http://arxiv.org/abs/1704. 00103.
239
+
240
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: a simple and accurate method to fool deep neural networks. CoRR, abs/1511.04599, 2015. URL http: //arxiv.org/abs/1511.04599.
241
+
242
+ Nina Narodytska and Shiva Prasad Kasiviswanathan. Simple black-box adversarial perturbations for deep networks. CoRR, abs/1612.06299, 2016. URL http://arxiv.org/abs/1612. 06299.
243
+
244
+ Aran Nayebi and Surya Ganguli. Biologically inspired protection of deep networks from adversarial attacks. CoRR, abs/1703.09202, 2017. URL http://arxiv.org/abs/1703.09202.
245
+
246
+ Blaine Nelson, Benjamin I. P. Rubinstein, Ling Huang, Anthony D. Joseph, Steven J. Lee, Satish Rao, and J. D. Tygar. Query strategies for evading convex-inducing classifiers. J. Mach. Learn. Res., 13:1293–1332, May 2012. ISSN 1532-4435. URL http://dl.acm.org/citation. cfm?id=2188385.2343688.
247
+
248
+ Nicolas Papernot, Patrick D. McDaniel, Somesh Jha, Matt Fredrikson, Z. Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. CoRR, abs/1511.07528, 2015. URL http://arxiv.org/abs/1511.07528.
249
+
250
+ Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In Security and Privacy (SP), 2016 IEEE Symposium on, pp. 582–597. IEEE, 2016.
251
+
252
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, pp. 506–519. ACM, 2017a.
253
+
254
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z. Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, ASIA CCS ’17, pp. 506–519, New York, NY, USA, 2017b. ACM. ISBN 978-1-4503-4944-4. doi: 10.1145/3052973.3053009. URL http://doi.acm.org/10.1145/3052973.3053009.
255
+
256
+ Jonas Rauber, Wieland Brendel, and Matthias Bethge. Foolbox v0.8.0: A python toolbox to benchmark the robustness of machine learning models. CoRR, abs/1707.04131, 2017. URL http://arxiv.org/abs/1707.04131.
257
+
258
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556, 2014. URL http://arxiv.org/abs/1409.1556.
259
+
260
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. CoRR, abs/1312.6199, 2013. URL http://arxiv.org/abs/1312.6199.
261
+
262
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. CoRR, abs/1512.00567, 2015. URL http://arxiv.org/abs/1512.00567.
263
+
264
+ Florian Tramer, Alexey Kurakin, Nicolas Papernot, Dan Boneh, and Patrick McDaniel. Ensemble adversarial training: Attacks and defenses. CoRR, abs/1705.07204, May 2017. URL http: //arxiv.org/abs/1705.07204.
md/train/Syx7WyBtwB/Syx7WyBtwB.md ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # INTERPRETATIONS ARE USEFUL: PENALIZING EXPLANATIONS TO ALIGN NEURAL NETWORKS WITH PRIOR KNOWLEDGE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ For an explanation of a deep learning model to be effective, it must provide both insight into a model and suggest a corresponding action in order to achieve some objective. Too often, the litany of proposed explainable deep learning methods stop at the first step, providing practitioners with insight into a model, but no way to act on it. In this paper, we propose contextual decomposition explanation penalization (CDEP), a method which enables practitioners to leverage existing explanation methods in order to increase the predictive accuracy of deep learning models. In particular, when shown that a model has incorrectly assigned importance to some features, CDEP enables practitioners to correct these errors by directly regularizing the provided explanations. Using explanations provided by contextual decomposition (CD) (Murdoch et al., 2018), we demonstrate the ability of our method to increase performance on an array of toy and real datasets.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In recent years, neural networks have demonstrated strong predictive performance across a wide variety of settings. However, in order to achieve that accuracy, they sometimes latch onto spurious correlations, leading to undesirable behavior as a result of dataset bias (Winkler et al., 2019), racial and ethnic stereotypes (Garg et al., 2018), or simply overfitting. While recent work into explaining neural network predictions (Murdoch et al., 2019; Doshi-Velez & Kim, 2017) has demonstrated an ability to uncover the relationships learned by a model, it is still unclear how to actually alter the model in order to remove incorrect, or undesirable, relationships.
12
+
13
+ We introduce contextual decomposition explanation penalization (CDEP), a method which leverages existing explanation techniques for neural networks in order to prevent a model from learning unwanted relationships and ultimately improve predictive accuracy.
14
+
15
+ Given particular importance scores, CDEP works by allowing the user to directly penalize importances of certain features, or interactions. This forces the neural network to not only produce the correct prediction, but also the correct explanation for that prediction. While we focus on contextual decomposition (CD) (Murdoch et al., 2018; Singh et al., 2018), which allows the penalization of both feature importances and interactions, CDEP can be readily adapted for existing interpretation techniques, as long as they are differentiable. Moreover, CDEP is a general technique, which can be applied to arbitrary neural network architectures, and is orders of magnitude faster and more memory efficient than recent gradient-based methods, allowing its use on meaningful datasets.
16
+
17
+ In order to demonstrate the effectiveness of CDEP, we conducted experiments across a wide variety of tasks. In the prediction of skin cancer from images, CDEP improves the prediction of a classifier by teaching it to ignore spurious confounding variables present in the training data. In a colored MNIST task, CDEP allows the network to focus on a digit’s shape rather than its color (with no extra human annotation needed). Finally, a toy example using text classification shows how the penalization can help a network avoid a bias towards particular words, such as those involving gender.
18
+
19
+ ![](images/617173982504932cee4bf87cc5887e0323a962415b05a74728054302451ac068.jpg)
20
+ Figure 1: CDEP allows a practitioner to penalize both a model’s prediction and the corresponding explanation.
21
+
22
+ # 2 BACKGROUND
23
+
24
+ Explanation methods Many methods have been developed to help explain the learned relationships contained in a DNN. For local, or prediction-level, explanation, most prior work has focused on assigning importance to individual features, such as pixels in an image or words in a document. There are several methods that give feature-level importance for different architectures. They can be categorized as gradient-based (Springenberg et al., 2014; Sundararajan et al., 2017; Selvaraju et al., 2016; Baehrens et al., 2010; Rieger & Hansen, 2019), decomposition-based (Murdoch & Szlam, 2017; Shrikumar et al., 2016; Bach et al., 2015) and others (Dabkowski & Gal, 2017; Fong & Vedaldi, 2017; Ribeiro et al., 2016; Zintgraf et al., 2017), with many similarities among the methods (Ancona et al., 2018; Lundberg & Lee, 2017). However, many of these methods have thus far been poorly evaluated (Adebayo et al., 2018; Nie et al., 2018), casting doubt on their usefulness. Another line of work, which we build upon, has focused on uncovering interactions between features, in addition to feature importances, (Murdoch et al., 2018), and using those interactions to create a hierarchy of features displaying the model’s prediction process (Singh et al., 2018).
25
+
26
+ Uses of explanation methods While much work has been put into developing methods for explaining DNNs, relatively little work has explored the potential to use these explanations to help build a better model. Some recent work proposes forcing models to attend to regions of the input which are known to be important (Burns et al., 2018; Mitsuhara et al., 2019), although it is important to note that attention is often not the same as explanation (Jain & Wallace, 2019). An alternative line of work proposes penalizing the gradients of a neural network to match human-provided binary annotations and shows the possibility to improve performance (Ross et al., 2017) and adversarial robustness (Ross & Doshi-Velez, 2018). Two recent papers extend these ideas by penalizing attributions for natural language models (Liu & Avci, 2019) and penalizing a modified gradient-based score to produce smooth attributions (Erion et al., 2019). Predating deep learning, (Zaidan et al., 2007) consider the use of “annotator rationales” in sentiment analysis to train support vector machines. This work on annotator rationales was recently extended to show improved explanations (not accuracy) in CNNs (Strout et al., 2019).
27
+
28
+ Other ways to constrain DNNs While we focus on the use of explanations to constrain the relationships learned by neural networks, other approaches for constraining neural networks have also been proposed. A computationally intensive alternative is to augment the dataset in order to prevent the model from learning undesirable relationships, through domain knowledge (Bolukbasi et al., 2016), projecting out superficial statistics (Wang et al., 2019) or dramatically altering training images (Geirhos et al., 2018). However, these processes are often not feasible, either due to their computational cost or the difficulty of constructing such an augmented data set. Adversarial training has also been explored (Zhang & Zhu, 2019). These techniques are generally limited, as they are often tied to particular datasets, and do not provide a clear link between learning about a model’s learned relationships through explanations, and subsequently correcting them.
29
+
30
+ # 3 METHODS
31
+
32
+ We now introduce CDEP, which penalizes the explanations of a neural network in order to align with prior knowledge about why a model should make a prediction. To do so, for each data point it penalizes the CD scores of features, or groups of features, which a user does not want the model to learn to be important. While we focus on CD scores, which allow the penalization of interactions between features in addition to features themselves, this approach readily generalizes to other interpretation techniques, so long as they are differentiable.
33
+
34
+ # 3.1 AUGMENTING THE LOSS FUNCTION
35
+
36
+ Given a particular classification task, we want to teach a model to not only produce the correct prediction, but also to arrive at the prediction for the correct reasons. That is, we want the model to be right for the right reasons, where the right reasons are provided by the user and are datasetdependent.
37
+
38
+ To accomplish this, CDEP modifies the objective function used to train a neural network, as displayed in Eq 1. In addition to the standard prediction loss $\mathcal { L }$ , which teaches the model to produce the correct predictions, CDEP adds an explanation error $\mathcal { L } _ { \mathrm { e x p l } }$ , which teaches the model to produce the correct explanations for its predictions. In place of the prediction and labels $f _ { \theta } ( X ) , y$ , used in the prediction error $\mathcal { L }$ , the explanation error $\mathcal { L } _ { \mathrm { e x p l } }$ uses the explanations produced by an interpretation method $\operatorname { e x p l } _ { \theta } ( X )$ , along with targets provided by the user $\operatorname { e x p l } _ { X }$ . As is common with penalization, the two losses are weighted by a hyperparameter $\lambda \in \mathbb { R }$ :
39
+
40
+ $$
41
+ \begin{array} { r } { \hat { \theta } = \underset { \theta } { \operatorname { a r g m i n } } \underbrace { \mathcal { L } \left( f _ { \theta } ( X ) , y \right) } _ { \mathrm { P r e d i c t i o n ~ e r r o r } } + \lambda \underbrace { \mathcal { L } _ { \mathrm { e x p l } } \left( \exp { \mathrm { l } _ { \theta } ( X ) } , \exp { \mathrm { l } _ { X } } \right) } _ { \mathrm { E x p l a n a t i o n ~ e r r o r } } } \end{array}
42
+ $$
43
+
44
+ The precise meanings of $\operatorname { e x p l } _ { X }$ depend on the context. For example, in the skin cancer image classification task described in Section 4, many of the benign skin images contain band-aids, but none of the malignant images. To force the model to ignore the band-aids in making their prediction, in each image $\operatorname { e x p l } _ { \theta } ( X )$ denotes the importance score of the band-aid and $\operatorname { e x p l } _ { X }$ would be zero. These and more examples are further explored in Section 4.
45
+
46
+ # 3.2 CONTEXTUAL DECOMPOSITION (CD)
47
+
48
+ In this work, we use the CD score as the explanation function. In contrast to other interpretation methods, which focus on feature importances, CD also captures interactions between features. CD was originally designed for LSTMs (Murdoch et al., 2018) and subsequently extended to convolutional neural networks and arbitrary DNNs (Singh et al., 2018). For a given DNN $f ( x )$ , one can represent its output as a SoftMax operation applied to logits $g ( x )$ . These logits, in turn, are the composition of $L$ layers $g _ { i }$ , such as convolutional operations or ReLU non-linearities.
49
+
50
+ $$
51
+ f ( x ) = { \mathrm { S o f t M a x } } { \big ( } g ( x ) { \big ) } = { \mathrm { S o f t M a x } } { \big ( } g _ { L } { \big ( } g _ { L - 1 } { \big ( } . . . { \big ( } g _ { 2 } { \big ( } g _ { 1 } ( x ) ) { \big ) } { \big ) } { \big ) } { \big ) }
52
+ $$
53
+
54
+ Given a group of features $\{ x _ { j } \} _ { j \in S }$ , the CD algorithm, $g ^ { C D } ( x )$ , decomposes the logits $g ( x )$ into a sum of two terms, $\beta ( x )$ and $\gamma ( x )$ . $\beta ( x )$ is the importance score of the feature group $\{ x _ { j } \} _ { j \in S }$ , and $\gamma ( x )$ captures contributions to $g ( x )$ not included in $\beta ( x )$ . The decomposition is computed by iteratively applying decompositions $g _ { i } ^ { C D } ( x )$ for each of the layers $g _ { i } ( x )$ .
55
+
56
+ $$
57
+ \begin{array} { c } { { g ^ { C D } ( x ) = g _ { L } ^ { C D } ( g _ { L - 1 } ^ { C D } ( . . . ( g _ { 2 } ^ { C D } ( g _ { 1 } ^ { C D } ( x ) ) ) ) ) = ( \beta ( x ) , \gamma ( x ) ) } } \\ { { \beta ( x ) + \gamma ( x ) = g ( x ) } } \end{array}
58
+ $$
59
+
60
+ # 3.3 CDEP OBJECTIVE FUNCTION
61
+
62
+ We now substitute the above CD scores into the generic equation in $\mathrm { E q } 1$ to arrive at the method used in this paper. While we use CD for the explanation method $\operatorname { e x p l } _ { \theta } ( X )$ , other explanation methods could be readily substituted at this stage. In order to convert CD scores to probabilities, we apply a SoftMax operation to $g ^ { C D } ( x )$ , allowing for easier comparison with the user-provided labels $\operatorname { e x p l } _ { X }$ . We collect from the user, for each input $x _ { i }$ , a collection of feature groups $x _ { i , S }$ , $x _ { i } \in \mathbb { R } ^ { d } , S \subseteq$ $\{ 1 , . . . , d \}$ , along with explanation target values $\mathrm { e x p l } _ { x _ { i , S } }$ , and use the $\| \cdot \| _ { 1 }$ loss for $\mathcal { L } _ { \mathrm { e x p l } }$ .
63
+
64
+ $$
65
+ \hat { \theta } = \underset { \theta } { \mathrm { a r g m i n } } \sum _ { i } \sum _ { c } - y _ { i , c } \log f _ { \theta } ( x _ { i } ) _ { c } + \lambda \sum _ { i } \sum _ { S } | | \beta ( x _ { i , S } ) - \exp | _ { x _ { i , S } } | | _ { 1 }
66
+ $$
67
+
68
+ In the above, $i$ indexes each individual example in the dataset, $S$ indexes a subset of the features for which we penalize their explanations, and $c$ sums over each class. Updating the model parameters in accordance with this formulation ensures that the model not only predicts the right output but also does so for the right (aligned with prior knowledge) reasons.
69
+
70
+ # 3.4 COMPUTATIONAL CONSIDERATIONS
71
+
72
+ A similar idea to Eq 1 has been proposed in previous/concurrent work, where the choice of explanation method uses a gradient-based attribution method (Ross et al., 2017; Erion et al., 2019). However, using such methods leads to three main complications which are solved by our approach. The first complication is the optimization process. When optimizing over attributions from a gradientbased attribution method via gradient descent, the optimizer requires the gradient of the gradient, thus requiring that all network components be twice differentiable. This process is computationally expensive and indeed optimizing it exactly involves optimizing over a differential equation. In contrast, CD attributions are calculated along with the forward pass of the network, and as a result can be optimized plainly with back-propagation using the standard single forward-pass and backward-pass per batch.
73
+
74
+ A second complication solved by the use of CD in $\operatorname { E q } 5$ is the ability to quickly finetune a pre-trained network. In many applications, particularly in transfer learning, it is common to finetune only the last few layers of a pre-trained neural network. Using CD, one can freeze early layers of the network and then finetune the last few layers of the network quickly as the activations and gradients of the frozen layers are not necessary.
75
+
76
+ Third, penalizing gradient-based methods incurs a very large memory usage. Using gradient-based methods, training requires the storage of activations and gradients for all layers of the network as well as the gradient of input (which can be omitted in normal training). Even for the simplest version, based on saliency, this more than doubles the required memory for a given batch and network size. More advanced methods proved to be completely infeasible to apply to a real-life dataset used, since the memory requirements were too high. By contrast, penalizing CD only requires a small constant amount of memory more than standard training.
77
+
78
+ # 4 RESULTS
79
+
80
+ The results here demonstrate the efficacy of CDEP on a variety of datasets using diverse explanation types. Sec 4.1 shows results on ignoring spurious patches in the ISIC skin cancer dataset (Codella et al., 2019), Sec 4.2 details experiments on converting a DNN’s preference for color to a preference for shape on a variant of the MNIST dataset (LeCun, 1998), and Sec 4.3 shows experiments on text data from the Stanford Sentiment Treebank (SST) (Socher et al., 2013).1
81
+
82
+ # 4.1 IGNORING SPURIOUS SIGNALS IN SKIN CANCER DIAGNOSIS
83
+
84
+ In recent years, deep learning has achieved impressive results in diagnosing skin cancer, with predictive accuracy sometimes comparable to human doctors (Esteva et al., 2017). However, the datasets used to train these models often include spurious features which make it possible to attain high test accuracy without learning the underlying phenomena (Winkler et al., 2019). In particular, a popular dataset from ISIC (International Skin Imaging Collaboration) has colorful patches present in approximately $50 \%$ of the non-cancerous images but not in the cancerous images (Codella et al., 2019). An unpenalized DNN learns to look for these patches as an indicator for predicting that an image is benign. We use CDEP to remedy this problem by penalizing the DNN placing importance on the patches during training.
85
+
86
+ ![](images/c8be3164538aa83806cb69235be2bd2037a511d18f3a57b89b26a4d7d9664ddc.jpg)
87
+ Figure 2: Example images from the ISIC dataset. Half of the benign lesion images include a patch in the image.
88
+
89
+ The task in this section is to classify whether an image of a skin lesion contains (1) benign melanoma or (2) malignant melanoma. The ISIC dataset consists of 21,654 images (19,372 benign), each diagnosed by histopathology or a consensus of experts. For classification, we use a VGG16 architecture (Simonyan & Zisserman, 2014) pre-trained on the ImageNet Classification task 2 and freeze the weights of early layers so that only the fully connected layers are trained. In order to use CDEP, the spurious patches are identified via a s imple image segmentation algorithm using a color threshold (see Sec S4).
90
+
91
+ Table 1 shows results comparing the performance of a model trained with and without CDEP. We report results on two variants of the test set. The first, which we refer to as “no patches” only contains images of the test set that do not include patches. The second also includes images with those patches. Training with CDEP improves the AUC and F1-score for both test sets.
92
+
93
+ Table 1: Results from training a DNN on ISIC to recognize skin cancer (averaged over three runs). Results shown for the entire test set and for only the images the test set that do not include patches (“no patches”). The network trained with CDEP generalizes better, getting higher AUC and F1 on both. Std below 0.006 for all AUC and below 0.012 for all F1.
94
+
95
+ <table><tr><td></td><td>AUC (no patches)</td><td>F1 (no patches)</td><td>AUC (all)</td><td>F1 (all)</td></tr><tr><td>Vanilla (excluded data)</td><td>0.86</td><td>0.59</td><td>0.92</td><td>0.59</td></tr><tr><td>Vanilla</td><td>0.85</td><td>0.56</td><td>0.92</td><td>0.56</td></tr><tr><td>With RRR</td><td>0.66</td><td>0.39</td><td>0.82</td><td>0.39</td></tr><tr><td>With CDEP</td><td>0.88</td><td>0.61</td><td>0.93</td><td>0.61</td></tr></table>
96
+
97
+ In the first row of Table 1, the model is trained using only the data without the spurious patches, and the second row shows the model trained on the full dataset. The network trained using CDEP achieves the best AUC, surpassing both unpenalized versions. Applying our method increases the ROC AUC as well as the best F1 score. We also compared our method against the method introduced in 2017 by Ross et al. (RRR). For this, we restricted the batch size to 16 (and consequently use a learning rate of $1 0 ^ { - 5 }$ ) due to memory constraints. Using RRR did not improve on the base AUC, implying that penalizing gradients is not helpful in penalizing higher-order features.3
98
+
99
+ Visualizing explanations Fig. 3 visualize GradCAM heatmaps (Ozbulak, 2019; Selvaraju et al., 2017) for an unpenalized DNN and a DNN trained with CDEP to ignore spurious patches. As expected, after penalizing with CDEP, the DNN attributes less importance to the spurious patches, regardless of their position in the image. More examples, also for cancerous images, are shown in Sec S5.
100
+
101
+ ![](images/20a04a106d883c5e826264c1d280605495c44f4fa24b15395e969f269a172631.jpg)
102
+ Figure 3: Visualizing heatmaps for correctly predicted exampes from the ISIC skincancer test set. Lighter regions in the heatmap are attributed more importance. The DNN trained with CDEP correctly captures that the patch is not relevant for classification.
103
+
104
+ # 4.2 COMBATING INDUCTIVE BIAS ON VARIANTS OF THE MNIST DATASET
105
+
106
+ In this section, we investigate whether we can alter which features a DNN uses to perform digit classification, using variants of the MNIST dataset (LeCun, 1998) and a standard CNN architecture for this dataset retrieved from PyTorch 4.
107
+
108
+ # 4.2.1 COLORMNIST
109
+
110
+ Similar to a previous study (Li & Vasconcelos, 2019), we transform the MNIST dataset to include three color channels and assign each class a distinct color, as shown in Fig. 4. An unpenalized DNN trained on this biased data will completely misclassify a test set with inverted colors, dropping to $0 \%$ accuracy (see Section 4.2.1), suggesting that it learns to classify using the colors of the digits rather than their shape.
111
+
112
+ Here, we want to see if we can alter the DNN to focus on the shape of the digits rather than their color. Interestingly, this can be enforced by minimizing the contribution of pixels in isolation while maximizing the importance of groups of pixels (which can represent shapes). To do this, we add penalize the CD contribution of sampled single pixel values, following Eq 5. By minimizing the contribution of single pixels we effectively encourage the network to focus more on groups of pixels, which can represent shape.
113
+
114
+ ![](images/fb80d1db12bd143f0e50e57a070027be80ea8422d4e19038029b5c3902672461.jpg)
115
+ Figure 4: ColorMNIST: the test set shapes remain the same as the training set, but the colors are inverted. A vanilla network trained on this training set will get $0 \%$ accuracy on the test set.
116
+
117
+ Section 4.2.1 shows that CDEP can partially change the network’s focus on solely color to also focus on digit shape. We compare CDEP to two previously introduced explanation penalization techniques: penalization of the squared gradients (RRR) (Ross et al., 2017) and Expected Gradients (EG) (Erion et al., 2019). For EG we penalize variance between attributions of the RGB channels (as recommended by the authors of EG in personal correspondence). None of the baselines are able to improve the test accuracy of the model on this task above the random baseline, while CDEP is able to significantly improve this accuracy to $3 1 . 0 \%$ . We show the increase of predictive accuracy with increasing penalization in Fig. S5.
118
+
119
+ Table 2: Results on ColorMNIST (test accuracy). All values averaged over thirty runs. CDEP is the only method that captures and removes color bias.
120
+
121
+ <table><tr><td></td><td>Unpenalized</td><td>Baseline</td><td>CDEP</td><td>RRR</td><td>Expected Gradients</td></tr><tr><td>Test Accuracy</td><td>0.2±0.2</td><td>9.8</td><td>31.0 ± 2.3</td><td>0.2±0.1</td><td>10.0± 0.1</td></tr></table>
122
+
123
+ # 4.2.2 DECOYMNIST
124
+
125
+ For further comparison with previous work, we evaluate CDEP on an existing task: DecoyMNIST (Erion et al., 2019). DecoyMNIST adds a class-indicative gray patch to a random corner of the image. This task is relatively simple, as the spurious features are not entangled with any other feature and are always at the same location (the corners). Table 3 shows that all methods perform roughly equally, recovering the base accuracy. Results are reported using the best penalization parameter $\lambda$ , chosen via cross-validation on the test accuracy. We provide details on the computation time, and memory usage in Table S1, showing that CDEP is similar to existing approaches. However, when freezing early layers of a network and finetuning, CDEP very quickly becomes more efficient than other methods.
126
+
127
+ Table 3: Results on Grayscale Decoy set.
128
+
129
+ <table><tr><td></td><td>Unpenalized</td><td>CDEP</td><td>RRR</td><td>Expected Gradients</td></tr><tr><td>Testaccuracy</td><td>60.1 ± 5.1</td><td>97.2 ± 0.8</td><td>99.0 ± 1.0</td><td>97.8 ± 0.2</td></tr></table>
130
+
131
+ # 4.3 FIXING BIAS IN TEXT DATA
132
+
133
+ To demonstrate CDEP’s effectiveness on text, we use the Stanford Sentiment Treebank (SST) dataset (Socher et al., 2013), an NLP benchmark dataset consisting of movie reviews with a binary sentiment (positive/negative). We inject spurious signals into the training set and train a standard LSTM 5 to classify sentiment from the review.
134
+
135
+ # Positive
136
+
137
+ pacino is the best she's been in years and keener is marvelous
138
+ she showcases davies as a young woman of great charm , generosity and diplomacy shows she 's back in form , with an astoundingly rich film .
139
+ proves once again that she's the best brush in the business
140
+
141
+ # Negative
142
+
143
+ green ruins every single scene he's in, and the film, while it 's not completely wreaked, is seriously compromised by that
144
+
145
+ i'm sorry to say that this should seal the deal - arnold is not, nor will he be, back . this is sandler running on empty , repeating what he 's already done way too often . so howard appears to have had free rein to be as pretentious as he wanted
146
+
147
+ Figure 5: Example sentences from the SST dataset with artificially induced bias on gender.
148
+
149
+ We create three variants of the SST dataset, each with different spurious signals which we aim to ignore (examples in Sec S1). In the first variant, we add indicator words for each class (positive: ‘text’, negative: ‘video’) at a random location in each sentence. An unpenalized DNN will focus only on those words, dropping to nearly random performance on the unbiased test set. In the second variant, we use two semantically similar words (‘the’, ‘a’) to indicate the class by using one word only in the positive and one only in the negative class. In the third case, we use ‘he’ and ‘she’ to indicate class (example in Fig 5). Since these gendered words are only present in a small proportion of the training dataset $( \sim 2 \% )$ , for this variant, we report accuracy only on the sentences in the test set that do include the pronouns (performance on the test dataset not including the pronouns remains unchanged). Table 4 shows the test accuracy for all datasets with and without CDEP. In all scenarios, CDEP is successfully able to improve the test accuracy by ignoring the injected spurious signals.
150
+
151
+ Table 4: Results on SST. CDEP substantially improves predictive accuracy on the unbiased test set after training on biased data.
152
+
153
+ <table><tr><td></td><td>Unpenalized</td><td>CDEP</td></tr><tr><td>Random words</td><td>56.6 ± 5.8</td><td>75.4 ± 0.9</td></tr><tr><td>Biased (articles)</td><td>57.8 ± 0.8</td><td>68.2 ± 0.8</td></tr><tr><td>Biased (gender)</td><td>64.2 ± 3.1</td><td>78.0 ± 3.0</td></tr></table>
154
+
155
+ # 5 CONCLUSION
156
+
157
+ In this work we introduce a novel method to penalize neural networks to align with prior knowledge. Compared to previous work, CDEP is the first of its kind that can penalize complex features and feature interactions. Furthermore, CDEP is more computationally efficient than previous work and does not rely on backpropagation, enabling its use with more complex neural networks. We show that CDEP can be used to remove bias and improve predictive accuracy on a variety of toy and real data. The experiments here demonstrate a variety of ways to use CDEP to improve models both on real and toy datasets. CDEP is quite versatile and can be used in many more areas to incorporate the structure of domain knowledge (e.g. biology or physics). Of course, the effectiveness of CDEP depends upon the quality of the prior knowledge used to determine the explanation targets. Future work includes extending CDEP to more complex penalties, incorporating more fine-grained explanations and interactions. We hope the work here will help push the field towards a more rigorous way to use interpretability methods, a point which will become increasingly important as interpretable machine learning develops as a field (Doshi-Velez & Kim, 2017; Murdoch et al., 2019).
158
+
159
+ # REFERENCES
160
+
161
+ Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Susstrunk. Slic superpixels compared to state-of-the-art superpixel methods. ¨ IEEE transactions on pattern analysis and machine intelligence, 34(11):2274–2282, 2012.
162
+ Julius Adebayo, Justin Gilmer, Michael Muelly, Ian Goodfellow, Moritz Hardt, and Been Kim. Sanity checks for saliency maps. In Advances in Neural Information Processing Systems, pp. 9505–9515, 2018.
163
+ Marco Ancona, Enea Ceolini, Cengiz Oztireli, and Markus Gross. Towards better understanding of gradient-based attribution methods for deep neural networks. In 6th International Conference on Learning Representations (ICLR 2018), 2018.
164
+ Sebastian Bach, Alexander Binder, Gregoire Montavon, Frederick Klauschen, Klaus-Robert M ´ uller, ¨ and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PloS one, 10(7):e0130140, 2015.
165
+ David Baehrens, Timon Schroeter, Stefan Harmeling, Motoaki Kawanabe, Katja Hansen, and KlausRobert MA˜ zller. How to explain individual classification decisions. ˇ Journal of Machine Learning Research, 11(Jun):1803–1831, 2010.
166
+
167
+ Tolga Bolukbasi, Kai-Wei Chang, James Y Zou, Venkatesh Saligrama, and Adam T Kalai. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. In Advances in neural information processing systems, pp. 4349–4357, 2016.
168
+
169
+ Kaylee Burns, Lisa Anne Hendricks, Kate Saenko, Trevor Darrell, and Anna Rohrbach. Women also snowboard: Overcoming bias in captioning models. arXiv preprint arXiv:1803.09797, 2018.
170
+
171
+ Noel Codella, Veronica Rotemberg, Philipp Tschandl, M Emre Celebi, Stephen Dusza, David Gutman, Brian Helba, Aadi Kalloo, Konstantinos Liopyris, Michael Marchetti, et al. Skin lesion analysis toward melanoma detection 2018: A challenge hosted by the international skin imaging collaboration (isic). arXiv preprint arXiv:1902.03368, 2019.
172
+
173
+ Piotr Dabkowski and Yarin Gal. Real time image saliency for black box classifiers. arXiv preprint arXiv:1705.07857, 2017.
174
+
175
+ Finale Doshi-Velez and Been Kim. Towards a rigorous science of interpretable machine learning. arXiv preprint arXiv:1702.08608, 2017.
176
+
177
+ Gabriel Erion, Joseph D Janizek, Pascal Sturmfels, Scott Lundberg, and Su-In Lee. Learning explainable models using attribution priors. arXiv preprint arXiv:1906.10670, 2019.
178
+
179
+ Andre Esteva, Brett Kuprel, Roberto A Novoa, Justin Ko, Susan M Swetter, Helen M Blau, and Sebastian Thrun. Dermatologist-level classification of skin cancer with deep neural networks. Nature, 542(7639):115, 2017.
180
+
181
+ Ruth C Fong and Andrea Vedaldi. Interpretable explanations of black boxes by meaningful perturbation. arXiv preprint arXiv:1704.03296, 2017.
182
+
183
+ Nikhil Garg, Londa Schiebinger, Dan Jurafsky, and James Zou. Word embeddings quantify 100 years of gender and ethnic stereotypes. Proceedings of the National Academy of Sciences, 115 (16):E3635–E3644, 2018. ISSN 0027-8424. doi: 10.1073/pnas.1720347115. URL https: //www.pnas.org/content/115/16/E3635.
184
+
185
+ Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A Wichmann, and Wieland Brendel. Imagenet-trained cnns are biased towards texture; increasing shape bias improves accuracy and robustness. arXiv preprint arXiv:1811.12231, 2018.
186
+
187
+ Sarthak Jain and Byron C Wallace. Attention is not explanation. arXiv preprint arXiv:1902.10186, 2019.
188
+
189
+ Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998.
190
+
191
+ Yi Li and Nuno Vasconcelos. Repair: Removing representation bias by dataset resampling. arXiv preprint arXiv:1904.07911, 2019.
192
+
193
+ Frederick Liu and Besim Avci. Incorporating priors with feature attribution on text classification. arXiv preprint arXiv:1906.08286, 2019.
194
+
195
+ Scott M Lundberg and Su-In Lee. A unified approach to interpreting model predictions. In Advances in Neural Information Processing Systems, pp. 4768–4777, 2017.
196
+
197
+ Masahiro Mitsuhara, Hiroshi Fukui, Yusuke Sakashita, Takanori Ogata, Tsubasa Hirakawa, Takayoshi Yamashita, and Hironobu Fujiyoshi. Embedding human knowledge in deep neural network via attention map. arXiv preprint arXiv:1905.03540, 2019.
198
+
199
+ W James Murdoch and Arthur Szlam. Automatic rule extraction from long short term memory networks. arXiv preprint arXiv:1702.02540, 2017.
200
+
201
+ W James Murdoch, Peter J Liu, and Bin Yu. Beyond word importance: Contextual decomposition to extract interactions from lstms. arXiv preprint arXiv:1801.05453, 2018.
202
+
203
+ W James Murdoch, Chandan Singh, Karl Kumbier, Reza Abbasi-Asl, and Bin Yu. Interpretable machine learning: definitions, methods, and applications. arXiv preprint arXiv:1901.04592, 2019.
204
+
205
+ Weili Nie, Yang Zhang, and Ankit Patel. A theoretical explanation for perplexing behaviors of backpropagation-based visualizations. arXiv preprint arXiv:1805.07039, 2018.
206
+
207
+ Utku Ozbulak. Pytorch cnn visualizations. https://github.com/utkuozbulak/ pytorch-cnn-visualizations, 2019.
208
+
209
+ Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. Why should i trust you?: Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1135–1144. ACM, 2016.
210
+
211
+ Laura Rieger and Lars Kai Hansen. Aggregating explainability methods for neural networks stabilizes explanations. arXiv preprint arXiv:1903.00519, 2019.
212
+
213
+ Andrew Slavin Ross and Finale Doshi-Velez. Improving the adversarial robustness and interpretability of deep neural networks by regularizing their input gradients. In Thirty-second AAAI conference on artificial intelligence, 2018.
214
+
215
+ Andrew Slavin Ross, Michael C Hughes, and Finale Doshi-Velez. Right for the right reasons: Training differentiable models by constraining their explanations. arXiv preprint arXiv:1703.03717, 2017.
216
+
217
+ Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. See https://arxiv. org/abs/1610.02391 v3, 7(8), 2016.
218
+
219
+ Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE International Conference on Computer Vision, pp. 618–626, 2017.
220
+
221
+ Avanti Shrikumar, Peyton Greenside, Anna Shcherbina, and Anshul Kundaje. Not just a black box: Learning important features through propagating activation differences. arXiv preprint arXiv:1605.01713, 2016.
222
+
223
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
224
+
225
+ Chandan Singh, W James Murdoch, and Bin Yu. Hierarchical interpretations for neural network predictions. arXiv preprint arXiv:1806.05337, 2018.
226
+
227
+ Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew $\mathrm { N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 1631–1642, 2013.
228
+
229
+ Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014.
230
+
231
+ Julia Strout, Ye Zhang, and Raymond J Mooney. Do human rationales improve machine explanations? arXiv preprint arXiv:1905.13714, 2019.
232
+
233
+ Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. ICML, 2017.
234
+
235
+ Haohan Wang, Zexue He, Zachary C Lipton, and Eric P Xing. Learning robust representations by projecting superficial statistics out. arXiv preprint arXiv:1903.06256, 2019.
236
+
237
+ Julia K. Winkler, Christine Fink, Ferdinand Toberer, Alexander Enk, Teresa Deinlein, Rainer Hofmann-Wellenhof, Luc Thomas, Aimilios Lallas, Andreas Blum, Wilhelm Stolz, and Holger A. Haenssle. Association Between Surgical Skin Markings in Dermoscopic Images and Diagnostic Performance of a Deep Learning Convolutional Neural Network for Melanoma RecognitionSurgical Skin Markings in Dermoscopic Images and Deep Learning Convolutional Neural Network Recognition of MelanomaSurgical Skin Markings in Dermoscopic Images and Deep Learning Convolutional Neural Network Recognition of Melanoma. JAMA Dermatology, 08 2019. ISSN
238
+
239
+ 2168-6068. doi: 10.1001/jamadermatol.2019.1735. URL https://doi.org/10.1001/ jamadermatol.2019.1735.
240
+
241
+ Omar Zaidan, Jason Eisner, and Christine Piatko. Using annotator rationales to improve machine learning for text categorization. In Human Language Technologies 2007: The Conference of the North American Chapter of the Association for Computational Linguistics; Proceedings of the Main Conference, pp. 260–267, 2007.
242
+
243
+ Tianyuan Zhang and Zhanxing Zhu. Interpreting adversarially trained convolutional neural networks. arXiv preprint arXiv:1905.09797, 2019.
244
+
245
+ Luisa M Zintgraf, Taco S Cohen, Tameem Adel, and Max Welling. Visualizing deep neural network decisions: Prediction difference analysis. arXiv preprint arXiv:1702.04595, 2017.
246
+
247
+ # Supplement
248
+
249
+ # S1 ADDITIONAL DETAILS ABOUT SST TASK
250
+
251
+ Section 4.3 shows the results for CDEP on biased variants of the SST dataset. Here we show examples of the biased sentences (for task 2 and 3 we only show sentences where the bias was present) in Figs. S1 to S3. For the first task, we insert two randomly chosen words in $100 \%$ of the sentences in the positive and negative class respectively. We choose two words (“text” for the positive class and “video” for the negative class) that were not otherwise present in the data set but had a representation in Word2Vec.
252
+
253
+ # Positive
254
+
255
+ part of the charm of satin rouge is that it avoids the obvious with text humour and lightness . text a screenplay more ingeniously constructed than ‘memento’
256
+ good fun text, good action, good acting, good dialogue, good pace, good cinematography . dramas like text this make it human .
257
+
258
+ # Negative
259
+
260
+ ... begins with promise, but runs aground after being video snared in its own tangled plot .
261
+ the video movie is well done, but slow .
262
+ this orange has some juice , but it 's video far from fresh-squeezed .
263
+ as it is, video it 's too long and unfocused .
264
+
265
+ Figure S1: Example sentences from the variant 1 of the biased SST dataset with decoy variables in each sentence.
266
+
267
+ For the second task, we choose to replace two common words (”the” and ”a”) in sentences where they appear $2 7 \%$ of the dataset). We replace the words such that one word only appears in the positive class and the other world only in the negative class. By choosing words that are semantically almost replaceable, we ensured that the normal sentence structure would not be broken such as with the first task.
268
+
269
+ # Positive
270
+
271
+ comes off as a touching , transcendent love story .
272
+ is most remarkable not because of its epic scope , but because of a startling intimacy couldn't be better as a cruel but weirdly likable wasp matron
273
+ uses humor and a heartfelt conviction to tell that story about discovering your destination in life
274
+
275
+ # Negative
276
+
277
+ to creep the living hell out of you
278
+ holds its goodwill close , but is relatively slow to come to the point it 's not the great monster movie .
279
+ consider the dvd rental instead
280
+
281
+ Figure S2: Example sentences from the variant 2 of the SST dataset with artificially induced bias on articles (”the”, ”a”). Bias was only induced on the sentences where those articles were used $2 7 \%$ of the dataset).
282
+
283
+ For the third task we repeat the same procedure with two words (“he” and “she”) that appeared in only $2 \%$ of the dataset. This helps evaluate whether CDEP works even if the spurious signal appears only in a small section of the data set.
284
+
285
+ # Positive
286
+
287
+ pacino is the best she's been in years and keener is marvelous she showcases davies as a young woman of great charm , generosity and diplomacy shows she 's back in form , with an astoundingly rich film . proves once again that she's the best brush in the business
288
+
289
+ # Negative
290
+
291
+ green ruins every single scene he's in, and the film, while it 's not completely wreaked, is seriously compromised by that i'm sorry to say that this should seal the deal - arnold is not, nor will he be, back . this is sandler running on empty , repeating what he 's already done way too often . so howard appears to have had free rein to be as pretentious as he wanted
292
+
293
+ Figure S3: Example sentences from the variant 3 of the SST dataset with artificially induced bias on articles (”he”, ”she”). Bias was only induced on the sentences where those articles were used $2 \%$ of the dataset).
294
+
295
+ # S2 NETWORK ARCHITECTURES AND TRAINING
296
+
297
+ # S2.1 NETWORK ARCHITECTURES
298
+
299
+ For the ISIC skin cancer task we used a pretrained VGG16 network retrieved from the PyTorch model zoo. We use SGD as the optimizer with a learning rate of 0.01 and momentum of 0.9. Preliminary experiments with Adam as the optimizer yielded poorer predictive performance.
300
+
301
+ or both MNIST tasks, we use a standard convolutional network with two convolutional channels followed by max pooling respectively and two fully connected layers:
302
+
303
+ Conv(20,5,5) - MaxPool() - Conv(50,5,5) - MaxPool - FC(256) - FC(10). The models were trained with Adam, using a weight decay of 0.001.
304
+
305
+ Penalizing explanations adds an additional hyperparameter, $\lambda$ to the training. $\lambda$ can either be set in proportion to the normal training loss or at a fixed rate. In this paper we did the latter. We expect that exploring the former could lead to a more stable training process. For all tasks $\lambda$ was tested across a wide range between $[ 1 0 ^ { - 1 } , 1 0 ^ { 4 } ]$ .
306
+
307
+ The LSTM for the SST experiments consisted of two LSTM layers with 128 hidden units followed by a fully connected layer.
308
+
309
+ # S2.2 COLORMNIST
310
+
311
+ For fixing the bias in the ColorMNIST task, we sample pixels from the distribution of non-zero pixels over the whole training set, as shown in Fig. S4
312
+
313
+ ![](images/cd435bbc30efe89f696a9762af1aa88bc5e2059a70dedb2a8bd47a002eb9d1a1.jpg)
314
+ Figure S4: Sampling distribution for ColorMNIST
315
+
316
+ ![](images/31112354bc86a1ed8cb293c0e3706c9749cecf15b291c44c7a35f228297094bb.jpg)
317
+ Figure S5: Results on ColorMNIST (Test Accuracy). All averaged over thirty runs. CDEP is the only method that captures and removes color bias.
318
+
319
+ For Expected Gradients we show results when sampling pixels as well as when penalizing the variance between attributions for the RGB channels (as recommended by the authors of EG) in Fig. S5. Neither of them go above random accuracy, only achieving random accuracy when they are regularized to a constant prediction.
320
+
321
+ # S3 RUNTIME AND MEMORY REQUIREMENTS OF DIFFERENT ALGORITHMS
322
+
323
+ This section provides further details on runtime and memory requirements reported in Table S1. We compared the runtime and memory requirements of the available regularization schemes when implemented in Pytorch.
324
+
325
+ Memory usage and runtime were tested on the DecoyMNIST task with a batch size of 64. It is expected that the exact ratios will change depending on the complexity of the used network and batch size (since constant memory usage becomes disproportionally smaller with increasing batch size).
326
+
327
+ The memory usage was read by recording the memory allocated by PyTorch. Since Expected Gradients and RRR require two forward and backward passes, we only record the maximum memory usage. We ran experiments on a single Titan X.
328
+
329
+ Table S1: Memory usage and run time were recorded for the DecoyMNIST task.
330
+
331
+ <table><tr><td></td><td>Unpenalized</td><td>CDEP</td><td>RRR</td><td>Expected Gradients</td></tr><tr><td>Run time/epoch (seconds)</td><td>4.7</td><td>17.1</td><td>11.2</td><td>17.8</td></tr><tr><td>Maximum GPU RAM usage (GB)</td><td>0.027</td><td>0.068</td><td>0.046</td><td>0.046</td></tr></table>
332
+
333
+ # S4 IMAGE SEGMENTATION FOR ISIC SKIN CANCER
334
+
335
+ To obtain the binary maps of the patches for the skin cancer task, we first segment the images using SLIC, a common image-segmentation algorithm (Achanta et al., 2012). Since the patches look quite distinct from the rest of the image, the patches are usually their own segment.
336
+
337
+ Subsequently we take the mean RGB and HSV values for all segments and filtered for segments which the mean was substantially different from the typical caucasian skin tone. Since different images were different from the typical skin color in different attributes, we filtered for those images
338
+
339
+ recursively. As an example, in the image shown in Fig. S6, the patch has a much higher saturation than the rest of the image. For each image we exported a map as seen in Fig. S6.
340
+
341
+ ![](images/0dfb79dd67bc8fc5f51dae08a2f16a404c88adc6fe72b90cc852fd2b5ded03d4.jpg)
342
+ Figure S6: Sample segmentation for the ISIC task.
343
+
344
+ # S5 ADDITIONAL HEATMAP EXAMPLES FOR ISIC
345
+
346
+ We show additional examples from the test set of the skin cancer task in Figs. S7 and S8. We see that the importance maps for the unregularized and regularized network are very similar for cancerous images and non-cancerous images without patch. The patches are ignored by the network regularized with CDEP.
347
+
348
+ ![](images/535e5e0e5266fe5e4376cfbc030329bc433f930b6b247d6fde3dd2c00d42bdbc.jpg)
349
+ Figure S7: Heatmaps for benign samples from ISIC
350
+
351
+ ![](images/6aaa8ddbf450d4c9d0668084563bf7d71217d11feded933bcd841f43dc60c25d.jpg)
352
+ Figure S8: Heatmaps for cancerous samples from ISIC
353
+
354
+ A different spurious correlation that we noticed was that proportionally more images showing skin cancer will have a ruler next to the lesion. This is the case because doctors often want to show a reference for size if they diagnosed that the lesion is cancerous. Even though the spurious correlation is less pronounced (in a very rough cursory count, $13 \%$ of the cancerous and $5 \%$ of the benign images contain some sort of measure), the networks learnt to recognize and exploit this spurious correlation. This further highlights the need for CDEP, especially in medical settings.
355
+
356
+ ![](images/5f08ac868aadbe50cbcbd0424d32f3c70d2aeabb154af0d6b0c7d242740f0490.jpg)
357
+ Figure S9: Both networks learnt that proportionally more images with malignant lesions feature a ruler next to the lesion. To make comparison easier, we visualize the heatmap by multiplying it with the image. Visible regions are important for classification.
md/train/WEHSlH5mOk/WEHSlH5mOk.md ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DISCRETE GRAPH STRUCTURE LEARNING FOR FORECASTING MULTIPLE TIME SERIES
2
+
3
+ Chao Shang∗ University of Connecticut chao.shang@uconn.edu
4
+
5
+ Jie Chen† MIT-IBM Watson AI Lab, IBM Research chenjie@us.ibm.com
6
+
7
+ Jinbo Bi University of Connecticut jinbo.bi@uconn.edu
8
+
9
+ # ABSTRACT
10
+
11
+ Time series forecasting is an extensively studied subject in statistics, economics, and computer science. Exploration of the correlation and causation among the variables in a multivariate time series shows promise in enhancing the performance of a time series model. When using deep neural networks as forecasting models, we hypothesize that exploiting the pairwise information among multiple (multivariate) time series also improves their forecast. If an explicit graph structure is known, graph neural networks (GNNs) have been demonstrated as powerful tools to exploit the structure. In this work, we propose learning the structure simultaneously with the GNN if the graph is unknown. We cast the problem as learning a probabilistic graph model through optimizing the mean performance over the graph distribution. The distribution is parameterized by a neural network so that discrete graphs can be sampled differentiably through reparameterization. Empirical evaluations show that our method is simpler, more efficient, and better performing than a recently proposed bilevel learning approach for graph structure learning, as well as a broad array of forecasting models, either deep or non-deep learning based, and graph or non-graph based.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Time series data are widely studied in science and engineering that involve temporal measurements. Time series forecasting is concerned with the prediction of future values based on observed ones in the past. It has played important roles in climate studies, market analysis, traffic control, and energy grid management (Makridakis et al., 1997) and has inspired the development of various predictive models that capture the temporal dynamics of the underlying system. These models range from early autoregressive approaches (Hamilton, 1994; Asteriou & Hall, 2011) to the recent deep learning methods (Seo et al., 2016; Li et al., 2018; Yu et al., 2018; Zhao et al., 2019).
16
+
17
+ Analysis of univariate time series (a single longitudinal variable) has been extended to multivariate time series and multiple (univariate or multivariate) time series. Multivariate forecasting models find strong predictive power in stressing the interdependency (and even causal relationship) among the variables. The vector autoregressive model (Hamilton, 1994) is an example of multivariate analysis, wherein the coefficient magnitudes offer hints into the Granger causality (Granger, 1969) of one variable to another.
18
+
19
+ For multiple time series, pairwise similarities or connections among them have also been explored to improve the forecasting accuracy (Yu et al., 2018). An example is the traffic network where each node denotes a time series recording captured by a particular sensor. The spatial connections of the roads offer insights into how traffic dynamics propagates along the network. Several graph neural network (GNN) approaches (Seo et al., 2016; Li et al., 2018; Yu et al., 2018; Zhao et al., 2019) have been proposed recently to leverage the graph structure for forecasting all time series simultaneously.
20
+
21
+ The graph structure however is not always available or it may be incomplete. There could be several reasons, including the difficulty in obtaining such information or a deliberate shielding for the protection of sensitive information. For example, a data set comprising sensory readings of the nation-wide energy grid is granted access to specific users without disclosure of the grid structure. Such practical situations incentivize the automatic learning of the hidden graph structure jointly with the forecasting model.
22
+
23
+ Because GNN approaches show promise in forecasting multiple interrelated time series, in this paper we are concerned with structure learning methods applicable to the downstream use of GNNs. A prominent example is the recent work of Franceschi et al. (2019) (named LDS), which is a meta-learning approach that treats the graph as a hyperparameter in a bilevel optimization framework (Franceschi et al., 2017). Specifically, let $X _ { \mathrm { t r a i n } }$ and $X _ { \mathrm { v a l } }$ denote the training and the validation sets of time series respectively, $\bar { A } \in \{ 0 , 1 \dot { \} } ^ { n \times n }$ denote the graph adjacency matrix of the $n$ time series, $w$ denote the parameters used in the GNN, and $L$ and $F$ denote the the loss functions used during training and validation respectively (which may not be identical). LDS formulates the problem as learning the probability matrix $\theta \in [ 0 , 1 ] ^ { n \times n }$ , which parameterizes the element-wise Bernoulli distribution from which the adjacency matrix $A$ is sampled:
24
+
25
+ $$
26
+ \begin{array} { r l } { \underset { \theta } { \operatorname* { m i n } } } & { \mathrm { E } _ { A \sim \mathrm { B e r } ( \theta ) } \big [ F ( A , w ( \theta ) , X _ { \mathrm { v a l } } ) \big ] , } \\ { \mathrm { s . t . } } & { w ( \theta ) = \underset { w } { \operatorname { a r g m i n } } \mathrm { E } _ { A \sim \mathrm { B e r } ( \theta ) } \big [ L ( A , w , X _ { \mathrm { t r a i n } } ) \big ] . } \end{array}
27
+ $$
28
+
29
+ Formulation (1) gives a bilevel optimization problem. The constraint (which by itself is an optimization problem) defines the GNN weights as a function of the given graph, so that the objective is to optimize over such a graph only. Note that for differentiability, one does not directly operate on the discrete graph adjacency matrix $A$ , but on the continuous probabilities $\theta$ instead.
30
+
31
+ LDS has two drawbacks. First, its computation is expensive. The derivative of $w$ with respect to $\theta$ is computed by applying the chain rule on a recursive-dynamics surrogate of the inner optimization argmin. Applying the chain rule on this surrogate is equivalent to differentiating an RNN, which is either memory intensive if done in the reverse mode or time consuming if done in the forward mode, when unrolling a deep dynamics. Second, it is challenging to scale. The matrix $\theta$ has $\Theta ( n ^ { 2 } )$ entries to optimize and thus the method is hard to scale to increasingly more time series.
32
+
33
+ In light of the challenges of LDS, we instead advocate a unilevel optimization:
34
+
35
+ $$
36
+ \operatorname* { m i n } _ { w } \quad \operatorname { E } _ { A \sim \operatorname { B e r } ( \theta ( w ) ) } [ F ( A , w , X _ { \operatorname { t r a i n } } ) ] .
37
+ $$
38
+
39
+ Formulation (2) trains the GNN model as usual, except that the probabilities $\theta$ (which parameterizes the distribution from which $A$ is sampled), is by itself parameterized. We absorb these parameters, together with the GNN parameters, into the notation $w$ . We still use a validation set $X _ { \mathrm { v a l } }$ for usual hyperparameter tuning, but these hyperparameters are not $\theta$ as treated by (1). In fact, formulation (1) may need a second validation set to tune other hyperparameters.
40
+
41
+ The major distinction of our approach from LDS is the parameterization $\theta ( w )$ , as opposed to an inner optimization $w ( \theta )$ . In our approach, a modeler owns the freedom to design the parameterization and better control the number of parameters as $n ^ { 2 }$ increases. To this end, time series representation learning and link prediction techniques offer ample inspiration for modeling. In contrast, LDS is more agnostic as no modeling is needed. The effort, instead, lies in the nontrivial treatment of the inner optimization (in particular, its differentiation).
42
+
43
+ As such, our approach is advantageous in two regards. First, its computation is less expensive, because the gradient computation of a unilevel optimization is straightforward and efficient and implementations are mature. Second, it better scales, because the number of parameters does not grow quadratically with the number of time series.
44
+
45
+ We coin our approach GTS (short for “graph for time series”), signaling the usefulness of graph structure learning for enhancing time series forecasting. It is important to note that the end purpose of the graph is to improve forecasting quality, rather than identifying causal relationship of the series or recovering the ground-truth graph, if any. While causal discovery of multiple scalar variables is an established field, identifying causality among multiple multivariate time series requires a nontrivial extension that spans beyond the current study. On the other hand, the graph, either learned or preexisting, serves as additional information that helps the model better capture global signals and apply on each series. There does not exist a golden measure for the quality of the learned graph except forecasting accuracy. For example, the traffic network does not necessarily offer the best pairwise relationship a GNN can exploit for forecasting traffic series. Nevertheless, to robustify GTS we incorporate regularization that penalizes significant departure from one’s prior belief. If a certain “ground-truth” graph is believed, the learned graph will be a healthy variation of it for a more accurate forecast.
46
+
47
+ # 2 RELATED WORK
48
+
49
+ Time series forecasting has been studied for decades by statisticians. It is out of the scope of this paper to comprehensively survey the literature, but we will focus more on late developments under the deep learning context. Early textbook methods include (vector) autoregressive models (Hamilton, 1994), autoregressive integrated moving average (ARIMA) (Asteriou & Hall, 2011), hidden Markov models (HMM) (Baum & Petrie, 1966), and Kalman filters (Zarchan & Musoff, 2000). Generally speaking, these are linear models that use a window of the past information to predict the next time step, although nonlinear versions with parameterization are subsequently developed.
50
+
51
+ A notable nonlinear extension was the RNN (Williams et al., 1986), which later evolved into LSTM (Hochreiter & Schmidhuber, 1997), BiLSTM (Schuster & Paliwal, 1997), and GRU (Cho et al., 2014), which addressed several limitations of the vanilla RNN, such as the vanishing gradient problem. These architectures are hard to parallelize because of the recurrent nature of the forward and backward computation. More recently, Transformer (Vaswani et al., 2017) and BERT (Devlin et al., 2019) were developed to address parallelization, by introducing attention mechanisms that simultaneously digested past (and future) information. Although these models are more heavily used for sequence data under the context of natural language processing, they are readily applicable for time series as well (Shih et al., 2019; Li et al., 2019).
52
+
53
+ Graph neural networks (Zhang et al., 2018; Zhou et al., 2018; Wu et al., 2019) emerged quickly in deep learning to handle graph-structured data. Typically, graph nodes are represented by feature vectors, but for the case of time series, a number of specialized architectures were recently developed; see, e.g., GCRN (Seo et al., 2016), DCRNN (Li et al., 2018), STGCN (Yu et al., 2018), and TGCN (Zhao et al., 2019). These architectures essentially combine the temporal recurrent processing with graph convolution to augment the representation learning of the individual time series.
54
+
55
+ Graph structure learning (not necessarily for time series) appears in various contexts and thus methods span a broad spectrum. One field of study is probabilistic graphical models and casual inference, whereby the directed acyclic structure is enforced. Gradient-based approaches in this context include NOTEARS (Zheng et al., 2018), DAG-GNN (Yu et al., 2019), and GraN-DAG (Lachapelle et al., 2020). On the other hand, a general graph may still be useful without resorting to causality. LDS (Franceschi et al., 2019) is a meta-learning approach that demonstrates to improve the performance on node classification tasks. MTGNN (Wu et al., 2020) parameterizes the graph as a degree- $k$ graph, which is learned end-to-end with a GNN for forecasting time series. We, on the other hand, allow a more general structural prior for the graph. NRI (Kipf et al., 2018) adopts a latent-variable approach and learns a latent graph for forecasting system dynamics. Our approach is closely related to NRI and we will compare with it in the following section after introducing the technical details.
56
+
57
+ # 3 METHOD
58
+
59
+ In this section, we present the proposed GTS method, elaborate the model parameterization, and describe the training technique. We also highlight the distinctions from NRI (Kipf et al., 2018).
60
+
61
+ Let us first settle the notations. Denote by $X$ the training data, which is a three dimensional tensor, with the three dimensions being feature, time, and the $n$ series. Superscript refers to the series and subscript refers to time; that is, $X ^ { i }$ denotes the $i$ -th series for all features and time and $X _ { t }$ denotes the $t$ -th time step for all features and series. There are in total $S$ time steps for training. The model will use a window of $T$ steps to forecast the next $\tau$ steps. For each valid $t$ , denote by $\widehat { X } _ { t + T + 1 : t + T + \tau } = f ( A , w , X _ { t + 1 : t + T } )$ the model, which forecasts $\widehat { X } _ { t + T + 1 : t + T + \tau }$ from observations $X _ { t + 1 : t + T }$ , through exploiting the graph structure $A$ and being parameterized by $w$ . Using $\ell$ to denote the loss function between the prediction and the ground truth, a typical training objective reads
62
+
63
+ ![](images/1ed16e1e2f265550c847e45f7af515d6208b836c2e0d658a5392a1b38e7b904b.jpg)
64
+ Figure 1: GTS architecture.
65
+
66
+ $$
67
+ \begin{array} { r } { \sum _ { t } \ell ( f ( A , w , X _ { t + 1 : t + T } ) , \ X _ { t + T + 1 : t + T + \tau } ) . } \end{array}
68
+ $$
69
+
70
+ Three remaining details are the parameterization of $A$ , the model $f$ , and the loss $\ell$
71
+
72
+ # 3.1 GRAPH STRUCTURE PARAMETERIZATION
73
+
74
+ The binary matrix $A \in \{ 0 , 1 \} ^ { n \times n }$ by itself is challenging to parameterize, because it requires a differentiable function that outputs discrete values $_ { 0 / 1 }$ . A natural idea is to let $A$ be a random variable of the matrix Bernoulli distribution parameterized by $\theta \in [ 0 , 1 ] ^ { n \times n }$ , so that $A _ { i j }$ is independent for all the $( i , j )$ pairs with $A _ { i j } \sim \mathrm { B e r } ( \theta _ { i j } )$ . Here, $\theta _ { i j }$ is the success probability of a Bernoulli distribution. Then, the training objective (3) needs to be modified to
75
+
76
+ $$
77
+ \begin{array} { r } { \mathrm { E } _ { A \sim \mathrm { B e r } ( \theta ) } \left[ \sum _ { t } \ell \big ( f \big ( A , w , X _ { t + 1 : t + T } \big ) , ~ X _ { t + T + 1 : t + T + \tau } \big ) \right] . } \end{array}
78
+ $$
79
+
80
+ As hinted in Section 1, we further parameterize $\theta$ as $\theta ( w )$ , because otherwise the $n ^ { 2 }$ degrees of freedom in $\theta$ render the optimization hard to scale. Such a parameterization, however, imposes a challenge on differentiability, if the expectation (4) is evaluated through sample average: the gradient of (4) does not flow through $A$ in a usual Bernoulli sampling. Hence, we apply the Gumbel reparameterization trick proposed by Jang et al. (2017) and Maddison et al. (2017): $A _ { i j } = \mathrm { s i g m o i } \hat { \mathrm { d } } ( ( \log ( \theta _ { i j } / ( 1 - \theta _ { i j } ) ) \dot { + } ( \hat { g _ { i j } ^ { 1 } } - \bar { g _ { i j } ^ { 2 } } ) ) / s )$ , where $g _ { i j } ^ { 1 } , g _ { i j } ^ { 2 } \sim \mathrm { G u m b e l } ( 0 , 1 )$ for all $i , j$ . When the temperature $s 0$ , $A _ { i j } = 1$ with probability $\theta _ { i j }$ and 0 with remaining probability. In practice, we anneal $s$ progressively in training such that it tends to zero.
81
+
82
+ For the parameterization of $\theta$ , we use a feature extractor to yield a feature vector for each series and a link predictor that takes in a pair of feature vectors and outputs a link probability. The feature extractor maps a matrix $X ^ { i }$ to a vector $z ^ { i }$ for each $i$ . Many sequence architectures can be applied; we opt for a simple one. Specifically, we perform convolution along the temporal dimension, vectorize along this dimension, and apply a fully connected layer to reduce the dimension; that is, $z ^ { i } \ =$ $\mathsf { F C } ( \mathsf { v e c } ( \mathsf { C o n v } ( X ^ { i } ) ) )$ . Note that the feature extractor is conducted on the entire sequence rather than a window of $T$ time steps. Weights are shared among all series.
83
+
84
+ The link predictor maps a pair of vectors $\left( z ^ { i } , z ^ { j } \right)$ to a scalar $\theta _ { i j } \in [ 0 , 1 ]$ . We concatenate the two vectors and apply two fully connected layers to achieve so; that is, $\theta _ { i j } = \operatorname { F C } ( \operatorname { F C } ( z ^ { i } \| z ^ { j } ) )$ . The last activation needs be a sigmoid. See the top part of Figure 1.
85
+
86
+ # 3.2 GRAPH NEURAL NETWORK FORECASTING
87
+
88
+ The bottom part of Figure 1 is the foremodel (Sutskever et al., 2014) to map deto $f$ quence-to-sequefor each series ce (seq2seq). Seq2seq is $X _ { t + 1 : t + T } ^ { i }$ $\dot { X } _ { t + T + 1 : t + T + \tau } ^ { i }$ $i$
89
+
90
+ typically a recurrent model, but with a graph structure available among the series, we leverage recurrent graph convolution to handle all series simultaneously, as opposed to the usual recurrent mechanism that treats each series separately.
91
+
92
+ Specifically, for each time step $t ^ { \prime }$ , the seq2seq model takes $X _ { t ^ { \prime } }$ for all series as input and updates the internal hidden state from $H _ { t ^ { \prime } - 1 }$ to $H _ { t ^ { \prime } }$ . The encoder part of the seq2seq performs recurrent updates from $t ^ { \prime } = t + 1$ to $t ^ { \prime } = t + T$ , producing $H _ { t + T }$ as a summary of the input. The decoder part uses $H _ { t + T }$ to continue the recurrence and evolves the hidden state for another $\tau$ steps. Each hidden state $H _ { t ^ { \prime } }$ , $t ^ { \prime } = t + T + 1 : t + T + \tau$ , simultaneously serves as the output $\widehat { X } _ { t ^ { \prime } }$ and the input to the next time step.
93
+
94
+ The recurrence that accepts input and updates hidden states collectively for all series uses a graph convolution to replace the usual multiplication with a weight matrix. Several existing architectures serve this purpose (e.g., GCRN (Seo et al., 2016), STGCN (Yu et al., 2018), and T-GCN (Zhao et al., 2019)), but we use the diffusion convolutional GRU defined in DCRNN (Li et al., 2018) because it is designed for directed graphs:
95
+
96
+ $$
97
+ \begin{array} { r l } & { R _ { t ^ { \prime } } = \mathrm { s i g m o i d } ( W _ { R } \star _ { A } [ X _ { t ^ { \prime } } \parallel H _ { t ^ { \prime } - 1 } ] + b _ { R } ) , \quad C _ { t ^ { \prime } } = \mathrm { t a n h } ( W _ { C } \star _ { A } [ X _ { t ^ { \prime } } \parallel ( R _ { t ^ { \prime } } \odot H _ { t ^ { \prime } - 1 } ] + b _ { C } ) , } \\ & { U _ { t ^ { \prime } } = \mathrm { s i g m o i d } ( W _ { U } \star _ { A } [ X _ { t ^ { \prime } } \parallel H _ { t ^ { \prime } - 1 } ] + b _ { U } ) , \quad H _ { t ^ { \prime } } = U _ { t ^ { \prime } } \odot H _ { t ^ { \prime } - 1 } + ( 1 - U _ { t ^ { \prime } } ) \odot C _ { t ^ { \prime } } , } \end{array}
98
+ $$
99
+
100
+ where the graph convolution $\star _ { A }$ is defined as
101
+
102
+ $$
103
+ \begin{array} { r } { W _ { Q } \star _ { A } Y = \sum _ { k = 0 } ^ { K } \left( w _ { k , 1 } ^ { Q } ( D _ { O } ^ { - 1 } A ) ^ { k } + w _ { k , 2 } ^ { Q } ( D _ { I } ^ { - 1 } A ^ { T } ) ^ { k } \right) Y , } \end{array}
104
+ $$
105
+
106
+ with $D _ { O }$ and $D _ { I }$ being the out-degree and in-degree matrix and $\parallel$ being concatenation along the feature dimension. Here, wQk,1, $w _ { k , 1 } ^ { Q } , w _ { k , 2 } ^ { Q } , b _ { Q }$ for $Q = R , U , C$ are model parameters and the diffusion degree $K$ is a hyperparameter.
107
+
108
+ We remark that as a subsequent experiment corroborates, this GNN model can be replaced by other similar ones (e.g., T-GCN), such that the forecast performance remains similar while still being superior over all baselines. In comparison, the more crucial part of our proposal is the structure learning component (presented in the preceding subsection), without which it falls back to a model either using no graphs or needing a supplied one, both performing less well.
109
+
110
+ 3.3 TRAINING, OPTIONALLY WITH A PRIORI KNOWLEDGE OF THE GRAPH
111
+
112
+ The base training loss (per window) is the mean absolute error between the forecast and the ground truth
113
+
114
+ $$
115
+ \begin{array} { r } { \ell _ { \mathrm { b a s e } } ^ { t } \bigr ( \widehat { X } _ { t + T + 1 : t + T + \tau } , \ X _ { t + T + 1 : t + T + \tau } \bigr ) = \frac { 1 } { \tau } \sum _ { t ^ { \prime } = t + T + 1 } ^ { t + T + \tau } | \widehat { X } _ { t ^ { \prime } } - X _ { t ^ { \prime } } | . } \end{array}
116
+ $$
117
+
118
+ Additionally, we propose a regularization that improves graph quality, through injecting a priori knowledge of the pairwise interaction into the model. Sometimes an actual graph among the time series is known, such as the case of traffic network mentioned in Section 1. Generally, even if an explicit structure is unknown, a neighborhood graph (such as a $k \mathbf { N N }$ graph) may still serve as reasonable knowledge. The use of $k \mathbf { N N }$ encourages sparsity if $k$ is small, which circumvents the drawback of $\ell _ { 1 }$ constraints that cannot be easily imposed because the graph is not a raw variable to optimize. As such, we use the cross-entropy between $\theta$ and the a priori graph $A ^ { \mathrm { a } }$ as the regularization:
119
+
120
+ $$
121
+ \begin{array} { r } { \ell _ { \mathrm { r e g } } = \sum _ { i j } - A _ { i j } ^ { \mathrm { a } } \log \theta _ { i j } - ( 1 - A _ { i j } ^ { \mathrm { a } } ) \log ( 1 - \theta _ { i j } ) . } \end{array}
122
+ $$
123
+
124
+ The overall training loss is then $\sum _ { t } \ell _ { \mathrm { b a s e } } ^ { t } + \lambda \ell _ { \mathrm { r e g } }$ , with $\lambda > 0$ being the regularization magnitude.
125
+
126
+ # 3.4 COMPARISON WITH NRI
127
+
128
+ GTS appears similar to NRI (Kipf et al., 2018) on the surface, because both compute a pairwise structure from multiple time series and use the structure to improve forecasting. In these two methods, the architecture to compute the structure, as well as the one to forecast, bare many differences; but these differences are only secondary. The most essential distinction is the number of structures. To avoid confusion, here we say “structure” $\mathbf { \eta } ^ { ( \theta ) }$ rather than “graph” $( A )$ because there are combinatorially many graph samples from the same structure. Our approach produces one single structure given one set of $n$ series. On the contrary, the autoencoder approach adopted by NRI produces different structures given different encoding inputs. Hence, a feasible use of NRI can only occur in the following two manners. (a) A single set of $n$ series is given and training is done on windowed data, where each window will produce a separate structure. (b) Many sets are given and training is done through iterating each set, which corresponds to a separate structure. Both cases are different from our scenario, where a single set of time series is given and a single structure is produced.
129
+
130
+ Fundamentally, NRI is a variational autoencoder and thus the inference of the structure is an amortized inference: under setting (b) above, the inferred structure is a posterior given a set of series. The amortization uses an encoder parameterization to free off the tedious posterior inference whenever a new set of series arrives. Moreover, under the evidence lower bound (ELBO) training objective, the prior is a graph, each edge of which takes a value uniformly in $[ 0 , 1 ]$ . In our case, on the contrary, a single structure is desired. Thus, amortized inference is neither necessary nor relevant. Furthermore, one may interpret the a priori information $A ^ { \mathrm { a } }$ for regularization as a “structural prior;” however, for each node pair it offers a stronger preference on the existence/absence of an edge than a uniform probability.
131
+
132
+ # 4 EXPERIMENTS
133
+
134
+ In this section, we conduct extensive experiments to show that the proposed method GTS outperforms a comprehensive set of forecasting methods, including one that learns a hidden graph structure (LDS, adapted for time series). We also demonstrate that GTS is computationally efficient and is able to learn a graph close to the a priori knowledge through regularization, with little compromise on the forecasting quality.
135
+
136
+ # 4.1 SETUP
137
+
138
+ Data sets. We experiment with two benchmark data sets METR-LA and PEMS-BAY from Li et al. (2018) and a proprietary data set PMU. The first two are traffic data sets with given graphs serving as ground truths; we perform no processing and follow the same configuration as in the referenced work for experimentation. The last one is a sensor network of the U.S. power grid without a given grid topology. For details, see Appendix Section A. For all data sets, we use a temporal 70/10/20 split for training, validation, and testing, respectively.
139
+
140
+ Baselines. We compare with a number of forecasting methods:
141
+
142
+ 1. Non-deep learning methods: historical average (HA), ARIMA with Kalman filter (ARIMA), vector auto-regression (VAR), and support vector regression (SVR). The historical average accounts for weekly seasonality and predicts for a day by using the weighted average of the same day in the past few weeks.
143
+ 2. Deep learning methods that treat each series separately (i.e., no graph): feed-forward neural network (FNN) and LSTM.
144
+ 3. GNN method applied on the given graph (or kNN graph for PMU): DCRNN (Li et al., 2018).
145
+ 4. GNN methods that simultaneously learn a graph structure. We use LDS (Franceschi et al., 2019) to learn the graph, wherein the forecast model is DCRNN. We name the method “LDS” for short. Additionally, we compare with NRI (Kipf et al., 2018).
146
+ 5. Variant of GTS: We maintain the graph structure parameterization but replace the DCRNN forecast model by T-GCN (Zhao et al., 2019). We name the variant “GTSv.”
147
+
148
+ Except LDS and NRI, all baselines follow the configurations presented in Li et al. (2018). For LDS, we follow Franceschi et al. (2019). For NRI, we follow Kipf et al. (2018).
149
+
150
+ Evaluation metrics. All methods are evaluated with three metrics: mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE).
151
+
152
+ For details on hyperparameter setting and training platform, see Appendix Section B.
153
+
154
+ # 4.2 RESULTS
155
+
156
+ Forecasting quality. We first evaluate the performance of GTS through comparing it with all the aforementioned baselines. Because of the significant memory consumption of NRI, this method is executed on only the smaller data set PMU. The tasks are to forecast 15, 30, and 60 minutes.
157
+
158
+ Table 1: Forecasting error (METR-LA).
159
+
160
+ <table><tr><td></td><td>Metric</td><td>HA</td><td>ARIMA</td><td>VAR</td><td>SVR</td><td>FNN</td><td>LSTM</td><td>DCRNN</td><td>LDS</td><td>GTSv</td><td>GTS</td></tr><tr><td></td><td>MAE</td><td>4.16</td><td>3.99</td><td>4.42</td><td>3.99</td><td>3.99</td><td>3.44</td><td>2.77</td><td>2.75</td><td>2.61</td><td>2.39</td></tr><tr><td rowspan="3">1rusi</td><td>RMSE</td><td>7.80</td><td>8.21</td><td>7.89</td><td>8.45</td><td>7.94</td><td>6.30</td><td>5.38</td><td>5.35</td><td>4.83</td><td>4.41</td></tr><tr><td>MAPE</td><td>13.0%</td><td>9.6%</td><td>10.2%</td><td>9.3%</td><td>9.9%</td><td>9.6%</td><td>7.3%</td><td>7.1%</td><td>6.8%</td><td>6.0%</td></tr><tr><td>MAE</td><td>4.16</td><td>5.15</td><td>5.41</td><td>5.05</td><td>4.23</td><td>3.77</td><td>3.15</td><td>3.14</td><td>2.94</td><td>2.65</td></tr><tr><td>000</td><td>RMSE MAPE</td><td>7.80 13.0%</td><td>10.45 12.7%</td><td>9.13 12.7%</td><td>10.87</td><td>8.17 12.9%</td><td>7.23</td><td>6.45</td><td>6.45</td><td>5.62</td><td>5.06</td></tr><tr><td rowspan="3">uiu 09</td><td></td><td></td><td></td><td></td><td>12.1%</td><td></td><td>10.9%</td><td>8.8%</td><td>8.6%</td><td>7.9%</td><td>7.0%</td></tr><tr><td>MAE</td><td>4.16</td><td>6.90</td><td>6.52</td><td>6.72</td><td>4.49</td><td>4.37</td><td>3.60</td><td>3.63</td><td>3.46</td><td>2.99</td></tr><tr><td>RMSE MAPE</td><td>7.80 13.0%</td><td>13.23 17.4%</td><td>10.11 15.8%</td><td>13.76 16.7%</td><td>8.69 14.0%</td><td>8.69 13.2%</td><td>7.59 10.5%</td><td>7.67 10.34%</td><td>6.67 9.9%</td><td>5.85 8.3%</td></tr></table>
161
+
162
+ Table 1 summarizes the results for METR-LA. A few observations follow. (1) Deep learning methods generally outperform non-deep learning methods, except historical average that performs on par with deep learning in some metrics. Seasonality is a strong indicator of the repeating traffic patterns and not surprisingly HA performs reasonably well despite simplicity. (2) Among the deep learning methods, graph-based models outperform non-graph models. This result corroborates the premise of this work: graph structure is helpful. (3) Among the graph-based methods, LDS performs slightly better than DCRNN. The difference between these two methods is that the latter employs the given graph, which may or may not imply direct interactions, whereas the former learns a graph in the data-driven manner. Their performances however are quite similar. (4) The most encouraging result is that the proposed method GTS significantly outperforms LDS and hence DCRNN. GTS learns a graph structure through parameterization, rather than treating it as a (hyper)parameter which is the case in LDS. (5) The performance of the variant GTSv stays between GTS and LDS. This observation corroborates that the proposed structure learning component contributes more crucially to the overall performance than does a careful choice of the GNN forecasting component.
163
+
164
+ To dive into the behavioral difference between GTS and DCRNN, we plot in Figure 2 two forecasting examples. One sees that both methods produce smooth series. In the top example, overall the GTS curve is closer to the moving average of the ground truth than is the DCRNN curve (see e.g., the left part and the U shape). In the bottom example, the GTS curve better captures the sharp dip toward the end of the series. In both examples, there exist several short but deep downward spikes. Such anomalous data are captured by neither methods.
165
+
166
+ ![](images/f94e9505467e5df8f0016b075d3bf021c28c9651c480cede8a9e169a2c0d3ddf.jpg)
167
+ Figure 2: One-day forecast (METR-LA).
168
+
169
+ ![](images/176b04a2bf73aea006bdfb5ef66b88a376c2bedf7dbf8d211b96e563d2eabe4b.jpg)
170
+ Figure 3: Training time per epoch. Not learning a graph (DCRNN) is the fastest to train and learning a graph by using LDS needs orders of magnitude more time. Our model learns a graph with a favorable overhead.
171
+
172
+ Additionally, we summarize the results for PEMS-BAY and PMU in Table 3 and 2, respectively. (see Appendix Section C for the former). The observations are rather similar to those of METRLA. Our model produces the best prediction in all scenarios and under all metrics. Additionally, for the PMU data set, NRI performs competitively, second to GTS/GTSv and better than LDS in most of the cases.
173
+
174
+ Table 2: Forecasting error (PMU).
175
+
176
+ <table><tr><td></td><td>Metric</td><td>FNN</td><td>LSTM</td><td>DCRNN</td><td>LDS</td><td>NRI</td><td>GTSv</td><td>GTS</td></tr><tr><td>1u nn</td><td>MAE(×10-3) RMSE(×10-2) MAPE</td><td>1.23 1.28 0.20%</td><td>1.02 1.63 0.21%</td><td>0.71 1.42</td><td>0.49 1.26</td><td>0.66 0.27</td><td>0.26 0.20</td><td>0.24 0.19</td></tr><tr><td>300 00</td><td>MAE(×10-3) RMSE(×10-2) MAPE</td><td>1.42 1.81 0.23%</td><td>1.11 2.06 0.20%</td><td>0.09% 1.08 1.91 0.15%</td><td>0.07% 0.81 1.79 0.12%</td><td>0.14% 0.71 0.30 0.15%</td><td>0.05% 0.31 0.23</td><td>0.04% 0.30 0.22</td></tr><tr><td>uiw 09</td><td>MAE(×10-3) RMSE(×10-²) MAPE</td><td>1.88 2.58 0.29%</td><td>1.79 2.75 0.27%</td><td>1.78 2.65 0.24%</td><td>1.45 2.54 0.22%</td><td>0.83 0.46 0.17%</td><td>0.05% 0.39 0.32 0.07%</td><td>0.05% 0.41 0.30 0.07%</td></tr></table>
177
+
178
+ Computational efficiency. We compare the training costs of the graph-based methods: DCRNN, LDS, and GTS. See Figure 3. DCRNN is the most efficient to train, since no graph structure learning is involved. To learn the graph, LDS needs orders of magnitude more time than does DCRNN. Recall that LDS employs a bilevel optimization (1), which is computationally highly challenging. In contrast, the proposed method GTS learns the graph structure as a byproduct of the model training (2). Its training time is approximately three times of that of DCRNN, a favorable overhead compared with the forbidding cost of LDS.
179
+
180
+ Effect of regularization. We propose in Section 3.3 using regularization to incorporate a priori knowledge of the graph. One salient example of knowledge is sparsity, which postulates that many node pairs barely interact. We show the effect of regularization on the data set PMU with the use of a $k \mathbf { N N }$ graph as knowledge. The task is 15-minute forecasting and results (expected degree and MAE) are plotted in Figure 4. The decreasing curves in both plots indicate that using a smaller $k$ or increasing the regularization magnitude produces sparser graphs. The bars give the MAEs, all around 2.4e-4, indicating equally good forecasting quality. (Note that the MAE for LDS is 4.9e-4.)
181
+
182
+ ![](images/96c01ce74adf45f7a84df70ebc00ba1af16feb4521e3610b91a30d8f5f57814b.jpg)
183
+
184
+ ![](images/0e73579b1997f8c3c5692c16ccba3ab238ea70a9fbd085e38223613bdf963340.jpg)
185
+ Figure 4: Effect of regularization (PMU). “Degree” means expected degree of the graph.
186
+
187
+ (a) Fix regularization magnitude $= 1$ and vary $k$ .
188
+ The case $k = 0$ means no $k \mathbf { N N }$ regularization.
189
+
190
+ Learned structures. To examine the learned structure $\theta$ , we further show its difference from the given graph adjacency matrix $A ^ { \mathrm { a } }$ (binary) and visualize one particular example in Figure 5. The difference is defined as $\ell _ { \mathrm { r e g } } / n ^ { 2 }$ (average cross entropy; see (5)). One reads that when $\lambda = 2 0$ , the difference is 0.34. It indicates that the learned probabilities in $\theta$ are on average 0.3 away from the entries of $A ^ { \mathrm { a } }$ , because $- \log ( 1 - 0 . 3 ) \approx 0 . 3 4$ . When using 0.5 as a cutoff threshold for $\theta$ , such a difference possibly results in false-positive edges (existing in $\theta$ but not in $A ^ { \mathrm { a } }$ ; orange dashed) and false-negative edges (existing in $A ^ { \mathrm { a } }$ but not in $\theta$ ; none in the example).
191
+
192
+ Note that the regularization strength $\lambda$ weighs the forecasting error (MAE) and the cross entropy in the loss function. When $\lambda = 0$ , the training loss is not regularized, yielding optimal forecast results reported in Table 2. When $\lambda = \infty$ , one effectively enforces $\theta$ to be identical to $A ^ { \mathrm { a } }$ and hence the model reduces to DCRNN, whose forecasting performance is worse than our model. The interesting question is when $\lambda$ interpolates between the two extremes, whether it is possible to find a sweet spot such that forecasting performance is close to our model but meanwhile $\theta$ is close to $A ^ { \mathrm { a } }$ . Figure 5 suggests positively. We stress that our model does not intend to learn a “ground-truth” graph (e.g., the traffic network or the power grid); but rather, learn a structure that a GNN can exploit to improve forecast.
193
+
194
+ ![](images/7dbdf60a2c17d2ed437a8b64752e89ba9391cd253a8d2d956a95ef2262682448.jpg)
195
+
196
+ Figure 5: Learned structures (PMU). Left: difference between $A ^ { \mathrm { a } }$ and $\theta$ (in terms of average cross entropy) as $\lambda$ varies. Right: $A ^ { \mathrm { a } }$ overlaid with $\theta$ (orange edges exist in $\theta$ but not in $A ^ { \mathrm { a } }$ ) when $\lambda = 2 0$ .
197
+
198
+ <table><tr><td colspan="3">入=1</td><td>入=2</td><td>入=10</td><td>入=20</td></tr><tr><td>15 min</td><td>CE MAE</td><td>1.93 2.47e-4</td><td>1.87 2.74e-4</td><td>0.53 2.83e-4</td><td>0.34 2.87e-4</td></tr><tr><td>30 min</td><td>CE MAE</td><td>1.93 3.02e-4</td><td>1.87 3.26e-4</td><td>0.53 3.44e-4</td><td>0.34 3.59e-4</td></tr><tr><td>60 min</td><td>CE MAE</td><td>1.93 4.14e-4</td><td>1.87 4.33e-4</td><td>0.53 4.78e-4</td><td>0.34 5.12e-4</td></tr></table>
199
+
200
+ Other structural priors. In the PMU data set, we use a synthetic $k \mathbf { N N }$ structure prior $A ^ { \mathrm { a } }$ due to the lack of a known graph. For METR-LA and PEMS-BAY, however, such as graph can be constructed based on spatial proximity (Li et al., 2018). We show in Figure 6 the effect of regularization for these data sets. Similar to the findings of PMU, moving $\lambda$ between 0 and $\infty$ interpolates two extremes: the best forecast quality and recovery of $A ^ { \mathrm { a } }$ . With a reasonable choice of $\lambda$ (e.g., 0.3), the forecast quality degrades only slightly but the learned structure is rather close to the given $A ^ { \mathrm { a } }$ , judged from the average cross entropy.
201
+
202
+ ![](images/40d92a1dabc26463f13eb018d6f59654fb87197979793ac909c0b49e91fca09d.jpg)
203
+ Figure 6: Effect of regularization (left: METR-LA; right: PEMS-BAY; $6 0 \mathrm { { m i n } }$ forecast). Average cross entropy measures departure from $A ^ { \mathrm { a } }$ .
204
+
205
+ # 5 CONCLUSIONS
206
+
207
+ We have presented a time series forecasting model that learns a graph structure among multiple time series and forecasts them simultaneously with a GNN. Both the graph and the GNN are learned end-to-end, maximally exploiting the pairwise interactions among data streams. The graph structure is parameterized by neural networks rather than being treated as a (hyper)parameter, hence significantly reducing the training cost compared with a recently proposed bilevel optimization approach LDS. We conduct comprehensive comparisons with a number of baselines, including nondeep learning methods and deep learning methods (which either ignore the pairwise interaction, use a given graph, or learn a graph by using LDS), and show that our approach attains the best forecasting quality. We also demonstrate that regularization helps incorporate a priori knowledge, rendering the learned graph a healthy variation of the given one for more accurate forecast.
208
+
209
+ # ACKNOWLEDGMENT AND DISCLAIMER
210
+
211
+ This material is based upon work supported by the Department of Energy under Award Number(s) DE-OE0000910. C. Shang was also supported by National Science Foundation grant IIS-1718738 (to J. Bi) during this work. J. Bi was additionally supported by National Institutes of Health grants K02-DA043063 and R01-DA051922. This report was prepared as an account of work sponsored by agencies of the United States Government. Neither the United States Government nor any agency thereof, nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof.
212
+
213
+ # REFERENCES
214
+
215
+ Dimitros Asteriou and Stephen G. Hall. ARIMA models and the Box-Jenkins methodology. In Applied Econometrics, pp. 265–286. Palgrave MacMillan, 2011.
216
+
217
+ L. E. Baum and T. Petrie. Statistical inference for probabilistic functions of finite state markov chains. The Annals of Mathematical Statistics, 37(6):1554–1563, 1966.
218
+
219
+ Kyunghyun Cho, Bart van Merrienboera, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder-decoder for statistical machine translation. In EMNLP, 2014.
220
+
221
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019.
222
+
223
+ Luca Franceschi, Michele Donini, Paolo Frasconi, and Massimiliano Pontil. Forward and reverse gradient-based hyperparameter optimization. In ICML, 2017.
224
+
225
+ Luca Franceschi, Mathias Niepert, Massimiliano Pontil, and Xiao He. Learning discrete structures for graph neural networks. In ICML, 2019.
226
+
227
+ C. W. J. Granger. Investigating causal relations by econometric models and cross-spectral methods. Econometrica, 37(3):424–438, 1969.
228
+
229
+ James D. Hamilton. Time Series Analysis. Princeton University Press, 1994.
230
+
231
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 9(8): 1735–1780, 1997.
232
+
233
+ H. V. Jagadish, Johannes Gehrke, Alexandros Labrinidis, Yannis Papakonstantinou, Jignesh M. Patel, Raghu Ramakrishnan, and Cyrus Shahabi. Big data and its technical challenges. Commun. ACM, 57(7):86–94, 2014.
234
+
235
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with Gumbel-Softmax. In ICLR, 2017.
236
+
237
+ Thomas Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard Zemel. Neural relational inference for interacting systems. In ICML, 2018.
238
+
239
+ Sebastien Lachapelle, Philippe Brouillard, Tristan Deleu, and Simon Lacoste-Julien. Gradient-based ´ neural DAG learning. In ICLR, 2020.
240
+
241
+ Shiyang Li, Xiaoyong Jin, Yao Xuan, Xiyou Zhou, Wenhu Chen, Yu-Xiang Wang, and Xifeng Yan. Enhancing the locality and breaking the memory bottleneck of transformer on time series forecasting. In NeurIPS, 2019.
242
+
243
+ Yaguang Li, Rose Yu, Cyrus Shahabi, and Yan Liu. Diffusion convolutional recurrent neural network: Data-driven traffic forecasting. In ICLR, 2018.
244
+ Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. In ICLR, 2017.
245
+ Spyros G. Makridakis, Steven C. Wheelwright, and Rob J Hyndman. Forecasting: Methods and Applications. Wiley, 3 edition edition, 1997.
246
+ Mike Schuster and Kuldip K. Paliwal. Bidirectional recurrent neural networks. IEEE Transactions on Signal Processing, 45(11):2673–2681, 1997.
247
+ Youngjoo Seo, Michael Defferrard, Pierre Vandergheynst, and Xavier Bresson. Structured sequence ¨ modeling with graph convolutional recurrent networks. arXiv:1612.07659, 2016.
248
+ Shun-Yao Shih, Fan-Keng Sun, and Hung yi Lee. Temporal pattern attention for multivariate time series forecasting. Machine Learning volume, 108:1421–1441, 2019.
249
+ Ilya Sutskever, Oriol Vinyals, and Quoc Viet Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
250
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, 2017.
251
+ Ronald J. Williams, Geoffrey E. Hinton, and David E. Rumelhart. Learning representations by back-propagating errors. Nature, 323(6088):533–536, 1986.
252
+ Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and Philip S. Yu. A comprehensive survey on graph neural networks. Preprint arXiv:1901.00596, 2019.
253
+ Zonghan Wu, Shirui Pan, Guodong Long, Jing Jiang, Xiaojun Chang, and Chengqi Zhang. Connecting the dots: Multivariate time series forecasting with graph neural networks. In KDD, 2020.
254
+ Bing Yu, Haoteng Yin, and Zhanxing Zhu. Spatio-temporal graph convolutional networks: A deep learning framework for traffic forecasting. In IJCAI, 2018.
255
+ Yue Yu, Jie Chen, Tian Gao, and Mo Yu. DAG-GNN: DAG structure learning with graph neural networks. In ICML, 2019.
256
+ Paul Zarchan and Howard Musoff. Fundamentals of Kalman Filtering. American Institute of Aeronautics and Astronautics, Incorporated, 2000.
257
+ Ziwei Zhang, Peng Cui, and Wenwu Zhu. Deep learning on graphs: A survey. Preprint arXiv:1812.04202, 2018.
258
+ Ling Zhao, Yujiao Song, Chao Zhang, Yu Liu, Pu Wang, Tao Lin, Min Deng, and Haifeng Li. T-GCN: A temporal graph convolutional network for traffic prediction. IEEE Transactions on Intelligent Transportation Systems, 2019.
259
+ Xun Zheng, Bryon Aragam, Pradeep Ravikumar, and Eric P. Xing. DAGs with NO TEARS: Continuous optimization for structure learning. In NeurIPS, 2018.
260
+ Jie Zhou, Ganqu Cui, Zhengyan Zhang, Cheng Yang, Zhiyuan Liu, Lifeng Wang, Changcheng Li, and Maosong Sun. Graph neural networks: A review of methods and applications. Preprint arXiv:1812.08434, 2018.
261
+
262
+ # Appendices
263
+
264
+ A ADDITIONAL DETAILS OF DATA SETS
265
+
266
+ METR-LA is a traffic data set collected from loop detectors in the highway of Los Angles, CA (Jagadish et al., 2014). It contains 207 sensors, each of which records four months of data at the frequency of five minutes. A graph of sensors is given; it was constructed by imposing a radial basis function on the pairwise distance of sensors at a certain cutoff. For more information see Li et al. (2018). We perform no processing and follow the same configuration as in Li et al. (2018)
267
+
268
+ PEMS-BAY is also a traffic data set, collected by the California Transportation Agencies Performance Measurement System. It includes 325 sensors in the Bay Area for a period of six months, at the same five-minute frequency. Construction of the graph is the same as that of METR-LA. No processing is performed.
269
+
270
+ PMU contains time series data recorded by the phasor measurement units (PMUs) deployed across the U.S. power grid. We extract one month of data (February 2017) from one interconnect of the grid, which includes 42 PMU sources. Each PMU records a number of state variables and we use only the voltage magnitude and the current magnitude. The PMUs sample the system states at high rates (either 30 or 60 Hertz). We aggregate every five minutes, yielding a data frequency the same as the above two data sets. Different from them, this data set offers neither the grid topology, the sensor identities, nor the sensor locations. Hence, a “ground truth” graph is unknown.
271
+
272
+ However, it is highly plausible that the PMUs interact in a nontrivial manner, since some series are highly correlated whereas others not much. Figure 7 shows three example series. Visually, the first series appears more correlated to the second one than to the third one. For example, in the first two series, the blue curves (the variable ip m) are visually seasonal and synchronous. Moreover, inside the purple window, the red curves (the variable vp m) in the first two series show three downward spikes, which are missing in the third series. Indeed, the correlation matrix between the first two series is $\left( \begin{array} { c } { 0 . 7 6 } \\ { - 0 . 3 1 } \end{array} \frac { - 0 . 0 4 } { 0 . 9 6 } \right)$ and that between the first and the third series is $\left( \begin{array} { c } { 0 . 1 8 \ - 0 . 1 0 } \\ { 0 . 2 2 } \end{array} \right)$ . Such an observation justifies graph structure learning among the PMUs.
273
+
274
+ It is important to note a few processing steps of the data set because of its noisy and incomplete nature. The data set contains a fair amount of unreliable readings (e.g., outliers). Hence, we consult domain experts and set lower and upper bounds to filter out extremely small and large values. Accounting for missing data, within every five minutes we take the mean of the available readings if any, or impute with the mean of the entire series.
275
+
276
+ # B ADDITIONAL DETAILS OF EXPERIMENT SETTING
277
+
278
+ Hyperparameters. Several hyperparameters are tuned through grid search: initial learning rate $\{ 0 . 1 , 0 . 0 1 , 0 . 0 0 1 \}$ , dropout rate $\{ 0 . 1 , 0 . 2 , 0 . 3 \}$ , embedding size of LSTM $\{ 3 2 , 6 4 , 1 2 8 , 2 5 6 \}$ , the $k$ value in $k \mathrm { N N } \left\{ 5 , 1 0 , 2 0 , 3 0 \right\}$ , and the weight of regularization $\{ 0 , 1 , 2 , 5 , 1 0 , 2 0 \}$ . For other hyperparameters, the convolution kernel size in the feature extractor is 10 and the decay ratio of learning rate is 0.1. After tuning, the best initial learning rate for METR-LA and PEMS-BAY is 0.01 and for PMU is 0.001. The optimizer is Adam.
279
+
280
+ Because the loss function is an expectation (see (1) and (2)), the expectation is computed as an average of 10 random samples. Such an averaging is needed only for model evaluation. In training, one random sample suffices because the optimizer is a stochastic optimizer.
281
+
282
+ Platform. We implement the models in PyTorch. All experiments are run on one compute node of an IBM Power9 server. The compute node contains 80 CPU cores and four NVidia V100 GPUs, but because of scheduling limitation we use only one GPU.
283
+
284
+ Code is available at https://github.com/chaoshangcs/GTS.
285
+
286
+ # C ADDITIONAL RESULTS FOR FORECASTING QUALITY
287
+
288
+ See Table 3 for the forecast results of PEMS-BAY. The observations are rather similar to those of Tables 1 and 2 in Section 4.2. In particular, GTS produces the best prediction in all scenarios and under all metrics.
289
+
290
+ ![](images/73363a105e54c75eefc4948555e66e287a70f3850fce6d5f8d4502a823dd11f0.jpg)
291
+ Figure 7: Example time series from the PMU data set. Data have been standardized and the vertical axes do not show the raw value.
292
+
293
+ Table 3: Forecasting error (PEMS-BAY).
294
+
295
+ <table><tr><td></td><td>Metric</td><td>HA</td><td>ARIMA</td><td>VAR</td><td>SVR</td><td>FNN</td><td>LSTM</td><td>DCRNN</td><td>LDS</td><td>GTSv</td><td>GTS</td></tr><tr><td></td><td>MAE</td><td>2.88</td><td>1.62</td><td>1.74</td><td>1.85</td><td>2.20</td><td>2.05</td><td>1.38</td><td>1.33</td><td>1.16</td><td>1.12</td></tr><tr><td rowspan="4">uu si</td><td>RMSE</td><td>5.59</td><td>3.30</td><td>3.16</td><td>3.59</td><td>4.42</td><td>4.19</td><td>2.95</td><td>2.81</td><td>2.27</td><td>2.16</td></tr><tr><td>MAPE</td><td>6.8%</td><td>3.5%</td><td>3.6%</td><td>3.8%</td><td>5.2%</td><td>4.8%</td><td>2.9%</td><td>2.8%</td><td>2.3%</td><td>2.3%</td></tr><tr><td>MAE</td><td>2.88</td><td>2.33</td><td>2.32</td><td>2.48</td><td>2.30</td><td>2.20</td><td>1.74</td><td>1.67</td><td>1.44</td><td>1.34</td></tr><tr><td>RMSE MAPE</td><td>5.59</td><td>4.76</td><td>4.25</td><td>5.18</td><td>4.63</td><td>4.55</td><td>3.97</td><td>3.80</td><td>2.97</td><td>2.74</td></tr><tr><td>100 00</td><td>MAE</td><td>6.8%</td><td>5.4%</td><td>5.0% 2.93</td><td>5.5%</td><td>5.4%</td><td>5.2%</td><td>3.9%</td><td>3.8%</td><td>3.1%</td><td>2.9%</td></tr><tr><td rowspan="3">uru 09</td><td>RMSE</td><td>2.88</td><td>3.38</td><td></td><td>3.28</td><td>2.46</td><td>2.37</td><td>2.07</td><td>1.99</td><td>1.81</td><td>1.58</td></tr><tr><td></td><td>5.59</td><td>6.50</td><td>5.44</td><td>7.08</td><td>4.98</td><td>4.96</td><td>4.74</td><td>4.59</td><td>3.78</td><td>3.30</td></tr><tr><td>MAPE</td><td>6.8%</td><td>8.3%</td><td>6.5%</td><td>8.0% 5.9%</td><td></td><td>5.7%</td><td>4.9%</td><td>4.8%</td><td>4.1%</td><td>3.6%</td></tr></table>
296
+
297
+ # D UPDATES OF TABLES 1, 2, AND 3
298
+
299
+ Our implementation had been developed based on the PyTorch version of DCRNN (https: //github.com/chnsh/DCRNN_PyTorch). It was brought to our attention recently that this version calculated the evaluation metrics MAE/RMSE/MAPE in a manner slightly different from that used to report the results of DCRNN in the official publication (https://github.com/ chnsh/DCRNN_PyTorch/issues/3). We updated Tables 1, 2, and 3 by correcting the calculations to be consistent with the official DCRNN results. See Tables 4, 5, and 6. Despite the correction, observations and conclusions regarding the comparison of different methods remain unchanged.
300
+
301
+ Table 4: (Correction of Table 1) Forecasting error (METR-LA).
302
+
303
+ <table><tr><td></td><td>Metric</td><td>HA</td><td>ARIMA</td><td>VAR</td><td>SVR</td><td>FNN</td><td>LSTM</td><td>DCRNN</td><td>LDS</td><td>GTSv</td><td>GTS</td></tr><tr><td></td><td>MAE</td><td>4.16</td><td>3.99</td><td>4.42</td><td>3.99</td><td>3.99</td><td>3.44</td><td>2.77</td><td>2.75</td><td>2.74</td><td>2.64</td></tr><tr><td rowspan="4">urusi</td><td>RMSE</td><td>7.80</td><td>8.21</td><td>7.89</td><td>8.45</td><td>7.94</td><td>6.30</td><td>5.38</td><td>5.35</td><td>5.09</td><td>4.95</td></tr><tr><td>MAPE</td><td>13.0%</td><td>9.6%</td><td>10.2%</td><td>9.3%</td><td>9.9%</td><td>9.6%</td><td>7.3%</td><td>7.1%</td><td>7.3%</td><td>6.8%</td></tr><tr><td>MAE</td><td>4.16</td><td>5.15</td><td>5.41</td><td>5.05</td><td>4.23</td><td>3.77</td><td>3.15</td><td>3.14</td><td>3.11</td><td>3.01</td></tr><tr><td>RMSE</td><td>7.80</td><td>10.45</td><td>9.13</td><td>10.87</td><td>8.17</td><td>7.23</td><td>6.45</td><td>6.45</td><td>6.02</td><td>5.85</td></tr><tr><td rowspan="3">00 0 uru 09</td><td>MAPE MAE</td><td>13.0%</td><td>12.7%</td><td>12.7%</td><td>12.1%</td><td>12.9%</td><td>10.9%</td><td>8.8%</td><td>8.6%</td><td>8.7%</td><td>8.2%</td></tr><tr><td>RMSE</td><td>4.16</td><td>6.90</td><td>6.52</td><td>6.72</td><td>4.49</td><td>4.37</td><td>3.60</td><td>3.63</td><td>3.53</td><td>3.41</td></tr><tr><td>MAPE</td><td>7.80 13.0%</td><td>13.23 17.4%</td><td>10.11 15.8%</td><td>13.76 16.7%</td><td>8.69 14.0%</td><td>8.69 13.2%</td><td>7.59 10.5%</td><td>7.67 10.3%</td><td>6.84 10.3%</td><td>6.74 9.9%</td></tr></table>
304
+
305
+ Table 5: (Correction of Table 2) Forecasting error (PMU).
306
+
307
+ <table><tr><td></td><td>Metric</td><td>FNN</td><td>LSTM</td><td>DCRNN</td><td>LDS</td><td>NRI</td><td>GTSv</td><td>GTS</td></tr><tr><td>11mr</td><td>MAE(×10-3) RMSE(×10-2) MAPE</td><td>1.23 1.28 0.20%</td><td>1.02 1.63 0.21%</td><td>0.71 1.42 0.09%</td><td>0.49 1.26 0.07%</td><td>0.66 0.27 0.14%</td><td>0.35 0.22 0.06%</td><td>0.26 0.20 0.04%</td></tr><tr><td>300 00</td><td>MAE(×10-3) RMSE(×10-2) MAPE</td><td>1.42 1.81 0.23%</td><td>1.11 2.06 0.20%</td><td>1.08 1.91 0.15%</td><td>0.81 1.79 0.12%</td><td>0.71 0.30 0.15%</td><td>0.45 0.29 0.07%</td><td>0.37 0.26 0.06%</td></tr><tr><td>uru 09</td><td>MAE(×10-3) RMSE(×10-2) MAPE</td><td>1.88 2.58 0.29%</td><td>1.79 2.75 0.27%</td><td>1.78 2.65 0.24%</td><td>1.45 2.54 0.22%</td><td>0.83 0.46 0.17%</td><td>0.63 0.43 0.11%</td><td>0.59 0.41 0.10%</td></tr></table>
308
+
309
+ Table 6: (Correction of Table 3) Forecasting error (PEMS-BAY).
310
+
311
+ <table><tr><td></td><td>Metric</td><td>HA</td><td>ARIMA</td><td>VAR</td><td>SVR</td><td>FNN</td><td>LSTM</td><td>DCRNN</td><td>LDS</td><td>GTSv</td><td>GTS</td></tr><tr><td></td><td>MAE</td><td>2.88</td><td>1.62</td><td>1.74</td><td>1.85</td><td>2.20</td><td>2.05</td><td>1.38</td><td>1.33</td><td>1.35</td><td>1.32</td></tr><tr><td>uu si</td><td>RMSE</td><td>5.59</td><td>3.30</td><td>3.16</td><td>3.59</td><td>4.42</td><td>4.19</td><td>2.95</td><td>2.81</td><td>2.64</td><td>2.62</td></tr><tr><td></td><td>MAPE</td><td>6.8%</td><td>3.5%</td><td>3.6%</td><td>3.8%</td><td>5.2%</td><td>4.8%</td><td>2.9%</td><td>2.8%</td><td>2.9%</td><td>2.8%</td></tr><tr><td rowspan="2">100 00</td><td>MAE RMSE</td><td>2.88</td><td>2.33</td><td>2.32</td><td>2.48</td><td>2.30</td><td>2.20</td><td>1.74</td><td>1.67</td><td>1.69</td><td>1.64</td></tr><tr><td></td><td>5.59</td><td>4.76</td><td>4.25</td><td>5.18</td><td>4.63</td><td>4.55</td><td>3.97</td><td>3.80</td><td>3.45</td><td>3.41</td></tr><tr><td rowspan="2"></td><td>MAPE MAE</td><td>6.8%</td><td>5.4%</td><td>5.0%</td><td>5.5%</td><td>5.4%</td><td>5.2%</td><td>3.9%</td><td>3.8%</td><td>3.9%</td><td>3.6%</td></tr><tr><td>RMSE</td><td>2.88</td><td>3.38</td><td>2.93</td><td>3.28</td><td>2.46</td><td>2.37</td><td>2.07</td><td>1.99</td><td>1.99</td><td>1.91</td></tr><tr><td>uru 09</td><td>MAPE</td><td>5.59 6.8%</td><td>6.50 8.3%</td><td>5.44 6.5%</td><td>7.08 8.0%</td><td>4.98 5.9%</td><td>4.96 5.7%</td><td>4.74 4.9%</td><td>4.59 4.8%</td><td>4.05 4.7%</td><td>3.97 4.4%</td></tr></table>
md/train/X7GEA3KiJiH/X7GEA3KiJiH.md ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning Dynamic Graph Representation of Brain Connectome with Spatio-Temporal Attention
2
+
3
+ Byung-Hoon Kim ∗
4
+
5
+ Department of Psychiatry Institute of Behavioral Sciences in Medicine College of Medicine, Yonsei University egyptdj@yonsei.ac.kr
6
+
7
+ Jong Chul Ye
8
+ Department of Bio/Brain Engineering
9
+ Kim Jaechul Graduate School of AI KAIST jong.ye@kaist.ac.kr
10
+
11
+ # Jae-Jin Kim
12
+
13
+ Department of Psychiatry Institute of Behavioral Sciences in Medicine College of Medicine, Yonsei University jaejkim@yonsei.ac.kr
14
+
15
+ # Abstract
16
+
17
+ Functional connectivity (FC) between regions of the brain can be assessed by the degree of temporal correlation measured with functional neuroimaging modalities. Based on the fact that these connectivities build a network, graph-based approaches for analyzing the brain connectome have provided insights into the functions of the human brain. The development of graph neural networks (GNNs) capable of learning representation from graph structured data has led to increased interest in learning the graph representation of the brain connectome. Although recent attempts to apply GNN to the FC network have shown promising results, there is still a common limitation that they usually do not incorporate the dynamic characteristics of the FC network which fluctuates over time. In addition, a few studies that have attempted to use dynamic FC as an input for the GNN reported a reduction in performance compared to static FC methods, and did not provide temporal explainability. Here, we propose STAGIN, a method for learning dynamic graph representation of the brain connectome with spatio-temporal attention. Specifically, a temporal sequence of brain graphs is input to the STAGIN to obtain the dynamic graph representation, while novel READOUT functions and the Transformer encoder provide spatial and temporal explainability with attention, respectively. Experiments on the HCP-Rest and the HCP-Task datasets demonstrate exceptional performance of our proposed method. Analysis of the spatio-temporal attention also provide concurrent interpretation with the neuroscientific knowledge, which further validates our method. Code is available at https://github.com/egyptdj/stagin
18
+
19
+ # 1 Introduction
20
+
21
+ Neuroimaging modalities provide measurements of brain activity by capturing the signals of neural activity. Functional magnetic resonance imaging (fMRI) is a non-invasive imaging method that measures the blood-oxygen level dependence (BOLD) in order to estimate the neural activity of the whole brain over time [20]. Functional connectivity (FC) is defined as the degree of temporal correlation between regions of the brain. Based on the fact that these connectivities form networks that change over time, graph-based network analysis of brain connectome has been one of the key approaches to understanding how the brain works [7, 4, 43].
22
+
23
+ Graph neural networks (GNNs) are a type of deep neural networks that have recently been successful in learning the representation of graph-structured data [50]. The graph-structured nature of the brain has led to an increased interest in learning the reperesentation of the brain FC network with the GNNs. Learning the representation of the brain connectome can be linked to decoding trait or state from human brain signal measurements. Accordingly, the current trend in studies attempting to apply GNN to the brain connectome is to input the FC graph from either resting-state [25, 26, 2, 33, 23, 48, 49] or task fMRI data [29, 30, 32] and predict a particular phenotype of the subjects, such as gender [26, 2, 23, 22] or presence of a specific disease [26, 33, 29, 30, 32, 22]. While these studies have shown potential strengths and opportunities for learning the network representation of the brain, they also suggest limitations of current GNN-based methods.
24
+
25
+ One of the most common limitations with previous GNN-based FC network analysis methods is that most of them fail to take advantage of the dynamic properties of the FC network, which fluctuates over time. Incorporating the dynamic features of the FC network into the neuroimaging analysis has been an important direction in the field of functional neuroimaging [21, 37]. A work by [15] tried to address this issue by using the Spatial Temporal Graph Convolutional Network (ST-GCN) [54] model to incorporate dynamic features of the FC network. However, [15] reported lower accuracy than other non-dynamic GNN-based FC methods [23, 2] in the gender classification experiment, leaving a question about the effectiveness of the dynamic FC method. In addition, another limitation of the method is that no temporal explainability is provided from the model. This is a major drawback considering that the goal of applying GNNs to functional neuroimaging methods is not only to achieve high classification accuracy, but also to uncover the functional basis of the brain [23, 32]. Another recent work by [3], using GraphNets [5] and DiffPool [58] for the dynamic FC analysis, also suffers from the same limitations in terms of poor classification accuracy and lack of temporal explainability.
26
+
27
+ Here, we propose Spatio-Temporal Attention Graph Isomorphism Network (STAGIN) for learning the dynamic graph representation of the brain connectome with spatio-temporal attention. The proposed method exploits the temporal features of the dynamic FC network graphs to improve the classification accuracy of the model. In particular, we address the issue that the node features of the input dynamic graph should contain temporal information and concatenate encoded timestamp with the node features (Section 4.1). In addition, the proposed method includes novel attention-based READOUT modules (Section 4.2) and the Transformer encoder [46] (Section 4.3) in order to further improve the classification performance and provide spatial-temporal explainability at the same time. STAGIN achieves state-of-the-art performance with the Human Connectome Project (HCP) dataset [45] in gender classification for resting-state fMRI and task decoding for task fMRI. We inherit $\mathbf { k }$ -means clustering analysis of the resting-state dynamic FC [1] and general linear model (GLM) statistical mapping of task fMRI [14] for interpreting the spatio-temporal attention learned from STAGIN, which are widely accepted analysis methods for the fMRI data. The interpretation of the learned spatio-temporal attention replicates neuroscientific findings from previous large-scale fMRI studies in both resting-state and task fMRI, which further validates our proposed method.
28
+
29
+ Our work holds potential societal impact in that brain decoding methods can be linked to finding neural biomarkers of important phenotypes or diseases. However, potential negative impact related to privacy concerns that arise from abuse or misuse of accurate decoding methods should also be noted. Although our method is yet behind the decoding capability that can be abused or misused, our research cannot still be free from these ethical considerations.
30
+
31
+ # 2 Related works
32
+
33
+ # 2.1 Graph Neural Network on Dynamic Graphs
34
+
35
+ Many networks that arise around us are inherently dynamic, with changes in the existence of nodes and edges over time. Learning the representation of dynamic graphs has piqued the interest of researchers and has led to development of methods that can embed dynamic graphs using their time information [35]. Methods that incorporate attention for learning the representation of dynamic graphs have also been proposed [51, 40]. However, it is not easy to apply these techniques directly to the dynamic brain graphs because of the different inherent properties of the dynamic brain graphs that do not include any addition or deletion of nodes and are sampled uniformly over time. Nonetheless, our work is inspired by these earlier studies, particularly for the encoding of temporal information and their concatenation to the node features, as proposed in Section 4.1 [51, 40].
36
+
37
+ # 2.2 Attention in Graph Neural Networks
38
+
39
+ Bringing attention to the GNNs is a topic that is being actively studied in the field of geometric deep learning [27]. One of the most successful uses of attention is to compute the attention at edges of the graph and scale the importance of the links when the features of the neighborhood node are aggregated [47, 6], often providing performance gain in learning the representation of input graphs. Another stream of applying attention to the GNNs comes with the motivation to define a pooling function on the graph domain. Since it is not straightforward to decide on what basis the coarsening should be carried out for graph structured data, works such as [16, 28, 38] have addressed this problem by selecting the nodes with top scores computed from projecting the node feature vectors into a learnable parameter vector, or from a GNN layer aggregated local graph features. Although the motivation may have been different, these graph pooling methods are closely related to the spatial attention modules that we propose in Section 4.2 in that they exploit learned relative scores across the vertices of the graph. While some works have already been aware that the appropriate use of node-wise attention can improve performance of downstream tasks [55, 11], we note that previous methods tend to score attention based on randomly initialized parameters or local graph structures which may be suboptimal for graph classification tasks that require taking the whole graph feature into account.
40
+
41
+ # 3 Theory
42
+
43
+ # 3.1 Problem definition
44
+
45
+ The goal of our study is to train a neural network
46
+
47
+ $$
48
+ f : G _ { \mathrm { d y n } } \to h _ { G _ { \mathrm { d y n } } } ,
49
+ $$
50
+
51
+ where $G _ { \mathrm { d y n } } = ( G ( 1 ) , . . . , G ( T ) )$ is the sequence of brain graphs with $T$ timepoints and $\pmb { h } _ { G _ { \mathrm { d y n } } } \in \mathbb { R } ^ { D }$ is the vector representation of the dynamic graph $G ( t )$ with length $D$ . The graph $G ( t ) = ( V ( t ) , E ( t ) )$ at time $t$ is a pair of vertex set $V ( t ) = \{ { \pmb x } _ { 1 } ( t ) , . . . , { \pmb x } _ { N } ( t ) \}$ of $N$ nodes and edge set $E ( t ) \ =$ $\left\{ \{ \pmb { x } _ { i } ( t ) , \pmb { x } _ { j } ( t ) \} \mid j \in \mathcal { N } ( i ) , i \in \{ 1 , . . . N \} \right\}$ where $\mathcal { N } ( i )$ denotes the neighborhood of the vertex $i$ . If $f$ learns to extract a disentangled representation of the dynamic brain graph $G _ { \mathrm { d y n } }$ , then the classification of a certain phenotypic characteristic (e.g. gender) from $h _ { G _ { \mathrm { d y n } } }$ can be performed with a linear mapping as a downstream task. Another important consideration in this work is to ensure the explainability of the model $f$ , being able to inform us which part of the brain at which timepoint was considered important when extracting the meaningful representation $h _ { G _ { \mathrm { d y n } } }$ . Specifically, we formulate $f = q \circ g$ as a composition of the GNN $g$ and the Transformer encoder $q$ , where $g$ outputs the set of graph representations $\mathbf { \mathcal { h } } _ { G ( t ) }$ from each timepoint and $q$ exploits self-attention to integrate $\mathbf { \mathcal { h } } _ { G ( t ) }$ into the final representation $h _ { G _ { \mathrm { d y n } } }$ :
52
+
53
+ $$
54
+ \begin{array} { r l } & { g : G _ { \mathrm { d y n } } \to ( h _ { G ( 1 ) } , . . . , h _ { G ( T ) } ) , } \\ & { } \\ & { q : ( { h _ { G ( 1 ) } } , . . . , { h _ { G ( T ) } } ) \to h _ { G _ { \mathrm { d y n } } } . } \end{array}
55
+ $$
56
+
57
+ We will omit timepoint notation $( t )$ for brevity, whenever it is not of contextual importance.
58
+
59
+ # 3.2 Graph Isomorphism Network
60
+
61
+ The GNNs are generally composed of functions that (i) integrate the node features from its neighbors, and (ii) embed the integrated information with a nonlinear transformation to obtain the next layer node features. These functions are called AGGREGATE, and COMBINE functions, respectively, and the choice of these functions define many variants of the GNN,
62
+
63
+ $$
64
+ \begin{array} { r l } & { \pmb { a } _ { v } ^ { ( k ) } = \mathtt { A G G R E G A T E } ^ { ( k ) } \Big ( \Big \{ \pmb { h } _ { u } ^ { ( k - 1 ) } : u \in \mathcal { N } ( v ) \Big \} \Big ) , } \\ & { \pmb { h } _ { v } ^ { ( k ) } = \mathtt { C O M B I N E } ^ { ( k ) } \Big ( \pmb { h } _ { v } ^ { ( k - 1 ) } , \pmb { a } _ { v } ^ { ( k ) } \Big ) , } \end{array}
65
+ $$
66
+
67
+ where $\boldsymbol { h } _ { v } ^ { ( k ) }$ denotes the feature vector of node $v$ at layer $k$ and ${ h } _ { v } ^ { ( 0 ) } : = \pmb { x } _ { v }$
68
+
69
+ The Graph Isomorphism Network (GIN) is a variant of the GNN suitable for graph classification tasks, which is known to be as powerful as the WL-test under certain assumptions of injectivity [52]. The GIN typically defines sum as the AGGREGATE and a multi-layer perceptron (MLP) with two layers as the COMBINE updating the node representation $\boldsymbol { h } _ { v } ^ { ( k ) }$ at layer $k$ [52] by :
70
+
71
+ $$
72
+ \pmb { h } _ { v } ^ { ( k ) } = \mathtt { M L P } ^ { ( k ) } \Big ( ( 1 + \epsilon ^ { ( k ) } ) \cdot \pmb { h } _ { v } ^ { ( k - 1 ) } + \sum _ { u \in \mathcal { N } ( v ) } \pmb { h } _ { u } ^ { ( k - 1 ) } \Big ) ,
73
+ $$
74
+
75
+ where $\epsilon$ is a learnable parameter initialized with zero. Equation (5) can be easily reformulated into the matrix form [23] by:
76
+
77
+ $$
78
+ \pmb { H } ^ { ( k ) } = \sigma \left( ( \epsilon ^ { ( k ) } \cdot \pmb { I } + \pmb { A } ) \pmb { H } ^ { ( k - 1 ) } \pmb { W } ^ { ( k ) } \right) ,
79
+ $$
80
+
81
+ where
82
+
83
+ $$
84
+ \pmb { H } ^ { ( k ) } = \left[ \pmb { h } _ { 1 } ^ { ( k ) } , \cdots , \pmb { h } _ { N } ^ { ( k ) } \right] \in \mathbb { R } ^ { D \times N }
85
+ $$
86
+
87
+ is the stack of node feature vectors, $\pmb { I }$ is the identity matrix, $\pmb { A }$ is the adjacency matrix between the node features, $W$ is the network weights of the MLP, and $\sigma$ is the nonlinearity function.
88
+
89
+ The READOUT function takes the updated node features $\boldsymbol { h } _ { v } ^ { ( k ) }$ to compute the representation of the whole graph:
90
+
91
+ $$
92
+ \begin{array} { r } { \pmb { h } _ { G } ^ { ( k ) } = \mathtt { R E A D O U T } \Big ( \{ \pmb { h } _ { v } ^ { ( k ) } \ | \ v \in G \} \Big ) . } \end{array}
93
+ $$
94
+
95
+ In general, the READOUT function is defined simply as computing the sum or average of the input node features. This is equivalent to multiplication with the length $N$ pooling vectors $\phi _ { \mathrm { s u m } } ^ { \mp } = [ 1 , \stackrel { \cdot } { \dots } , 1 ]$ or $\phi _ { \mathrm { m e a n } } ^ { \top } = [ 1 / N , . . . , 1 / N ]$ for the matrix form:
96
+
97
+ $$
98
+ \begin{array} { r } { \pmb { h } _ { G } ^ { ( k ) } = \pmb { H } ^ { ( k ) } \phi _ { \mathrm { m e a n } } . } \end{array}
99
+ $$
100
+
101
+ # 3.3 Encoder-decoder understanding of GNNs
102
+
103
+ Although formulating the GIN (5) as a combination of AGGREGATE and COMBINE function might not suggest its close relationship with convolutional neural networks (CNNs) at first glance, previous works by [23, 8] show that the matrix formulation of the GIN operation (6) can be thought of a CNN layer with shift operation of the convolution as the adjacency matrix $\pmb { A }$ . We extend the understanding of encoder-decoder CNN as a framelet expansion [57, 56] to the GIN to formulate node feature vectors $H ^ { ( k ) }$ at layer $k$ with respect to the input node feature $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ as:
104
+
105
+ $$
106
+ \operatorname { V e c } \left( \pmb { H } ^ { ( k ) } \right) = \pmb { \Sigma } ^ { ( k ) } \pmb { E } ^ { ( k ) \top } \cdot \cdot \cdot \pmb { \Sigma } ^ { ( 1 ) } \pmb { E } ^ { ( 1 ) \top } \pmb { x } , \quad \mathrm { w h e r e } \quad \pmb { x } : = \operatorname { V e c } \left( [ \pmb { x } _ { 1 } , \cdots , \pmb { x } _ { N } ] \right)
107
+ $$
108
+
109
+ where $\mathrm { V e c } ( \cdot )$ denotes the vectorization operation, and the $k$ -th layer encoder matrix $\pmb { { \cal E } } ^ { ( k ) }$ is defined as
110
+
111
+ $$
112
+ \pmb { E } ^ { ( k ) } = \pmb { W } ^ { ( k ) } \otimes ( \epsilon ^ { ( k ) } \cdot \pmb { I } + \pmb { A } ^ { T } )
113
+ $$
114
+
115
+ where $\otimes$ refers to the Kronecker product, and $\pmb { \Sigma } ^ { ( k ) }$ is the diagonal matrix with values 1 or 0 depending on the activation pattern of the nonlinearity. Now, $\phi _ { \mathrm { { m e a n } } }$ of equation (8) can be thought as the decoder at the $k$ -th layer which yields the whole graph feature vector from the encoded node feature vectors.
116
+
117
+ Proposition 1. The READOUT function $\phi _ { m e a n }$ in (8) generates a decoder with fixed constant bases.
118
+
119
+ Proof. From the READOUT function (8), we have
120
+
121
+ $$
122
+ \begin{array} { r l } & { \boldsymbol { h } _ { G } ^ { ( k ) } = \mathrm { V e c } \left( \boldsymbol { h } _ { G } ^ { ( k ) } \right) = \mathrm { V e c } \left( \boldsymbol { H } ^ { ( k ) } \phi _ { \mathrm { m e a n } } \right) = \left( \phi _ { \mathrm { m e a n } } ^ { T } \otimes \boldsymbol { I } \right) \mathrm { V e c } \left( \boldsymbol { H } ^ { ( k ) } \right) } \\ & { \qquad = \left( \phi _ { \mathrm { m e a n } } ^ { T } \otimes \boldsymbol { I } \right) \boldsymbol { \Sigma } ^ { ( k ) } \boldsymbol { E } ^ { ( k ) \top } \cdot \cdot \cdot \boldsymbol { \Sigma } ^ { ( 1 ) } \boldsymbol { E } ^ { ( 1 ) \top } \boldsymbol { x } } \end{array}
123
+ $$
124
+
125
+ Now let $\mathbf { } _ { b _ { i } }$ and $\tilde { \mathbf { b } } _ { i }$ denote the $i$ -th column of the encoder matrix ${ \cal E } ^ { ( 1 ) } \Sigma ^ { ( 1 ) } \cdot \cdot \cdot { \cal E } ^ { ( k ) } \Sigma ^ { ( k ) }$ and the decoder matrix $\left( \phi _ { \mathrm { m e a n } } ^ { T } \otimes I \right)$ , respectively. Then, it is straight to obtain the following representation:
126
+
127
+ $$
128
+ { h } _ { G } ^ { ( k ) } = \sum _ { i } \langle b _ { i } , { x } \rangle \tilde { b } _ { i }
129
+ $$
130
+
131
+ Therefore, we can see that although the encoder basis $b _ { i }$ is a function of $_ { \textbf { \em x } }$ , the decoder basis $\tilde { \boldsymbol { b } } _ { i }$ is a constant. □
132
+
133
+ ![](images/742f062d71231a50f5c4e1d9e80c0b555365b6f10c527c39295fb635063d5273.jpg)
134
+ Figure 1: Schematic illustration of the proposed method. (a) Overall framework of the STAGIN. A sequence of dynamic graph is first input to the GIN followed by GARO or SERO which produces a sequence of spatially attended graph representation vectors $\tilde { h } _ { G ( t ) }$ . Temporal attention is computed over $\tilde { h } _ { G ( t ) }$ and the temporally attended graph representations are averaged to generate the final representation $\tilde { h } _ { G _ { \mathrm { d y n } } }$ . (b) Attention-based READOUT modules. Both GARO and SERO compute spatial attention $z _ { \mathrm { s p a c e } }$ with global average-pooled graph feature $_ { h _ { G } }$ as prior.
135
+
136
+ We address the issue that the decoder being a constant function can restrict the expressivity of the neural network, and explore adaptive READOUT functions with attention in Section 4.2.
137
+
138
+ # 4 STAGIN: Spatio-Temporal Attention Graph Isomorphism Network
139
+
140
+ In this section, we discuss the details of our main contribution. Specifically, we propose STAGIN with two novel attention-based READOUT modules for learning the dynamic graph representation of the brain connectome (Figure 1).
141
+
142
+ # 4.1 Dynamic graph definition
143
+
144
+ The sequence of input dynamic FC graphs is constructed from 4D fMRI data with 3D voxels across time. The ROI-timeseries matrix $\bar { P ^ { \prime } } \in \bar { \mathbb { R } } ^ { N \times T _ { \operatorname* { m a x } } }$ is extracted by taking the mean values within a predefined 3D atlas which consists of $N$ ROIs at each timepoint. Values of each ROI are standardized across time. Constructing dynamic FC matrix follows the sliding-window approach, where the temporal window of length $\Gamma$ is shifted across time with stride $S$ to generate $T = \lfloor T _ { \mathrm { m a x } } - \Gamma / S \rfloor$ windowed matrices $\bar { P } ( t ) \in \mathbb { R } ^ { N \times \Gamma }$ (Figure 2 (a)). The FC at time $t$ is defined as the correlation coefficient matrix $R ( t )$ of the windowed timeseries between ${ \bar { p } } _ { i } ( t )$ and $\bar { p } _ { j } ( t )$ :
145
+
146
+ $$
147
+ R _ { i j } ( t ) = \frac { \mathrm { C o v } ( \bar { p } _ { i } ( t ) , \bar { p } _ { j } ( t ) ) } { \sigma _ { \bar { p } _ { i } } ( t ) \sigma _ { \bar { p } _ { j } } ( t ) } \in \mathbb { R } ^ { N \times N } ,
148
+ $$
149
+
150
+ where the subscript $i$ and $j$ are the row and column indices of $\bar { P } ( t )$ , Cov denotes the cross covariance, and $\sigma _ { p }$ denotes the standard deviation of $\pmb { p }$ . The final binary adjacency matrix $A ( t ) \in \{ 0 , 1 \} ^ { N \times N }$ is obtained from the FC matrix $\mathbf { } R ( t )$ by thresholding the top 30-percentile values of the correlation matrix as connected, and otherwise unconnected following [23]. Other thresholds for binarizing the correlation matrix are also experimented and the results are provided in the Appendix Section C.2.
151
+
152
+ Unlike the adjacency matrix $\mathbf { } A ( t )$ , conventional definition of node feature vectors ${ \bf \mathit { x } } _ { v } ( t )$ at node index $v$ as coordinates [29], mean-activation [29, 15], or one-hot encoding [23], do not change over $t$ , disregarding any temporal variation. To address this issue, we concatenate encoded timestamp $\eta ( t ) \in \mathbb { R } ^ { D }$ to the spatial one-hot encoding $e _ { v }$ , followed by linear mapping with a learnable parameter matrix $W \in \mathbb { R } ^ { D \times ( N + D ) }$ to define the input node feature,
153
+
154
+ $$
155
+ \begin{array} { r } { \pmb { x } _ { v } ( t ) = \pmb { W } [ \pmb { e } _ { v } | | \eta ( t ) ] . } \end{array}
156
+ $$
157
+
158
+ Here, the learnable timestamp encoder $\eta$ is a Gated Recurrent Unit (GRU) [9] which takes ROItimeseries upto the endpoint of the sliding-window as the input. Both the vertex set $V ( t )$ and the
159
+
160
+ ![](images/290dcab37d7782ea35b2d29fd27ceb77cd28469f9fdf7c1690b968d398ee15f2.jpg)
161
+ Figure 2: Defining the dynamic graph. (a) Scheme of extracting dynamic graph from ROI-timeseries matrix $_ { r }$ . (b) Example of a constructed dynamic graph.
162
+
163
+ edge set $E ( t )$ of graph $G ( t )$ now incorporates temporal information at time t. See Figure 2 for an illustration of the dynamic graph definition.
164
+
165
+ # 4.2 Spatial attention with attention-based READOUT
166
+
167
+ As suggested from Proposition 1, conventional READOUT function of GNN can be thought of as a fixed decoder that decodes whole-graph feature from the node features with no learnable parameters. We address this issue by incorporating attention to the READOUT function, which the attention here refers to the scaling coefficient across the nodes learned by the model. Specifically, the spatial attention vector $z _ { \mathrm { s p a c e } } ( t ) \in [ 0 , 1 ] ^ { N }$ is computed by taking the $\pmb { H }$ as a prior:
168
+
169
+ $$
170
+ \begin{array} { c } { { z _ { \mathrm { s p a c e } } = s ( { \cal H } ) , } } \\ { { \tilde { h } _ { \cal G } = { \cal H } z _ { \mathrm { s p a c e } } , } } \end{array}
171
+ $$
172
+
173
+ where $s : \mathbb { R } ^ { D \times N } \to [ 0 , 1 ] ^ { N }$ is the attention function and $\tilde { h } _ { G }$ denotes spatially attended graph representation $h _ { G }$ . We propose two types of attention function $s ( \cdot )$ for the attention-based READOUT, named Graph-Attention READOUT (GARO) and Squeeze-Excitation READOUT (SERO) inspired by the attention mechanisms of [46] and [19], respectively.
174
+
175
+ # 4.2.1 GARO: Graph-Attention READOUT
176
+
177
+ The GARO follows key-query embedding based attention of the Transformer [46]. However, the key embedding is computed from the matrix of node features $\pmb { H }$ , while the query embedding is computed from the vector of unattended graph representation $H \phi _ { \mathrm { { m e a n } } }$ :
178
+
179
+ $$
180
+ \begin{array} { c } { { \kappa = W _ { \mathrm { k e y } } H , } } \\ { { q = W _ { \mathrm { q u e r y } } H \phi _ { \mathrm { m e a n } } , } } \\ { { { z } _ { \mathrm { s p a c e } } = \mathrm { s i g m o i d } \Big ( \frac { q ^ { \top } K } { \sqrt { D } } \Big ) , } } \end{array}
181
+ $$
182
+
183
+ where $W _ { \mathrm { k e y } } \in \mathbb { R } ^ { D \times D }$ , $W _ { \mathrm { q u e r y } } \in \mathbb { R } ^ { D \times D }$ are learnable key-query parameter matrices, $\pmb { K } \in \mathbb { R } ^ { D \times N }$ is the embedded key matrix, and $\pmb q \in \mathbb { R } ^ { D }$ is the embedded query vector.
184
+
185
+ # 4.2.2 SERO: Squeeze-Excitation READOUT
186
+
187
+ The SERO follows MLP based attention of the Squeeze-and-Excitation Networks [19]. However, attention from the squeezed graph representation does not scale the channel dimension, but the node dimension in SERO:
188
+
189
+ $$
190
+ z _ { \mathrm { s p a c e } } = \mathrm { s i g m o i d } \Big ( W _ { 2 } \sigma ( W _ { 1 } H \phi _ { \mathrm { m e a n } } ) \Big ) ,
191
+ $$
192
+
193
+ where $\sigma$ is the nonlinearity function and $W _ { 1 } \in \mathbb { R } ^ { D \times D }$ , $W _ { 2 } \in \mathbb { R } ^ { N \times D }$ are learnable parameter matrices. This type of spatial dimension squeeze-excitation module has been shown to improve
194
+
195
+ performance of the CNN models [41], but was not easily applicable to general graphs which may vary in number of nodes for each graph. We exploit the fact that the brain graphs have fixed number of nodes $N$ across participants based on the chosen atlas.
196
+
197
+ # 4.2.3 Orthogonal regularization
198
+
199
+ If we take a closer look at (8) and (12), computation of graph feature vector $_ { h _ { G } }$ from the node feature matrix $\pmb { H }$ can also be viewed as reconstructing signal $h _ { G }$ from the basis frames $\pmb { H }$ with vectors $\phi _ { \mathrm { { m e a n } } }$ and $z _ { \mathrm { s p a c e } }$ , respectively. While $z _ { \mathrm { s p a c e } }$ provides further expressivity of the model with adaptive coefficients when compared to $\phi _ { \mathrm { { m e a n } } }$ , we find it desirable to encourage the orthogonality of $\pmb { H }$ as elaborated in the Appendix Section A. The orthogonal regularization $\mathcal { L } _ { \mathrm { o r t h o } }$ is defined as:
200
+
201
+ $$
202
+ \mathcal { L } _ { \mathrm { o r t h o } } = \left\| 1 / m \cdot H ^ { \top } H - I \right\| _ { 2 } ,
203
+ $$
204
+
205
+ where $m = \operatorname* { m a x } ( H ^ { \top } H )$ . The scaling term $1 / m$ ensures the columns of the matrix $\pmb { H }$ become orthogonal to each other with the same length, while not restricting the specific length that the column vectors should follow.
206
+
207
+ # 4.3 Temporal attention with Transformer encoder
208
+
209
+ For attention across time, we employ a single-headed Transformer encoder [46] upon the sequence of graph features $( \tilde { h } _ { G ( 1 ) } , . . . , \tilde { h } _ { G ( T ) } )$ . The temporal attention can be measured by the self-attention graph representation weights $Z _ { \mathrm { t i m e } } \in [ 0 , 1 ] ^ { T \times T }$ $h _ { G _ { \mathrm { d y n } } } ^ { ( k ) }$ after the softmax function of the Transformer encoder. Per-layer dynamic is computed by summing the temporally attended feature output from the Transformer encoder across time at each layers, where the final representation:
210
+
211
+ $$
212
+ { \pmb h } _ { G _ { \mathrm { d y n } } } = \mathrm { c o n c a t e n a t e } ( \{ { \pmb h } _ { G _ { \mathrm { d y n } } } ^ { ( k ) } ~ | ~ k \in \{ 1 , . . . , K \} \} )
213
+ $$
214
+
215
+ is the concatenation of dynamic graph representation of all $K$ layers following [53].
216
+
217
+ # 5 Experiment
218
+
219
+ # 5.1 Dataset
220
+
221
+ Publicly available2 fMRI data from the HCP S1200 release [45] was used for our experiments. The data was collected from voluntary participants with informed consent and was fully anonymized. We constructed two datasets, the HCP-Rest and the HCP-Task, depending on whether the subject was resting or performing specific tasks during the acquisition of the image. The HCP-Rest dataset consisted of pre-processed and ICA denoised resting-state fMRI data [17], which the subjects were instructed to rest for 15 minutes during the data acquisition. We used first run data of the four sessions, and excluded data with short acquisition time with $T _ { \mathrm { m a x } } < 1 2 0 0$ . There were 1093 images finally included in the dataset, which consisted of 594 female and 499 male subjects. The gender of each subject served as the labels of the HCP-Rest dataset letting the number of classes $C = 2$ . The HCP-Task consisted of pre-processed task fMRI data [17], which the subjects were instructed to perform specific tasks during data acquisition. For example in the "Motor" task fMRI, participants were told to perform one of the subtasks during the acquisition to make motor movements on one’s left hand, left foot, right hand, right foot, or tongue. There were seven types of tasks including working memory, social, relational, motor, language, gambling, and emotion. After excluding the fMRI data with short acquisition time, there were 7450 images included in the dataset. The task type during the data acquisition served as the labels of the HCP-Task dataset, letting $C = 7$ . A more detailed description of the experiment datasets with a note on the twin subjects of HCP can be found in the Appendix Section B.
222
+
223
+ # 5.2 Experimental settings
224
+
225
+ Experiments were performed on a workstation with two NVIDIA GeForce GTX 1080 Ti GPUs. The STAGIN model $f$ is trained end-to-end in a supervised manner with the loss $\mathcal { L } = \mathcal { L } _ { \mathrm { x e n t } } + \lambda \cdot \mathcal { L } _ { \mathrm { o r t h o } }$ where $\mathcal { L } _ { \mathrm { x e n t } }$ is the cross entropy loss and $\lambda$ is the scaling coefficient of the orthogonal regularization. We set the number of layers $K = 4$ , embedding dimension $D = 1 2 8$ , window length $\Gamma = 5 0$ , window stride $S = 3$ , and regularization coefficient $\lambda \stackrel { - } { = } 1 . 0 \times 1 0 ^ { - 5 }$ . The window length and stride correspond to capturing the FC within 36 seconds every 2.16 seconds, which follows the standard setting of the sliding-window dFC analyses [59, 37]. Dropout rate 0.5 is applied to the final dynamic graph representation $h _ { G _ { \mathrm { d y n } } }$ , and rate 0.1 is applied to the attention vectors $z _ { \mathrm { s p a c e } }$ and $z _ { \mathrm { t i m e } }$ during training. For nonlinearity $\sigma$ in (6) and (14), GELU [18] is used instead of ReLU with batch normalization before each $\sigma$ . One-cycle learning rate policy is employed, which the learning rate is gradually increased from 0.0005 to 0.001 during the early $20 \%$ of the training, and gradually decreased to $5 . 0 \times 1 0 ^ { - 7 }$ afterwise. Thirty training epochs were run for the HCP-Rest dataset with minibatch size 3, while ten epochs were run with minibatch size 16 for the HCP-Task dataset. We performed 5-fold stratified cross-validation of the dynamic graphs from the dataset, and report mean and standard deviation across the folds. To extract the ROI-timeseries, the Schaefer atlas [42] with 400 regions $N = 4 0 0$ ) labelled with 7 intrinsic connectivity networks (ICNs) was used. The time dimension of ROI-timeseries matrix $_ { r }$ was randomly sliced with a fixed length (600 for HCP-Rest, 150 for HCP-Task) at each steps during training for (i) relieving computational overload, (ii) stochastic augmentation of the training dataset, (iii) mitigating unwanted memorization of the specific timing of subtask onset, and (iv) matching the number of timepoints $T$ across different task labels for the HCP-Task dataset. Unsliced full matrix $_ { r }$ was used for inference at test time. The end-to-end inference from the construction of the dynamic graph to the acquisition of the final prediction required 1.68 seconds per sample with given experimental settings.
226
+
227
+ Table 1: Comparative study on HCP-Rest and HCP-Task dataset.
228
+
229
+ <table><tr><td rowspan="2">Model</td><td colspan="2">HCP-Rest</td><td>HCP-Task</td><td rowspan="2">Type of FC</td><td rowspan="2"># Params</td></tr><tr><td>Accuracy (%)</td><td>AUROC</td><td>Accuracy (%)</td></tr><tr><td>STAGIN-SERO</td><td>88.20 ± 1.33</td><td>0.9296 ± 0.0187</td><td>99.19 ± 0.20</td><td>Dynamic</td><td>1,209k</td></tr><tr><td>STAGIN-GARO</td><td>87.01 ± 3.00</td><td>0.9151 ± 0.0258</td><td>99.02 ± 0.17</td><td>Dynamic</td><td>1,068k</td></tr><tr><td>ST-GCN [15]</td><td>76.95 ± 3.00</td><td>0.8545 ± 0.0316</td><td>98.92 ± 0.27</td><td>Dynamic</td><td>355k</td></tr><tr><td>MS-G3D[10]</td><td>79.16 ± 2.53</td><td>0.8912 ± 0.0329</td><td>1</td><td>Dynamic</td><td>3,045k</td></tr><tr><td>BAnD++ [36]</td><td></td><td></td><td>97.20 ± 0.57</td><td>None</td><td>2,010k</td></tr><tr><td>BAnD [36]</td><td></td><td></td><td>95.10 ± 0.62</td><td>None</td><td>2,010k</td></tr><tr><td>r-BAnD</td><td></td><td></td><td>98.90 ± 0.27</td><td>Dynamic</td><td>664k</td></tr><tr><td>GIN [23]</td><td>81.34 ± 2.40</td><td>0.8955 ± 0.0237</td><td>93.87 ± 0.66</td><td>Static</td><td>169k</td></tr><tr><td>GCN [24]</td><td>80.79 ± 2.00</td><td>0.8741 ± 0.0174</td><td>45.07 ± 1.63</td><td>Static</td><td>101k</td></tr><tr><td>GraphSAGE[31]</td><td>75.48 ± 1.97</td><td>0.8237 ± 0.0228</td><td>54.52 ± 0.97</td><td>Static</td><td>202k</td></tr><tr><td>ChebGCN[2]</td><td>77.76 ± 2.09</td><td>0.8582 ± 0.0233</td><td>73.06 ± 0.68</td><td>Static</td><td>704k</td></tr></table>
230
+
231
+ # 5.3 HCP-Rest: Gender classification
232
+
233
+ We first validate our proposed method by gender classification on the HCP-Rest dataset. The two proposed methods, named STAGIN-GARO and STAGIN-SERO based on the type of the spatial attention module, resulted in $8 7 . 0 1 \%$ and $8 8 . 2 0 \%$ mean accuracy on the 5-fold cross validation, respectively (Table 1). The mean area under receiver operator characteristic curve (AUROC) were 0.9151 and 0.9296. Classification performance of STAGIN is compared with other GNN methods for reprensentation learning of dynamic/static FC network, including ST-GCN [15], MS-G3D [10], GIN [23], GCN [24], GraphSAGE [31], and ChebGCN [2]. We used the code by the authors of $[ 1 5 ]$ and $[ 1 0 ]$ but modified the cross validation scheme to avoid early stopping based on the test dataset for fair comparison. It can be seen from Table 1 that our proposed method outperforms other GNN based methods. The results of the ablation study are shown in Table 3 in the Appendix.
234
+
235
+ We use STAGIN-SERO, which showed the best accuracy, for analyzing temporal and spatial attention of the dynamic FC networks. We define the temporal attention vector $\bar { \boldsymbol { z } } _ { \mathrm { t i m e } } ^ { ( k ) } \in [ 0 , \bar { 1 } ] ^ { T }$ at layer $k$ as the average of row elements in the self-attention weight matrix $\begin{array} { r } { z _ { \mathrm { t i m e } } ^ { ( k ) } [ j ] = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } Z _ { i j } } \end{array}$ where $z _ { \mathrm { t i m e } } ^ { ( k ) } [ j ]$ and $Z _ { i j }$ are $j$ -th lement of $z _ { \mathrm { t i m e } } ^ { ( k ) }$ and $( i , j )$ -th element of $Z _ { \mathrm { t i m e } } ^ { ( k ) }$ for the resting-state data, respectively. To employ $\mathbf { k }$ -means clustering to the resting-state dynamic FC analysis [1], we first define a set of attended timepoints $\tilde { T } = \{ t \mid z _ { \mathrm { t i m e } } [ t ] > \alpha \cdot \sigma _ { z _ { \mathrm { t i m e } } } \}$ where $\alpha$ is the cutoff coefficient, and ${ \sigma } _ { z _ { \mathrm { t i m e } } ^ { ( k ) } }$ denotes the standard deviation of $z _ { \mathrm { t i m e } } ^ { ( k ) }$ . Defining the threshold based on standard deviation inherits the practice of the point-process analysis for dynamic FC, so we set $\alpha = 1 . 0$ following [44]. Pattern of the FC matrices at attended timepoints $A ^ { \tilde { T } } = \{ A ( t ) \mid t \in \tilde { T } \}$ for each subject can now be analyzed with the $\mathbf { k }$ -means clustering. Specifically, we fit 7 template cluster centroids from the dynamic FC matrices $A ( t )$ over all subjects, and assign elements of $A ^ { \tilde { T } }$ into one of the 7 template clusters. The ratio of each clusters from $A ^ { \tilde { T } }$ with respect to $\pmb { A }$ can then be analyzed with the subset of $A ^ { \tilde { T } }$ including only the female or male subjects.
236
+
237
+ ![](images/5e2ae4d16e5a7a857695c0ed72b31036b27c90a793402955d4c8562a6632bd87.jpg)
238
+ Figure 3: Analysis of temporal attention of the gender classification experiment with $\mathbf { k }$ -means clustering. The DMN and SMN of the 7 cluster centroids are plotted and the relative proportion of temporally attended clusters for female and male subjects are written below. The clusters are sorted in descending order of the female/male attended cluster ratio.
239
+
240
+ Evidences from large scale studies suggest that female subjects show hyperconnectivity of the DMN [34, 39] and hypoconnectivity of the SMN when compared to male subjects [39, 13]. We accordingly hypothesized that the FC at attended timepoints will show higher values for the DMN and lower values for the SMN in female participants. Figure 3 demonstrates that the clusters mainly attended by female participants show a trend of hyperconnectivity of the DMN and hypoconnectivity of the SMN. This can be interpreted to mean that the STAGIN is properly trained to take the dynamic state of the FC networks into account for predicting the phenotype of the subject.
241
+
242
+ The spatial attention across regions of the brain is analyzed with the $z _ { \mathrm { s p a c e } } ^ { ( k ) }$ averaged across time $\begin{array} { r } { \tilde { z } _ { \mathrm { s p a c e } } ^ { ( k ) } : = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } z _ { \mathrm { s p a c e } } ^ { ( k ) } ( t ) } \end{array}$ . The regions with top 5 percentile attention values of $\tilde { z } _ { \mathrm { s p a c e } } ^ { ( k ) }$ are plotted with respect to the seven ICNs in Figure 9 in the Appendix. It can be seen that the majority of the top attended regions are from the SMN, which further suggests gender difference of resting-state FC within the SMN. A notable limitation here is that the threshold for determining the top attended region is heuristically set. Statistically determining the spatially attended regions from the resting-state data would further provide validity of the method, which is left as a future work.
243
+
244
+ # 5.4 HCP-Task: Task decoding
245
+
246
+ Task decoding refers to classifying which of the seven tasks the subject was performing during the acquisition of the brain fMRI. The STAGIN-GARO and STAGIN-SERO showed $9 9 . 0 2 \%$ and $9 9 . 1 9 \%$ mean accuracy for the task decoding experiment, respectively (Table 1). It can be seen that the proposed methods outperform the previous state-of-the-art model BAND and $\mathrm { B A n D + + }$ [36], which applied self-attention of the Transformer encoder directly to 3D ResNet extracted representation vectors of the fMRI without considering the network property of the brain. To account for the possible statistical disadvantage of voxel-based feature extraction, we further implemented a new region-based BAnD (r-BAnD) by using GIN without attention-based READOUT instaed of the 3D ResNet. Accuracy of r-BAnD resulted in an accuracy of $9 8 . 9 0 \%$ , suggesting that our method shows superior performance even when the statistical disadvantages are matched. Experiment on other models including ST-GCN [15], GIN [23], GCN [24], GraphSAGE [31], and ChebGCN [2] demonstrate exceptional performance of our proposed method for HCP-Task (Table 1). The fact that subtask timing information is completely lost may reflect the reason behind poor performance of static FC methods, which can be a critical disadvantage in task classification.
247
+
248
+ ![](images/e4ace94c7da5d4c584df69fe320c29cc2a46fe60afe2eebec1f2beeb1c406879.jpg)
249
+ Figure 4: Analysis of spatio-temporal attention for working memory task of the task decoding experiment. (a) Plot of average temporal attention matrix Z(k)time across subjects. (b) Proportion of statistically significant regions within the 7 ICNs from the spatial attention GLM.
250
+
251
+ We interpret the result from the working memory task for spatio-temporal attention analysis, where the subtask consists of either performing an n-back memory task or rest. Our key expectation of the temporal attention analysis was that if STAGIN learns to accurately attend to temporal features of the dynamic FC graphs, then $Z _ { \mathrm { t i m e } }$ should represent which subtask the subject was upto. Surprisingly, it can be clearly seen that the Transformer encoder of STAGIN learns to attend to the timing of subtasks from Figure 4 (a), which demonstrates mean temporal attention $Z _ { \mathrm { t i m e } }$ across all subjects. Notice that no supervision is provided to the STAGIN model regarding the subtask timing during training.
252
+
253
+ To analyze the spatially attended regions $z _ { \mathrm { s p a c e } }$ of STAGIN, we construct a GLM [14] to statistically evaluate how much each region is responsible for performing the subtasks. The parameter vectors $\beta _ { \mathrm { t a s k } } \in \mathbb { R } ^ { N }$ and $\beta _ { \mathrm { r e s t } } \in \mathbb { R } ^ { \widetilde { N } }$ are estimated with the sequence of spatial attention vectors and the subtask timing design matrix $M \in \{ 0 , 1 \} ^ { T \times 2 }$ by solving the following with least-squares estimation:
254
+
255
+ $$
256
+ \left[ z _ { \mathrm { s p a c e } } ( 0 ) , \cdot \cdot \cdot , z _ { \mathrm { s p a c e } } ( T ) \right] ^ { \top } = M [ \beta _ { \mathrm { t a s k } } , \beta _ { \mathrm { r e s t } } ] ^ { \top } + \epsilon ,
257
+ $$
258
+
259
+ where $\epsilon$ denotes residual error. The contrast of the estimated parameters $\hat { \beta } _ { \mathrm { t a s k } }$ and $\hat { \beta } _ { \mathrm { r e s t } }$ was set to $\pmb { c } = [ 1 , - 1 ]$ so the rejection of null hypothesis indicates $\hat { \beta } _ { \mathrm { t a s k } } [ \bar { i } ] > \hat { \beta } _ { \mathrm { r e s t } } [ i ]$ at the $i$ -th ROI. Multiple comparisons of the $N$ ROIs are family-wise error (FWE) corrected.
260
+
261
+ Figure 4 (b) shows the proportion of statistically significant regions within the 7 ICNs for each layers. Interestingly, the layer 1 and 2 share a similar trend that the regions from SMN, visual network (VN), and salience/ventral attention network (SVN) are dominant. In contrast, layer 3 and 4 suggest a dominance of the regions from DMN and cognitive control network (CCN). We denote the layer 1 and 2 as the low-order layers (LoL) and the layer 3 and 4 as the high-order layers (HoL). The dominance of SMN and VN at LoL can be understood as the low-level sensorimotor function for perceiving the task is being processed within the short-range $1 \mathrm { - }$ or 2-hop connection of the networks. On the other hand, the dominance of DMN and CCN at HoL reflects the high-level cognitive integration for executing and controlling the given task being processed within the long-range 3- or 4-hop connection of the networks. Considering that the SVN is a network for integrating the low-level sensorimotor networks and the high-level executive networks to provide dynamic balancing between the two functions, the significant regions of SVN being present at both LoL and HoL is not surprising. Temporal and spatial attention plot of other six tasks are further provided in the Appendix Section D.2.
262
+
263
+ # Acknowledgments and Disclosure of Funding
264
+
265
+ This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. NRF-2021M3E5D9025019, NRF-2020R1A2B5B03001980). This work was also supported by Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korea government(MSIT) (No.2019-0-00075, Artificial Intelligence Graduate School Program(KAIST)) and the KAIST Key Research Institute (Interdisciplinary Research Group) Project.
266
+
267
+ # References
268
+
269
+ [1] Elena A Allen, Eswar Damaraju, Sergey M Plis, Erik B Erhardt, Tom Eichele, and Vince D Calhoun. Tracking whole-brain connectivity dynamics in the resting state. Cerebral cortex, 24(3):663–676, 2014.
270
+ [2] Salim Arslan, Sofia Ira Ktena, Ben Glocker, and Daniel Rueckert. Graph saliency maps through spectral convolutional networks: Application to sex classification with brain connectivity. In Graphs in Biomedical Image Analysis and Integrating Medical Imaging and Non-Imaging Modalities, pages 3–13. Springer, 2018.
271
+ [3] Tiago Azevedo, Alexander Campbell, Rafael Romero-Garcia, Luca Passamonti, Richard AI Bethlehem, Pietro Lio, and Nicola Toschi. A deep graph neural network architecture for modelling spatio-temporal dynamics in resting-stating functional mri data. bioRxiv, 2020.
272
+ [4] Danielle S Bassett and Olaf Sporns. Network neuroscience. Nature neuroscience, 20(3):353, 2017. [5] 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.
273
+ [6] Shaked Brody, Uri Alon, and Eran Yahav. How attentive are graph attention networks? arXiv preprint arXiv:2105.14491, 2021.
274
+ [7] Ed Bullmore and Olaf Sporns. Complex brain networks: graph theoretical analysis of structural and functional systems. Nature reviews neuroscience, 10(3):186–198, 2009.
275
+ [8] Mark Cheung, John Shi, Oren Wright, Lavendar Y Jiang, Xujin Liu, and José MF Moura. Graph signal processing and deep learning: Convolution, pooling, and topology. IEEE Signal Processing Magazine, 37(6):139–149, 2020.
276
+ [9] 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.
277
+ [10] Simon Dahan, Logan ZJ Williams, Daniel Rueckert, and Emma C Robinson. Improving phenotype prediction using long-range spatio-temporal dynamics of functional connectivity. In International Workshop on Machine Learning in Clinical Neuroimaging, pages 145–154. Springer, 2021.
278
+ [11] Xiaolong Fan, Maoguo Gong, Yu Xie, Fenlong Jiang, and Hao Li. Structured self-attention architecture for graph-level representation learning. Pattern Recognition, 100:107084, 2020.
279
+ [12] Matthias Fey and Jan Eric Lenssen. Fast graph representation learning with pytorch geometric. arXiv preprint arXiv:1903.02428, 2019.
280
+ [13] Massimo Filippi, Paola Valsasina, Paolo Misci, Andrea Falini, Giancarlo Comi, and Maria A Rocca. The organization of intrinsic brain activity differs between genders: A resting-state fmri study in a large cohort of young healthy subjects. Human brain mapping, 34(6):1330–1343, 2013.
281
+
282
+ [14] Karl J Friston, Andrew P Holmes, Keith J Worsley, J-P Poline, Chris D Frith, and Richard SJ Frackowiak. Statistical parametric maps in functional imaging: a general linear approach. Human brain mapping, 2(4):189–210, 1994.
283
+
284
+ [15] Soham Gadgil, Qingyu Zhao, Adolf Pfefferbaum, Edith V Sullivan, Ehsan Adeli, and Kilian M Pohl. Spatio-temporal graph convolution for resting-state fmri analysis. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 528–538. Springer, 2020.
285
+
286
+ [16] Hongyang Gao and Shuiwang Ji. Graph u-nets. In international conference on machine learning, pages 2083–2092. PMLR, 2019.
287
+
288
+ [17] Matthew F Glasser, Stamatios N Sotiropoulos, J Anthony Wilson, Timothy S Coalson, Bruce Fischl, Jesper L Andersson, Junqian Xu, Saad Jbabdi, Matthew Webster, Jonathan R Polimeni, et al. The minimal preprocessing pipelines for the human connectome project. Neuroimage, 80:105–124, 2013.
289
+
290
+ [18] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
291
+
292
+ [19] Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7132–7141, 2018.
293
+
294
+ [20] Scott A Huettel, Allen W Song, and Gregory McCarthy. Functional magnetic resonance imaging, volume 1. Sinauer Associates Sunderland, MA, 2004.
295
+
296
+ [21] R Matthew Hutchison, Thilo Womelsdorf, Elena A Allen, Peter A Bandettini, Vince D Calhoun, Maurizio Corbetta, Stefania Della Penna, Jeff H Duyn, Gary H Glover, Javier Gonzalez-Castillo, et al. Dynamic functional connectivity: promise, issues, and interpretations. Neuroimage, 80:360–378, 2013.
297
+
298
+ [22] Anees Kazi, Soroush Farghadani, and Nassir Navab. Ia-gcn: Interpretable attention based graph convolutional network for disease prediction. arXiv preprint arXiv:2103.15587, 2021.
299
+
300
+ [23] Byung-Hoon Kim and Jong Chul Ye. Understanding graph isomorphism network for rs-fmri functional connectivity analysis. Frontiers in neuroscience, 14:630, 2020.
301
+
302
+ [24] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
303
+
304
+ [25] Sofia Ira Ktena, Sarah Parisot, Enzo Ferrante, Martin Rajchl, Matthew Lee, Ben Glocker, and Daniel Rueckert. Distance metric learning using graph convolutional networks: Application to functional brain networks. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 469–477. Springer, 2017.
305
+
306
+ [26] Sofia Ira Ktena, Sarah Parisot, Enzo Ferrante, Martin Rajchl, Matthew Lee, Ben Glocker, and Daniel Rueckert. Metric learning with spectral graph convolutions on brain connectivity networks. NeuroImage, 169:431–442, 2018.
307
+
308
+ [27] John Boaz Lee, Ryan A Rossi, Sungchul Kim, Nesreen K Ahmed, and Eunyee Koh. Attention models in graphs: A survey. ACM Transactions on Knowledge Discovery from Data (TKDD), 13(6):1–25, 2019.
309
+
310
+ [28] Junhyun Lee, Inyeop Lee, and Jaewoo Kang. Self-attention graph pooling. In International Conference on Machine Learning, pages 3734–3743. PMLR, 2019.
311
+
312
+ [29] Xiaoxiao Li, Nicha C Dvornek, Yuan Zhou, Juntang Zhuang, Pamela Ventola, and James S Duncan. Graph neural network for interpreting task-fmri biomarkers. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 485–493. Springer, 2019.
313
+
314
+ [30] Xiaoxiao Li, Nicha C Dvornek, Juntang Zhuang, Pamela Ventola, and James Duncana. Graph embedding using infomax for asd classification and brain functional difference detection. arXiv preprint arXiv:1908.04769, 2019.
315
+
316
+ [31] Xiaoxiao Li, Yuan Zhou, Nicha C Dvornek, Muhan Zhang, Juntang Zhuang, Pamela Ventola, and James S Duncan. Pooling regularized graph neural network for fmri biomarker analysis. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 625–635. Springer, 2020.
317
+ [32] Xiaoxiao Li, Yuan Zhou, Siyuan Gao, Nicha Dvornek, Muhan Zhang, Juntang Zhuang, Shi Gu, Dustin Scheinost, Lawrence Staib, Pamela Ventola, et al. Braingnn: Interpretable brain graph neural network for fmri analysis. bioRxiv, 2020.
318
+ [33] Guixiang Ma, Nesreen K Ahmed, Ted Willke, Dipanjan Sengupta, Michael W Cole, Nick TurkBrowne, and Philip S Yu. Similarity learning with higher-order proximity for brain network analysis. arXiv preprint arXiv:1811.02662, 2018.
319
+ [34] Lauren E Mak, Luciano Minuzzi, Glenda MacQueen, Geoffrey Hall, Sidney H Kennedy, and Roumen Milev. The default mode network in healthy individuals: a systematic review and meta-analysis. Brain connectivity, 7(1):25–33, 2017.
320
+ [35] Giang Hoang Nguyen, John Boaz Lee, Ryan A Rossi, Nesreen K Ahmed, Eunyee Koh, and Sungchul Kim. Continuous-time dynamic network embeddings. In Companion Proceedings of the The Web Conference 2018, pages 969–976, 2018.
321
+ [36] Sam Nguyen, Brenda Ng, Alan D Kaplan, and Priyadip Ray. Attend and decode: 4d fmri task state decoding using attention models. In Machine Learning for Health, pages 267–279. PMLR, 2020.
322
+ [37] Maria Giulia Preti, Thomas AW Bolton, and Dimitri Van De Ville. The dynamic functional connectome: State-of-the-art and perspectives. Neuroimage, 160:41–54, 2017.
323
+ [38] Ekagra Ranjan, Soumya Sanyal, and Partha Talukdar. Asap: Adaptive structure aware pooling for learning hierarchical graph representations. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 5470–5477, 2020.
324
+ [39] Stuart J Ritchie, Simon R Cox, Xueyi Shen, Michael V Lombardo, Lianne M Reus, Clara Alloza, Mathew A Harris, Helen L Alderson, Stuart Hunter, Emma Neilson, et al. Sex differences in the adult human brain: evidence from 5216 uk biobank participants. Cerebral Cortex, 28(8):2959–2975, 2018.
325
+ [40] Emanuele Rossi, Ben Chamberlain, Fabrizio Frasca, Davide Eynard, Federico Monti, and Michael Bronstein. Temporal graph networks for deep learning on dynamic graphs. arXiv preprint arXiv:2006.10637, 2020.
326
+ [41] Abhijit Guha Roy, Nassir Navab, and Christian Wachinger. Recalibrating fully convolutional networks with spatial and channel “squeeze and excitation” blocks. IEEE transactions on medical imaging, 38(2):540–549, 2018.
327
+ [42] Alexander Schaefer, Ru Kong, Evan M Gordon, Timothy O Laumann, Xi-Nian Zuo, Avram J Holmes, Simon B Eickhoff, and BT Thomas Yeo. Local-global parcellation of the human cerebral cortex from intrinsic functional connectivity mri. Cerebral Cortex, 28(9):3095–3114, 2017.
328
+ [43] Olaf Sporns. Graph theory methods: applications in brain networks. Dialogues in clinical neuroscience, 20(2):111, 2018.
329
+ [44] Enzo Tagliazucchi, Pablo Balenzuela, Daniel Fraiman, and Dante R Chialvo. Criticality in largescale brain fmri dynamics unveiled by a novel point process analysis. Frontiers in physiology, 3:15, 2012.
330
+ [45] David C Van Essen, Stephen M Smith, Deanna M Barch, Timothy EJ Behrens, Essa Yacoub, Kamil Ugurbil, Wu-Minn HCP Consortium, et al. The wu-minn human connectome project: an overview. Neuroimage, 80:62–79, 2013.
331
+ [46] 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, pages 5998–6008, 2017.
332
+ [47] Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
333
+ [48] Simon Wein, WM Malloni, Ana Maria Tomé, Sebastian M Frank, G-I Henze, Stefan Wüst, Mark W Greenlee, and Elmar W Lang. A graph neural network framework for causal inference in brain networks. Scientific reports, 11(1):1–18, 2021.
334
+ [49] Dongya Wu, Xin Li, and Jun Feng. Connectome-based individual prediction of cognitive behaviors via the graph propagation network reveals directed brain network topology. bioRxiv, 2021.
335
+ [50] Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and S Yu Philip. A comprehensive survey on graph neural networks. IEEE transactions on neural networks and learning systems, 2020.
336
+ [51] Da Xu, Chuanwei Ruan, Evren Korpeoglu, Sushant Kumar, and Kannan Achan. Inductive representation learning on temporal graphs. arXiv preprint arXiv:2002.07962, 2020.
337
+ [52] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
338
+ [53] 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, 2018.
339
+ [54] Sijie Yan, Yuanjun Xiong, and Dahua Lin. Spatial temporal graph convolutional networks for skeleton-based action recognition. In Proceedings of the AAAI conference on artificial intelligence, volume 32, 2018.
340
+ [55] Yichao Yan, Jie Qin, Bingbing Ni, Jiaxin Chen, Li Liu, Fan Zhu, Wei-Shi Zheng, Xiaokang Yang, and Ling Shao. Learning multi-attention context graph for group-based re-identification. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020.
341
+ [56] Jong Chul Ye, Yoseob Han, and Eunju Cha. Deep convolutional framelets: A general deep learning framework for inverse problems. SIAM Journal on Imaging Sciences, 11(2):991–1048, 2018.
342
+ [57] Jong Chul Ye and Woon Kyoung Sung. Understanding geometry of encoder-decoder CNNs. In International Conference on Machine Learning, pages 7064–7073, 2019.
343
+ [58] Zhitao Ying, Jiaxuan You, Christopher Morris, Xiang Ren, Will Hamilton, and Jure Leskovec. Hierarchical graph representation learning with differentiable pooling. In Advances in neural information processing systems, pages 4800–4810, 2018.
344
+ [59] Andrew Zalesky and Michael Breakspear. Towards a statistical test for functional connectivity dynamics. Neuroimage, 114:466–470, 2015.
md/train/ZdJQ8KekIyd/ZdJQ8KekIyd.md ADDED
@@ -0,0 +1,522 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Partial Identification of Counterfactual Distributions
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 This paper investigates the problem of bounding counterfactual queries from a
11
+ 2 combination of observational data and qualitative assumptions about the underlying
12
+ 3 data-generating model. These assumptions are usually represented in the form
13
+ 4 of a causal diagram (Pearl, 1995). We show that all counterfactual distributions
14
+ 5 (over finite observed variables) in an arbitrary causal diagram could be generated
15
+ 6 by a special family of structural causal models (SCMs), compatible with the
16
+ 7 same causal diagram, where unobserved (exogenous) variables are discrete, taking
17
+ 8 values in a finite domain. This entails a reduction in which the space where the
18
+ 9 original, arbitrary SCM lives can be mapped to a dual, more well-behaved space
19
+ 10 where the exogenous variables are discrete, and more easily parametrizable. Using
20
+ 11 this reduction, we translate the bounding problem in the original space into an
21
+ 12 equivalent optimization program in the new space. Solving such programs leads to
22
+ 13 optimal bounds over unknown counterfactuals. Finally, we develop effective Monte
23
+ 14 Carlo algorithms to approximate these optimal bounds from a finite number of
24
+ 15 observational data. Our algorithms are validated extensively on synthetic datasets.
25
+
26
+ # 16 1 Introduction
27
+
28
+ 17 This paper studies the problem of inferring counterfactual queries from the combination of non
29
+ 18 experimental data (e.g., observational studies) and qualitative assumptions about the data-generating
30
+ 19 process. These assumptions are represented in the form of a causal diagram $\pmb { \mathbb { B 2 } }$ , which is a
31
+ 20 directed acyclic graph where arrows indicate the potential existence of functional relationships among
32
+ 21 corresponding variables; some variables are unobserved. This problem arises in diverse fields such
33
+ 22 as artificial intelligence, statistics, cognitive science, economics, and the health and social sciences.
34
+ 23 For example, when investigating the gender discrimination in college admission, one may ask “what
35
+ 24 would the admission outcome be for a female applicant had she been a male?” Such a counterfactual
36
+ 25 query contains conflicting information: in the real world the applicant is female, in the hypothetical
37
+ 26 world she was not. Therefore, it is not immediately clear how to design effective experimental
38
+ 27 procedures for evaluating counterfactuals, let alone how to compute them from observations alone.
39
+ 28 The problem of identifying counterfactual distributions from the combination of data and a causal
40
+ 29 diagram has been studied in the causal inference literature. First, there exist a complete proof system
41
+ 30 for reasoning about counterfactual queries [19]. While such a system, in principle, is sufficient in
42
+ 31 evaluating any identifiable counterfactual expression, it lacks a proof guideline which determines the
43
+ 32 feasibility of such evaluation efficiently. There are algorithms to determine whether a counterfactual
44
+ 33 distribution is inferrable from all possible controlled experiments [41]. There exist also algorithms
45
+ 34 for identifying path-specific effects from experimental data [1] and observational data [42].
46
+ 35 In practice, however, the combination of quantitative knowledge and observed data does not always
47
+ 36 permit one to point-identify the target counterfactual queries. Partial identification methods concern
48
+ 37 with deriving informative bounds over the target counterfactual probability, even when the target
49
+ 38 itself is non-identifiable. Several algorithms have been developed to bound counterfactuals from the
50
+ 39 combination of observational and experimental data [30, 36, 3, 4, 14, 35, 23, 24, 16, 25, 49].
51
+ 40 In this work, we build on the approach introduced by Balke & Pearl in $\mathbb { \left[ 3 \right] }$ , which involves direct
52
+ 41 discretization of the exogenous domains, also referred to as the principal stratification $\mathbb { L } \mathbb { Z } \mathbb { B } \mathbb { 4 } \mathbb { I }$ Con
53
+ 42 sider the causal diagram of Fig. $\begin{array}{c} \end{array} \boxed { 1 \mathrm { a } }$ where $X , Y , Z$ are binary variables in $\{ 0 , 1 \}$ ; $U$ is an unobserved
54
+ 43 variable taking values in an arbitrary continuous domain. $\boxed { 1 3 }$ showed that domains of $U$ could be
55
+ 44 discretized into 16 equivalent classes without changing the original counterfactual distributions and
56
+ 45 the graphical structure in Fig. 1a. For instance, despite it being induced by an arbitrary distribution
57
+ 46 $P ^ { * } ( u )$ over a continuous domain of the exogenous variable $U$ , the observational distribution $P ( x , y | z )$
58
+ 47 must be reproduced by a generative model of the form $\begin{array} { r } { P ( x , y | z ) = \sum _ { u } P ( x | u , z ) P ( y | x , \dot { u } ) P ( \dot { u } ) } \end{array}$
59
+ 48 where $P ( u )$ is a discrete distribution over a finite exogenous domain $\{ 1 , \ldots , 1 6 \}$ .
60
+ 49 Using the finite-state representation of unobserved variables, $\mathbb { H }$ derived tight bounds on treatment
61
+ 50 effects under the condition of noncompliance in Fig. 1a. [11, 21] applied the parsimony of finite-state
62
+ 51 representation in a Bayesian framework, to obtain credible intervals for the posterior distribution of
63
+ 52 causal effects in noncompliance settings. Despite their optimal guarantees, these bounds are only
64
+ 53 applicable to the specific noncompliance setting in Fig. 1a. For the most general cases, a systematic
65
+ 54 procedure for bounding counterfactual queries in arbitrary causal diagrams is still missing.
66
+ 55 Our goal in this paper is to overcome these challenges. We investigate the expressive power of discrete
67
+ 56 structural causal models (SCMs) $\pmb { \mathbb { B 3 } } \|$ where each unobserved variable is drawn from a discrete
68
+ 57 distribution, takes values in a finite set of states. We show that when inferring about counterfactual
69
+ 58 distributions (over finite observed variables) in an arbitrary causal diagram, one could restrict domains
70
+ 59 of unobserved variables to a finite space without loss of generality. This observation allows us to
71
+ 60 develop novel partial identification algorithms to bound unknown counterfactual probabilities from
72
+ 61 the observational data. More specifically, our contributions are as follows. (1) We introduce a
73
+ 62 special family of discrete SCMs, with finite unobserved domains, and show that it could represent
74
+ 63 all categorical counterfactual distributions in an arbitrary causal diagram. (2) Using this result, we
75
+ 64 translate the original partial identification task into equivalent polynomial programs. Solving such
76
+ 65 programs leads to informative bounds over unknown counterfactual probabilities, which are provably
77
+ 66 optimal. (3) We develop an effective Monte Carlo algorithm to approximate optimal counterfactual
78
+ 67 bounds from a finite number of observational data. Finally, our algorithms are validated extensively
79
+ 68 on synthetic datasets. Given space constraints, all proofs are provided in Appendices A and B.
80
+
81
+ ![](images/6f82c575bdbe37b02df34a95b75fa7432880eccb577020331b7cc4e0d9798dca.jpg)
82
+ Figure 1: DAGs $\mathrm { \textregistered }$ containing a treatment $X$ , an outcome $Y$ , an ancestor $Z$ , and exogenous variables $U$ ; $Z$ in (a) is also referred to as an instrumental variable.
83
+
84
+ # 69 1.1 Preliminaries
85
+
86
+ 70 We introduce in this section some basic notations and definitions that will be used throughout the
87
+ 71 paper. We use capital letters to denote variables $( X )$ , small letters for their values $( x )$ and $\Omega _ { X }$ for
88
+ 72 their domains. For an arbitrary set $\boldsymbol { X }$ , let $| X |$ be its cardinality. For convenience, we denote by $P ( { \pmb x } )$
89
+ 73 probabilities $P ( \pmb { X } = \pmb { x } )$ ; for an arbitrary subdomain ${ \mathcal { X } } \subseteq \Omega _ { X }$ , $P ( \mathcal X ) \equiv P ( X \in \mathcal X )$ . Finally, the
90
+ 74 indicator function $\mathbb { 1 } _ { X = x }$ returns 1 if an event $\mathbf { \nabla } X = x$ holds true; otherwise $\mathbb { 1 } _ { X = \pmb { x } } = 0$ .
91
+ 75 The basic semantical framework of our analysis rests on structural causal models (SCMs) [33,
92
+ 76 Ch. 7]. An SCM $M$ is a tuple $\langle V , U , F , P \rangle$ where $V$ is a set of endogenous variables and $U$ is
93
+ 77 a set of exogenous variables. $\pmb { F }$ is a set of functions where each $f _ { V } \in F$ decides values of an
94
+ 78 endogenous variable $V \in V$ taking as argument a combination of other variables in the system. That
95
+ 79 is, $v f _ { V } ( p a _ { V } , u _ { V } ) , P a _ { V } \subseteq V , U _ { V } \subseteq U$ . Exogenous variables $U \in U$ are mutually independent,
96
+ 80 values of which are drawn from the exogenous distribution $P ( \pmb { u } )$ . Naturally, $M$ induces a joint
97
+ 81 distribution $P ( \pmb { v } )$ over endogenous variables $V$ , called the observational distribution. Each SCM
98
+ 82 is associated with a causal diagram $\mathcal { G }$ (e.g., Fig. 1), which is a directed acyclic graph (DAG) where
99
+ 83 solid nodes represent endogenous variables $V$ , empty nodes represent exogenous variables $U$ and
100
+ 84 arrows represent the arguments $P a _ { V } , U _ { V }$ of each function $f _ { V }$ .
101
+ 85 An intervention on an arbitrary subset $X \subseteq V$ , denoted by ${ \mathrm { d o } } ( { \pmb x } )$ , is an operation where values of
102
+ 86 $\boldsymbol { X }$ are set to constants $_ { \textbf { \em x } }$ , regardless of how they are ordinarily determined. For an SCM $M$ , let
103
+ 87 $M _ { x }$ denote a submodel of $M$ induced by intervention ${ \mathrm { d o } } ( { \pmb x } )$ . For any subset $Y \subseteq V$ , the potential
104
+ 88 response $Y _ { x } ( u )$ is defined as the solution of $\mathbf { Y }$ in the submodel $M _ { x }$ given $U = { \pmb u }$ . Drawing values
105
+ 89 of exogenous variables $U$ following the probability measure $P$ induces a counterfactual variable $Y _ { x }$ .
106
+ 90 Specifically, the event $Y _ { x } = y$ (for short, $\scriptstyle { \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 \Psi \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { \Psi } \mathbf \mathbf { } \mathbf { } \mathbf { \Psi \Psi } \mathbf \mathbf { } \mathbf { \Psi } \mathbf \mathbf { } \mathbf { \Psi \Psi \Psi \mathbf } \mathbf { \Psi \Psi \mathbf } \mathbf \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { \Psi \Psi \Psi \mathbf } \mathbf \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \mathbf \Psi \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \mathbf \Psi \mathbf \Psi \mathbf \mathbf \Psi \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf $ ) can be read as $\mathbf { \sigma } ^ { \bullet } \mathbf { Y }$ would be $\textbf { { y } }$ had $\boldsymbol { X }$ been $\mathbf { \nabla } _ { \mathbf { x } } , \mathbf { \vec { x } }$ . For any
107
+ 91 subsets $Y , \dots , Z , X , \dots , W \subseteq V$ , the distribution over counterfactuals $Y _ { x } , \dots , Z _ { w }$ is defined as:
108
+
109
+ $$
110
+ P \left( y _ { x } , \ldots , z _ { w } \right) = \int _ { \Omega _ { U } } \mathbb { 1 } _ { Y _ { x } ( \boldsymbol { u } ) = \boldsymbol { y } } \wedge \cdots \wedge \mathbb { 1 } _ { Z _ { w } ( \boldsymbol { u } ) = z } d P ( \boldsymbol { u } ) .
111
+ $$
112
+
113
+ 92 Distributions of the form $P ( \pmb { y _ { x } } )$ is called the interventional distribution; when the treatment set
114
+ 93 $\boldsymbol { X } = \boldsymbol { \emptyset }$ , $P ( \pmb { y } )$ coincides with the observational distribution. Throughout this paper, we assume
115
+ 94 that endogenous variables $V$ are discrete and finite; while exogenous variables $U$ could take any
116
+ 95 (continuous) value. The counterfactual distribution $P \left( y _ { x } , \ldots , z _ { w } \right)$ defined above is thus a categorical
117
+ 96 distribution. For a more detailed survey on SCMs, we refer readers to $\pmb { \mathbb { B 3 } }$ Ch. 7].
118
+
119
+ # 97 2 Discretization of Structural Causal Models
120
+
121
+ For a DAG 98 $\mathcal { G }$ with endogenous $V$ and exogenous variables $U$ , let $P ^ { * }$ denote the collection of all 99 counterfactual distributions over variables $V$ . Formally,
122
+
123
+ $$
124
+ \pmb { P } ^ { * } = \{ P \left( \pmb { y } _ { \pmb { x } } , \ldots , \pmb { z } _ { w } \right) | \forall \pmb { Y } , \ldots , \pmb { Z } , \pmb { X } , \ldots , \pmb { W } \subseteq \pmb { V } \} .
125
+ $$
126
+
127
+ 100 Let $\mathcal { M }$ be the family of all the SCMs compatible with the causal diagram $\mathcal { G }$ , i.e., $\mathcal { M } =$
128
+ 101 $\{ \forall M \mid { \mathcal { G } } _ { M } = { \mathcal { G } } \} ^ { 1 }$ . Counterfactual distributions in $\mathcal { G }$ are defined as the collection $\{ P _ { M } ^ { * } : \forall M \in \mathcal { M } \}$
129
+ 102 that contains all counterfactual probabilities induced by SCMs $M$ in the candidate family $\mathcal { M }$ . In this
130
+ 103 section, we will show that counterfactual distributions in any causal diagram $\mathcal { G }$ could be generated by
131
+ 104 an alternative family of “generic” SCMs compatible with $\mathcal { G }$ , which we will define later.
132
+ 05 Definition 1 (Counterfactual-Equivalence). For a DAG $\mathcal { G }$ , let ${ \mathcal { M } } , { \mathcal { N } }$ be two sets of SCMs compatible
133
+ 106 with $\mathcal { G }$ . $\mathcal { M }$ and $\mathcal { N }$ are said to be counterfactually equivalent (for short, ctf-equivalent) if for any
134
+ 107 $M \in \mathcal { M }$ , there exists an alternative $N \in \mathcal { N }$ such that $P _ { M } ^ { * } = P _ { N } ^ { * }$ , and vice versa.
135
+
136
+ Our analysis rests on a special family of SCMs where values of each exogenous variable are drawn from a discrete distribution over a finite set of states.
137
+
138
+ Definition 2. An SCM $M = \langle V , U , F , P \rangle$ is said to be a discrete SCM if
139
+
140
+ 1. Values of every $U \in U$ are drawn from a discrete distribution $P ( u )$ over a domain $\Omega _ { U }$ ; let $\theta _ { u }$ denote the probability $P ( U = u )$ , for any $u \in \Omega _ { U }$ . f
141
+ 2. Values of every $V \in V$ are decided by function $v f _ { V } ( p a _ { V } , u _ { V } ) \equiv \xi _ { V } ^ { ( p a _ { V } , u _ { V } ) }$ , where for $\forall p a _ { V } , u _ { V } , \xi _ { V } ^ { ( p a _ { V } , u _ { V } ) }$ is a constant in the finite domain $\Omega _ { V }$ .
142
+
143
+ 115 Given a causal diagram $\mathcal { G }$ , our goal is to construct a family of discrete SCMs $\mathcal { N }$ that is counter
144
+ 116 factually equivalent to the original family of SCMs $\mathcal { M }$ . Our construction utilizes a special type of
145
+ 117 clustering of nodes in the diagram, called the confounded component $\lVert \rVert 5 \rVert$ .
146
+ 118 Definition 3. For an DAG $\mathcal { G }$ , a subset $C \subseteq V$ is a c-component if any pair $X , Y \in C$ is connected
147
+ 19 in $\mathcal { G }$ by a bi-directed path of the form $V _ { 1 } V _ { 2 } \cdots V _ { n }$ , $n = 1 , 2 , \ldots$ , where (1) $V _ { 1 } = X$ ,
148
+ 120 $V _ { n } = Y$ ; (2) $\{ V _ { 1 } , \ldots , V _ { n } \} \subseteq V$ ; and (3) each $V _ { i } V _ { j }$ is a sequence $V _ { i } \left. U _ { k } \right. V _ { j }$ and $U _ { k } \in U$ .
149
+
150
+ A c-component $C$ in $\mathcal { G }$ is maximal if there exists no other c-component that contains $C$ . We denote by ${ \mathcal { C } } ( { \mathcal { G } } )$ the collection of all maximal c-components in $\mathcal { G }$ . Naturally, c-components in ${ \mathcal { C } } ( { \mathcal { G } } )$ form a partition over endogenous variables $V$ , which, in turn, defines a partition $\{ \cup _ { V \in C } U _ { V } \mid \forall C \in { \mathcal { C } } ( { \mathcal { G } } ) \}$ over exogenous variables $U$ . Therefore, for every $U \in U$ , there must exist a unique c-component in ${ \mathcal { C } } ( { \mathcal { G } } )$ , denoted by $C _ { U }$ , such that $U \in \cup _ { V \in C _ { U } } U _ { V }$ . For example, exogenous variables $U _ { 1 } , U _ { 2 }$ in Fig. 1a corresponds to c-components $C _ { U _ { 1 } } = \{ Z \}$ and $C _ { U _ { 2 } } = \{ X , Y \}$ respectively; while the causal diagram of Fig. 1b only has a single c-component $\{ X , Y , Z \}$ .
151
+
152
+ 128 Theorem 1. For a DAG $\mathcal { G }$ , consider the following conditions2 : (1) $\mathcal { M }$ is the set of all SCMs
153
+ 129 compatible with $\mathcal { G }$ ; (2) $\mathcal { N }$ is the set of all discrete SCMs compatible with $\mathcal { G }$ where for every $U \in U$ ,
154
+ 130 its cardinality $\begin{array} { r } { \left| \Omega _ { U } \right| = \prod _ { V \in { \cal C } _ { U } } | \Omega _ { P a _ { V } } \mapsto \Omega _ { V } | , } \end{array}$ , i.e., the number of functions mapping from $P a _ { V }$ to
155
+ 131 $V$ for every variable $V$ in the $c$ -component $C _ { U }$ . Then, $\mathcal { M }$ and $\mathcal { N }$ are counterfactually equivalent.
156
+ 132 Thm. $^ 1$ establishes the expressive power of discrete SCMs in representing counterfactual distributions
157
+ 133 in a causal diagram $\mathcal { G }$ . It implies that the counterfactual distribution $P \left( y _ { x } , \ldots , z _ { w } \right)$ in any SCM $M$
158
+ 134 could be generated using a generic model as follows, for $\begin{array} { r } { d _ { U } = \prod _ { V \in { \cal { C } } _ { U } } | \Omega _ { P a _ { V } } \mapsto \Omega _ { V } | } \end{array}$ ,
159
+
160
+ $$
161
+ P \left( y _ { x } , \ldots , z _ { w } \right) = \sum _ { U \in U } \sum _ { u = 1 , \ldots , d _ { U } } \mathbb { 1 } _ { Y _ { x } ( u ) = y } \wedge \cdots \wedge \mathbb { 1 } _ { Z _ { w } ( u ) = z } \prod _ { U \in U } \theta _ { u } .
162
+ $$
163
+
164
+ 135 Among above quantities, $\theta _ { u }$ are parameters of the exogenous distribution $P ( u )$ over a finite domain
165
+ 136 $\{ 1 , \ldots , d _ { U } \}$ . Counterfactual variables ${ \cal Y } _ { x } ( u )$ are recursively defined as follows:
166
+
167
+ $$
168
+ Y _ { x } ( u ) = \left\{ Y _ { x } ( u ) \ | \ \forall Y \in Y \right\} , \ \mathrm { w h e r e } \ Y _ { x } ( u ) = \left\{ \begin{array} { l l } { \hfill \hfill \hfill \hfill } { x _ { Y } } & { \mathrm { i f } \ Y \in X } \\ \hfill \hfill \xi _ { Y } ^ { ( \{ V _ { x } ( u ) \} \backslash V \in P a _ { Y } \} , u _ { Y } ) } & { \mathrm { o t h e r w i s e } } \end{array} \right.
169
+ $$
170
+
171
+ 137 where $\pmb { x } _ { Y }$ is the value assigned to variable $Y$ in constants $_ { \textbf { \em x } }$ . As an example, consider the causal
172
+ 138 diagram $\mathcal { G }$ described in Fig. $\boxed { 1 6 }$ where $X , Y , Z$ are binary variables in $\{ 0 , 1 \}$ . Since $\mathcal { G }$ has a single c
173
+ 139 component $\{ X , Y , Z \}$ , exogenous variables $U _ { 1 } , U _ { 2 }$ must share the same cardinality $d$ in the proposed
174
+ 140 family of discrete SCMs $\mathcal { N }$ . It follows from Thm. $^ 1$ the counterfactual distribution $P ( z , x _ { z ^ { \prime } } , y _ { x ^ { \prime } } )$ in
175
+ 141 any SCM compatible with $\mathcal { G }$ could be written as follows:
176
+
177
+ $$
178
+ P ( z , x _ { z ^ { \prime } } , y _ { x ^ { \prime } } ) = \sum _ { u _ { 1 } , u _ { 2 } = 1 } ^ { d } \mathbb { 1 } _ { \xi _ { z } ^ { ( u _ { 1 } ) } = z } \wedge \mathbb { 1 } _ { \xi _ { x } ^ { ( z ^ { \prime } , u _ { 1 } , u _ { 2 } ) } = x } \wedge \mathbb { 1 } _ { \xi _ { Y } ^ { ( x ^ { \prime } , u _ { 2 } ) } = y } \theta _ { u _ { 1 } } \theta _ { u _ { 2 } } ,
179
+ $$
180
+
181
+ where 142 $\xi _ { Z } ^ { ( u _ { 1 } ) } , \xi _ { X } ^ { ( z , u _ { 1 } , u _ { 2 } ) } , \xi _ { Y } ^ { ( x , u _ { 2 } ) }$ are parameters taking values in $\{ 0 , 1 \}$ ; $\theta _ { u _ { i } }$ , $i = 1 , 2$ , are probabilities 143 of the discrete distribution $P ( u _ { i } )$ over the finite domain $\{ 1 , \ldots , d \}$ . The cardinality $d = | \Omega _ { Z } | \times$ 144 $| \Omega _ { Z } \mapsto \Omega _ { X } | \times | \Omega _ { X } \mapsto \Omega _ { Y } | = 3 2$ . The total cardinalities of domains for $U _ { 1 } , U _ { 2 }$ are thus $2 d = 6 4$ .
182
+
183
+ 145 Comparison with related work One could naïvely apply the discretization procedure in $\mathbb { \left[ 3 \right] }$ and
184
+ 146 obtain a family of discrete SCMs that are sufficient in representing distributions in an causal diagram.
185
+ 147 However, such parametrization is not necessarily complete. To witness, consider again the causal
186
+ 148 diagram in Fig. $\bar { 1 } 6$ with binary $X , Y , Z$ . Applying the discretization in $\mathbb { \left[ 3 \right] }$ leads to a family of discrete
187
+ 149 SCMs compatible with a different diagram in Fig. $\bigstar$ where the cardinality of exogenous variable
188
+ 150 $U$ is equal to $d = 3 2$ (see Appendix $\bar { \bigstar }$ for details). However, this parametrization fails to capture
189
+ 151 some critical constraints over counterfactual distributions since it does not maintain the original
190
+ 152 structure of the causal diagram. For instance, counterfactual variables $Z$ and $Y _ { x }$ in the original
191
+ 153 diagram of Fig. 1b are independent due to independence restrictions $\pmb { \mathbb { B 3 } }$ Ch. 7.3.2]; while $Z$ and
192
+ 154 $Y _ { x }$ in Fig. $\boxed { 1 \mathrm { c } }$ are generally correlated due to the presence of unobserved confounder $U$ . Compared
193
+ 155 with $\pmb { \Vert 3 \Vert }$ , the discretization method in Thm. $^ 1$ captures all constraints over counterfactual distributions
194
+ 156 while requiring only a factor of $| U |$ increase in the cardinality of exogenous domains.
195
+ 157 More recently, $\mathbb { \lVert 1 5 \rVert }$ proved a special case of Thm. $\bigstar$ for interventional distributions in a specific
196
+ 158 class of causal diagrams that satisfy the running intersection property. When there is no direct arrow
197
+ 159 between endogenous variables, $\pmb { \mathbb { B } } 8 \|$ showed that the observational distribution in a diagram could be
198
+ 160 represented using finite-state exogenous variables. Thm. $^ 1$ generalizes these results by showing that,
199
+ 161 for the first time, all counterfactual distributions in an arbitrary causal diagram could be generated
200
+ 162 using discrete exogenous variables taking values from a finite domain, without any loss of generality.
201
+
202
+ # 2.1 Partial identification of Counterfactual Distributions
203
+
204
+ To demonstrate the expressive power of discrete SCMs, we investigate the problem of partial identification of counterfactual distributions. For an SCM $M ^ { * } = \langle V , U , F , P \rangle$ , we are interested in evaluating an arbitrary counterfactual probability $P ( \pmb { y } _ { \pmb { x } } , \dots , \pmb { z } _ { \pmb { w } } )$ . The detailed parametrization of $M ^ { * }$ is unknown. Instead, the learner only has access to the causal diagram $\mathcal { G }$ and the observational distribution $P ( \pmb { v } )$ induced by $M ^ { * }$ . Our goal is to derive an informative bound $[ l , r ]$ from the combination of $\mathcal { G }$ and $P ( \pmb { v } )$ that contains the actual counterfactual probability $P ( \pmb { y } _ { \pmb { x } } , \dots , \pmb { z } _ { \pmb { w } } )$ .
205
+
206
+ 170 Let $\mathcal { N }$ denote the family of discrete SCMs defined in Thm. $\bigstar$ which are compatible with the causal
207
+ 171 diagram $\mathcal { G }$ . We derive a bound $[ l , r ]$ over $P ( \pmb { y } _ { \pmb { x } } , \dots , \pmb { z } _ { \pmb { w } } )$ from the observational data $P ( \pmb { v } )$ by solving
208
+ 172 the following optimization problem:
209
+
210
+ $$
211
+ [ l , r ] = \operatorname* { m i n } / \operatorname* { m a x } \Big \{ P _ { N } ( \pmb { y _ { x } } , \dots , \pmb { z _ { w } } ) \ | \ \forall N \in \mathcal { N } , P _ { N } ( \pmb { v } ) = P ( \pmb { v } ) \Big \}
212
+ $$
213
+
214
+ 173 For instance, consider again the double-bow diagram $\mathcal { G }$ in Fig. 1b. The observational distribution
215
+ 174 $P ( x , y , z )$ in any discrete SCM in $\mathcal { N }$ could be written as:
216
+
217
+ $$
218
+ P ( x , y , z ) = \sum _ { u _ { 1 } , u _ { 2 } = 1 } ^ { d } \mathbb { 1 } _ { \xi _ { z } ^ { ( u _ { 1 } ) } = z } \wedge \mathbb { 1 } _ { \xi _ { x } ^ { ( z , u _ { 1 } , u _ { 2 } ) } = x } \wedge \mathbb { 1 } _ { \xi _ { Y } ^ { ( x , u _ { 2 } ) } = y } \theta _ { u _ { 1 } } \theta _ { u _ { 2 } } .
219
+ $$
220
+
221
+ 175 One could derive a bound over the counterfactual distribution $P ( z , x _ { z ^ { \prime } } , y _ { x ^ { \prime } } )$ from the observational
222
+ 176 data $P ( x , y , z )$ by solving polynomial programs which optimize the objective Eq. $( 5 )$ over parameters
223
+ 177 $\theta _ { u _ { 1 } } , \theta _ { u _ { 2 } } , \xi _ { Z } ^ { ( u _ { 1 } ) } , \xi _ { X } ^ { ( z , u _ { 1 } , u _ { 2 } ) } , \xi _ { Y } ^ { ( x , u _ { 2 } ) }$ , subject to the observational constraints Eq. $( 7 )$
224
+ 178 As a corollary, it follows immediately from Thm. $^ 1$ that the solution $[ l , r ]$ of the optimization problem
225
+ 179 Eq. $( 6 )$ is guaranteed to be a valid bound over the unknown counterfactual $P ( \pmb { y } _ { x } , \dots , \pmb { z } _ { w } )$ .
226
+ 180 Corollary 1 (Soundness). Given a $D A G { \mathcal { G } }$ and an observational distribution $P ( \pmb { v } )$ , let $\mathcal { M }$ be the set
227
+ 181 of all SCMs compatible with $\mathcal { G }$ and let $\mathcal { M } _ { o } = \{ \forall M \in \mathcal { M } \mid P _ { M } ( \pmb { v } ) = P ( \pmb { v } ) \}$ . For the solution $[ l , r ]$
228
+ 182 of Eq. (6), $P _ { M } ( \pmb { y _ { x } } , \dotsc , \pmb { z _ { w } } ) \in [ l , r ]$ for any SCM $M \in \mathcal { M } _ { o }$ .
229
+ 183 Since the underlying SCM $M ^ { \ast } \in \mathcal { M } _ { o }$ , Corol. $^ 1$ implies that the derived bound $[ l , r ]$ must contain the
230
+ 184 actual counterfactual probability $P ( \pmb { y } _ { x } , \dots , \pmb { z } _ { w } )$ . Our next result shows that such a bound $[ l , r ]$ is
231
+ 185 provably tight, i.e., it cannot be improved without additional assumptions.
232
+ 186 Corollary 2 (Tightness). Given a DAG $\mathcal { G }$ and an observational distribution $P ( \pmb { v } )$ , let $\mathcal { M }$ be the set
233
+ 187 of all SCMs compatible with $\mathcal { G }$ and let $\mathcal { M } _ { o } = \{ \forall M \in \mathcal { M } \mid P _ { M } ( \pmb { v } ) = P ( \pmb { v } ) \} ,$ . For the solution $[ l , r ]$
234
+ 188 of Eq. $( 6 )$ , there exist SCMs $M _ { 1 } , M _ { 2 } \in \mathcal { M } _ { o }$ such that $P _ { M _ { 1 } } ( y _ { x } , \dots , z _ { w } ) = l$ , $P _ { M _ { 2 } } ( y _ { x } , \dots , z _ { w } ) = r$
235
+ 189 Corol. $2$ confirms the tightness of the bound $[ l , r ]$ obtained from Eq. (6). Suppose there exists a valid
236
+ 190 bound $[ l ^ { \prime } , r ^ { \prime } ]$ strictly contained in $[ l , r ]$ . One could construct from Corol. $\bigstar$ an SCM $M$ compatible
237
+ 191 with the causal diagram $\mathcal { G }$ and the observational distribution $P ( \pmb { v } )$ , but its counterfactual probability
238
+ 192 $P ( \pmb { y } _ { x } , \dots , \pmb { z } _ { w } )$ lies outside $[ l ^ { \prime } , r ^ { \prime } ]$ , which is a contradiction.
239
+ 193 The optimization problem of Eq. $( 6 )$ is reducible to equivalent polynomial programs (see Appendix $\mathbf { E } )$ .
240
+ 194 Despite the soundness and tightness of derived bounds, solving such programs may take exponentially
241
+ 195 long in the most general case $\pmb { \mathbb { Z } } 9 \|$ . Our focus here is upon the causal inference aspect of the problem
242
+ 196 and like earlier discussions we do not specify which solvers are used [3, 4]. In some cases of
243
+ 197 interest, effective approximate planning methods for polynomial programs do exist. Investigating
244
+ 198 these methods is an ongoing subject of research [26, 31, 48, 28, 27].
245
+
246
+ # 99 3 Bayesian Approach for Partial Identification
247
+
248
+ This section describes an effective algorithm to approximate the optimal counterfactual bound in Eq. $\textcircled { 6 }$ , provided with finite samples $\bar { \pmb { v } } = \left\{ \pmb { v } ^ { ( n ) } \right\} _ { n = 1 } ^ { \bar { N } }$ drawn from the observational distribution $P ( \pmb { v } )$ , and prior distributions over parameters $\theta _ { u }$ and $\xi _ { V } ^ { ( p a _ { V } , u _ { V } ) }$ (possibly uninformative).
249
+
250
+ 203 We first introduce Markov Chain Monte Carlo (MCMC) algorithms that sample the posterior distribu
251
+ 204 tion $P \left( \theta _ { \mathrm { c t f } } \mid \bar { \mathbf { v } } \right)$ over a counterfactual probability $\theta _ { \mathrm { c t f } } = P \left( \pmb { y _ { x } } , \ldots , \pmb { z _ { w } } \right)$ . More specifically, for every
252
+ 205 $V \in V$ , $\forall p a _ { V } , u _ { V }$ , parameters $\xi _ { V } ^ { ( p a _ { V } , u _ { V } ) }$ are drawn uniformly over the finite domain $\Omega _ { V }$ . For every
253
+ 206 $U \in U$ , exogenous probabilities $\theta _ { u }$ are drawn from a generalized Dirichlet distribution $\pmb { \mathbb { I } }$ . We will
254
+ 207 take the view of a stick-breaking construction $\mathbb { \left[ \left. 4 0 \right\| \right. }$ which successively breaks pieces off a unit-length
255
+ 208 stick with size proportional to random draws from a Beta distribution. Parameters $\theta _ { u }$ are proportions
256
+ 209 of each of the pieces relative to its original size. Formally,
257
+
258
+ $$
259
+ \forall u = 1 , 2 , \ldots , d _ { U } , \qquad \theta _ { u } = \mu _ { u } \prod _ { i = 1 } ^ { u - 1 } ( 1 - \mu _ { i } ) , \qquad \mu _ { u } \sim \mathtt { B e t a } \left( { \alpha _ { U } ^ { ( u ) } } , \beta _ { U } ^ { ( u ) } \right) ,
260
+ $$
261
+
262
+ ![](images/d74052b275b7d98ccaae19f807f008cb034d418e22761d90955771930346c904.jpg)
263
+ Figure 2: The data-generating process for the observational data $\left\{ X ^ { ( n ) } , Y ^ { ( n ) } , Z ^ { ( n ) } \right\} _ { n = 1 } ^ { N }$ in an SCM associated with the causal diagram in Fig. 1b. For every exogenous variable $U \in U$ , $\ddot { \theta _ { U } } \overset { \cdot } { = } \{ \theta _ { u } \mid \forall u \}$ . For every endogenous variable $V \in V$ , $\xi _ { V } = \Big \{ \xi _ { V } ^ { ( p a _ { V } , u _ { V } ) } \ | \ \forall p a _ { V } , u _ { V } \Big \} .$ .
264
+
265
+ 210 where $\begin{array} { r } { d _ { U } = \prod _ { V \in { \cal { C } } _ { U } } | \Omega _ { P a _ { V } } \mapsto \Omega _ { V } | } \end{array}$ and $\alpha _ { U } ^ { ( u ) } , \beta _ { U } ^ { ( u ) } > 0$ are hyperparameters. Finally, we truncate
266
+ 211 2 this construction by setting $\mu _ { d _ { U } } = 1$ . Note from Eq. $\textcircled { 8 }$ that all parameters $\theta _ { u }$ for $u > d _ { U }$ are equal
267
+ 212 to zero. As an example, Fig. $2$ shows a graphical representation of the data-generating process over
268
+ 213 parameters ✓u and ⇠ (paV ,uV )V associated with SCMs in Fig. 1b, spanning over $N$ observations.
269
+ 214 Gibbs sampling is a well-known MCMC algorithm that allows one to sample posterior distributions.
270
+ 215 For convenience, we introduce the following notations. Let parameters $\pmb { \theta } = \{ \theta _ { u } | \forall U \in U , \forall u \}$
271
+ 216 and ⇠ = n ⇠ (paV ,uV )V | $\bigstar \bigstar = \Big \{ \xi _ { V } ^ { ( p a _ { V } , u _ { V } ) } | \forall V \in V , \forall p a _ { V } , u _ { V } \Big \}$ . The set $\bar { U } = \left\{ U ^ { ( n ) } \right\} _ { n = 1 } ^ { N }$ are exogenous variables
272
+ 217 affecting N observations V¯ = V (n) N n=1; we use u¯ to represent their realizations. Our blocked
273
+ 218 Gibbs sampler works by iteratively drawing values from the conditional distributions of variables as
274
+ 219 follows $\lVert \hat { 2 2 } \rVert$ . Detailed derivations of complete conditional distributions are shown in Appendix F.
275
+ 220 Sampling $P \left( \bar { \pmb { u } } | \bar { \pmb { v } } , \pmb { \theta } , \pmb { \xi } \right)$ . Exogenous variables $U ^ { ( n ) }$ , $n = 1 , \ldots , N$ , are mutually independent
276
+ 221 given parameters $\theta , \xi$ . We could draw each $\left( U ^ { ( n ) } \mid \theta , \xi , \bar { V } \right)$ corresponding to the $n$ th observation
277
+ 222 independently. The complete conditional for $U ^ { ( n ) }$ is given by
278
+
279
+ $$
280
+ P \left( \pmb { u } ^ { ( n ) } \mid \pmb { v } ^ { ( n ) } , \pmb { \theta } , \pmb { \xi } \right) \propto \prod _ { V \in \pmb { V } } \mathbb { 1 } _ { \pmb { \xi } _ { V } ^ { \left( p a _ { V } ^ { ( n ) } , \pmb { u } _ { V } ^ { ( n ) } \right) } = \pmb { v } ^ { ( n ) } } \prod _ { U \in \pmb { U } } \theta _ { u } .
281
+ $$
282
+
283
+ 223 Sampling $P \left( \xi , \pmb \theta \mid \bar { \pmb v } , \bar { \pmb u } \right)$ . Parameters $\xi , \theta$ are independent given $\bar { V } , \bar { U }$ . Therefore, we will derive
284
+ 224 complete conditional $\xi , \theta$ separately. Note that in discrete SCMs, the $n$ th observation of variable
285
+ 225 $V \in V$ is decided by $v ^ { ( n ) } \xi _ { V } ^ { ( p a _ { V } , u _ { V } ) }$ given $p a _ { V } ^ { ( n ) } = p a _ { V }$ , $u _ { V } ^ { ( n ) } = u _ { V }$ . Thus, draw values of each
286
+ 226 $\xi _ { V } ^ { \left( p a _ { V } , u _ { V } \right) } \in \xi$ from the complete conditional defined as:
287
+
288
+ $$
289
+ P \left( \xi _ { V } ^ { ( p a _ { V } , u _ { V } ) } \mid \bar { v } , \bar { u } \right) = \left\{ \begin{array} { l l } { \mathbb { 1 } _ { \xi _ { V } ^ { ( p a _ { V } , u _ { V } ) } = v ^ { ( i ) } } } & { \mathrm { i f } \exists i , \mathrm { s . t . } p a _ { V } ^ { ( i ) } = p a _ { V } , u _ { V } ^ { ( i ) } = u _ { V } , } \\ { 1 / | \Omega _ { V } | } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
290
+ $$
291
+
292
+ Let 227 $\begin{array} { r } { n _ { u } = \sum _ { n = 1 } ^ { N } \mathbb { 1 } _ { u ^ { ( n ) } = u } } \end{array}$ records the number of values in $u ^ { ( n ) }$ that equal to $u$ . By the co of the generalized Dirichlet distribution, the complete conditional of $\theta _ { u }$ is given by, for every $\bar { U } \in \bar { U }$ ,
293
+
294
+ $$
295
+ \forall u = 1 , 2 , \ldots d _ { U } , \quad \theta _ { u } = \mu _ { u } \prod _ { i = 1 } ^ { u - 1 } ( 1 - \mu _ { i } ) , \quad \mu _ { u } \sim \mathtt { B e t a } \left( \alpha _ { U } ^ { ( u ) } + n _ { u } , \beta _ { U } ^ { ( u ) } + \sum _ { k = u + 1 } ^ { d _ { U } } n _ { k } \right) .
296
+ $$
297
+
298
+ 229 Doing so eventually produces values drawn from the posterior distribution over $\left( \theta , \xi , \bar { U } \mid \bar { V } \right)$ . Given
299
+ 230 parameters $\theta , \xi$ , we compute the counterfactual probability $\theta _ { \mathrm { c t f } } = P ( \pmb { y _ { x } } , \dots , \pmb { z _ { w } } )$ following the
300
+ 231 three-step algorithm in $\bar { \big \| } \bar { 3 3 } \big \|$ which consists of abduction, action, and prediction. Thus computing $\theta _ { \mathrm { c t f } }$
301
+ 232 from each draw $\theta , \xi , { \bar { U } }$ eventually gives us the draw from the posterior distribution $P \left( \theta _ { \mathrm { c t f } } \mid \bar { \mathbf { v } } \right)$ .
302
+
303
+ # 3.1 Collapsed Gibbs Sampling
304
+
305
+ 234 We also describe an alternative sampler that applies to stick-breaking priors with a known Pólya
306
+ 235 urn characterization. Formally, consider stick-breaking priors in Eq. $( 8 )$ with hyperparameters
307
+ 236 $\alpha _ { U } ^ { ( u ) } = \alpha _ { U } / d _ { U }$ and $\beta _ { U } ^ { ( u ) } = ( d _ { U } - u ) \alpha _ { U } / d _ { U }$ for some real $\alpha _ { U } ~ > ~ 0$ . Let $\bar { U } _ { - n }$ denote the set
308
+ 237 difference ${ \bar { U } } \setminus U ^ { ( n ) }$ ; so does $\bar { V } _ { - n } = \bar { V } \setminus V ^ { ( n ) }$ . Our collapsed Gibbs sampler first iteratively draws
309
+ 238 values from the conditional distribution of $\left( U ^ { ( n ) } \mid \bar { U } _ { - n } , \bar { V } \right)$ , $n = 1 , \ldots , N$ , as follows.
310
+
311
+ Sampling 239 $P \left( \pmb { u } ^ { ( n ) } \mid \bar { \pmb { v } } , \bar { \pmb { u } } _ { - n } \right)$ . At each iteration, draw $U ^ { ( n ) }$ from the conditional given by
312
+
313
+ $$
314
+ P \left( \boldsymbol { u } ^ { ( n ) } \mid \bar { \boldsymbol { v } } , \bar { \boldsymbol { u } } _ { - n } \right) \propto \prod _ { V \in V } P \left( \boldsymbol { v } ^ { ( n ) } \mid p a _ { V } ^ { ( n ) } , \boldsymbol { u } _ { V } ^ { ( n ) } , \bar { \boldsymbol { v } } _ { - n } , \bar { \boldsymbol { u } } _ { - n } \right) \prod _ { U \in U } P \left( \boldsymbol { u } ^ { ( n ) } \mid \bar { \boldsymbol { v } } _ { - n } , \bar { \boldsymbol { u } } _ { - n } \right) .
315
+ $$
316
+
317
+ 240 Among quantities in the above equation, for every $V \in V$ ,
318
+
319
+ $$
320
+ P \left( v ^ { ( n ) } \mid p a _ { V } ^ { ( n ) } , u _ { V } ^ { ( n ) } , \bar { v } _ { - n } , \bar { u } _ { - n } \right) = \left\{ \mathbb { 1 } _ { v ^ { ( n ) } = v ^ { ( i ) } } \ \begin{array} { l } { \mathrm { i f } \exists i \neq n , p a _ { V } ^ { ( i ) } = p a _ { V } ^ { ( n ) } , u _ { V } ^ { ( i ) } = u _ { V } ^ { ( n ) } , } \\ { 1 / | \Omega _ { V } | \ \mathrm { o t h e r w i s e } . } \end{array} \right.
321
+ $$
322
+
323
+ For every 241 $U \in U$ , let $\bar { u } _ { - n }$ be a set of exogenous samples $\left\{ u ^ { ( 1 ) } , \ldots , u ^ { ( n - 1 ) } , u ^ { ( n + 1 ) } , \ldots , u ^ { ( N ) } \right\} .$ . Let 242 $\{ u _ { 1 } ^ { * } , \ldots , u _ { K } ^ { * } \}$ denote $K$ unique values that samples in $\bar { u } _ { - n }$ take on.
324
+
325
+ $$
326
+ P \left( u ^ { ( n ) } \mid \bar { v } _ { - n } , \bar { u } _ { - n } \right) = \left\{ \begin{array} { l l } { \displaystyle \frac { n _ { k } ^ { * } + \alpha _ { U } / d _ { U } } { \alpha _ { U } + N - 1 } } & { \mathrm { i f ~ } u ^ { ( n ) } = u _ { k } ^ { * } , \mathrm { ~ f o r ~ } k = 1 , \dots , K } \\ { \displaystyle \frac { \alpha _ { U } ( 1 - K / d _ { U } ) } { \alpha _ { U } + N - 1 } } & { \mathrm { i f ~ } u ^ { ( n ) } \notin \{ u _ { 1 } ^ { * } , \dots , u _ { K } ^ { * } \} } \end{array} \right. .
327
+ $$
328
+
329
+ where 243 $\begin{array} { r } { n _ { k } ^ { * } = \sum _ { i \neq n } \mathbb { 1 } _ { u ^ { ( i ) } = u _ { k } ^ { * } } } \end{array}$ records the number of values in $\boldsymbol { u } ^ { ( i ) } \in \bar { u } _ { - n }$ that are equal to $\boldsymbol { u } _ { k } ^ { * }$
330
+
331
+ 244 Doing so eventually produces exogenous variables drawn from the posterior distribution of $( \bar { U } \mid \bar { V } )$ .
332
+ 245 We then sample parameters from the posterior distribution of $\left( \theta , \xi \mid \bar { U } , \bar { V } \right)$ ; the complete conditional
333
+ 246 $P \left( \xi , \pmb { \theta } \mid \bar { \pmb { v } } , \bar { \pmb { u } } \right)$ are given in Eqs. $( 1 0 )$ and $\textcircled { 1 1 }$ . Finally, computing $\theta _ { \mathrm { c t f } }$ from each sample $\theta , \xi$ gives
334
+ 247 us a draw from the posterior distribution $P \left( \theta _ { \mathrm { c t f } } \mid \bar { v } \right)$ .
335
+
336
+ When the cardinality $d _ { U }$ of exogenous domains is high, the collapsed Gibbs sampler described here is more computational efficient than the blocked sampler, since it does not iteratively draw parameters $\theta , \xi$ in the high-dimensional space. Instead, the collapsed sampler only draws $\theta , \xi$ once after samples drawn from the distribution of $( \bar { U } \mid \bar { V } )$ converge. On the other hand, when the cardinality $d _ { U }$ is reasonably low, the blocked Gibbs sampler is preferable since it exhibits better convergence $[ [ 2 2 ] ]$ .
337
+
338
+ # 3.2 Credible Intervals over Counterfactual Probabilities
339
+
340
+ Given a MCMC sampler, one could bound the counterfactual probability $\theta _ { \mathrm { c t f } }$ by computing credible intervals from the posterior distribution $P \left( \theta _ { \mathrm { c t f } } \mid \bar { \mathbf { v } } \right)$ .
341
+
342
+ Definition 4. Fix $\alpha \in [ 0 , 1 )$ . A $1 0 0 ( 1 - \alpha ) \%$ credible interval $[ l _ { \alpha } , r _ { \alpha } ]$ for $\theta _ { \mathrm { c t f } }$ is given by
343
+
344
+ $$
345
+ l _ { \alpha } = \operatorname* { s u p } \left\{ x \mid P \left( \theta _ { \mathrm { c t } } \leq x \mid \bar { v } \right) = \alpha / 2 \right\} , ~ r _ { \alpha } = \operatorname* { i n f } \left\{ x \mid P \left( \theta _ { \mathrm { c t } } \leq x \mid \bar { v } \right) = 1 - \alpha / 2 \right\} .
346
+ $$
347
+
348
+ 257 For a $1 0 0 ( 1 - \alpha ) \%$ credible interval $[ l _ { \alpha } , r _ { \alpha } ]$ , any counterfactual probability $\theta _ { \mathrm { c t f } }$ that is compatible
349
+ 258 with observational data $\bar { \mathbf { \nabla } } \bar { \mathbf { v } }$ lies between the interval $l _ { \alpha }$ and $r _ { \alpha }$ with probability $1 - \alpha$ . Credible
350
+ 259 intervals have been widely applied for computing bounds over counterfactuals provided with finite
351
+ 260 observations $\underline { { \| 2 0 \| } } , \boxed { 4 7 } , \boxed { 3 7 } , \boxed { 8 } , \boxed { 4 6 } $ . As the number of observational data $N$ grows (to infinite), the $1 0 0 \%$
352
+ 261 credible interval $[ l _ { 0 } , r _ { 0 } ]$ eventually converges to the optimal asymptotic bound $[ l , r ]$ in Eq. $( 6 )$ [11].
353
+
354
+ Let ✓(t) T be $T$ samples drawn from $P \left( \theta _ { \mathrm { c t f } } \mid \bar { \mathbf { v } } \right)$ . One could compute the $1 0 0 ( 1 - \alpha ) \%$ credible interval for $\bar { \theta _ { \mathrm { c t f } } }$ using the following consistent estimators $\pmb { \| 3 9 \| }$ :
355
+
356
+ $$
357
+ \hat { l } _ { \alpha } ( T ) = \theta ^ { ( \lceil ( \alpha / 2 ) T \rceil ) } , \hat { r } _ { \alpha } ( T ) = \theta ^ { ( \lceil ( 1 - \alpha / 2 ) T \rceil ) } ,
358
+ $$
359
+
360
+ where $\theta ^ { ( \lceil ( \alpha / 2 ) T \rceil ) } , \theta ^ { ( \lceil ( 1 - \alpha / 2 ) T \rceil ) }$ are the $\lceil ( \alpha / 2 ) T \rceil$ th smallest and the $\lceil ( 1 - \alpha / 2 ) T \rceil$ th smallest of $\big \{ \theta ^ { ( t ) } \big \} ^ { 3 } .$ Our next results establish non-asymptotic deviation bounds for the empirical estimates of credible intervals defined in Eq. $\textcircled { 1 6 }$ for finite samples.
361
+
362
+ Lemma 1. Fix 267 $T > 0$ and $\delta \in ( 0 , 1 )$ . Let function $f ( T , \delta ) = \sqrt { 2 T ^ { - 1 } \ln ( 4 / \delta ) }$ . With probability at least 268 $1 - \delta$ , estimators $\hat { l } _ { \alpha } ( T ) , \hat { r } _ { \alpha } ( T )$ for any $\alpha \in [ 0 , 1 )$ is bounded by
363
+
364
+ $$
365
+ \hat { l } _ { \alpha } ( T ) \in \left[ l _ { \alpha - f ( T , \delta ) } , l _ { \alpha + f ( T , \delta ) } \right] , \qquad \hat { r } _ { \alpha } ( T ) \in \left[ r _ { \alpha + f ( T , \delta ) } , r _ { \alpha - f ( T , \delta ) } \right] .
366
+ $$
367
+
368
+ 3 For any real $\alpha \in \mathbb { R }$ , $\lceil \alpha \rceil$ denotes the smallest integer $n \in \mathbb { Z }$ larger than $\alpha$ , i.e., $\lceil \alpha \rceil = \operatorname* { m i n } \{ n \in \mathbb { Z } \mid n \geq \alpha \}$
369
+
370
+ 269 We summarize our algorithm, CREDIBLEIN
371
+ 270 TERVAL, in Alg. $1 .$ It takes a credible level
372
+ 271 $\alpha$ and tolerance levels $\delta , \epsilon$ as inputs. In par
373
+ 272 ticular, CREDIBLEINTERVAL repeatedly draw
374
+ 273 $T \ge \lceil 2 \epsilon ^ { - 2 } \ln ( 4 / \delta ) \rceil$ samples from $P \left( \dot { \theta _ { \mathrm { c t f } } } \mid \bar { v } \right)$ .
375
+ 274 It then computes estimates $\hat { l } _ { \alpha } ( T ) , \hat { h } _ { \alpha } ( T )$ from
376
+ 275 drawn samples following Eq. $\textcircled { 1 6 }$ and return
377
+ 276 them as the output. It follows immediately from
378
+ 277 Lem. $\bigstar$ that such a procedure efficiently approx
379
+ 278 imates a $1 0 0 ( 1 - \bar { \alpha } ) \%$ credible interval.
380
+
381
+ # Algorithm 1: CREDIBLEINTERVAL
382
+
383
+ 1: Input: Credible level $\alpha$ , tolerance level $\delta , \epsilon$ .
384
+ 2: Output: An credible interval $[ l _ { \alpha } , h _ { \alpha } ]$ for $\theta _ { \mathrm { c t f } }$
385
+ 3: Let $\dot { T } = \left. \lceil 2 \epsilon ^ { - 2 } \ln ( 4 / \delta ) \right\rceil$ .
386
+ 4: Draw samples $\big \{ \theta ^ { ( 1 ) } , \dots , \theta ^ { ( T ) } \big \}$ from the
387
+ posterior distribution $P \left( \theta _ { \mathrm { c t f } } \mid \bar { \mathbf { v } } \right)$ .
388
+ 5: Return interval $\big [ \hat { l } _ { \alpha } ( T ) , \hat { r } _ { \alpha } ( T ) \big ]$ (Eq. (16)
389
+
390
+ Corollary 3. Fix $\delta \in \mathsf { \Gamma } ( 0 , 1 )$ and $\epsilon > 0$ . With probability at least $1 - \delta$ , the interval $[ { \hat { l } } , { \hat { r } } ] =$ CREDIBLEINTERVAL $( \alpha , \delta , \epsilon )$ for any $\alpha \in [ 0 , 1 )$ is bounded by $\hat { l } \in [ l _ { \alpha - \epsilon } , l _ { \alpha + \epsilon } ]$ and $\hat { r } \in [ r _ { \alpha + \epsilon } , r _ { \alpha - \epsilon } ]$ .
391
+
392
+ Corol. $3$ implies that any counterfactual parameter $\theta _ { \mathrm { c t f } }$ compatible with observational data $\bar { \mathbf { \nabla } } \bar { \mathbf { v } }$ falls between $[ { \hat { l } } , { \hat { r } } ] =$ CREDIBLEINTERVAL $( \alpha , \delta , \epsilon )$ with probability $P \left( \theta _ { \mathrm { c t f } } \in [ \hat { l } , \hat { r } ] \mid \bar { v } \right) \approx 1 - \alpha \pm \epsilon$ . As the tolerance rate $\epsilon 0 , [ \hat { l } , \hat { r } ]$ converges to a $1 0 0 ( 1 - \alpha ) \%$ credible interval with high probability.
393
+
394
+ # 284 4 Simulations and Experiments
395
+
396
+ We demonstrate our algorithms on various simulated SCM instances and a real world patient dataset collected from the International Stroke Trial (IST) $\mathbb { m }$ . Overall, we found that simulation results support our findings and the proposed bounding strategy consistently dominates state-of-art algorithms. When target distributions are identifiable (Experiment 1), our bounds collapse to the actual, unknown counterfactual probabilities. For non-identifiable settings, our algorithm obtains sharp asymptotic bounds when closed-form solutions already exist (Experiments 2 & 3); and improves over state-of-art bounds in other more general cases where the optimal strategy is unknown (Experiment 4).
397
+
398
+ In all experiments, we evaluate our proposed bounding strategy based on credible intervals $( c i )$ . In particular, we draw $4 \times 1 0 ^ { 3 }$ samples from the posterior distribution over the target counterfactual $\mathbf { \bar { \Psi } } ( \theta _ { \mathrm { c t f } } \mid \bar { V } )$ . This allows us to compute $1 0 0 \%$ credible interval over $\theta _ { \mathrm { c t f } }$ within error $\epsilon = 0 . 0 5$ , with probability at least $1 - \delta = 0 . 9 5$ . As the baseline, we also include the actual counterfactual probability $\theta ^ { * }$ . For details on simulation setups and additional experiments, we refer readers to Appendix C.
399
+
400
+ 297 Experiment 1: Frontdoor Graph This experiment evaluates our sam
401
+ 298 pling algorithm on interventional probabilities that are identifiable from
402
+ 299 the observational data. Consider the “Frontdoor” graph described in
403
+ 300 Fig. $\bigtriangledown$ where $X , Y , W$ are binary variables in $\{ 0 , 1 \}$ ; $U _ { 1 } , U _ { 2 } \in \mathbb { R }$ . In this
404
+ 301 case, the interventional distribution $P ( y _ { x } )$ is identifiable from $P ( x , w , y )$
405
+ 302 through the frontdoor adjustment $\mathbb { \left[ \left. 3 3 \right. \right. }$ Thm. 3.3.4]. We collect $N = 1 0 ^ { 5 }$
406
+ 303 observational samples $\bar { \cal V } = \{ X ^ { ( n ) } , Y ^ { ( n ) } , W ^ { ( n ) } \} _ { n = 1 } ^ { N }$ from a randomly
407
+
408
+ ![](images/51afcc5bc58f94bd670f99dd40c8baf277d6e24ff5e68479eb604bfea3c9b594.jpg)
409
+ Figure 3: Frontdoor
410
+
411
+ generated SCM. Fig. 4a shows samples drawn from the posterior distribution of the target probability $\stackrel { \prime } { P } ( Y _ { x = 0 } = 1 ) \mid \bar { V } )$ . The analysis reveals that these samples collapse to the actual interventional probability $P ( Y _ { x = 0 } = 1 ) = 0 . 5 0 8 5$ , which confirms the identifiability of $P ( y _ { x } )$ in Fig. 3.
412
+
413
+ 307 Experiment 2: Instrumental Variables (IV) This experiment evaluates our bounding strategy in
414
+ 308 non-identifiable settings, while closed-form solutions for the optimal bounds over target probabilities
415
+ 309 already exist. Consider first the “IV” diagram in Fig. $^ { 1 \mathrm { a } }$ where $X , Y , Z \in \{ 0 , 1 \}$ and $U _ { 1 } , U _ { 2 } \in \mathbb { R }$
416
+ 310 The non-identifiability of $P ( y _ { x } )$ from the observational data $P ( x , y , z )$ with the instrument $Z$ and the
417
+ 311 unobserved confounding between $X$ and $Y$ has been acknowledged in [5]. For binary $X , Y , Z$ , [2]
418
+ 312 derived closed-form, sharp bounds over $P ( y _ { x } )$ (labelled as opt). We collect $N = 1 0 ^ { 5 }$ observational
419
+ 313 samples $\bar { \cal V } = \{ X ^ { ( n ) } , Y ^ { ( n ) } , Z ^ { ( n ) } \} _ { n = 1 } ^ { N }$ from a randomly generated SCM instance. Fig. $4 { \mathbf { b } }$ shows
420
+ 314 samples drawn from the posterior distribution of $P ( Y _ { x = 0 } = 1 ) \mid \bar { V } )$ . As a baseline, we also include
421
+ 315 the optimal bound opt, and posterior samples obtained from the Gibbs sampler of $\mathbb { \ m }$ , which utilizes
422
+ 316 the canonical partitions of exogenous domains in $\pmb { \Vert 2 \Vert }$ $( b p )$ . The analysis reveals that our algorithm
423
+ 317 derives the valid bound over the actual probability $P ( Y _ { x = 0 } = 1 ) = 0 . 3 9 5 4$ ; the $1 0 0 \%$ credible
424
+ 318 interval converges to the optimal IV bound $l = 0 . 1 4 6 8 , r = 0 . 6 6 1 7$ .
425
+
426
+ ![](images/974221abcdde98c4222177846c82d05008fed3d1d6f770cc3c9c4ca44560435c.jpg)
427
+ Figure 4: Histogram plots for samples drawn from the posterior distribution over target counterfactual probabilities. For all plots $( { \bf a } - { \bf d } )$ , ci represents our proposed algorithms; $b p$ stands for Gibbs samplers using the representation of canonical partitions $\pmb { \bigtriangledown } \bar { \bigtriangledown } \bar { \bigtriangledown }$ ; $\theta ^ { * }$ is the actual counterfactual probability. $\mathbf { \underline { { \sigma } } } ( \mathbf { b } , \mathbf { c } )$ opt represents the optimal asymptotic bound, if exists. (d) $n b$ stands for the natural bounds $\pmb { \mathbb { B } } \pmb { \mathbb { O } } \Vert$ .
428
+
429
+ Experiment 3: Probability of Necessity and Sufficiency (PNS) We now study the problem of evaluating the probability of necessity and sufficiency $P ( Y _ { x = 1 } = 1 , Y _ { x = 0 } = 0 )$ from the observational data $P ( x , y )$ in the “Bow” diagram of Fig. $\boxed { 1 \dot { \mathrm { d } } }$ where $X , Y \in \{ 0 , 1 \}$ and $U \in \mathbb { R }$ . The sharp bound for $P ( Y _ { x = 1 } = 1 , Y _ { x = 0 } = 0 )$ from $P ( x , y )$ was introduced in $\textcircled { \lVert { 4 4 } \rVert }$ (labelled as opt). We collect $N = 1 0 ^ { 5 }$ observational samples $\bar { \cal V } = \{ X ^ { ( n ) } , Y ^ { ( n ) } \} _ { n = 1 } ^ { N }$ from an SCM instance. Fig. $\boxed { 4 \mathrm { c } }$ shows samples drawn from the posterior distribution of $\stackrel { \prime } { P } ( Y _ { x = 1 } = 1 , Y _ { x = 0 } = 0 ) \mid \bar { V } )$ . As a baseline, we also include the optimal bound opt, and posterior samples obtained from the Gibbs sampler which discretizes the exogenous domains using canonical partitions $\mathbb { I } \mathbb { I } \left( b p \right)$ . The analysis reveals that our $1 0 0 \%$ credible interval $( c i )$ matches the optimal PNS bound $l = 0 , r = 0 . 6 7 7 5$ , i.e., the proposed strategy achieves the sharp bound over the counterfactual probability $P ( Y _ { x = 1 } = 1 , Y _ { x = 0 } = 0 ) = 0 . 1 8 6 7$ .
430
+
431
+ Experiment 4: International Stroke Trials (IST) IST was a large, randomized, open trial of up to 14 days of antithrombotic therapy after stroke onset $\mathbb { \ m }$ . In particular, the treatment $X$ is a pair $( i , j )$ where $i = 0$ stands for no aspirin allocation, 1 otherwise; $j = 0$ stands for no heparin allocation, 1 for median-dosage, and 2 for high-dosage. The primary outcome $Y \in \{ 0 , \ldots , 3 \}$ is the health of the patient 6 months after the treatment, where 0 stands for death, 1 for being dependent on the family, 2 for the partial recovery, and 3 for the full recovery.
432
+
433
+ To emulate the presence of unobserved confounding, we filter the experimental data with selection rules $f _ { X } ^ { ( Z ) }$ , $Z \in \{ 0 , \ldots , 9 \}$ , following a procedure in $\mathbb { H }$ . Doing so allows us to obtain $N = 3 \times 1 0 ^ { 3 }$ synthetic observational samples $\bar { \cal V } = \{ X ^ { ( n ) } , Y ^ { ( n ) } , Z ^ { ( n ) } \} _ { n = 1 } ^ { N }$ that are compatible with the “Double bow” diagram of Fig. 1b. We are interested in evaluating the treatment effect $E [ Y _ { x = ( 1 , 0 ) } ]$ for only assigning aspirin $\overline { { \boldsymbol { X } } } = ( 1 , 0 )$ . Fig. 4d shows samples drawn from the posterior distribution of $\left( E [ Y _ { x = ( 1 , 0 ) } ] \mid \bar { V } \right)$ . As a baseline, we also include a naïve generalization of the discretization procedure $( b p ) \pmb { \mathbb { Z } }$ (see Appendix ${ \bf D } )$ and the natural bounds $\pm \infty \ldots$ estimated at the $9 5 \%$ confidence level $( n b )$ [49]. Posterior samples of $c i$ and $b p$ are drawn using our proposed collapsed sampler due to the high-dimensional latent space. The analysis reveals that all algorithms achieve bounds that contain the actual, target causal effect $E [ Y _ { x = ( 1 , 0 ) } ] = 1 . 3 4 1 8$ . Our bounding strategy obtains a $1 0 0 \%$ credible interval $l _ { c i } = 1 . 2 6 0 4 , r _ { c i } = 1 . 4 6 8 7$ , which consistently improves over all the other algorithms $( l _ { b p } = 1 . 1 1 2 1$ , $r _ { b p } = 1 . 8 0 7 3 , l _ { n b } = 1 . 1 1 9 5 , r _ { n b } = 1$ $r _ { n b } = 1 . 6 2 2 1$ ).
434
+
435
+ # 47 5 Conclusion
436
+
437
+ This paper investigated the problem of partial identification of counterfactual distributions, which concerns with bounding unknown counterfactual probabilities from the combination of the observational data and qualitative assumptions of the data-generating process, represented in the form of a directed acyclic causal diagram. We studied a special family of SCMs with discrete exogenous variables, taking values from a finite set of unobserved states, and showed that it could represent all counterfactual distributions (over finite observed variables) in an arbitrary causal diagram. That is, this new family of discrete SCMs is counterfactual equivalent to the original family of candidate SCMs compatible with the causal diagram. Using this result, we developed a novel algorithm to derive bounds over counterfactual probabilities from finite observations, which are provably tight.
438
+
439
+ References
440
+ [1] C. Avin, I. Shpitser, and J. Pearl. Identifiability of path-specific effects. In Proceedings of the Nineteenth International Joint Conference on Artificial Intelligence IJCAI-05, pages 357–363, Edinburgh, UK, 2005. Morgan-Kaufmann Publishers.
441
+ [2] A. Balke and J. Pearl. Counterfactual probabilities: Computational methods, bounds, and applications. In R. L. de Mantaras and D. Poole, editors, Uncertainty in Artificial Intelligence 10, pages 46–54. Morgan Kaufmann, San Mateo, CA, 1994.
442
+ [3] A. Balke and J. Pearl. Counterfactuals and policy analysis in structural models. In P. Besnard and S. Hanks, editors, Uncertainty in Artificial Intelligence 11, pages 11–18. San Francisco, 1995.
443
+ [4] A. Balke and J. Pearl. Bounds on treatment effects from studies with imperfect compliance. Journal of the American Statistical Association, 92(439):1172–1176, September 1997.
444
+ [5] E. Bareinboim and J. Pearl. Causal inference by surrogate experiments: $z$ -identifiability. In N. de Freitas and K. Murphy, editors, Proceedings of the Twenty-Eighth Conference on Uncertainty in Artificial Intelligence, pages 113–120, Corvallis, OR, 2012. AUAI Press.
445
+ [6] H. Bauer. Probability theory and elements of measure theory. Holt, 1972.
446
+ [7] H. Bauer. Measure and integration theory, volume 26. Walter de Gruyter, 2011.
447
+ [8] F. A. Bugni. Bootstrap inference in partially identified models defined by moment inequalities: Coverage of the identified set. Econometrica, 78(2):735–753, 2010.
448
+ [9] C. Carathéodory. Über den variabilitätsbereich der fourier’schen konstanten von positiven harmonischen funktionen. Rendiconti Del Circolo Matematico di Palermo (1884-1940), 32(1):193– 217, 1911.
449
+ [10] A. Carolei et al. The international stroke trial (ist): a randomized trial of aspirin, subcutaneous heparin, both, or neither among 19435 patients with acute ischaemic stroke. The Lancet, 349:1569–1581, 1997.
450
+ [11] D. Chickering and J. Pearl. A clinician’s tool for analyzing non-compliance. Computing Science and Statistics, 29(2):424–431, 1997.
451
+ [12] R. J. Connor and J. E. Mosimann. Concepts of independence for proportions with a generalization of the dirichlet distribution. Journal of the American Statistical Association, 64(325):194– 206, 1969.
452
+ [13] J. Eckhoff. Helly, radon, and carathéodory type theorems. In Handbook of convex geometry, pages 389–448. Elsevier, 1993.
453
+ [14] R. J. Evans. Graphical methods for inequality constraints in marginalized dags. In 2012 IEEE International Workshop on Machine Learning for Signal Processing, pages 1–6. IEEE, 2012.
454
+ [15] R. J. Evans et al. Margins of discrete bayesian networks. The Annals of Statistics, 46(6A):2623– 2656, 2018.
455
+ [16] N. Finkelstein and I. Shpitser. Deriving bounds and inequality constraints using logical relations among counterfactuals. In Conference on Uncertainty in Artificial Intelligence, pages 1348– 1357. PMLR, 2020.
456
+ [17] C. Frangakis and D. Rubin. Principal stratification in causal inference. Biometrics, 1(58):21–29, 2002.
457
+ [18] D. Galles and J. Pearl. An axiomatic characterization of causal counterfactuals. Foundation of Science, 3(1):151–182, 1998.
458
+ [19] J. Halpern. Axiomatizing causal reasoning. In G. Cooper and S. Moral, editors, Uncertainty in Artificial Intelligence, pages 202–210. Morgan Kaufmann, San Francisco, CA, 1998. Also, Journal of Artificial Intelligence Research 12:3, 17–37, 2000.
459
+ [20] G. W. Imbens and C. F. Manski. Confidence intervals for partially identified parameters. Econometrica, 72(6):1845–1857, 2004.
460
+ [21] G. W. Imbens and D. B. Rubin. Bayesian inference for causal effects in randomized experiments with noncompliance. The annals of statistics, pages 305–327, 1997.
461
+ [22] H. Ishwaran and L. F. James. Gibbs sampling methods for stick-breaking priors. Journal of the American Statistical Association, 96(453):161–173, 2001.
462
+ [23] N. Kallus and A. Zhou. Confounding-robust policy improvement. In Advances in neural information processing systems, pages 9269–9279, 2018.
463
+ [24] N. Kallus and A. Zhou. Confounding-robust policy evaluation in infinite-horizon reinforcement learning. Advances in Neural Information Processing Systems, 2020.
464
+ [25] N. Kilbertus, M. J. Kusner, and R. Silva. A class of algorithms for general instrumental variable models. In Advances in Neural Information Processing Systems, 2020.
465
+ [26] J. B. Lasserre. Global optimization with polynomials and the problem of moments. SIAM Journal on optimization, 11(3):796–817, 2001.
466
+ [27] J. B. Lasserre. Moments, positive polynomials and their applications, volume 1. World Scientific, 2009.
467
+ [28] M. Laurent. Sums of squares, moment matrices and optimization over polynomials. In Emerging applications of algebraic geometry, pages 157–270. Springer, 2009.
468
+ [29] H. R. Lewis. Computers and intractability. a guide to the theory of np-completeness, 1983.
469
+ [30] C. Manski. Nonparametric bounds on treatment effects. American Economic Review, Papers and Proceedings, 80:319–323, 1990.
470
+ [31] P. A. Parrilo. Semidefinite programming relaxations for semialgebraic problems. Mathematical programming, 96(2):293–320, 2003.
471
+ [32] J. Pearl. Causal diagrams for empirical research. Biometrika, 82(4):669–710, 1995.
472
+ [33] J. Pearl. Causality: Models, Reasoning, and Inference. Cambridge University Press, New York, 2000. 2nd edition, 2009.
473
+ [34] J. Pearl. Principal stratification – a goal or a tool? The International Journal of Biostatistics, 7(1), 2011. Article 20, DOI: 10.2202/1557-4679.1322. Available at: <http://ftp.cs.ucla.edu/pub/stat_ser/r382.pdf>.
474
+ [35] A. Richardson, M. G. Hudgens, P. B. Gilbert, and J. P. Fine. Nonparametric bounds and sensitivity analysis of treatment effects. Statistical science: a review journal of the Institute of Mathematical Statistics, 29(4):596, 2014.
475
+ [36] J. Robins. The analysis of randomized and non-randomized aids treatment trials using a new approach to causal inference in longitudinal studies. In L. Sechrest, H. Freeman, and A. Mulley, editors, Health Service Research Methodology: A Focus on AIDS, pages 113–159. NCHSR, U.S. Public Health Service, Washington, D.C., 1989.
476
+ [37] J. P. Romano and A. M. Shaikh. Inference for identifiable parameters in partially identified econometric models. Journal of Statistical Planning and Inference, 138(9):2786–2807, 2008.
477
+ [38] D. Rosset, N. Gisin, and E. Wolfe. Universal bound on the cardinality of local hidden variables in networks. Quantum Information & Computation, 18(11-12):910–926, 2018.
478
+ [39] P. K. Sen and J. M. Singer. Large sample methods in statistics: an introduction with applications, volume 25. CRC press, 1994.
479
+ [40] J. Sethuraman. A constructive definition of dirichlet priors. Statistica sinica, pages 639–650, 1994.
480
+ [41] I. Shpitser and J. Pearl. What counterfactuals can be tested. In Proceedings of the Twenty-Third Conference on Uncertainty in Artificial Intelligence, pages 352–359. AUAI Press, Vancouver, BC, Canada, 2007. Also, Journal of Machine Learning Research, 9:1941–1979, 2008.
481
+ [42] I. Shpitser and E. Sherman. Identification of personalized effects associated with causal pathways. In UAI, 2018.
482
+ [43] J. Tian. Studies in Causal Reasoning and Learning. PhD thesis, Computer Science Department, University of California, Los Angeles, CA, November 2002.
483
+ [44] J. Tian and J. Pearl. Probabilities of causation: Bounds and identification. Annals of Mathematics and Artificial Intelligence, 28:287–313, 2000.
484
+ [45] J. Tian and J. Pearl. A general identification condition for causal effects. In Proceedings of the Eighteenth National Conference on Artificial Intelligence, pages 567–573. AAAI Press/The MIT Press, Menlo Park, CA, 2002.
485
+ [46] D. Todem, J. Fine, and L. Peng. A global sensitivity test for evaluating statistical hypotheses with nonidentifiable models. Biometrics, 66(2):558–566, 2010.
486
+ [47] S. Vansteelandt, E. Goetghebeur, M. G. Kenward, and G. Molenberghs. Ignorance and uncertainty regions as inferential tools in a sensitivity analysis. Statistica Sinica, pages 953–979, 2006.
487
+ [48] H. Waki, S. Kim, M. Kojima, and M. Muramatsu. Sums of squares and semidefinite program relaxations for polynomial optimization problems with structured sparsity. SIAM Journal on Optimization, 17(1):218–242, 2006.
488
+ [49] J. Zhang and E. Bareinboim. Bounding causal effects on continuous outcomes. In Proceedings of the 35nd AAAI Conference on Artificial Intelligence, 2021.
489
+
490
+ # Checklist
491
+
492
+ 1. For all authors...
493
+
494
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
495
+ (b) Did you describe the limitations of your work? [Yes] “Throughout this paper, we assume that endogenous variables $V$ are discrete and finite; while exogenous variables $U$ could take any (continuous) value.”
496
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A] This work does not present any foreseeable societal consequence.
497
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
498
+
499
+ 2. If you are including theoretical results...
500
+
501
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] See Sec. 1.1. (b) Did you include complete proofs of all theoretical results? [Yes] See Appendices A and B.
502
+
503
+ 3. If you ran experiments...
504
+
505
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See Appendix C.
506
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix C.
507
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
508
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix C. “Experiments were performed on a computer with 32GB memory.”
509
+
510
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
511
+
512
+ (a) If your work uses existing assets, did you cite the creators? [Yes] “IST was a large, randomized, open trial of up to 14 days of antithrombotic therapy after stroke onset [10].” See also Appendix C
513
+ (b) Did you mention the license of the assets? [Yes] See Appendix C. The IST dataset is shared under “Open Data Commons Attribution License (ODC-By) v1.0”.
514
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
515
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
516
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
517
+
518
+ 5. If you used crowdsourcing or conducted research with human subjects...
519
+
520
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
521
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
522
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/b83ibRX55T/b83ibRX55T.md ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Towards Gradient-based Bilevel Optimization with Non-convex Followers and Beyond
2
+
3
+ Risheng Liu1,2 Yaohua Liu1 Shangzhi Zeng3 Jin Zhang ∗4,5
4
+
5
+ 1International School of Information Science & Engineering, DUT 2Pazhou Lab, Guangzhou 3Department of Mathematics and Statistics, UVic
6
+ 4Department of Mathematics, SUSTech 5National Center for Applied Mathematics Shenzhen rsliu@dlut.edu.cn liuyaohua_918@163.com zengshangzhi@gmail.com zhangj9@sustech.edu.cn
7
+
8
+ # Abstract
9
+
10
+ In recent years, Bi-Level Optimization (BLO) techniques have received extensive attentions from both learning and vision communities. A variety of BLO models in complex and practical tasks are of non-convex follower structure in nature (a.k.a., without Lower-Level Convexity, LLC for short). However, this challenging class of BLOs is lack of developments on both efficient solution strategies and solid theoretical guarantees. In this work, we propose a new algorithmic framework, named Initialization Auxiliary and Pessimistic Trajectory Truncated Gradient Method (IAPTT-GM), to partially address the above issues. In particular, by introducing an auxiliary as initialization to guide the optimization dynamics and designing a pessimistic trajectory truncation operation, we construct a reliable approximate version of the original BLO in the absence of LLC hypothesis. Our theoretical investigations establish the convergence of solutions returned by IAPTT-GM towards those of the original BLO without LLC. As an additional bonus, we also theoretically justify the quality of our IAPTT-GM embedded with Nesterov’s accelerated dynamics under LLC. The experimental results confirm both the convergence of our algorithm without LLC, and the theoretical findings under LLC.
11
+
12
+ # 1 Introduction
13
+
14
+ Bi-Level Optimization (BLO) has been widely used to formulate problems in the field of deep learning [1, 2], especially for hyperparameter optimization [3, 4, 5], meta learning [6, 7, 8, 9], neural architecture search [10, 11, 12], adversarial learning [13], and reinforcement learning [14], etc. BLO aims to tackle nested optimization structures appearing in applications, which has emerged as a prevailing optimization technique for modern machine learning tasks with underlying hierarchy. In the last decade, a large number of BLO methods have been proposed to address different machine learning tasks. In fact, Gradient Methods (GMs), which can effectively handle BLO problems of large scale, thus gain popularity. According to different types of strategies for gradient calculations, existing GMs can be divided into two categories, i.e., the explicit approaches which aim to replace the Lower-Level (LL) problem with dynamic iterations and implicit schemes that apply the implicit function theorem to formulate the first-order optimality condition of the LL problem.
15
+
16
+ Explicit Gradient Methods for BLOs. In this type, solving the LL problem is regarded as the evolution path of the dynamic system starting from a given initial point of the LL variable. The gradient of the Upper-Level (UL) variable can be directly calculated by automatic differentiation based on the trajectory of LL variable. This class of methods can be further divided into three types, namely, recurrence-based EG (e.g., [3, 15, 6, 16, 10]), initialization-based EG (e.g., [17, 18]) and proxy-based EG methods (e.g., [19, 20, 21, 22]), differing from each other in the way of accessing the gradient of constructed dynamic trajectory. While most of this type of works assume the LLC and Lower-Level Singleton (LLS) to simplify their optimization process and theoretical analysis, cases where the LLS assumption does not hold have been tackled in the recent work [23, 24]. In particular, to eliminate the LLS assumption which is too restrctive to be satisfied in real-world complex tasks, [23] first considers incorporating UL objective information into the dynamic iterations, but the more general cases where LLC does not hold remain unsolved. On the other hand, while most of the mentioned works focus on the asymptotic convergence, the progress on nonasymptotic convergence analysis has been recently witnessed see, e.g., [25, 26, 27].
17
+
18
+ Implicit Gradient Methods for BLOs. This type, also known as implicit differentiation [28, 7, 29], replaces the LL problem with its first-order optimality condition and uses the implicit function theorem to calculate the gradient of the UL problem by solving a linear system. This method decouples the calculation of UL gradient from the dynamic system of LL, resulting in a significant speed increase when the dynamic system iterates many times. However, because of the burden originated from computing a Hessian matrix and its inverse, IG methods are usually computationally expensive when linear systems are ill-conditioned. To alleviate this computational issue, there are mainly two kinds of techniques, i.e., IG based on Linear System (LS) [28, 7] and Neumann Series (NS) [29]. On the theoretical side, IG methods rely on the strong convexity of LL problems heavily, which is even more restrictive than the LLC and LLS together.
19
+
20
+ Initialization Optimization for Learning. In deep learning, the selection of initialization scheme has a great influence on the training speed and performance [30]. As the most representative work in recent years, Model-Agnostic Meta-Learning (MAML) [31] applies the same initialization to all tasks, and is optimized by a loss function common to the task that evaluates the effect of the initial value, resulting in an initialization that achieves good generalization performance with only a few gradient steps on new tasks. Due to its simple form this method has been widely studied and applied [32, 33, 34, 35]. [36] noticed that not all network parameters are suitable for the same initialization, and therefore proposed a strategy to apply co-initialization only on a part of parameters. In theory, [37, 38, 39] give comprehensive study on the convergence and convergence rate of MAML and some MAML-type approaches based on the meta objective function. However, the convergence theory of these existing results are given based on the loss function for evaluating initial values, and the convergence analysis of such type of methods from the perspective of each task is still lacked.
21
+
22
+ Value-Function Approach. The value function based methods have also emerged as a promising branch to solve BLO problems [40]. Under the special case where the LL is jointly convex with respect to both the UL and LL variables, the BLO problem can be equivalently reformulated into a difference-of-convex program [41], which is numerically solvable. Typically, by reformulating the BLO into an Inner Single Bi-level (ISB) optimization problem with value-function approach, a gradient-based interior-point method name BVFIM [42] is proposed to solve the BLO tasks, which effectively avoids the expensive Hessian-vector and Jacobian-vector products. Generally speaking, the value-function does not admit an explicit form, and is always nonsmooth, non-convex and with jumps.
23
+
24
+ # 1.1 Our Motivations and Contributions
25
+
26
+ As mentioned above, some theoretical progresses have long been witnessed in diversified learning areas, but for most existing BLO methods, extra restrictive assumptions (e.g., LLS, LLC and LL strong convexity) have to be enforced. Their algorithm design and associated theoretical analysis actually are only valid for optimization with a simplified problem structure. Unfortunately, it has been well recognized that LL non-convexity frequently appears in a variety of applications, e.g., sparse $\ell _ { q }$ regularization ( $0 < q < 1$ ) for avoiding over-fitting, and learning parameters of coupled multi-layer neural networks, etc. Therefore, in challenging real-world scenarios, we are usually required to consider BLO problems where these assumptions (e.g., LLS, LLC and even LL strong convexity) are naturally violated. These fundamental theoretical issues motivate us to propose a series of new techniques to address BLO with non-convex LL problems, which have been frequently appeared in various learning applications.
27
+
28
+ In particular, by introducing an Initialization Auxiliary (IA) to the LL optimization dynamics and operating a Pessimistic Trajectory Truncation (PTT) strategy during the UL approximation, we construct a Gradient-based Method (GM), named IAPTT-GM, to address BLO in challenging optimization scenarios (i.e., with non-convex follower tasks). We analyze the convergence behaviors of IAPTT-GM on BLOs without LLC and also investigate theoretical properties of the accelerated version of our algorithm on BLOs under LLC. Extensive experiments verify our theoretical results and demonstrate the effectiveness of IAPTT-GM on different learning applications. The main contributions of our IAPTT-GM are summarized as follows:
29
+
30
+ • We propose IA and PTT, two new mechanisms to efficiently handle complex BLOs where the follower is facing with a non-convex task (i.e., without LLS and even LLC). IA actually paves the way for jointly optimizing both the UL variables and the dynamical initialization, while PTT adaptively reduces the complexity of backward recurrent propagation. To our best knowledge, we establish the first strict convergence guarantee for gradientbased method on BLOs with non-convex follower tasks. We also justify the quality of our IAPTT-GM embedded with Nesterov’s accelerated dynamics under LLC. • We conduct a series of experiments to verify our theoretical findings and evaluate IAPTT-GM on various challenging BLOs, in which the follower tasks are either with non-convex loss functions (e.g., few-shot learning) or coupled network structures (e.g., data hyper-cleaning).
31
+
32
+ # 2 The Proposed Algorithmic Framework
33
+
34
+ In this work, we consider the BLO problem in the form:
35
+
36
+ $$
37
+ \operatorname* { m i n } _ { \mathbf { x } \in \mathcal { X } , \mathbf { y } } F ( \mathbf { x } , \mathbf { y } ) , \quad s . t . \quad \mathbf { y } \in S ( \mathbf { x } ) ,
38
+ $$
39
+
40
+ where $\mathbf { x } \in \mathbb { R } ^ { n } , \mathbf { y } \in \mathbb { R } ^ { m }$ are UL and LL variables respectively, and $\boldsymbol { S } ( \mathbf { x } )$ denotes the set of solutions of the LL problem, i.e.,
41
+
42
+ $$
43
+ S ( \mathbf x ) : = \arg \operatorname* { m i n } _ { \mathbf y \in \mathcal y } f ( \mathbf x , \mathbf y ) ,
44
+ $$
45
+
46
+ where $f$ is differentiable w.r.t. y. To ensure the BLO model in Eq. (1) is well-defined, we assume that $\scriptstyle { \mathcal { S } } ( \mathbf { x } )$ is nonempty for all $\mathbf { x } \in \mathcal { X }$ . Observe further that the above BLO is structurally different from those in existing literature in the sense that no convexity assumption is required in the LL problem.
47
+
48
+ In the following, we describe the proposed IAPTT-GM to solve the class of BLOs defined in Eq. (1). The mechanism of a classical dynamics-embedded gradient method, approximates the LL solution via a dynamical system drawn from optimization iterations. Choosing gradient descent as the optimization dynamics for example, the approximation ${ \bf y } _ { K } ( { \bf x } )$ is accessed by operations repeatedly performed by $K - 1$ steps parameterized by UL variable $\mathbf { x }$
49
+
50
+ $$
51
+ \begin{array} { r } { \mathbf { y } _ { k + 1 } ( \mathbf { x } ) = \mathbf { y } _ { k } ( \mathbf { x } ) - s \nabla _ { \mathbf { y } } f ( \mathbf { x } , \mathbf { y } _ { k } ( \mathbf { x } ) ) , k = 0 , \cdots , K - 1 , } \end{array}
52
+ $$
53
+
54
+ where $s$ is a step size, and $\mathbf { y } _ { 0 }$ is a fixed initial value.
55
+
56
+ # 2.1 Initialization Auxiliary
57
+
58
+ Embedding the dynamical iterations into the UL problem returns the approximate version $F ( \mathbf { x } , \mathbf { y } _ { K } ( \mathbf { x } ) )$ . As long as $\nabla _ { \mathbf { y } } f ( \mathbf { x } , \mathbf { y } _ { K } ( \mathbf { x } ) )$ uniformly converges to zero w.r.t. UL variable $\mathbf { x }$ varying in $\mathcal { X }$ , we call this a good approximation. To this end, usually restrictive LL strong convexity assumptions are imposed, thus the desired convergence of solutions of approximation problems towards those of the original BLO follows. By drawing inspiration from the classic dynamics-embedded gradient method which replaces the LL problem with certain optimization dynamics, hence resulting in an approximation of the bi-level problem, we propose a new gradient scheme to solve BLO in Eq. (1) without LLC restriction. Specifically, we let $K$ be a prescribed positive integer and construct the following approximation ${ \bf y } _ { K } ( { \bf x } , { \bf z } )$ of the LL solution drawn from projected gradient descent iterations
59
+
60
+ $$
61
+ \begin{array} { r l } & { \mathbf { y } _ { 0 } ( \mathbf { x } , \mathbf { z } ) = \mathbf { z } , } \\ & { \mathbf { y } _ { k + 1 } ( \mathbf { x } , \mathbf { z } ) = \operatorname* { P r o j } _ { \mathcal { V } } ( \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) - \alpha _ { \mathbf { y } } ^ { k } \nabla _ { \mathbf { y } } f ( \mathbf { x } , \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) ) ) , k = 0 , \cdots , K - 1 , } \end{array}
62
+ $$
63
+
64
+ where $\{ \alpha _ { \mathbf { y } } ^ { k } \}$ is a sequence of steps sizes. We next embed the dynamical iterations ${ \bf y } _ { k } ( { \bf x } , { \bf z } )$ into $\mathrm { m a x } _ { 1 \le k \le K } \{ F ( { \bf x } , { \bf y } _ { k } ( { \bf x } , { \bf z } ) ) \}$ , which can be regarded as a pessimistic trajectory truncation of the UL objective. The mechanism of the above scheme, in comparison, accesses the approximation parameterized by UL variable $\mathbf { x }$ and LL initial point $\mathbf { y } _ { 0 }$ . Our motivation for the initialization auxiliary variable $\mathbf { z }$ comes from convergence theory [42] of non-convex first-order optimization methods. In fact, when the non-convex LL problem admits multiple solutions, the gradient descent steps with a “bad” initial point $\mathbf { y } _ { 0 }$ cannot return a desired point in the LL solution set, simultaneously optimizing the UL objective. To overcome such a difficulty, instead of using a fixed initial value, we introduce an initialization auxiliary variable $\mathbf { z }$ . Therefore, when it comes to solving the UL approximation problems, together with the UL variable $\mathbf { x }$ , the auxiliary variable $\mathbf { z }$ is also updated and hence optimized. As a consequence, we may search for the “best” initial value, starting from which the gradient descent steps approach a solution to the BLO in Eq. (1), i.e., a point in the LL solution set, simultaneously minimizing the UL objective.
65
+
66
+ # 2.2 Pessimistic Trajectory Truncation
67
+
68
+ This is a striking feature of our algorithm that significantly differs from existing methods and leads to some new convergence results without LLC. The motivation for the design of pessimistic trajectory truncation comes again from convergence theory of non-convex firstorder optimization methods. It is understood that when LL is non-convex, $\mathcal { R } _ { \alpha } ( { \bf x } , { \bf y } _ { K } ( { \bf x } , { \bf z } ) )$ may not uniformly converge w.r.t. $\mathbf { x }$ and $\mathbf { z }$ , where $\mathcal { R } _ { \alpha } ( \mathbf { x } , \mathbf { y } )$ is the proximal gradient residual mapping defined as $\mathcal { R } _ { \alpha } ( \mathbf { x } , \mathbf { y } ) : = \textbf { y } -$ $\mathrm { P r o j } _ { \mathcal { V } } \left( \mathbf { \bar { y } } - \alpha \nabla _ { \mathbf { y } } f ( \mathbf { x } , \mathbf { y } ) \right) ^ { 1 }$ , which can be used as a measurement of the optimality of LL problem in Eq. (2). Thus a direct embedding of ${ \bf y } _ { K } ( { \bf x } , { \bf z } )$ into UL objective $F ( \mathbf { x } , \mathbf { y } )$ may not necessarily provide an appropriate approximation. Fortunately, it is also understood that, for each $\mathbf { x } \in \mathcal { X }$ , $\mathbf { z } \in \mathcal { V }$ and $K > 0$ , there exists at
69
+
70
+ # Algorithm 1 The Proposed IAPTT-GM
71
+
72
+ 1: Initialize $\mathbf { x } ^ { 0 }$ and $\mathbf { z } ^ { 0 }$ .
73
+ 2: for $t = 0 T - 1$ do
74
+ 3: $\mathbf { y } _ { 0 } = \mathbf { z } ^ { t }$ .
75
+ 4: for $k = 0 K - 1$ do
76
+ 5: $\%$ LL Updating with $\mathbf { x } ^ { t }$ and $\mathbf { z } ^ { t }$
77
+ 6: $\mathbf { y } _ { k + 1 } = \mathbf { \widetilde { P } r o j } _ { \mathcal { V } } ^ { - } ( \mathbf { y } _ { k } - \alpha _ { \mathbf { y } } ^ { k } \nabla _ { \mathbf { y } } f ( \mathbf { x } ^ { t } , \mathbf { y } _ { k } ) )$
78
+ 7: end for
79
+ 8: 9: $\%$ $\bar { k } = \arg \operatorname* { m a x } _ { k } \{ \bar { F ( \mathbf { x } , \mathbf { y } _ { k } ) } \} _ { k = 1 } ^ { K } .$ cation.
80
+ 10: $\%$ UL Updating with ${ \bf y } _ { \bar { k } } ( { \bf x } , { \bf z } )$
81
+ 11: $\mathbf { x } ^ { t + 1 } = \operatorname { P r o j } _ { \mathcal { X } } ( \mathbf { x } ^ { t } - \alpha _ { \mathbf { x } } \nabla _ { \mathbf { x } } F ( \mathbf { x } ^ { t } , \mathbf { y } _ { \bar { k } } ) )$ .
82
+ 12: $\%$ Initialization Updating with ${ \bf y } _ { \bar { k } } ( { \bf x } , { \bf z } )$
83
+ 13: $\mathbf { z } ^ { t + 1 } = \operatorname { P r o j } _ { \mathcal { V } } ( \mathbf { z } ^ { t ^ { \top } } - \alpha _ { \mathbf { z } } \bar { \nabla } _ { \mathbf { z } } F ( \mathbf { x } ^ { t } , \mathbf { y } _ { \bar { k } } ) )$ .
84
+ 14: end for
85
+
86
+ least a $\tilde { K }$ such that along the selection ${ \mathbf { y } } _ { \tilde { K } } ( { \mathbf { x } } , { \mathbf { z } } )$ , $\mathcal { R } _ { \alpha } ( \mathbf { x } , \mathbf { y } _ { \tilde { K } } ( \mathbf { x } , \mathbf { z } ) )$ uniformly converges to zero w.r.t.
87
+ $\mathbf { x }$ and $\mathbf { z }$ , as $K$ tending infinity.
88
+
89
+ However, in general, it is too ambitious to expect an explicit identification of the exact selection ${ \bf y } _ { \tilde { K } } ( { \bf x } , { \bf z } )$ . Alternatively, we consider a pessimistic strategy, minimizing the worst case of all selections of $\{ \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) \}$ , i.e., $\begin{array} { r } { \operatorname* { m a x } _ { 1 \leq k \leq K } \left\{ F ( \mathbf { x } , \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) ) \right\} } \end{array}$ . By doing so, we successfully reach a good approximation. In addition to the theoretical convergence, we also benefit from this pessimistic strategy in a numerical sense. The pessimistic max operation always results in a favorable trajectory truncation smaller than $K$ . Consequently, this technique offers inexpensive computational cost for computing the hyper-gradient through back propagation, as shown in the numerical experiments.
90
+
91
+ To conclude this section, we state the complete IAPTT-GM in Algorithm 1. Note that $K$ and $T$ represent the numbers of inner and outer iterations, respectively.
92
+
93
+ # 3 Theoretical Investigations
94
+
95
+ With the purpose of studying the convergence of dynamics-embedded gradient method for BLO without LLC, we involve two signature features in our algorithmic design, i.e., initialization auxiliary and pessimistic trajectory truncated. This section is devoted to the convergence analysis of our proposed algorithm with and without LLC assumption. Please notice that all the proofs of our theoretical results are stated in the Supplemental Material.
96
+
97
+ # 3.1 Convergence Analysis of IAPTT-GM for BLO with Non-convex Followers
98
+
99
+ In this part, we conduct the convergence analysis of the IAPTT-GM for solving BLO in Eq. (1) without LLC. Before presenting our main convergence results, we introduce some notations related to BLO. With introduced function $\varphi ( \mathbf x ) : = \operatorname* { i n f } _ { \mathbf y \in { \cal S } ( \mathbf x ) } { \cal F } ( \mathbf x , \mathbf y )$ , the BLO in Eq. (1) can be rewritten as
100
+
101
+ $$
102
+ \operatorname* { m i n } _ { \mathbf { x } \in \mathcal { X } } \varphi ( \mathbf { x } ) .
103
+ $$
104
+
105
+ With given $K \geq 1$ and defining $\varphi _ { K } ( \mathbf x , \mathbf z ) : = \mathrm { m a x } _ { k } \left\{ F ( \mathbf x , \mathbf y _ { k } ( \mathbf x , \mathbf z ) ) \right\}$ with $\{ \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) \}$ defined in Eq. (4), our proposed IAPTT-GM generates sequence $\{ ( \mathbf { x } ^ { t } , \mathbf { z } ^ { t } ) \}$ for solving following approximation problem to BLO in Eq. (5),
106
+
107
+ $$
108
+ \operatorname* { m i n } _ { { \mathbf { x } } \in { \mathcal { X } } , { \mathbf { z } } \in { \mathcal { Y } } } { \varphi _ { K } ( \mathbf { x } , \mathbf { z } ) } .
109
+ $$
110
+
111
+ This section is mainly devoted to the convergence of solutions of approximation problems in Eq. (6) towards those of the original BLO in Eq. (5).
112
+
113
+ Assumption 3.1 We make following standing assumptions throughout this section.
114
+
115
+ (1) $F , f : \mathbb { R } ^ { n } \times \mathbb { R } ^ { m } \mathbb { R }$ are continuous functions.
116
+ (2) $\nabla f$ is continuous and $\nabla _ { \mathbf y } f$ is $L _ { f }$ Lipschitz continuous with respect to y for any $\mathbf { x } \in \mathcal { X }$ .
117
+ (3) $\mathcal { X }$ and $\mathcal { V }$ are convex compact sets.
118
+ (4) $\boldsymbol { S } ( \mathbf { x } )$ is nonempty for any $\mathbf { x } \in \mathcal { X }$ .
119
+ (5) For any $( { \bar { \mathbf { x } } } , { \bar { \mathbf { y } } } )$ minimizing $F ( \mathbf { x } , \mathbf { y } )$ over constraints $\mathbf { x } \in \mathcal { X } , \mathbf { y } \in \mathcal { Y }$ and $\mathbf { y } \in \hat { S } ( \mathbf { x } )$ , it holds that $\bar { \mathbf { y } } \in S ( \mathbf { x } )$ .
120
+
121
+ Note that $\hat { S } ( \mathbf { x } )$ denotes the set of LL stationary points, i.e., $\hat { \mathcal { S } } ( \mathbf { x } ) = \{ \mathbf { y } \in \mathcal { Y } | 0 = \nabla \mathbf { y } f ( \mathbf { x } , \mathbf { y } ) +$ $\mathcal { N } _ { \mathcal { Y } } ( \mathbf { y } ) \}$ . It should be noticed that $\mathbf { y } \in \hat { S } ( \mathbf { x } )$ if and only if $\begin{array} { r } { \mathcal { R } _ { \alpha } ( \mathbf { x } , \mathbf { y } ) = 0 } \end{array}$ . Assumption 3.1 is standard in bi-level optimziation related literature, which will be shown to be satisfied for the numerical example given in Section 4.1.
122
+
123
+ As discussed in the preceding section, for each $\mathbf { x } \in \mathcal { X }$ , $\mathbf { z } \in \mathcal { V }$ and $K > 0$ , there exists at least a $\tilde { K }$ such that along the selection ${ \mathbf { y } } _ { \tilde { K } } ( { \mathbf { x } } , { \mathbf { z } } )$ , $\mathcal { R } _ { \alpha } ( \mathbf { x } , \mathbf { y } _ { \tilde { K } } ( \mathbf { x } , \mathbf { z } ) )$ uniformly converges to zero w.r.t. $\mathbf { x }$ and $\mathbf { z }$ , as $K$ tending infinity. We next specifically show the existence of such index $\tilde { K }$ . To this end, $\tilde { K }$ can be chosen by optimizing $\| \mathcal { R } _ { \alpha } ( \mathbf { x } , \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) ) \|$ among the indices $k = 0 , 1 , . . . , K$ . In particular, as stated in the following lemma, $\| \mathcal { R } _ { \alpha } ( \mathbf { x } , \mathbf { y } _ { \tilde { K } } ( \mathbf { x } , \mathbf { z } ) ) \|$ uniformly decreases with a $\textstyle { \frac { 1 } { \sqrt { K } } }$ rate on $\mathcal { X } \times \mathcal { V }$ as $K$ increases.
124
+
125
+ Lemma 3.1 Let $\{ \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) \}$ be the sequence defined in Eq. (4) with $\begin{array} { r } { \alpha _ { \mathbf { y } } ^ { k } \in [ \underline { { \alpha } } _ { \mathbf { y } } , \overline { { \alpha } } _ { \mathbf { y } } ] \subset ( 0 , \frac { 2 } { L _ { f } } ) } \end{array}$ , there exists $C _ { f } > 0$ such that
126
+
127
+ $$
128
+ \operatorname* { m i n } _ { 0 \leq k \leq K } \| \mathcal { R } _ { \underline { { \alpha } } _ { \mathbf { y } } } ( \mathbf { x } , \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) ) \| \leq \frac { C _ { f } } { \sqrt { K + 1 } } , \quad \forall \mathbf { x } \in \boldsymbol { \mathcal { X } } , \mathbf { z } \in \mathcal { Y } .
129
+ $$
130
+
131
+ As shown in the Appendix, the proof of Lemma 3.1 for the existence cannot offer us an explicit identification of the exact selection of $\tilde { K }$ . Alternatively, we construct the approximation by a pessimistic trajectory truncation strategy, minimizing the worst case of all selections of $\{ \mathbf { y } _ { k } ( \mathbf { x } , \bar { \mathbf { z } } ) \}$ , i.e., $\varphi _ { K } ( \mathbf { x } , \mathbf { z } )$ . By further solving the approximated problems $\operatorname* { m i n } { \varphi _ { K } ( \mathbf { x } , \mathbf { z } ) }$ , we shall provide a lower bound estimation for the optimal value of the BLO problem in Eq. (5).
132
+
133
+ Lemma 3.2 Let $( { \bf x } _ { K } , { \bf z } _ { K } ) \in \mathrm { ~ a r g m i n ~ } \varphi _ { K } ( { \bf x } , { \bf z } )$ , then x∈X ,z∈Y
134
+
135
+ $$
136
+ \varphi _ { K } ( \mathbf x _ { K } , \mathbf z _ { K } ) \leq \operatorname* { i n f } _ { \mathbf y \in \hat { \mathcal S } ( \mathbf x ) } F ( \mathbf x , \mathbf y ) , \quad \forall \mathbf x \in \mathcal X .
137
+ $$
138
+
139
+ Upon together with the uniform convergence result in Lemma 3.1, the gap between the lower bound provided by $\operatorname* { m i n } { \varphi _ { K } ( \mathbf { x } , \mathbf { z } ) }$ and the true optimal value of the BLO problem in Eq. (5) eventually vanishes. To fill in this gap and present the main convergence result of our proposed IAPTT-GM,
140
+
141
+ we need the continuity of $\mathcal { R } _ { \alpha } ( \mathbf { x } , \mathbf { y } )$ . Indeed, it follows from [43, Theorem 6.42] that $\mathsf { P r o j } _ { \mathcal { Y } }$ is continuous. Combined with the assumed continuity of $\nabla _ { \mathbf y } { f } ( \mathbf x , \mathbf y )$ , we get the desired continuity of $\mathcal { R } _ { \alpha } ( \mathbf { x } , \mathbf { y } )$ immediately.
142
+
143
+ Theorem 3.1 Let $\{ \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) \}$ be the sequence generated by Eq. (4) with $\begin{array} { r } { \boldsymbol { \alpha } _ { \mathbf { y } } ^ { k } \in [ \underline { { \boldsymbol { \alpha } } } _ { \mathbf { y } } , \overline { { \boldsymbol { \alpha } } } _ { \mathbf { y } } ] \subset ( 0 , \frac { 2 } { L _ { f } } ) , } \end{array}$ ,
144
+ and $( { \bf x } _ { K } , { \bf z } _ { K } ) \in \underset { -- } { \operatorname { a r g m i n } } \varphi _ { K } ( { \bf x } , { \bf z } )$ , then we have: $\mathbf { x } { \in } \mathcal { X } , \mathbf { z } { \in } \mathcal { Y }$
145
+
146
+ (1) Any limit point $\bar { \bf x }$ of the sequence $\left\{ { \bf x } _ { K } \right\}$ is the solution to BLO in Eq. (1), that is $\bar { \textbf { x } } \in$ $\underset { \mathbf { x } \in \mathcal { X } } { \mathrm { a r g m i n } } \varphi ( \mathbf { x } )$ .
147
+
148
+ $$
149
+ \operatorname* { i n f } _ { \mathbf { x } \in \mathcal { X } , \mathbf { z } \in \mathcal { V } } \varphi _ { K } ( \mathbf { x } , \mathbf { z } ) \to \operatorname* { i n f } _ { \mathbf { x } \in \mathcal { X } } \varphi ( \mathbf { x } ) a s K \to \infty .
150
+ $$
151
+
152
+ In the above theorem, we justify the global solutions convergence of the approximated problems. We next derive a convergence characterization regarding the local minimums of the approximated problems. In particular, the next theorem shows that any limit point of the local minimums of approximated problems is in some sense a local minimum of the bilevel problem in Eq. (1).
153
+
154
+ Theorem 3.2 Let $\{ \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) \}$ be the sequence generated by Eq. (4) with $\begin{array} { r } { \boldsymbol { \alpha } _ { \mathbf { y } } ^ { k } \in [ \underline { { \boldsymbol { \alpha } } } _ { \mathbf { y } } , \overline { { \boldsymbol { \alpha } } } _ { \mathbf { y } } ] \subset ( 0 , \frac { 2 } { L _ { f } } ) , } \end{array}$ , and $\left( { { \bf { x } } _ { K } } , { { \bf { z } } _ { K } } \right)$ be a local minimum of $\varphi _ { K } ( \mathbf { x } , \mathbf { z } )$ with uniform neighborhood modulus $\delta > 0$ , i.e.,
155
+
156
+ $$
157
+ \varphi _ { K } ( \mathbf { x } _ { K } , \mathbf { z } _ { K } ) \leq \varphi _ { K } ( \mathbf { x } , \mathbf { z } ) , \quad \forall ( \mathbf { x } , \mathbf { z } ) \in \mathbb { B } _ { \delta } ( \mathbf { x } _ { K } , \mathbf { z } _ { K } ) \cap \mathcal { X } \times \mathcal { Y } .
158
+ $$
159
+
160
+ Then we have that for any limit point $( \bar { \bf x } , \bar { \bf z } )$ of the sequence $\{ ( { \bf x } _ { K } , { \bf z } _ { K } ) \}$ , there exists a limit point $\bar { \mathbf { y } }$ of the sequence $\left\{ { \bf y } _ { K } ( { \bf x } _ { K } , { \bf z } _ { K } ) \right\}$ such that $\bar { \mathbf { y } } \in \hat { S } ( \bar { \mathbf { x } } )$ and $( { \bar { \mathbf { x } } } , { \bar { \mathbf { y } } } )$ satisfies that there exists $\tilde { \delta } > 0$ such that
161
+
162
+ $$
163
+ \begin{array} { r } { F ( \bar { \mathbf { x } } , \bar { \mathbf { y } } ) \leq F ( \mathbf { x } , \mathbf { z } ) , \quad \forall ( \mathbf { x } , \mathbf { z } ) \in \mathbb { B } _ { \widetilde { \delta } } ( \bar { \mathbf { x } } , \bar { \mathbf { z } } ) \cap \{ \mathbf { x } \in \mathcal { X } , \mathbf { z } \in \mathcal { V } \mid \mathbf { z } \in \hat { S } ( \mathbf { x } ) \} . } \end{array}
164
+ $$
165
+
166
+ # 3.2 Theoretical Findings of IA-GM (A) for BLO with LLC
167
+
168
+ A byproduct of our study, which has its own interest, is that thanks to the involved initialization auxiliary, our theory can improve those existing results for classical gradient methods with accelerated gradient descent dynamical iterations under LLC. Nesterov’s acceleration technique [44] has been used widely for solving convex optimization problem and it greatly improves the convergence rate of gradient descent. To illustrate our result, we will take the Nesterov’s acceleration proximal gradient method [45] as the embedded optimization dynamics in classical gradient method for example.
169
+
170
+ Thanks to the LLC setting, $\mathcal { R } _ { \alpha } ( { \bf x } , { \bf y } _ { K } ( { \bf x } , { \bf z } ) )$ may uniformly converge to zero w.r.t. UL variable $x$ and auxiliary variable $\mathbf { z }$ , thus the pessimistic trajectory truncation operation can be removed. Subsequently, we slightly simplify our algorithm that $\bar { k }$ is simply taken as $K$ , thus the approximation objective admits a succinct form, i.e., $F ( \mathbf { x } , \mathbf { y } _ { K } ( \mathbf { x } , \mathbf { z } ) )$ .
171
+
172
+ In summary, by constructing ${ \bf y } _ { k } ( { \bf x } , { \bf z } )$ through following Nesterov’s acceleration dynamics,
173
+
174
+ $$
175
+ \begin{array} { r l } & { \mathbf { y } _ { 0 } ( \mathbf { x } , \mathbf { z } ) = \mathbf { z } , \qquad t _ { 0 } = 1 , \quad t _ { k + 1 } = \frac { 1 + \sqrt { 1 + t _ { k } ^ { 2 } } } { 2 } , k = 0 , \cdots , K - 1 , } \\ & { \mathbf { u } ^ { k + 1 } ( \mathbf { x } , \mathbf { z } ) = \mathbf { y } ^ { k + 1 } ( \mathbf { x } , \mathbf { z } ) + \left( \frac { t _ { k } - 1 } { t _ { k + 1 } } \right) ( \mathbf { y } ^ { k + 1 } ( \mathbf { x } , \mathbf { z } ) - \mathbf { y } ^ { k } ( \mathbf { x } , \mathbf { z } ) ) , k = 0 , \cdots , K - 1 , } \\ & { \mathbf { y } _ { k + 1 } ( \mathbf { x } , \mathbf { z } ) = \mathrm { P r o j } _ { \mathcal { Y } } \left( \mathbf { u } ^ { k } ( \mathbf { x } , \mathbf { z } ) - \alpha \nabla _ { \mathbf { y } } f ( \mathbf { x } , \mathbf { u } ^ { k } ( \mathbf { x } , \mathbf { z } ) ) \right) , k = 0 , \cdots , K - 1 , } \end{array}
176
+ $$
177
+
178
+ where $\alpha > 0$ is the step size, we propose an accelerated Gradient-based Method with Initialization Auxiliary, named IA-GM(A), via minimizing the approximation objective function,
179
+
180
+ $$
181
+ \operatorname* { m i n } _ { \mathbf { x } \in \mathcal { X } , \mathbf { z } \in \mathcal { V } } \phi _ { K } ( \mathbf { x } , \mathbf { z } ) : = F ( \mathbf { x } , \mathbf { y } _ { K } ( \mathbf { x } , \mathbf { z } ) ) .
182
+ $$
183
+
184
+ The detailed description of the proposed IA-GM(A) is stated in the Supplemental Material.
185
+
186
+ We suppose Assumption 3.1(1)-(4) are satisfied throughout this subsection. The convergence result of our proposed IA-GM(A) with LLC assumption is given as below.
187
+
188
+ Theorem 3.3 Assume that the generated sequence $\{ \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) \}$ satisfies that $\mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) \in \mathcal { Y } _ { \mathrm { : } }$ , and ${ \bf y } _ { k } ( { \bf x } , { \bf z } ) = { \bf z }$ for any $\mathbf { z } \in S ( \mathbf { x } )$ , $\mathbf { x } \in \mathcal { X }$ , and either
189
+
190
+ (a) for any $\epsilon > 0$ , there exists $k ( \epsilon ) > 0$ such that whenever $K > k ( \epsilon )$
191
+
192
+ whenever $K > k ( \epsilon )$ , or
193
+
194
+ (b) there exists $\alpha > 0 _ { : }$ , for any $\epsilon > 0$ , there exists $k ( \epsilon ) > 0$ such that,
195
+
196
+ Let $( \mathbf { x } _ { K } , \mathbf { z } _ { K } ) \in \operatorname { a r g m i n } _ { \mathbf { x } \in \mathcal { X } , \mathbf { z } \in \mathcal { Y } } \phi _ { K } ( \mathbf { x } , \mathbf { z } ) : = F ( \mathbf { x } , \mathbf { y } _ { K } ( \mathbf { x } , \mathbf { z } ) )$ , then we have
197
+
198
+ (1) any limit point $\bar { x }$ of the sequence $\left\{ { \bf x } _ { K } \right\}$ satisfies that $\bar { \mathbf { x } } \in \underset { \mathbf { x } \in \mathcal { X } } { \mathrm { a r g m i n } } \varphi ( \mathbf { x } ) ,$ , i.e., $\bar { x }$ is the solution
199
+
200
+ to BLO (1).
201
+
202
+ $$
203
+ \operatorname* { i n f } _ { \mathbf { x } \in \mathcal { X } , \mathbf { z } \in \mathcal { V } } \phi _ { K } ( \mathbf { x } , \mathbf { z } ) \to \operatorname* { i n f } _ { \mathbf { x } \in \mathcal { X } } \varphi ( \mathbf { x } ) a s K \to \infty .
204
+ $$
205
+
206
+ Next, we show that the Nesterov’s acceleration dynamics satisfy all the assumptions required in the above convergence theorem.
207
+
208
+ Theorem 3.4 Let $\{ \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) \}$ be the sequence generated by Nesterov’s acceleration dynamics in Eq. (9) with $\begin{array} { r } { \alpha = \frac { 1 } { L _ { f } } } \end{array}$ . Then $\{ \mathbf { y } _ { k } ( \mathbf { x } , \mathbf { z } ) \}$ satisfies all the assumptions required by Theorem 3.3.
209
+
210
+ Remark 3.1 Our convergence result Theorem 3.3 is not only for $\mathbf { y } _ { k }$ generated by Nesterov’s acceleration dynamics. It is a general convergence result that is applicable for the case where $\mathbf { y } _ { k }$ is generated by other dynamics. And the assumptions required in Theorem 3.3 is weak enough to be satisfied by the dynamics introduced by many first-order methods on convex LL problem in Eq. 2.
211
+
212
+ # 4 Experimental Results
213
+
214
+ In this section, we first verify the theoretical convergence results on non-convex numerical problems compared with existing EG methods and IG methods. Then we test the performance of IAPTT-GM and demonstrate its generalizability to real-world BLO problems with non-convex followers, which are caused by non-convex regularization and neural network structures. In addition, we further validate the performance of the accelerated version (i.e., IA-GM (A)) under LLC with numerical examples and data hyper-cleaning tasks 2.
215
+
216
+ # 4.1 Numerical Verification
217
+
218
+ To verify the convergence property under assumptions provided in Section 3, we consider the following non-convex BLO problem:
219
+
220
+ $$
221
+ \operatorname* { m i n } _ { x \in \mathcal { X } , y \in \mathbb { R } } x + x y , \quad s . t . \quad y \in \underset { y \in \mathcal { Y } } { \operatorname { a r g m i n } } - \sin ( x y ) ,
222
+ $$
223
+
224
+ where $\mathcal { X } \ : = \ : [ 1 , 1 0 ]$ and $\mathcal { V } = [ - 2 , 2 ]$ . Given any $x \in \mathcal { X }$ , it satisfies $\begin{array} { r } { \mathrm { a r g m i n } _ { y \in \mathcal { y } } - \mathrm { s i n } ( x y ) \ = } \end{array}$ $\{ ( 2 k \pi + \pi / 2 ) / x \mid k \in \mathbb { Z } \} \cap \mathcal { Y }$ and $\begin{array} { r } { \operatorname* { m i n } _ { y \in \mathcal { V } } - \sin ( x y ) = - 1 } \end{array}$ . The unique solution is $( x ^ { * } , y ^ { * } ) =$ $( 1 1 \pi / 4 , - 2 )$ . It should be noted that the LL problem of Eq. (10) has multiple global minima, which can significantly show the advantage of initialization auxiliary technique. It can be easily verified that the above toy example satisfies Assumption 3.1.
225
+
226
+ In Figure 1, we separately compared IAPTT-GM with EG methods such as RHG [3], BDA [23], IG methods such as LS [28], NS [7] and IA-GM. From Figure 1.(a) to Figure 1.(b), we can observe that different initialization points only slightly affect the convergence speed of IAPTT-GM. With initialization points distant from $( x ^ { * } , y ^ { * } )$ , IAPTT-GM can still achieve optimal solution of UL variables and optimal objective value, while other methods fail to converge to the true solution. In Figure 1.(g) and Figure 1.( h), we compare the performances of IAPTT-GM with IA-GM, which has no convergence guarantee without LLC assumption. As shown, IA-GM fails to converge to the true solution eventually, which validates the necessity of PTT technique and the effectiveness of IAPTT-GM.
227
+
228
+ ![](images/c127978dc735f90a7baeb2a430c84d4f2d7ad25a940e852e57c541daeb62a434.jpg)
229
+ Figure 1: Illustrating the convergence behavior of $\| F - F ^ { * } \| / \| F ^ { * } \|$ and $\| x - x ^ { * } \| / \| x ^ { * } \|$ as the training proceeds. $F _ { \mathrm { I A P T T - G M } }$ and $F _ { \mathrm { I A - G M } }$ denote the UL objectives of IAPTT-GM and IA-GM, respectively. Three representative initialization points for UL and LL variables are $( x _ { 0 } , y _ { 0 } ) = ( 1 , 2 )$ , $( x _ { 0 } , y _ { 0 } ) = \mathbf { \bar { ( 5 , 1 ) } }$ , $( x _ { 0 } , \overset { \cdot } { y } _ { 0 } ) = ( 7 , - 1 ) .$ .
230
+
231
+ Runtime and Memory Analysis. In Figure 2, we report the average steps $\bar { k }$ of IAPTT-GM for PTT and the iterative speed as the UL iteration increases. In comparison with IA-GM, which uses default $K$ for the LL optimization loop, the changing $\bar { k }$ for IAPTT-GM leads to less iterations for the backward recurrent propagation and thus faster iterative updates during optimization. Although IA introduces additional variables and iterations, the PTT technique can choose a small $\bar { k }$ , thus shortens the back-propagation trajectory for computing the UL gradient (see Figure 2). As can be seen in Table 1, the memory required by our IAPTT-GM is less than NS, LS, and BDA and the same as that for RHG. As for the runtime, IAPTT-GM is a bit slower than RHG and NS, and faster than BDA. But please notice that the performance and the theoretical properties of IAPTT-GM are better than these existing approaches.
232
+
233
+ ![](images/e00c87cd413be5c13a123c8f9646faf7864d31c9f7a3a818764051a283f0610c.jpg)
234
+ Figure 2: Illustrating average steps for PTT technique and average running speed of the numerical example. Note that we conduct the experiments using more LL iterations so as to reduce the measurement error.
235
+
236
+ Table 1: Memory and runtime of existing methods for solving the above BLO problem. We conduct the experiments using the same parameter settings in Section C of the supplementary materials.
237
+
238
+ <table><tr><td rowspan=1 colspan=1>Metrics</td><td rowspan=1 colspan=1>LS</td><td rowspan=1 colspan=1>NS</td><td rowspan=1 colspan=1>RHG</td><td rowspan=1 colspan=1>BDA</td><td rowspan=1 colspan=1>IAPTT-GM</td></tr><tr><td rowspan=1 colspan=1>Memory (GB)</td><td rowspan=1 colspan=1>10.426</td><td rowspan=1 colspan=1>10.387</td><td rowspan=1 colspan=1>10.153</td><td rowspan=1 colspan=1>10.154</td><td rowspan=1 colspan=1>10.153</td></tr><tr><td rowspan=1 colspan=1>Runtime (Sec)</td><td rowspan=1 colspan=1>5.120</td><td rowspan=1 colspan=1>10.815</td><td rowspan=1 colspan=1>9.990</td><td rowspan=1 colspan=1>16.800</td><td rowspan=1 colspan=1>10.835</td></tr></table>
239
+
240
+ # 4.2 BLO with Non-convex Followers in Different Application Scenarios
241
+
242
+ To cover various real-world BLO application scenarios, we consider two categories of non-convex LL problems caused by non-convex regularization term and neural network architectures, which refer to few-shot classification and data hyper-cleaning tasks, respectively. Please note that the set constraint $\mathcal { V }$ is only used to guarantee the completeness of our theoretical analysis in Section 3. In application scenarios, we can just consider the constraint as an extra large set, so that all the variables are automatically in this feasible set. In this way, it is natural to ignore the projection operation in practical computations.
243
+
244
+ # 4.2.1 Few-Shot Classification: Non-convex LL Objective
245
+
246
+ In few-shot learning, to be more specific, N-way M-shot classification tasks [46], provided with M samples from each class, we train models to take advantage of prior data from similar tasks to quickly classify unseen instances from these $_ \mathrm { N }$ classes. Following the experimental protocol [47], the model parameters are separated into two parts: the hyper representation module (parameterized by $\mathbf { x }$ ) shared by all the tasks and the last classifier (parameterized by $\mathbf { y } ^ { j }$ ) for $j$ -th task. Define the meta training dataset as $\mathcal { D } = \{ \mathcal { D } ^ { j } \}$ , where $\mathcal { D } ^ { j } = \mathcal { D } _ { \mathtt { t r } } ^ { j } \bigcup \mathcal { D } _ { \mathtt { v a l } } ^ { j }$ corresponds to the $j$ -th task.
247
+
248
+ The cross-entropy loss function is widely used for UL and LL objectives. Referring to Section 3, IAPTT-GM covers the convergence results with non-convex LL model, thus allowing flexible design of the LL objective function. For instance, while non-convex regularization terms, e.g., $\ell _ { q }$ regularization with $0 < q < 1$ , have shown effectiveness to help the LL model converge and avoid over-fitting, existing methods can only guarantee the convergence when $q \geq 1$ , thus almost provide no support for non-convex objectives. We consider the LL subproblem with non-convex loss functions by adding $\ell _ { q }$ regularization 3. Then the UL and LL subproblems can be written as
249
+
250
+ $$
251
+ F \left( \mathbf { x } , \left\{ \mathbf { y } ^ { j } \right\} \right) = \sum _ { j } \ell \left( \mathbf { x } , \mathbf { y } ^ { j } ; \mathcal { D } _ { \mathrm { v a l } } ^ { j } \right) , \quad f \left( \mathbf { x } , \left\{ \mathbf { y } ^ { j } \right\} \right) = \sum _ { j } \ell \left( \mathbf { x } , \mathbf { y } ^ { j } ; \mathcal { D } _ { \mathrm { t r } } ^ { j } \right) + \Vert \mathbf { y } ^ { j } \Vert _ { q } .
252
+ $$
253
+
254
+ Table 2: Mean test accuracy of 5-way classification on tieredImageNet and miniImageNet, and the $\pm$ represents $9 5 \%$ confidence intervals over tasks.
255
+
256
+ <table><tr><td rowspan=2 colspan=1>Methods</td><td rowspan=2 colspan=1>Backbone</td><td rowspan=1 colspan=2>MiniImagenet</td><td rowspan=1 colspan=2>TieredImagenet</td></tr><tr><td rowspan=1 colspan=1>5-way 1-shot</td><td rowspan=1 colspan=1> 5-way 5-shot</td><td rowspan=1 colspan=1> 5-way 1-shot</td><td rowspan=1 colspan=1>t5-way 5-shot</td></tr><tr><td rowspan=1 colspan=1>Proto Net</td><td rowspan=1 colspan=1>ConvNet-4</td><td rowspan=1 colspan=1>49.42 ± 1.84</td><td rowspan=1 colspan=1>68.20± 0.66</td><td rowspan=1 colspan=1>53.31 ± 0.89</td><td rowspan=1 colspan=1>72.69±0.74</td></tr><tr><td rowspan=1 colspan=1>Relation Net</td><td rowspan=1 colspan=1>ConvNet-4</td><td rowspan=1 colspan=1>50.44 ± 0.82</td><td rowspan=1 colspan=1>65.32 ± 0.70</td><td rowspan=1 colspan=1>54.48 ± 0.93</td><td rowspan=1 colspan=1>65.32 ± 0.70</td></tr><tr><td rowspan=1 colspan=1>MAML</td><td rowspan=1 colspan=1>ConvNet-4</td><td rowspan=1 colspan=1>48.70±0.75</td><td rowspan=1 colspan=1>63.11 ± 0.11</td><td rowspan=1 colspan=1>49.06 ± 0.50</td><td rowspan=1 colspan=1>67.48 ± 0.47</td></tr><tr><td rowspan=1 colspan=1>RHG</td><td rowspan=1 colspan=1>ConvNet-4</td><td rowspan=1 colspan=1>48.89 ±0.81</td><td rowspan=1 colspan=1>63.02 ± 0.70</td><td rowspan=1 colspan=1>49.63 ± 0.67</td><td rowspan=1 colspan=1>66.14 ± 0.57</td></tr><tr><td rowspan=1 colspan=1>T-RHG</td><td rowspan=1 colspan=1>ConvNet-4</td><td rowspan=1 colspan=1>47.67± 0.82</td><td rowspan=1 colspan=1>63.70 ± 0.76</td><td rowspan=1 colspan=1>50.79 ± 0.69</td><td rowspan=1 colspan=1>67.39 ± 0.60</td></tr><tr><td rowspan=1 colspan=1>BDA</td><td rowspan=1 colspan=1>ConvNet-4</td><td rowspan=1 colspan=1>49.08±0.82</td><td rowspan=1 colspan=1>62.17 ± 0.70</td><td rowspan=1 colspan=1>51.56 ± 0.68</td><td rowspan=1 colspan=1>68.21 ±0.58</td></tr><tr><td rowspan=1 colspan=1>MAML</td><td rowspan=1 colspan=1>ResNet-12</td><td rowspan=1 colspan=1>51.03 ± 0.50</td><td rowspan=1 colspan=1>68.26 ± 0.47</td><td rowspan=1 colspan=1>58.58± 0.49</td><td rowspan=1 colspan=1>71.24 ± 0.43</td></tr><tr><td rowspan=1 colspan=1>RHG</td><td rowspan=1 colspan=1>ResNet-12</td><td rowspan=1 colspan=1>50.54±0.85</td><td rowspan=1 colspan=1>64.53 ± 0.68</td><td rowspan=1 colspan=1>58.19 ±0.76</td><td rowspan=1 colspan=1>75.20±0.60</td></tr><tr><td rowspan=1 colspan=1>IAPTT-GM</td><td rowspan=1 colspan=1>ResNet-12</td><td rowspan=1 colspan=1>56.69±0.66</td><td rowspan=1 colspan=1>70.21 ± 0.55</td><td rowspan=1 colspan=1>60.71±0.77</td><td rowspan=1 colspan=1>75.85 ± 0.59</td></tr></table>
257
+
258
+ Detailed information about the datasets and network architectures can be found in the supplementary materials. We report results of IAPTT-GM and various mainstream methods, e.g., Prototypical Network [48], Relation Net [49] and T-RHG [16] on miniImageNet [47] and tieredImageNet [50] datasets with two different backbones [6, 51] in Table 2. As it is shown, our proposed method outperforms state-of-the-art methods on both 5-way 1-shot and 5-way 5-shot tasks.
259
+
260
+ # 4.2.2 Data Hyper-Cleaning: Non-convex LL Architecture Structure
261
+
262
+ Data hyper-cleaning [3] aims to cleanup the corrupted data with noise label. According to [16], the dataset is randomly split to three disjoint subsets: $\mathcal { D } _ { \mathtt { t r } }$ for training, $\mathcal { D } _ { \mathtt { v a l } }$ for validation and $\mathcal { D } _ { \mathrm { t e s t } }$ for testing, then a fixed proportion of the training samples in $\mathcal { D } _ { \mathtt { t r } }$ is randomly corrupted.
263
+
264
+ Following the classical experimental protocol [3], we choose cross-entroy as the loss function $\ell$ , and the UL and LL subproblem take the form of
265
+
266
+ $$
267
+ F ( { \mathbf x } , { \mathbf y } ) = \sum _ { ( \mathbf u _ { i } , \mathbf v _ { i } ) \in \mathcal { D } _ { v a } } \ell \left( { \mathbf y } ( { \mathbf x } ) ; \mathbf u _ { i } , { \mathbf v } _ { i } \right) , f ( { \mathbf x } , { \mathbf y } ) = \sum _ { ( \mathbf u _ { i } , \mathbf v _ { i } ) \in \mathcal { D } _ { v a } } [ \sigma ( { \mathbf x } ) ] _ { i } \ell \left( { \mathbf y } ; { \mathbf u } _ { i } , { \mathbf v } _ { i } \right) ,
268
+ $$
269
+
270
+ where $\left( \mathbf { u } _ { i } , \mathbf { v } _ { i } \right)$ denotes the data pair and $\sigma ( \mathbf { x } )$ represents the element-wise sigmoid function on $\mathbf { x }$ . We define the hyperparameter $\mathbf { x }$ as a vector being trained to label the noisy data, of which the dimension equals to the number of training samples. The LL variables parameterized by $\mathbf { y }$ contain the weights and bias of fully connected layers.
271
+
272
+ Note that existing methods consider convex a single fully connected layer as the LL model, while more complex neural network structure is not applicable. Under our assumption without LLC, we employ two fully connected layers as the LL network architecture.
273
+
274
+ In Table 3, we compare IAPTT-GM with IG methods (e.g., LS, NS) and EG methods (e.g., RHG, T-RHG [16]). As it is shown, IAPTT-GM achieves better test performance of both accuracy and F1 score on two datasets, including MNIST [46] and FashionMNIST [52]. Our theoretical results also show that the performance improvement comes from PTT and IA techniques to overcome non-convex LL subproblems.
275
+
276
+ Table 3: Reporting results of existing methods for solving data hyper-cleaning tasks. Acc. and F1 score denote the test accuracy and the harmonic mean of the precision and recall, respectively.
277
+
278
+ <table><tr><td rowspan=2 colspan=1>Method</td><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>FashionMNIST</td></tr><tr><td rowspan=1 colspan=1>Acc.F1 score</td><td rowspan=1 colspan=1>Acc.F1 score</td></tr><tr><td rowspan=1 colspan=1>LS</td><td rowspan=1 colspan=1>89.19 85.96</td><td rowspan=1 colspan=1>83.15 85.13</td></tr><tr><td rowspan=1 colspan=1>NS</td><td rowspan=1 colspan=1>87.54 89.58</td><td rowspan=1 colspan=1>81.37 87.28</td></tr><tr><td rowspan=1 colspan=1>RHG</td><td rowspan=1 colspan=1>87.90 89.36</td><td rowspan=1 colspan=1>81.91 87.12</td></tr><tr><td rowspan=1 colspan=1>T-RHG</td><td rowspan=1 colspan=1>88.57 89.77</td><td rowspan=1 colspan=1>81.85 86.76</td></tr><tr><td rowspan=1 colspan=1>BDA</td><td rowspan=1 colspan=1>87.15 90.38</td><td rowspan=1 colspan=1>79.97 88.24</td></tr><tr><td rowspan=1 colspan=1>IAPTT-GM</td><td rowspan=1 colspan=1>90.88 91.57</td><td rowspan=1 colspan=1>83.67 90.37</td></tr></table>
279
+
280
+ # 4.3 Evaluations of IA-GM (A) for BLOs under LLC
281
+
282
+ In addition to non-convex BLO problems, we also raise concerns about the acceleration strategy of our method with LLC condition. We first consider the following BLO with LLC condition [23]:
283
+
284
+ $$
285
+ \operatorname* { m i n } _ { \mathbf { x } \in \mathcal { X } } \| \mathbf { x } - \mathbf { y } _ { 2 } \| ^ { 4 } + \| \mathbf { y } _ { 1 } - \mathbf { e } \| ^ { 4 } , \quad s . t . \quad ( \mathbf { y } _ { 1 } , \mathbf { y } _ { 2 } ) \in \arg \operatorname* { m i n } _ { \mathbf { y } _ { 1 } \in \mathbb { R } ^ { n } , \mathbf { y } _ { 2 } \in \mathbb { R } ^ { n } } \frac { 1 } { 2 } \| \mathbf { y } _ { 1 } \| ^ { 2 } - \mathbf { x } ^ { \top } \mathbf { y } _ { 1 } ,
286
+ $$
287
+
288
+ where $n = 5 0$ , $\mathcal { X } = [ - 1 0 0 , 1 0 0 ] \times \cdot \cdot \cdot [ - 1 0 0 , 1 0 0 ] \subset \mathbb { R } ^ { n }$ , and e represents the vector whose elements are all equal to 1. The optimal solution for this problem is $\mathbf { x } ^ { * } = \mathbf { e } , \mathbf { y } _ { 1 } ^ { * } = \mathbf { e } , \mathbf { y } _ { 2 } ^ { * } = \mathbf { e }$ .
289
+
290
+ As shown in Section 3.2, our method IA-GM (A) incorporates Nesterov’s acceleration strategy for solving Eq. (2). Note that with LLC assumption, IA-GM maintains the convergence property.
291
+
292
+ ![](images/1c2daf47ed3e8975be7489fb933f9bbb8a0401e79da1c16050ce4df719b9a324.jpg)
293
+ Figure 3: The left two subfigures report the curves of $\| \mathbf { y } - \mathbf { y } ^ { * } \|$ and $\| \mathbf { x } - \mathbf { x } ^ { * } \|$ for IA-GM and IA-GM (A). The figures on the right illustrate the results of mean UL loss and accuracy on the convex data hyper-cleaning problems.
294
+
295
+ As illustrated in the first two figures in Figure 3, IA-GM (A) shows significant improvement of convergence speed on UL and LL variables, which verifies the convergence results of Theorem 3.4 under LLC. We further study the convex data hyper-cleaning problem, which simply implements single fully connected layer as the network structure. From the right half of Figure 3, we can easily find that IA-GM (A) also performs better than IA-GM on real-world applications.
296
+
297
+ # 5 Conclusion
298
+
299
+ This paper presents a generic first-order algorithmic framework named IAPTT-GM to solve BLO problems with non-convex follower. We introduce two features, initialization auxiliary and pessimistic trajectory truncation operation to guarantee the convergence without the LLC hypothesis and achieves better performance on various applications. Meanwhile, we also validate the performance and speed improvement for BLO with LLC condition.
300
+
301
+ # Acknowledgments and Disclosure of Funding
302
+
303
+ This work is partially supported by the National Natural Science Foundation of China (Nos. 61922019, 11971220), the National Key R&D Program of China (2020YFB1313503), LiaoNing Revitalization Talents Program (XLYC1807088), the Shenzhen Science and Technology Program (No. RCYX20200714114700072), the Fundamental Research Funds for the Central Universities, the Pacific Institute for the Mathematical Sciences (PIMS), the Stable Support Plan Program of Shenzhen Natural Science Fund (No. 20200925152128002) and the Guangdong Basic and Applied Basic Research Foundation 2019A1515011152.
304
+
305
+ # References
306
+
307
+ [1] Risheng Liu, Jiaxin Gao, Jin Zhang, Deyu Meng, and Zhouchen Lin. Investigating bilevel optimization for learning and vision from a unified perspective: A survey and beyond. arXiv:2101.11517, 2021.
308
+ [2] Risheng Liu, Zi Li, Xin Fan, Chenying Zhao, Hao Huang, and Zhongxuan Luo. Learning deformable image registration from optimization: perspective, modules, bilevel training and beyond. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.
309
+ [3] Luca Franceschi, Michele Donini, Paolo Frasconi, and Massimiliano Pontil. Forward and reverse gradient-based hyperparameter optimization. arXiv:1703.01785, 2017.
310
+ [4] Takayuki Okuno, Akiko Takeda, and Akihiro Kawana. Hyperparameter learning via bilevel nonsmooth optimization. arXiv:1806.01520, 2018.
311
+ [5] Matthew MacKay, Paul Vicol, Jonathan Lorraine, David Duvenaud, and Roger B. Grosse. Self-tuning networks: Bilevel optimization of hyperparameters using structured best-response functions. In ICLR, 2019.
312
+ [6] Luca Franceschi, Paolo Frasconi, Saverio Salzo, Riccardo Grazzi, and Massimiliano Pontil. Bilevel programming for hyperparameter optimization and meta-learning. In ICML, 2018.
313
+ [7] Aravind Rajeswaran, Chelsea Finn, Sham M Kakade, and Sergey Levine. Meta-learning with implicit gradients. In NeurIPS, 2019.
314
+ [8] Daniel Zügner and Stephan Günnemann. Adversarial attacks on graph neural networks via meta learning. In ICLR, 2018.
315
+ [9] Yaohua Liu and Risheng Liu. Boml: A modularized bilevel optimization library in python for meta learning. In ICMEW. IEEE, 2021.
316
+ [10] Hanxiao Liu, Karen Simonyan, and Yiming Yang. DARTS: differentiable architecture search. In ICLR, 2019.
317
+ [11] Hanwen Liang, Shifeng Zhang, Jiacheng Sun, Xingqiu He, Weiran Huang, Kechen Zhuang, and Zhenguo Li. Darts $^ +$ : Improved differentiable architecture search with early stopping. arXiv:1909.06035, 2019.
318
+ [12] Xin Chen, Lingxi Xie, Jun Wu, and Qi Tian. Progressive differentiable architecture search: Bridging the depth gap between search and evaluation. In CVPR, 2019.
319
+ [13] David Pfau and Oriol Vinyals. Connecting generative adversarial networks and actor-critic methods. arXiv preprint arXiv:1610.01945, 2016.
320
+ [14] Zhuoran Yang, Yongxin Chen, Mingyi Hong, and Zhaoran Wang. Provably global convergence of actor-critic: A case for linear quadratic regulator with ergodic cost. In NeurIPS, 2019.
321
+ [15] Dougal Maclaurin, David Duvenaud, and Ryan Adams. Gradient-based hyperparameter optimization through reversible learning. In ICML, 2015.
322
+ [16] Amirreza Shaban, Ching-An Cheng, Nathan Hatch, and Byron Boots. Truncated backpropagation for bilevel optimization. In AISTATS, 2019.
323
+ [17] Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms. arXiv:1803.02999, 2018.
324
+ [18] Alex Nichol and John Schulman. Reptile: a scalable metalearning algorithm. arXiv:1803.02999, 2(2):1, 2018.
325
+ [19] Ke Li and Jitendra Malik. Learning to optimize. arXiv:1606.01885, 2016.
326
+ [20] Yoonho Lee and Seungjin Choi. Meta-learning with adaptive layerwise metric and subspace. CoRR, abs/1801.05558, 2018.
327
+ [21] Eunbyung Park and Junier B Oliva. Meta-curvature. arXiv:1902.03356, 2019.
328
+ [22] Sebastian Flennerhag, Andrei A Rusu, Razvan Pascanu, Francesco Visin, Hujun Yin, and Raia Hadsell. Meta-learning with warped gradient descent. arXiv:1909.00025, 2019.
329
+ [23] Risheng Liu, Pan Mu, Xiaoming Yuan, Shangzhi Zeng, and Jin Zhang. A generic first-order algorithmic framework for bi-level programming beyond lower-level singleton. In ICML, 2020.
330
+ [24] Risheng Liu, Pan Mu, Xiaoming Yuan, Shangzhi Zeng, and Jin Zhang. A general descent aggregation framework for gradient-based bi-level optimization, 2021.
331
+ [25] Kaiyi Ji, Junjie Yang, and Yingbin Liang. Bilevel optimization: Nonasymptotic analysis and faster algorithms. arXiv:2010.07962, 2020.
332
+ [26] Riccardo Grazzi, Luca Franceschi, Massimiliano Pontil, and Saverio Salzo. On the iteration complexity of hypergradient computation. In ICML, 2020.
333
+ [27] Kaiyi Ji and Yingbin Liang. Lower bounds and accelerated algorithms for bilevel optimization. arXiv:2102.03926v2, 2021.
334
+ [28] Fabian Pedregosa. Hyperparameter optimization with approximate gradient. arXiv:1602.02355, 2016.
335
+ [29] Jonathan Lorraine, Paul Vicol, and David Duvenaud. Optimizing millions of hyperparameters by implicit differentiation. In AISTATS, 2020.
336
+ [30] Ilya Sutskever, James Martens, George Dahl, and Geoffrey Hinton. On the importance of initialization and momentum in deep learning. In ICML, 2013.
337
+ [31] Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML, 2017.
338
+ [32] Pan Zhou, Xiaotong Yuan, Huan Xu, Shuicheng Yan, and Jiashi Feng. Efficient meta learning via minibatch proximal update. 2019.
339
+ [33] Liam Collins, Aryan Mokhtari, and Sanjay Shakkottai. Task-robust model-agnostic metalearning. 2020.
340
+ [34] Ren Wang, Kaidi Xu, Sijia Liu, Pin-Yu Chen, Tsui-Wei Weng, Chuang Gan, and Meng Wang. On fast adversarial robustness adaptation in model-agnostic meta-learning. arXiv:2102.10454, 2021.
341
+ [35] Alireza Fallah, Aryan Mokhtari, and Asuman Ozdaglar. Generalization of model-agnostic meta-learning algorithms: Recurring and unseen tasks. arXiv:2102.03832, 2021.
342
+ [36] Aniruddh Raghu, Maithra Raghu, Samy Bengio, and Oriol Vinyals. Rapid learning or feature reuse? towards understanding the effectiveness of maml. In ICLR, 2019.
343
+ [37] Alireza Fallah, Aryan Mokhtari, and Asuman Ozdaglar. On the convergence theory of gradientbased model-agnostic meta-learning algorithms. In SIATATS, 2020.
344
+ [38] Kaiyi Ji, Junjie Yang, and Yingbin Liang. Theoretical convergence of multi-step model-agnostic meta-learning. arXiv e-prints, pages arXiv–2002, 2020.
345
+ [39] Kaiyi Ji, Jason D Lee, Yingbin Liang, and H. Vincent Poor. Convergence of meta-learning with task-specific adaptation over partial parameters. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, NeurIPS, 2020.
346
+ [40] Risheng Liu, Xuan Liu, Shangzhi Zeng, Jin Zhang, and Yixuan Zhang. Value-function-based sequential minimization for bi-level optimization, 2021.
347
+ [41] Jane J Ye, Xiaoming Yuan, Shangzhi Zeng, and Jin Zhang. Difference of convex algorithms for bilevel programs with applications in hyperparameter selection. arXiv:2102.09006, 2021.
348
+ [42] Risheng Liu, Xuan Liu, Xiaoming Yuan, Shangzhi Zeng, and Jin Zhang. A value-function-based interior-point method for non-convex bi-level optimization. In ICML, 2021.
349
+ [43] Amir Beck. First-order methods in optimization. SIAM, 2017.
350
+ [44] Yurii E Nesterov. A method for solving the convex programming problem with convergence rate o $( 1 / \mathrm { k } ^ { \sim } 2 )$ . In Dokl. akad. nauk Sssr, volume 269, pages 543–547, 1983.
351
+ [45] Amir Beck and Marc Teboulle. A fast iterative shrinkage-thresholding algorithm for linear inverse problems. 2009.
352
+ [46] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
353
+ [47] Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In NeurIPS, 2016.
354
+ [48] Jake Snell, Kevin Swersky, and Richard S Zemel. Prototypical networks for few-shot learning. arXiv:1703.05175, 2017.
355
+ [49] Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip HS Torr, and Timothy M Hospedales. Learning to compare: Relation network for few-shot learning. In CVPR, 2018.
356
+ [50] Mengye Ren, Eleni Triantafillou, Sachin Ravi, Jake Snell, Kevin Swersky, Joshua B Tenenbaum, Hugo Larochelle, and Richard S Zemel. Meta-learning for semi-supervised few-shot classification. arXiv:1803.00676, 2018.
357
+ [51] Boris N Oreshkin, Pau Rodriguez, and Alexandre Lacoste. Tadam: Task dependent adaptive metric for improved few-shot learning. arXiv:1805.10123, 2018.
358
+ [52] Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv:1708.07747, 2017.
359
+
360
+ # Checklist
361
+
362
+ 1. For all authors...
363
+
364
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] Please refer to Section 1.1 for detailed description corresponding to the abstract.
365
+ (b) Did you describe the limitations of your work? [No]
366
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A]
367
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
368
+
369
+ 2. If you are including theoretical results...
370
+
371
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] Please refer to Section 3.
372
+ (b) Did you include complete proofs of all theoretical results? [Yes] We put most of the detailed calculation process in the supplementary materials.
373
+
374
+ 3. If you ran experiments...
375
+
376
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Instruction for the code, datasets are provided in the supplemental material.
377
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Information about the dataset and hyperparameters for numerical experiments can be found in the supplemental material.
378
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
379
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We specify the detailed configuration of computing devices, GPUs in the supplementary materials.
380
+
381
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
382
+
383
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
384
+ (b) Did you mention the license of the assets? [Yes]
385
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
386
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
387
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] We conduct all the experiments based on public data.
388
+
389
+ 5. If you used crowdsourcing or conducted research with human subjects...
390
+
391
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
392
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
393
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/bajTv_cvkI/bajTv_cvkI.md ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Exploiting Domain-Specific Features to Enhance Domain Generalization
2
+
3
+ Manh-Ha Bui1 Toan Tran1 Anh Tuan Tran1 Dinh Phung1,2 1 VinAI Research, Vietnam 2 Monash University, Australia {v.habm1, v.toantm3, v.anhtt152, v.dinhpq2}@vinai.io ∗
4
+
5
+ # Abstract
6
+
7
+ Domain Generalization (DG) aims to train a model, from multiple observed source domains, in order to perform well on unseen target domains. To obtain the generalization capability, prior DG approaches have focused on extracting domaininvariant information across sources to generalize on target domains, while useful domain-specific information which strongly correlates with labels in individual domains and the generalization to target domains is usually ignored. In this paper, we propose meta-Domain Specific-Domain Invariant (mDSDI) - a novel theoretically sound framework that extends beyond the invariance view to further capture the usefulness of domain-specific information. Our key insight is to disentangle features in the latent space while jointly learning both domain-invariant and domainspecific features in a unified framework. The domain-specific representation is optimized through the meta-learning framework to adapt from source domains, targeting a robust generalization on unseen domains. We empirically show that mDSDI provides competitive results with state-of-the-art techniques in DG. A further ablation study with our generated dataset, Background-Colored-MNIST, confirms the hypothesis that domain-specific is essential, leading to better results when compared with only using domain-invariant.
8
+
9
+ # 1 Introduction and Related work
10
+
11
+ Domain Generalization (DG) has recently become an important research topic in machine learning due to its real-world applicability and its close connection to the way humans generalize to learn in a new domain. In a DG framework, the learner is trained on multiple datasets collected under different environments without any access to any data on the target domain (1). One of the most notable approaches to this problem is to learn the “domain-invariant” features across these training datasets, with the assumption that these invariant representations are also held in unseen target domains (2; 3; 4; 5; 6). While this has been shown to work well in practice, its key drawback is completely ignoring “domain-specific” information that could aid the generalization performance, especially when the number of source domains increases (7).
12
+
13
+ For instance, consider the problem of classifying dog or fish images from two source domains: sketch and photo. While the sketch contains a conceptual drawing of the animal, the photo includes their taken picture within a background. In this case, sketch domain-invariant is kept across domains, while domain-specific, e.g., a dog in a house or fish in the ocean, will be discarded due to only existing in the photo domain. However, this background information, when present, could lead to an improvement of the classification performance in target domains due to common association between the objects of its background, and when negligent sketches are hard to distinguish. From a theoretical standpoint, there has also been strong recent evidence to indicate the insufficiency of learning domaininvariant representation for successful adaptation in domain adaptation problems (8; 9). For example,
14
+
15
+ Zhao et al. (8) has pointed out the degradation in target predictive performance if domain-invariant representations are forced while the marginal label distributions on the source and target domains are overly different.
16
+
17
+ Utilizing domain-specific features in DG has been widely studied in recent works (e.g., (10; 7)). Ding and Fu (10) introduce multiple domain-specific networks for each domain, then use the structured low-rank constraints to align them with domain-invariant. While this encourages the better transfer of knowledge, its main problem is the requirement of too many domain-specific networks. More recently, Chattopadhyay et al. (7) proposed a masking strategy to disentangle domain-invariant and domain-specific to further boost domain-specific learning, but its key drawback is that domaininvariant/domain-specific representations might not be disentangled since the learning and inferring procedures are performed implicitly (i.e., without any theoretical guarantee) through a mask generalization process. That means it lacks a clear motivation as well as theoretical justifications.
18
+
19
+ Regarding meta-learning related work, a typical approach involving meta-learning in DG is MLDG (11) that is based on gradient update which simulates train/test domain shift within each mini-batch, mainly to learn transferable weight representations from meta-source domains to quickly adapt to the meta-target domain, and so improve generalization ability. However, their task objective adapts for all representation features which include domain-invariant, since low effectiveness because domain-invariant is stable across domains, pushing to adapt those features might affect the stability of those domain-invariant, leading to a lower generalization performance on the target domain.
20
+
21
+ To handle these domain-invariant shortcomings, in this paper, we propose a novel theoretically sound DG approach that aims to extract label-informative domain-specific and then explicitly disentangles the domain-invariant and domain-specific representations in an efficient way without training multiple networks for domain-specific. Following the meta-learning idea and mitigating previous work’s drawbacks, we apply a meta-learning technique specifically to exploit domain-specific quality which should need to be adapted to unseen domains from source domains. Our contributions in this work are summarized as follows:
22
+
23
+ • We provide a theoretical analysis based on the information bottleneck principle to point out the limitation of only learning invariant and the importance of domain-specific representation by a certainly plausible assumption.
24
+ • We then develop a rigorous framework to formulate elements of domain-invariant/domainspecific representations, in which our key insight is to introduce an effective metaoptimization training framework (11) to learn domain-specific representation from multiple training domains. Without accessing any data from unseen target domains, the meta-training procedure provides a suitable mechanism to self-learn domain-specific representation. We term our approach meta-Domain Specific-Domain Invariant (mDSDI) and provide necessary theoretical verifications for it.
25
+ • To demonstrate the merit of the proposed mDSDI framework, we extensively evaluate mDSDI on several state-of-the-art DG benchmark datasets, including Colored-MNIST, Rotated-MNIST, VLCS, PACS, Office-Home, Terra Incognita, DomainNet in addition to our newly created Background-Colored-MNIST for the ablation study to examine the behavior of our mDSDI.
26
+
27
+ # 2 Methodology
28
+
29
+ # 2.1 Problem setting and Definitions
30
+
31
+ Let $\boldsymbol { \mathcal { X } } \subset \mathbb { R } ^ { D }$ be the sample space and $\mathcal { V } \subset \mathbb { R }$ the label space. Denote the set of joint probability distributions on $\mathcal { X } \times \mathcal { V }$ by $\mathcal { P } _ { \mathcal { X } \times \mathcal { Y } }$ , and the set of probability marginal distributions on $\mathcal { X }$ by $\mathcal { P } _ { \mathcal { X } }$ . A domain is defined by a joint distribution $P ( x , y ) \in \mathcal P _ { \mathcal { X } \times \mathcal { Y } }$ , and let $\mathcal { P }$ be a measure on $\mathcal { P } _ { \mathcal { X } \times \mathcal { Y } }$ , i.e., whose realizations are distributions on $\mathcal { X } \times \mathcal { V }$ .
32
+
33
+ Denote $N$ source domains by $S ^ { ( i ) } = \{ ( x _ { j } ^ { ( i ) } , y _ { j } ^ { ( i ) } ) \} _ { j = 1 } ^ { n _ { i } }$ , $i = 1 , \ldots , N$ , where $n _ { i }$ is the number of data points in $S ^ { ( i ) }$ , i.e., $( x _ { j } ^ { ( i ) } , y _ { j } ^ { ( i ) } ) \stackrel { i i d } { \sim } P ^ { ( i ) } ( x , y )$ where $P ^ { ( i ) } ( x , y ) \sim \mathcal { P }$ ; and $x _ { j } ^ { ( i ) } \sim P _ { \mathcal { X } } ^ { ( i ) }$ , in which $P _ { \mathcal { X } } ^ { ( i ) } \sim P _ { \mathcal { X } }$ . In a typical DG framework, a learning model which is only trained on the set of source domains $\{ S ^ { ( i ) } \} _ { i = 1 } ^ { N }$ without any access to the (unlabeled) data points in the target domain, arrives at a good generalization performance on the test dataset $S ^ { T } = \{ ( x _ { j } ^ { T } , y _ { j } ^ { T } ) \} _ { j = 1 } ^ { n _ { T } }$ , where $( x _ { j } ^ { T } , y _ { j } ^ { T } ) \overset { i i d } { \sim } P ^ { T } ( x , y )$ and $P ^ { T } ( x , y ) \sim \mathcal { P }$ .
34
+
35
+ First, we present the definition of domain-invariant representation in a latent space $\mathcal { Z }$ under covariate shift assumption (i.e., the conditional distribution $P ( \boldsymbol { y } | \boldsymbol { x } )$ is unchanged across the source domains):
36
+
37
+ Definition 1. A feature extraction mapping $Q : \mathcal { X } \mathcal { Z }$ is said to be domain-invariant if the distribution $P _ { Q } ( Q ( X ) )$ is unchanged across the source domains, i.e., $\forall i , j = 1 , \ldots , N , i \neq j w e$ have $P _ { Q } ^ { ( i ) } ( Q ( X ) ) \equiv P _ { Q } ^ { ( j ) } ( Q ( X ) )$ , where $P _ { Q } ^ { ( i ) } ( Q ( X ) ) = P _ { Q } ( Q ( X ) | X \sim P _ { \ X } ^ { ( i ) } )$ , $i = 1 , \ldots , N .$ . In this case, the corresponding latent representation $Z _ { I } = Q ( X )$ is then called the domain-invariant representation (see (3) also).
38
+
39
+ As mentioned in the example in the introduction part, the definition 1 reveals that the extracted domain-invariant latent $Z _ { I }$ could be the conceptual drawing of the animal which is shared in both sketch and photo domains. However, when existing background information is taken by a picture such as a house or ocean, it is crucial to take these backgrounds into account because the domain-invariant feature extraction $Q$ might ignore them by only existing in the photo domain. Therefore, we next introduce the definition of domain-specific in latent space as follows:
40
+
41
+ Definition 2. A feature extraction mapping $R : \mathcal { X } \mathcal { Z }$ is said to be domain-specific $i f \ \forall i , j =$ $1 , \dots , N , \ i \ \neq \ j$ such that $P _ { R } ^ { ( i ) } ( R ( X ) ) \neq P _ { R } ^ { ( j ) } ( R ( X ) )$ , where $P _ { R } ^ { ( i ) } ( R ( X ) ) = P _ { R } ( R ( X ) | X \sim$ $P _ { \mathcal { X } } ^ { ( i ) } )$ ), $i = 1 , \ldots , N$ . In this case, given $X \sim P _ { \mathcal { X } } ^ { ( i ) }$ the corresponding latent representation $Z _ { S } ^ { ( i ) } = $ $R ( X )$ is then called the domain-specific representation w.r.t. the domain .
42
+
43
+ Definition 2 states that for any domain $i$ and $j$ , the distributions of the domain-specific latent $P _ { R } ^ { ( i ) } ( R ( X ) )$ and ven t $P _ { R } ^ { ( j ) } ( R ( X ) )$ must bes from comand letely different. For instance, following our menthat are sketch and photo domain, the mapping $i$ $j$ $R ( X )$ should extract specific information that only belongs to the domain including the shadow of the fish drawing in the sketch and ocean background information in the photo domain.
44
+
45
+ To this end, this paper aims to show that only learning domain-invariant will limit the prediction performance and generalization ability. Hence, we next provide a formal explanation for the motivation of learning domain-specific, by showing the potential drawback of only learning domain-invariance in terms of predicting class labels.
46
+
47
+ ![](images/3edf5c6eda874cebbcf7af6b99450ae6f38b1d6ec3646b7fb1831c1c5f553958.jpg)
48
+ 2.2 A theoretical analysis under the Information bottleneck method
49
+ Figure 1: Venn diagram showing relationships between source domains represented by $X ^ { 1 }$ , $X ^ { 2 }$ , target domain represented by $X ^ { T }$ , and label $Y$ . (a) The learning procedure of minimal and sufficient label-related representation in definition 3. (b) Explaining the theorem 1 where the domain-invariant based method provides an inferior prediction performance to our proposed method that incorporates both domain-invariant $I ( Z _ { I ^ { * } } ; Y )$ and labelrelated domain-specific values $\epsilon$ made by our assumption 1. (c) A case when the unseen (target) domain has different $X ^ { T }$ and $Y ^ { T }$ , while domain-invariant information is still stable across domains, some domain-specific in source domains become redundant information.
50
+
51
+ Notations. Given three arbitrary random variables $A , B$ , and $C$ , let us use $I ( A ; B )$ to represent mutual information between $A$ and $B$ ; $I ( A ; B | C )$ to represent conditional mutual information of $A$ and $B$ given $C$ ; $H ( A )$ to represent entropy of $A$ ; and $H ( A | B )$ to represent conditional entropy for random variables $A$ given $B$ . For simplicity, we consider the case with two source domains $S ^ { 1 } , S ^ { 2 }$ (the results with multiple source domains can be naturally extended from there). We also define two corresponding random variables $X ^ { i } \sim P _ { \mathcal { X } } ^ { ( i ) }$ , that are sampled from the marginal distribution $P _ { \mathcal { X } }$ in the domain $S ^ { i } , i = 1 , 2$ .
52
+
53
+ Figure 1 illustrates all the definitions and assumptions above used for our theoretical verification (in Theorem 1). In particular, in that figure, each of the four colored rectangles represents an individual entropy: $H ( X ^ { 1 } )$ for domain $S ^ { 1 }$ is in blue, $H ( X ^ { 2 } )$ for domain $S ^ { 2 }$ is in red, $\overset { \vartriangle } { \boldsymbol { H } } ( X ^ { T } )$ for the target domain is in black, and $H ( Y )$ for the class label is in green border rectangle.
54
+
55
+ We first show the ineffectiveness of only learning domain-invariant information when compared with incorporating domain-specific in source domain $S ^ { 1 }$ (and similarly with domain $S ^ { 2 }$ ). Our justification partly relies on the following assumption about the correlation between the domainspecific representation and the class label:
56
+
57
+ Assumption 1. (Label-correlated domain-specificity) Assuming that there exists a domain-specific representation $Z _ { S } ^ { ( 1 ) }$ extracted by the deterministic mapping $Z _ { S } ^ { ( 1 ) } = R ( X ^ { 1 } )$ in definition 2, which correlates with label in domain $S ^ { 1 }$ such that $I ( Z _ { S } ^ { ( 1 ) } ; Y | X ^ { 2 } ) = I ( X ^ { 1 } ; Y | X ^ { 2 } ) = \varepsilon _ { 1 }$ , where $\varepsilon _ { 1 } > 0$ is a constant.
58
+
59
+ Assumption 1 indicates that, for the source domain $S ^ { 1 }$ , we can learn $Z _ { S } ^ { ( 1 ) } = R ( X ^ { 1 } )$ such that $I ( Z _ { S } ^ { ( 1 ) } ; Y | X ^ { 2 } )$ is strictly positive and equals to $I ( X ^ { 1 } ; Y | X ^ { 2 } )$ , where $I ( X ^ { 1 } ; Y | X ^ { 2 } )$ is the specific information that correlates with the label in the domain $S ^ { 1 }$ , but not in the domain $S ^ { 2 }$ (12). For instance, in the example mentioned in the introduction, if domain $S ^ { 1 }$ is “photo” while $S ^ { 2 }$ is “sketch”, the value of $\epsilon _ { 1 }$ should be positive because the background information such as a house, the ocean also provides information to predict whether the object is a dog or fish without considering its conceptual drawing. This assumption is particularly valid and practically plausible and is demonstrated by several examples observed in our experiments. For instance, for the DomainNet benchmark dataset, in the real-world domain, many bed pictures contain a bed in the room or bike pictures that have bicycles parked on the street. Other examples are in PACS such as dogs in the yard or guitars lying on a table in photo and art domains. These examples are strongly related to assumption 1, in which specific information correlates with labels in a particular domain.
60
+
61
+ We next present supervised learning frameworks under the umbrella of the information theory (13; 14) and the information bottleneck method (13; 15) that generalizes minimal sufficient statistics to the minimal (i.e., less complexity) and sufficient (i.e, better fidelity) representations. The learning process of such representations is equivalent to solving the following objectives:
62
+
63
+ Definition 3. (Minimal and sufficient representations with label $( l 4 ) ,$ ). Let $Z _ { X ^ { 1 } } = G ( X ^ { 1 } )$ is the output of a deterministic latent mapping $G$ . A representation $Z _ { s u p }$ is said to be the sufficient label-related representation and $Z _ { \mathrm { s u p } ^ { * } }$ is said to be the minimal and sufficient representation $i f$ :
64
+
65
+ $$
66
+ Z _ { s u p } = \mathop { \mathrm { a r g m a x } } _ { G } I ( Z _ { X ^ { 1 } } ; Y ) ~ a n d ~ Z _ { \mathrm { s u p } ^ { * } } = \mathop { \mathrm { a r g m i n } } _ { Z _ { \mathrm { s u p } } } I ( Z _ { \mathrm { s u p } } ; X ^ { 1 } ) ~ s . t . ~ I ( Z _ { \mathrm { s u p } } ; Y )
67
+ $$
68
+
69
+ The learning procedure for definition 3 is illustrated in Figure 1: (a). The method is equivalent to employ compressed representations to reduce the complexity (redundant information) of ${ \bar { I } } ( Z _ { X ^ { 1 } } ; X ^ { 1 } )$ by minimizing and providing sufficient representation to class label $Y$ by maximizing $I ( Z _ { X ^ { 1 } } ; Y )$ . Similarly and motivated by multi-view information bottleneck settings (16), we present the objective of learning sufficient (and minimal) representations with domain-invariant information in the below definition:
70
+
71
+ Definition 4. (Minimal and sufficient representations with domain-invariance $( I 6 )$ ). Let $Z _ { X ^ { 1 } } =$ $Q ( X ^ { 1 } )$ is the output of a deterministic domain invariant mapping $Q$ in the definition $^ { l }$ . Then $Z _ { I }$ is said to be the sufficient domain-invariant representation and $Z _ { I ^ { * } }$ is said to be the minimal and sufficient representation $i f$ :
72
+
73
+ $$
74
+ Z _ { I } = \underset { Q } { \operatorname { a r g m a x } } I ( Z _ { X ^ { 1 } } ; X ^ { 2 } ) \mathrm { ~ } a n d ~ Z _ { I ^ { * } } = \underset { Z _ { I } } { \operatorname { a r g m i n } } I ( Z _ { I } ; X ^ { 1 } ) \mathrm { ~ } s . t . \mathrm { ~ } I ( Z _ { I } ; X ^ { 2 } ) \mathrm { ~ } i s \mathrm { ~ } m a ^ { \dag }
75
+ $$
76
+
77
+ Definition 4 introduces a learning strategy for domain-invariance across domains (or views) that preserves shared information across two domains by maximizing $I ( Z _ { X ^ { 1 } } ; X ^ { 2 } )$ ; and also reduces specificity (redundant information) of the domain $S ^ { 1 }$ by minimizing $I ( Z _ { X ^ { 1 } } ; X ^ { 1 } )$ . We next present a lemma about the conditional independence between the latent representation $Z _ { X ^ { 1 } }$ and both the label $Y$ and the random variable $X ^ { 2 }$ when $Q , R ,$ , and $G$ are deterministic functions of the random variable $X ^ { 1 }$ :
78
+
79
+ Lemma 1. (Determinism $( l 4 ) ,$ ) If $P ( Z _ { X ^ { 1 } } | X ^ { 1 } )$ is a Dirac delta function, then the following conditional independence holds: $Y$ ⊥⊥ $Z _ { X ^ { 1 } } | X ^ { 1 }$ and $X ^ { 2 }$ ⊥⊥ $Z _ { X ^ { 1 } } | X ^ { 1 }$ , inducing a Markov chain $X ^ { 2 } Y \mathbf { \bar { } } X ^ { 1 } Z _ { X ^ { 1 } }$ .
80
+
81
+ The proof of Lemma 1 is provided in Appendix A.1.
82
+
83
+ Lemma 1 simply states that $Z _ { X ^ { 1 } }$ contains no more information than $X ^ { 1 }$ . Now, we show the ineffectiveness of only learning domain-invariant approach, based on the existence of the label-related domain-specific in the following theorem:
84
+
85
+ Theorem 1. (Label-related information with domain-specificity) Assuming that there exists a domainspecific value $\varepsilon _ { 1 } > 0$ in domain $S ^ { 1 }$ (see Assumption $I$ ), the label-related representation - based learning approach (i.e., using $Z _ { s u p }$ and $Z _ { s u p ^ { * } }$ ) provides better prediction performance than the domain-invariant representation - based method (i.e., using $Z _ { I }$ and $Z _ { I ^ { * } }$ ). Formally,
86
+
87
+ $$
88
+ I ( X ^ { 1 } ; Y ) = I ( Z _ { s u p } ; Y ) = I ( Z _ { s u p ^ { * } } ; Y ) = I ( Z _ { I ^ { * } } ; Y ) + \varepsilon _ { 1 } > I ( Z _ { I ^ { * } } ; Y ) .
89
+ $$
90
+
91
+ The proof of Theorem 1 is mainly based on the result of Lemma 1, and is provided in Appendix A.2.
92
+
93
+ The visualization of Theorem 1 is depicted by Figure 1: (b), where the domain-specific value for domain $S ^ { 2 }$ , $\varepsilon _ { 2 }$ is obtained in the same way as $\varepsilon _ { 1 }$ . It indicates that if an existing domain-specific representation has the positive corresponding information value $\varepsilon$ , the domain-invariance-based learning method provides an inferior prediction performance to our proposed method that incorporates both domain-invariant and label-related domain-specific.
94
+
95
+ Now, Theorem 1 suggests that besides optimizing a domain-invariant mapping $Q$ as usual, we should jointly optimize domain-specific mapping $R$ to achieve a better generalization performance. However, in domain generalization, we are not allowed to access the target domain for training and must use $Q$ and $R$ from source domains. As pointed out in (10; 17; 7), although domain-invariant might be the same because it is unchanged across source domains, there is no guarantee whether this domain-specific information on the source domain is relevant to the target domain while making the prediction. Figure 1: (c) illustrates this case when the target domain has different $X ^ { T }$ and $Y ^ { T }$ , then some extracted domain-specific from source domains become redundant information. Therefore, the next raising question is how to learn domain-invariant and domain-specific effectively.
96
+
97
+ To handle these shortcomings, we next propose a unified framework that jointly optimizes both $Q$ and $R$ by disentangling their feature representation. In particular, the deterministic mapping $Q$ is optimized by adversarial learning to extract useful domain-invariant features across domains. Meanwhile, by leveraging the transfer weight representations from meta-source domains to adapt to a meta-target domain, we apply meta-learning to deterministic mapping $R$ to force it to extract relevant domain-specific features of the target domain to improve generalization ability.
98
+
99
+ # 2.3 Algorithm: meta-Domain Specific-Domain Invariant (mDSDI)
100
+
101
+ So far, we have discussed the main ideas of our proposed method. Here we discuss implementation details for our proposed mDSDI approach.
102
+
103
+ Figure 2 shows the graphical model and overview of our mDSDI framework. In particular, our unified network consists of the following components: a domain-invariant representation $Z _ { I } = Q _ { \theta _ { Q } } ( X )$ ; a domain-specific representation $Z _ { S } = R _ { \theta _ { R } } ( X )$ ; a domain discriminator $D _ { \theta _ { D _ { I } } } : Z _ { I } \to \overline { { { 1 , N } } }$ ; a domain classifier $D _ { \theta _ { D _ { S } } } : Z _ { S } \overline { { { 1 , N } } }$ and a classifier $F _ { \theta _ { F } } : Z _ { I } \oplus Z _ { S } \to \mathcal { V } .$ . We also denote domain random variable by $D$ , sample space by $\mathcal { D }$ , and outcome by $d$ .
104
+
105
+ Domain-Invariant and Domain-Specific Extraction. The domain-invariant representation $Z _ { I }$ defined in Definition 1, is obtained by using an adversarial training framework (3), in which the domain discriminator $D _ { \theta _ { D _ { I } } }$ tries to maximize the prediction probability of the domain label from the latent $Z _ { I }$ I, while the goal of the encoder $Q _ { \theta _ { Q } }$ is to map the sample $X$ to the latent $Z _ { I }$ , such that $D _ { \theta _ { D _ { I } } }$ cannot discriminate the domain of $X$ . This task can be performed by solving the following min-max game:
106
+
107
+ $$
108
+ \operatorname* { m i n } _ { \theta _ { Q } } \operatorname* { m a x } _ { \theta _ { D _ { I } } } \left\{ L _ { Z _ { I } } : = - \mathbb { E } _ { x , d \sim X , D } \left[ d \log D _ { I } ( Q ( x ) ) \right] \right\} .
109
+ $$
110
+
111
+ To extract the domain-specific $Z _ { S }$ defined in Definition 2, we propose the use of the domain classifier $D _ { \theta _ { D _ { S } } }$ , that is trained to predict the domain label from $Z _ { S }$ . The corresponding parameters $\theta _ { D _ { S } }$ and
112
+
113
+ ![](images/2fb1d00477803a4293ca60c05c0e62a26e208e119e7c3924bd0a57369cfabaad.jpg)
114
+ Figure 2: The graphical model (a) and overall architecture (b) for our proposed mDSDI, including: domaininvariant $Z _ { I }$ is optimized via adversarial training with domain discriminator $D _ { I }$ , domain-specific $Z _ { S }$ is optimized via domain classifier $D _ { S }$ , these latent $Z _ { I }$ and $\bar { Z } _ { S }$ are disentangled by using covariance matrix. To push them to contain label information, these latents are integrated into a classifier $F$ which is optimized via cross-entropy with the label $Y$ . To make the model able to adapt specific information from source to unseen domain while still remaining domain-invariance information across domains, we additionally push $Z _ { S }$ through a meta-learning procedure.
115
+
116
+ $\theta _ { R }$ are, therefore, optimized with the objective function below:
117
+
118
+ $$
119
+ \operatorname* { m i n } _ { \theta _ { D _ { S } } , \theta _ { R } } \left\{ L _ { Z _ { S } } : = - \mathbb { E } _ { x , d \sim X , D } \left[ d \log D _ { S } ( R ( x ) ) \right] \right\} .
120
+ $$
121
+
122
+ Disentanglement between Domain-Invariant and Domain-Specific. The disentanglement condition between two random vectors $Z _ { I }$ and $Z _ { S }$ can be solved by forcing their covariance matrix, denoted by $\mathrm { C o v } ( Z _ { I } , Z _ { S } )$ close to 0. A detailed discussion of disentangled two representations is provided in Appendix B.3. The related parameters $( \theta _ { Q } , \theta _ { R } )$ are then updated in the following optimization problem:
123
+
124
+ $$
125
+ \operatorname* { m i n } _ { \theta _ { Q } , \theta _ { R } } \left\{ L _ { D } : = \mathbb { E } _ { x \sim X } \left[ \| \mathrm { C o v } ( Q ( x ) , R ( x ) ) \| _ { 2 } \right] \right\} ,
126
+ $$
127
+
128
+ where $\| \cdot \| _ { 2 }$ is the $L _ { 2 }$ norm.
129
+
130
+ Sufficiency of domain-specific and domain-invariant w.r.t. the classification task. The goal of the classifier $F$ parameterized by $\theta _ { F }$ is to predict the label of the original sample $X$ based on the domain-invariant $Z _ { I }$ and domain-specific $Z _ { S }$ , i.e.,
131
+
132
+ $$
133
+ \hat { Y } = F _ { \theta _ { F } } ( Z _ { I } \oplus Z _ { S } ) ,
134
+ $$
135
+
136
+ where $\oplus$ denotes the concatenation operation. Then, the training process of $F$ is then performed by solving
137
+
138
+ $$
139
+ \operatorname* { m i n } _ { \theta _ { Q } , \theta _ { R } , \theta _ { F } } \left\{ L _ { T } : = - \mathbb { E } _ { x , y \sim X , Y } \left[ y \log F ( Q ( x ) , R ( x ) ) \right] \right\} .
140
+ $$
141
+
142
+ Meta-Training for Domain-Specific Information. To encourage the domain-specific representation $Z _ { S }$ to adapt information learned from the source domains to the unseen target domain, we introduce the use of meta-learning framework (11), targeting a robust generalization. Note that the domaininvariant feature $Z _ { I }$ remains during the meta-learning procedure. In particular, each source domain $S _ { m } , \ m \in \overline { { 1 , N } }$ is split into two sub-domains, namely meta-train $S _ { m r }$ and meta-test $S _ { m e }$ . The domain-specific parameters $\theta _ { R }$ and the classifier parameters $\theta _ { F }$ are then jointly optimized as follows:
143
+
144
+ $$
145
+ \operatorname* { m i n } _ { w } \left\{ L _ { T _ { m } } : = f \left( w - \nabla f \left( w , S _ { m r } \right) , S _ { m e } \right) \right\} ,
146
+ $$
147
+
148
+ where $w = ( \theta _ { R } , \theta _ { F } )$ and
149
+
150
+ $$
151
+ f \left( \boldsymbol { w } , \boldsymbol { S _ { m } } \right) = - \mathbb { E } _ { \boldsymbol { x } , \boldsymbol { y } \sim \boldsymbol { X } , \boldsymbol { Y } } \left[ \boldsymbol { y } \log \boldsymbol { F } ( \boldsymbol { Z } _ { I } , \boldsymbol { R } ( \boldsymbol { x } ) ) \right] .
152
+ $$
153
+
154
+ Training and Inference. The pseudo-code for training and inference processes of our proposed mDSDI framework is presented in Algorithm 1. Each iteration of the training process consists of two steps:
155
+
156
+ i) First, we integrate the objective functions (1), (2), (3) and (5) to construct an objective function $L _ { A }$ defined as follows:
157
+
158
+ $$
159
+ \operatorname* { m i n } _ { \theta _ { Q } , \theta _ { D _ { S } } , \theta _ { R } , \theta _ { F } } \operatorname* { m a x } _ { \theta _ { D _ { I } } } \left\{ L _ { A } : = \lambda _ { Z _ { I } } L _ { Z _ { I } } + \lambda _ { Z _ { S } } L _ { Z _ { S } } + \lambda _ { D } L _ { D } + L _ { T } \right\} ,
160
+ $$
161
+
162
+ where $\lambda _ { Z _ { I } } , \lambda _ { Z _ { S } }$ and $\lambda _ { D }$ are selected as the balanced parameters.
163
+
164
+ ii) The second step is to employ meta-training to adapt task-related domain-specific from source domains to unseen domains. In each mini-batch, the meta-train and meta-test are split, then the gradient transformation step from meta-train domains to the meta-test domain is performed by solving the optimization problem (6).
165
+
166
+ Algorithm 1: Training and Inference processes of mDSDI
167
+
168
+ Training Input: Source domain $S ^ { ( i ) }$ , encoder $Q _ { \theta _ { Q } }$ , $R _ { \theta _ { R } }$ , domain classifier $D _ { \theta _ { D _ { I } } }$ , $D _ { \theta _ { D _ { S } } }$ for $Z _ { I }$ ,
169
+ $Z _ { S }$ , task classifier $F _ { \theta _ { F } }$ , batch size $B$ , learning rate $\eta$ . Output: The optimal: $Q _ { \theta _ { Q } } ^ { * } , R _ { \theta _ { R } } ^ { * } , F _ { \theta _ { F } } ^ { * } ;$
170
+ for $i t e = 1 $ iterations do Sample $S _ { B }$ with a mini-batch $B$ for each domain $S ^ { ( i ) }$ ; Compute $L _ { A }$ using Eq. (8) and perform gradient update $\nabla _ { \theta _ { Q } , \theta _ { R } , \theta _ { D _ { I } } , \theta _ { D _ { S } } , \theta _ { F } } L _ { A }$ with $\eta$ .; for $j = 1 N$ (number of source domains) do Split Meta-train $S _ { B / j }$ , Meta-test $S _ { j }$ ; Meta-train: Perform gradient update $\nabla _ { { \boldsymbol { \theta } } _ { R } , { \boldsymbol { \theta } } _ { F } }$ by minimizing Eq. (7) with $S _ { B / j }$ and $\eta$ ; Meta-test: Compute $L _ { T _ { m } }$ using Eq. (6) with $S _ { j }$ and updated gradient from Meta-train; Meta-optimization: Perform gradient update $\dot { \nabla } _ { \theta _ { R } , \theta _ { F } } L _ { T _ { m } }$ with $\eta$ ; end
171
+ end
172
+ Inference Input: Target domain $S ^ { T }$ , optimal: $Q _ { \theta _ { Q } } ^ { * }$ , $R _ { \theta _ { R } } ^ { * }$ , $F _ { \theta _ { F } } ^ { * }$ . Output: $Y ^ { T }$ using Eq. (4);
173
+
174
+ # 3 Experiments
175
+
176
+ # 3.1 Experimental settings
177
+
178
+ Dataset. To evaluate the effectiveness of the proposed method, we utilize 7 commonly used datasets including: Colored-MNIST (18): includes 70000 samples of dimension (2, 28, 28) in binary classification problem with noisy label, from MNIST over 3 domains with noisy rate $d \in \{ 0 . 1 , 0 . 3$ , $0 . 9 \}$ , Rotated-MNIST (19): contains 70000 samples of dimension $( 1 , 2 8 , 2 8 )$ and 10 classes, rotated from MNIST over 6 domains $d \in \{ 0 , 1 5 , 3 0 , 4 5 , 6 0 , 7 5 \}$ , VLCS (20): includes 10729 samples of dimension $( 3 , 2 2 4 , 2 2 4 )$ and 5 classes, over 4 photographic domains $d \in \{ \mathrm { C a l t e c h } 1 0 1$ , LabelMe, SUN09, $\mathrm { V O C } 2 0 0 7 \}$ , PACS (2): contains 9991 images of dimension (3, 224, 224) and 7 classes, over 4 domains $d \in \{$ artpaint, cartoon, sketches, photo $\}$ , Office-Home (21): has 15500 daily images of dimension $( 3 , 2 2 4 , 2 2 4 )$ and 65 categories, over 4 domains $d \in \{ \mathrm { a r t } .$ , clipart, product, real $\}$ , Terra Incognita (22): includes 24778 wild photographs of dimension $( 3 , 2 2 4 , 2 2 4 )$ and 10 animals, over 4 camera-trap domains $d \in \{ \mathrm { L 1 0 0 , L 3 8 , L 4 3 , L 4 6 } \}$ , and DomainNet (23): contains 586575 images of dimension (3, 224, 224) and 345 classes, over 6 domains $d \in \{$ clipart, infograph, painting, quickdraw, real, sketch $\}$ . The detail of each dataset is provided in Appendix C.1.
179
+
180
+ Baseline. Following DomainBed (24) settings, we compare our model with 14 related methods in DG which are divided by 5 common techniques, including: Standard Empirical Risk Minimization: Empirical Risk Minimization (ERM (25)); domain-specific-learning: Group Distributionally Robust Optimization (GroupDRO (26)), Marginal Transfer Learning (MTL (1; 27)), Adaptive Risk Minimization (ARM (28)); Meta-learning: Meta-Learning for DG (MLDG (11)); domain-invariantlearning: Invariant Risk Minimization (IRM (18)), Deep CORrelation ALignment (CORAL (29)), Maximum Mean Discrepancy (MMD (30)), Domain Adversarial Neural Networks (DANN (31)), Class-conditional DANN (CDANN (32)), Risk Extrapolation (VREx (33)); Augmenting data: Interdomain Mixup (Mixup (34; 35; 36)), Style-Agnostic Networks (SagNets (37)), Representation Self Challenging (RSC (38)). The detail of each method is provided in Appendix C.2.
181
+
182
+ We use the training-domain validation set technique as proposed in DomainBed (24) for model selection. In particular, for all datasets, we first merge the raw training and validation, then, we run the test three times with three different seeds. For each random seed, we randomly split training and validation and choose the model maximizing the accuracy on the validation set, then compute performance on the given test sets. The mean and standard deviation of classification accuracy from these three runs are reported. We evaluate generalization performance based on backbones MNIST-ConvNet (24) for MNIST datasets and ResNet-50 (39) for non-MNIST datasets to compare with the mentioned methods. Data-processing techniques, model architectures, hyper-parameters, and changes of objective functions during training are presented in detail in Appendix C.3 C.5. All source code to reproduce results are available at https://github.com/VinAIResearch/mDSDI.
183
+
184
+ # 3.2 Results
185
+
186
+ Table 1: Classification accuracy $( \% )$ for all algorithms and datasets summarization. Our mDSDI method achieves highest accuracy on average when comparing 14 popular DG algorithms across 7 benchmark datasets.
187
+
188
+ <table><tr><td>Method</td><td>CMNIST</td><td>RMNIST</td><td>VLCS</td><td>PACS</td><td>OfficeHome</td><td>TerraInc</td><td>DomainNet</td><td>Average</td></tr><tr><td>ERM (25)</td><td>51.5±0.1</td><td>98.0±0.0</td><td>77.5±0.4</td><td>85.5±0.2</td><td>66.5±0.3</td><td>46.1±1.8</td><td>40.9±0.1</td><td>66.6</td></tr><tr><td>IRM (18)</td><td>52.0±0.1</td><td>97.7±0.1</td><td>78.5±0.5</td><td>83.5±0.8</td><td>64.3±2.2</td><td>47.6±0.8</td><td>33.9±2.8</td><td>65.4</td></tr><tr><td>GroupDRO (26)</td><td>52.1±0.0</td><td>98.0±0.0</td><td>76.7±0.6</td><td>84.4±0.8</td><td>66.0±0.7</td><td>43.2±1.1</td><td>33.3±0.2</td><td>64.8</td></tr><tr><td>Mixup (34; 35;36)</td><td>52.1±0.2</td><td>98.0±0.1</td><td>77.4±0.6</td><td>84.6±0.6</td><td>68.1±0.3</td><td>47.9±0.8</td><td>39.2±0.1</td><td>66.7</td></tr><tr><td>MLDG (11)</td><td>51.5±0.1</td><td>97.9±0.0</td><td>77.2±0.4</td><td>84.9±1.0</td><td>66.8±0.6</td><td>47.7±0.9</td><td>41.2±0.1</td><td>66.7</td></tr><tr><td>CORAL (29)</td><td>51.5±0.1</td><td>98.0±0.1</td><td>78.8±0.6</td><td>86.2±0.3</td><td>68.7±0.3</td><td>47.6±1.0</td><td>41.5±0.1</td><td>67.5</td></tr><tr><td>MMD (30)</td><td>51.5±0.2</td><td>97.9±0.0</td><td>77.5±0.9</td><td>84.6±0.5</td><td>66.3±0.1</td><td>42.2±1.6</td><td>23.4±9.5</td><td>63.3</td></tr><tr><td>DANN (31)</td><td>51.5±0.3</td><td>97.8±0.1</td><td>78.6±0.4</td><td>83.6±0.4</td><td>65.9±0.6</td><td>46.7±0.5</td><td>38.3±0.1</td><td>66.1</td></tr><tr><td>CDANN (32)</td><td>51.7±0.1</td><td>97.9±0.1</td><td>77.5±0.1</td><td>82.6±0.9</td><td>65.8±1.3</td><td>45.8±1.6</td><td>38.3±0.3</td><td>65.6</td></tr><tr><td>MTL (1; 27)</td><td>51.4±0.1</td><td>97.9±0.0</td><td>77.2±0.4</td><td>84.6±0.5</td><td>66.4±0.5</td><td>45.6±1.2</td><td>40.6±0.1</td><td>66.2</td></tr><tr><td>SagNets (37)</td><td>51.7±0.0</td><td>98.0±0.0</td><td>77.8±0.5</td><td>86.3±0.2</td><td>68.1±0.1</td><td>48.6±1.0</td><td>40.3±0.1</td><td>67.2</td></tr><tr><td>ARM (28)</td><td>56.2±0.2</td><td>98.2±0.1</td><td>77.6±0.3</td><td>85.1±0.4</td><td>64.8±0.3</td><td>45.5±0.3</td><td>35.5±0.2</td><td>66.1</td></tr><tr><td>VREx (33)</td><td>51.8±0.1</td><td>97.9±0.1</td><td>78.3±0.2</td><td>84.9±0.6</td><td>66.4±0.6</td><td>46.4±0.6</td><td>33.6±2.9</td><td>65.6</td></tr><tr><td>RSC (38)</td><td>51.7±0.2</td><td>97.6±0.1</td><td>77.1±0.5</td><td>85.2±0.9</td><td>65.5±0.9</td><td>46.6±1.0</td><td>38.9±0.5</td><td>66.1</td></tr><tr><td>mDSDI(Ours)</td><td>52.2±0.2</td><td>98.0±0.1</td><td>79.0±0.3</td><td>86.2±0.2</td><td>69.2±0.4</td><td>48.1±1.4</td><td>42.8±0.1</td><td>67.9</td></tr></table>
189
+
190
+ Table 1 summarizes the results of our experiments on 7 benchmark datasets when compared with mentioned methods. The full result per dataset and domain is provided in Appendix C.4. From these results, we draw three conclusions about our mDSDI model:
191
+
192
+ Our mDSDI still preserves domain-invariant information. We observe in some target domains which have background-less images and assume only contain domain-invariant information such as Colored-MNIST, Rotated-MNIST, or Terra Incognita (similar observation in cartoon or sketch in PACS, clip-art or product in OfficeHome, and quickdraw in DomainNet. Full results in Appendix C.4), our mDSDI model still achieves competitive results with other baselines (e.g., $5 2 . 2 \%$ in ColoredMNIST, $9 8 . 0 \%$ in Rotated-MNIST, and $4 8 . 1 \%$ in Terra Incognita) which are based on domaininvariant-learning techniques such as DANN, C-DANN, CORAL, MMD, IRM, and VREx. Those results demonstrate the effectiveness of our adversarial training technique for extracting domaininvariant features. Furthermore, due to considering disentangled domain-invariant and domainspecific latent, even in situations where the samples do not have domain-specific, our model still performs well by retaining informative domain-invariance.
193
+
194
+ Our mDSDI could capture the usefulness of domain-specific information. In contrast, we observe that in some target domains that have relevant domain-specific with source domains such as landscape background of the object class from photographic pictures in VLCS (similar observation in PACS such as dogs in the yard or guitars lying on a table in photo and art domain, bed in the room or bike parked on the street in the Art and Real-world domain of OfficeHome. Full results in Appendix C.4), mDSDI achieves significantly higher results than other methods (e.g., $7 9 . 0 \%$ in VLCS, $8 6 . 2 \%$ in PACS). This means that our domain-invariant features not only support generalization better but also our domain-specific ones cover helpful information in special scenarios such as backgrounds and colors related to objects in the classification task. Moreover, when comparing with other domain-specific based techniques such as GroupDRO, MTL, and ARM, the results showed that domain-specific features learned by meta-training from our model are more helpful than theirs and have captured useful domain-specific features from those object-background relations.
195
+
196
+ Extending beyond the invariance view to usefulness domain-specific information is important. As shown in Table 1, our mDSDI has the highest average number with $6 7 . 9 \%$ (highlighted with statistically significant according to a $t$ -test at a significance level $\alpha = 0 . 0 5$ ). The reason why our model outperforms other baselines could be explained by the fact that their domain-invariant methods are not able to capture domain-specific information, and so have poor performance. Meanwhile, when comparing with other domain-specific based methods, their models only concentrate on domainspecific techniques, and so provide inferior domain-invariant information to our techniques in some background-less images. In contrast, due to considering disentangled domain-invariant and domainspecific features, and having the right strategy to learn each latent, our model captures both this useful information, hence, outperforms their results. Not only has the highest average number, but our method also dominates other methods on a known large-scale dataset such as $6 9 . 2 \%$ in Office-Home or $4 2 . 8 \%$ in DomainNet. This implies that besides the essential combination between domain-invariant and domain-specific, when the number of datasets increases, our method can extract more relevant information for complex tasks, such as classifying 345 classes in DomainNet. These results also mean that our model has a balance between informative domain-invariant and domainspecific features to adapt better to different environments than others, therefore showing the highest average in all settings.
197
+
198
+ # 3.3 How does mDSDI work?
199
+
200
+ ![](images/fa9fdc3f39d19694c628748adf77167091b1d3b2559a70bb240ea60e48b62849.jpg)
201
+ Figure 3: Feature visualization for domain-invariant: (a): different colors represent different classes; (b): different colors indicate different domains. Feature visualization for domain-specific: (c): different colors represent different classes; (d): different colors indicate different domains. Source domain includes: art (red), cartoon (green), sketch (blue) while target domain is photo (black) in the domain plots. Best viewed in color (Zoom in for details).
202
+
203
+ To better understand our framework, we visualize the distribution of the learned features with tSNE (40) to analyze the feature space of domain-invariant and domain-specific. As shown in Figure 3 on PACS Dataset, our domain-invariant extractor can minimize the distance between the distribution of the domains (see Figure 3: (b)). However, these domain-invariant features still make mistakes on the classification task, indicated by a mixture of points from different class labels in the middle (see Figure 3: (a)), and many of these points are from the target domain (black color in the Figure 3: (b)). Meanwhile, the domain-specific representation better distinguishes points by class label (see Figure 3: (c)). More importantly, the photo domain’s specific features (black) are close to the art domain (red) (see Figure 3: (d)). This is reasonable because only these two domains include backgrounds related to the object class. It implies that meta-training in our model well learns specific features that can be adapted to the new unseen domain.
204
+
205
+ # 3.4 Ablation study: Important of mDSDI on the Background-Colored-MNIST dataset
206
+
207
+ This section examines our system design by checking its performance under different settings in the real scenario with our generated dataset (a similar experiment with PACS benchmark dataset is in Appendix C.6).
208
+
209
+ Background-Colored-MNIST dataset. Figure 4 illustrates our Background-Colored-MNIST, generated from the original MNIST. We assume the domain-invariant is the digit’s sketch and design the dataset so that the background color is domain-specific. As a result, on the unseen domain, domain-specific will be useful for the classification task. Specifically, the dataset includes three source domains $d _ { t r }$ , different by digit’s color red, green, blue , generated from a subset with 1000 training images for MNIST per each domain. In each source domain, the background color is the same for intra-class images but different across classes. In the target domain, 10000 testing images of MNIST are colored for one target domain $d _ { t e }$ with digit color $\left\{ \mathrm { o r a n g e } \right\}$ . In this domain, each class’s background color is similar to the same class’s background color in one of three source domains.
210
+
211
+ Importance of mDSDI. We aim to prove the combination of learning disentangled representation domain-specific, domain-invariant, and meta-training on domain-specific are important in this scenario. To do so, we compare our model under nine settings: learning domain-invariant only (DI), learning domain-specific only (DS), meta-training on domain-invariant (DI-Meta), meta-training on domain-specific (DS-Meta), a combination of domain-invariant and domain-specific without disentanglement loss $L _ { D }$ (DSDI-Without $L _ { D }$ ), a combination of domain-invariant and domain-specific without meta-training (DSDI-Without Meta), meta-training on both representation $Z _ { I }$ and $Z _ { S }$ (DSDIMeta), meta-training on domain-invariant without domain-specific (DSDI-Meta DI) and our proposed framework (mDSDI-Meta DS), which is meta-training on domain-specific without domain-invariant. Table 2 shows that our model is the best setting with $8 9 . 7 \%$ . It proves that combining domain-invariant and domain-specific is crucial by dominating the settings with only domain-invariant or domainspecific (DI, DI-Meta, DS, DS-Meta). Regarding disentangling two representations $Z _ { I }$ and $Z _ { S }$ , it is worth noting that without disentanglement loss $L _ { D }$ , the model only achieves $8 1 . 4 \%$ , which is lower than mDSDI. It reveals adding disentanglement loss $L _ { D }$ is essential to boost our model performance. Compared with meta-training on both, which only reaches $8 2 . 1 \%$ and on domain-invariant are $7 9 . 0 \%$ , it implies that meta-training is necessary but only for the domain-specific, and our arguments are reasonable. It also shows that our combination with domain-invariant and domain-specific is not easy: a deep ensemble between two neural networks, but existing a deep-down insight in our framework in DG, when compared with mDSDI-Without Meta which can be seen as a type of ensemble, is only around $8 0 . 4 \%$ .
212
+
213
+ ![](images/f6f4e395e2fdc76b3ae09c624dbf54bffba0a3cfc77dc72a48647677c428f3ba.jpg)
214
+ Figure 4: Background-Colored-MNIST Dataset, where source domains include $\{$ red, green, blue $\}$ digit colors and target domain has $\left\{ { \mathrm { o r a n g e } } \right\}$ color.
215
+
216
+ Table 2: Classification accuracy $( \% )$ on BackgroundColored-MNIST. Ablation study shows impact of domain-invariant when combined with meta-training on domain-specific in our method.
217
+
218
+ <table><tr><td>Method</td><td>Accuracy</td></tr><tr><td>DI</td><td>65.7±4.6</td></tr><tr><td>DI-Meta</td><td>63.6±5.1</td></tr><tr><td>DS</td><td>70.7±4.8</td></tr><tr><td>DS-Meta</td><td>75.3±3.4</td></tr><tr><td>DSDI-Without L D</td><td>81.4±2.6</td></tr><tr><td>DSDI-WithoutMeta</td><td>80.4±1.7</td></tr><tr><td>DSDI-Meta</td><td>82.1±1.4</td></tr><tr><td>DSDI-Meta DI</td><td>79.0±2.3</td></tr><tr><td>mDSDI-Meta DS (Ours)</td><td>89.7±0.8</td></tr></table>
219
+
220
+ # 4 Conclusion and Discussion
221
+
222
+ Despite being aware of the importance of domain-specific information, little investigation into the theory and a rigorous algorithm to explore its representation. To the best of our knowledge, our work provides the first theoretical analysis to understand and realize the efficiency of domain-specific information in domain generalization. The domain-specific contains unique characteristics and when combined with domain-invariant information can significantly aid performance on unseen domains. Following our theoretical insights based on the information bottleneck principle, we propose a mDSDI algorithm which disentangles these features. We next introduce the use of the meta-training scheme to support domain-specific to adapt information from source domains to unseen domains. Our experimental results demonstrate mDSDI brings out competitive results with related approaches in domain generalization. In addition, the ablation study with our Background-Colored-MNIST further illustrated and demonstrated the efficiency of combining domain-invariant and domain-specific via our proposed mDSDI. Our theoretical analysis and proposed mDSDI framework can facilitate fundamental progress in understanding the behavior of both domain-invariant and domain-specific representation in domain generalization.
223
+
224
+ Toward a robustness algorithm that can effectively learn both domain-invariant and domain-specific features, there are certainly many challenges that remain in our paper, for example, a theorem to explain when domain-specific may hurt performance in the unseen domain, a stronger connection between theory in implementation, a method to make two representations to be non-linearly independent as well as a lower computational cost of the covariance matrix. In the future, we plan to continue tackling these challenges to provide a better understanding and learning framework in domain generalization then extending to broader settings of transfer learning. A detailed clarification, discussion, and plausible methods in the future work are provided in Appendix B.
225
+
226
+ References
227
+ [1] Gilles Blanchard, Gyemin Lee, and Clayton Scott. Generalizing from several related classification tasks to a new unlabeled sample. In J. Shawe-Taylor, R. Zemel, P. Bartlett, F. Pereira, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems, volume 24, pages 2178–2186. Curran Associates, Inc., 2011.
228
+ [2] Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M Hospedales. Deeper, broader and artier domain generalization. In Proceedings of the IEEE international conference on computer vision, pages 5542–5550, 2017.
229
+ [3] Y. Li, X. Tian, M. Gong, Y. Liu, T. Liu, K. Zhang, and D. Tao. Deep domain generalization via conditional invariant adversarial networks. In ECCV, 2018.
230
+ [4] Shoubo Hu, Kun Zhang, Zhitang Chen, and Laiwan Chan. Domain generalization via multidomain discriminant analysis, 2019.
231
+ [5] Maximilian Ilse, Jakub M. Tomczak, Christos Louizos, and Max Welling. Diva: Domain invariant variational autoencoders, 2019.
232
+ [6] Ching-Yao Chuang, Antonio Torralba, and Stefanie Jegelka. Estimating generalization under distribution shifts via domain-invariant representations, 2020.
233
+ [7] Prithvijit Chattopadhyay, Yogesh Balaji, and Judy Hoffman. Learning to balance specificity and invariance for in and out of domain generalization, 2020.
234
+ [8] Han Zhao, Remi Tachet des Combes, Kun Zhang, and Geoffrey J. Gordon. On learning invariant representation for domain adaptation. CoRR, abs/1901.09453, 2019.
235
+ [9] Fredrik D. Johansson, David Sontag, and Rajesh Ranganath. Support and invertibility in domain-invariant representations, 2019.
236
+ [10] Z. Ding and Y. Fu. Deep domain generalization with structured low-rank constraint. IEEE Transactions on Image Processing, 27(1):304–313, 2018.
237
+ [11] Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M. Hospedales. Learning to generalize: Meta-learning for domain generalization, 2017.
238
+ [12] Naftali Tishby, Fernando C. Pereira, and William Bialek. The information bottleneck method. In Proc. of the 37-th Annual Allerton Conference on Communication, Control and Computing, pages 368–377, 1999.
239
+ [13] Naftali Tishby, Fernando C. Pereira, and William Bialek. The information bottleneck method. In Proc. of the 37-th Annual Allerton Conference on Communication, Control and Computing, pages 368–377, 1999.
240
+ [14] Yao-Hung Hubert Tsai, Yue Wu, Ruslan Salakhutdinov, and Louis-Philippe Morency. Selfsupervised learning from a multi-view perspective. In International Conference on Learning Representations, 2021.
241
+ [15] Alessandro Achille and Stefano Soatto. Emergence of invariance and disentanglement in deep representations, 2018.
242
+ [16] Marco Federici, Anjan Dutta, Patrick Forré, Nate Kushman, and Zeynep Akata. Learning robust representations via multi-view information bottleneck. CoRR, abs/2002.07017, 2020.
243
+ [17] Vihari Piratla, Praneeth Netrapalli, and Sunita Sarawagi. Efficient domain generalization via common-specific low-rank decomposition, 2020.
244
+ [18] Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization, 2020.
245
+ [19] Muhammad Ghifary, W. Bastiaan Kleijn, Mengjie Zhang, and David Balduzzi. Domain generalization for object recognition with multi-task autoencoders. CoRR, abs/1508.07680, 2015.
246
+ [20] Chen Fang, Ye Xu, and Daniel N. Rockmore. Unbiased metric learning: On the utilization of multiple datasets and web images for softening bias. In 2013 IEEE International Conference on Computer Vision, pages 1657–1664, 2013.
247
+ [21] Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation, 2017.
248
+ [22] Sara Beery, Grant Van Horn, and Pietro Perona. Recognition in terra incognita. CoRR, abs/1807.04975, 2018.
249
+ [23] Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, and Bo Wang. Moment matching for multi-source domain adaptation, 2019.
250
+ [24] Ishaan Gulrajani and David Lopez-Paz. In search of lost domain generalization. CoRR, abs/2007.01434, 2020.
251
+ [25] Vladimir N. Vapnik. Statistical Learning Theory. Wiley-Interscience, 1998.
252
+ [26] Shiori Sagawa, Pang Wei Koh, Tatsunori B. Hashimoto, and Percy Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization, 2020.
253
+ [27] Gilles Blanchard, Aniket Anand Deshmukh, Urun Dogan, Gyemin Lee, and Clayton Scott. Domain generalization by marginal transfer learning, 2021.
254
+ [28] Marvin Zhang, Henrik Marklund, Nikita Dhawan, Abhishek Gupta, Sergey Levine, and Chelsea Finn. Adaptive risk minimization: A meta-learning approach for tackling group distribution shift, 2021.
255
+ [29] Baochen Sun and Kate Saenko. Deep coral: Correlation alignment for deep domain adaptation, 2016.
256
+ [30] Haoliang Li, Sinno Jialin Pan, Shiqi Wang, and Alex C. Kot. Domain generalization with adversarial feature learning. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5400–5409, 2018.
257
+ [31] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks, 2016.
258
+ [32] Ya Li, Mingming Gong, Xinmei Tian, Tongliang Liu, and Dacheng Tao. Domain generalization via conditional invariant representation, 2018.
259
+ [33] David Krueger, Ethan Caballero, Joern-Henrik Jacobsen, Amy Zhang, Jonathan Binas, Dinghuai Zhang, Remi Le Priol, and Aaron Courville. Out-of-distribution generalization via risk extrapolation (rex), 2021.
260
+ [34] Minghao Xu, Jian Zhang, Bingbing Ni, Teng Li, Chengjie Wang, Qi Tian, and Wenjun Zhang. Adversarial domain adaptation with domain mixup, 2019.
261
+ [35] Shen Yan, Huan Song, Nanxiang Li, Lincan Zou, and Liu Ren. Improve unsupervised domain adaptation with mixup training, 2020.
262
+ [36] Yufei Wang, Haoliang Li, and Alex C. Kot. Heterogeneous domain generalization via domain mixup. ICASSP 2020 - 2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), May 2020.
263
+ [37] Hyeonseob Nam, HyunJae Lee, Jongchan Park, Wonjun Yoon, and Donggeun Yoo. Reducing domain gap by reducing style bias, 2021.
264
+ [38] Zeyi Huang, Haohan Wang, Eric P. Xing, and Dong Huang. Self-challenging improves crossdomain generalization, 2020.
265
+ [39] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015.
266
+ [40] Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(86):2579–2605, 2008.
267
+ [41] Thomas M. Cover and Joy A. Thomas. Elements of Information Theory (Wiley Series in Telecommunications and Signal Processing). Wiley-Interscience, USA, 2006.
268
+ [42] Arthur Gretton, Karsten M. Borgwardt, Malte J. Rasch, Bernhard Schölkopf, and Alexander Smola. A kernel two-sample test. Journal of Machine Learning Research, 13(25):723–773, 2012.
269
+ [43] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization, 2017.
270
+ [44] Seonguk Seo, Yumin Suh, Dongwan Kim, Jongwoo Han, and Bohyung Han. Learning to optimize domain specific normalization for domain generalization. CoRR, abs/1907.04275, 2019.
md/train/kR95DuwwXHZ/kR95DuwwXHZ.md ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DynamicViT: Efficient Vision Transformers with Dynamic Token Sparsification
2
+
3
+ Yongming Rao1 Wenliang Zhao1 Benlin Liu2,3 Jiwen $\mathbf { L u } ^ { 1 * }$ Jie Zhou1 Cho-Jui Hsieh2
4
+
5
+ 1 Tsinghua University 2 UCLA 3 University of Washington
6
+
7
+ # Abstract
8
+
9
+ Attention is sparse in vision transformers. We observe the final prediction in vision transformers is only based on a subset of most informative tokens, which is sufficient for accurate image recognition. Based on this observation, we propose a dynamic token sparsification framework to prune redundant tokens progressively and dynamically based on the input. Specifically, we devise a lightweight prediction module to estimate the importance score of each token given the current features. The module is added to different layers to prune redundant tokens hierarchically. To optimize the prediction module in an end-to-end manner, we propose an attention masking strategy to differentiably prune a token by blocking its interactions with other tokens. Benefiting from the nature of self-attention, the unstructured sparse tokens are still hardware friendly, which makes our framework easy to achieve actual speed-up. By hierarchically pruning $66 \%$ of the input tokens, our method greatly reduces $3 1 \% \sim 3 7 \%$ FLOPs and improves the throughput by over $40 \%$ while the drop of accuracy is within $0 . 5 \%$ for various vision transformers. Equipped with the dynamic token sparsification framework, DynamicViT models can achieve very competitive complexity/accuracy trade-offs compared to state-of-the-art CNNs and vision transformers on ImageNet. Code is available at https://github.com/ raoyongming/DynamicViT.
10
+
11
+ # 1 Introduction
12
+
13
+ These years have witnessed the great progress in computer vision brought by the evolution of CNNtype architectures [12, 18]. Some recent works start to replace CNN by using transformer for many vision tasks, like object detection [36, 20] and classification [25]. Just like what has been done to the CNN-type architectures in the past few years, it is also desirable to accelerate the transformer-like models to make them more suitable for real-time applications.
14
+
15
+ One common practice for the acceleration of CNN-type networks is to prune the filters that are of less importance. The way input is processed by the vision transformer and its variants, i.e. splitting the input image into multiple independent patches, provides us another orthogonal way to introduce the sparsity for the acceleration. That is, we can prune the tokens of less importance in the input instance, given the fact that many tokens contribute very little to the final prediction. This is only possible for the transformer-like models where the self-attention module can take the token sequence of variable length as input, and the unstructured pruned input will not affect the self-attention module, while dropping a certain part of the pixels can not really accelerate the convolution operation since the unstructured neighborhood used by convolution would make it difficult to accelerate through parallel computing. Since the hierarchical architecture of CNNs with structural downsampling has improved model efficiency in various vision tasks, we hope to explore the unstructured and data-dependent downsampling strategy for vision transformers to further leverage the advantages of self-attention (our experiments also show unstructured sparsification can lead to better performance for vision transformers compared to structural downsampling). The basic idea of our method is illustrated in Figure 1.
16
+
17
+ ![](images/d4271a07b0ae3b36791a37a66e78570f014f99e6cd4733f82c9e1ff2750057fc.jpg)
18
+ (c) Attention Visualization
19
+ Figure 1: Illustration of our main idea. CNN models usually leverage the structural downsampling strategy to build hierarchical architectures as shown in (a). unstructured and data-dependent downsampling method in (b) can better exploit the sparsity in the input data. Thanks to the nature of the self-attention operation, the unstructured token set is also easy to accelerate through parallel computing. (c) visualizes the impact of each spatial location on the final prediction in the DeiT-S model [25] using the visualization method proposed in [3]. These results demonstrate the final prediction in vision transformers is only based on a subset of most informative tokens, which suggests a large proportion of tokens can be removed without hurting the performance.
20
+
21
+ In this work, we propose to employ a lightweight prediction module to determine which tokens to be pruned in a dynamic way, dubbed as DynamicViT. In particular, for each input instance, the prediction module produces a customized binary decision mask to decide which tokens are uninformative and need to be abandoned. This module is added to multiple layers of the vision transformer, such that the sparsification can be performed in a hierarchical way as we gradually increase the amount of pruned tokens after each prediction module. Once a token is pruned after a certain layer, it will not be ever used in the feed-forward procedure. The additional computational overhead introduced by this lightweight module is quite small, especially considering the computational overhead saved by eliminating the uninformative tokens.
22
+
23
+ This prediction module can be optimized jointly in an end-to-end manner together with the vision transformer backbone. To this end, two specialized strategies are adopted. The first one is to adopt Gumbel-Softmax [15] to overcome the non-differentiable problem of sampling from a distribution so that it is possible to perform the end-to-end training. The second one is about how to apply this learned binary decision mask to prune the unnecessary tokens. Considering the number of zero elements in the binary decision mask is different for each instance, directly eliminating the uninformative tokens for each input instance during training will make parallel computing impossible. Moreover, this would also hinder the back-propagation for the prediction module, which needs to calculate the probability distribution of whether to keep the token even if it is finally eliminated. Besides, directly setting the abandoned tokens as zero vectors is also not a wise idea since zero vectors will still affect the calculation of the attention matrix. Therefore, we propose a strategy called attention masking where we drop the connection from abandoned tokens to all other tokens in the attention matrix based on the binary decision mask. By doing so, we can overcome the difficulties described above. We also modify the original training objective of the vision transformer by adding a term to constrain the proportion of pruned tokens after a certain layer. During the inference phase, we can directly abandon a fixed amount of tokens after certain layers for each input instance as we no longer need to consider whether the operation is differentiable, and this will greatly accelerate the inference.
24
+
25
+ We illustrate the effectiveness of our method on ImageNet using DeiT [25] and LV-ViT [16] as backbone. The experimental results demonstrate the competitive trade-off between speed and accuracy. In particular, by hierarchically pruning $66 \%$ of the input tokens, we can greatly reduce $31 \%$ $\sim 3 7 \%$ GFLOPs and improve the throughput by over $40 \%$ while the drop of accuracy is within $0 . 5 \%$ for all different vision transformers. Our DynamicViT demonstrates the possibility of exploiting the sparsity in space for the acceleration of transformer-like model. We expect our attempt to open a new path for future work on the acceleration of transformer-like models.
26
+
27
+ # 2 Related Work
28
+
29
+ Vision transformers. Transformer model is first widely studied in NLP community [26]. It proves the possibility to use self-attention to replace the recurrent neural networks and their variants. Recent progress has demonstrated the variants of transformers can also be a competitive alternative to CNNs and achieve promising results on different vision tasks including image classification [8, 25, 20, 35, 23], object detection [2], semantic segmentation [34, 5] and 3D analysis [31, 33]. DETR [2] is the first work to apply the transformer model to vision tasks. It formulates the object detection task as a set prediction problem and follows the encoder-decoder design in the transformer to generate a sequence of bounding boxes. ViT [8] is the first work to directly apply transformer architecture on non-overlapping image patches for the image classification task, and the whole framework contains no convolution operation. Compared to CNN-type models, ViT can achieve better performance with large-scale pre-training. It is really preferred if the architecture can achieve the state-of-the-art without any pre-training. DeiT [25] proposes many training techniques so that we can train the convolutionfree transformer only on ImageNet1K [7] and achieve better performance than ViT. LV-ViT [16] further improves the performance by introducing a new training objective called token labeling. Both ViT and its follow-ups split the input image into multiple independent image patches and transform these image patches into tokens for further process. This makes it feasible to incorporate the sparsity in space dimension for these transformer-like models.
30
+
31
+ Model acceleration. Model acceleration techniques are important for the deployment of deep models on edge devices. There are many techniques can be used to accelerate the inference speed of deep model, including quantization [9, 27], pruning [13, 22], low-rank factorization [30], knowledge distillation [14, 19] and so on. There are also many works aims at accelerating the inference speed of transformer models. For example, TinyBERT [17] proposes a distillation method to accelerate the inference of transformer. Star-Transformer [10] reduces quadratic space and time complexity to linear by replacing the fully connected structure with a star-shaped topology. However, all these works focus on NLP tasks, and few works explore the possibility of making use of the characteristic of vision tasks to accelerate vision transformer. Furthermore, the difference between the characteristics of Transformer and CNN also makes it possible to adopt another way for acceleration rather than the methods used for CNN acceleration like filter pruning [13], which removes non-critical or redundant neurons from a deep model. Our method aims at pruning the tokens of less importance instead of the neurons by exploiting the sparsity of informative image patches.
32
+
33
+ # 3 Dynamic Vision Transformers
34
+
35
+ # 3.1 Overview
36
+
37
+ The overall framework of our DynamicViT is illustrated in Figure 2. Our DynamicViT consists of a normal vision transformer as the backbone and several prediction modules. The backbone network can be implemented as a wide range of vision transformer (e.g., ViT [8], DeiT [25], LV-ViT [16]). The prediction modules are responsible for generating the probabilities of dropping/keeping the tokens. The token sparsification is performed hierarchically through the whole network at certain locations. For example, given a 12-layer transformer, we can conduct token sparsification before the 4th, 7th, and 10th blocks. During training, the prediction modules and the backbone network can be optimized in an end-to-end manner thanks to our newly devised attention masking strategy. During inference, we only need to select the most informative tokens according to a predefined pruning ratio and the scores computed by the prediction modules.
38
+
39
+ ![](images/60c84b61353b60447abb0291fa5feca07f0a78e5f57fdd197aacba080f24b0c4.jpg)
40
+ Figure 2: The overall framework of the proposed approach. The proposed prediction module is inserted between the transformer blocks to selectively prune less informative token conditioned on features produced by the previous layer. By doing so, less tokens are processed in the followed layers.
41
+
42
+ # 3.2 Hierarchical Token Sparsification with Prediction Modules
43
+
44
+ An important characteristic of our DynamicViT is that the token sparsification is performed hierarchically, i.e., we gradually drop the uninformative tokens as the computation proceeds. To achieve this, we maintain a binary decision mask $\hat { \bf D } \in \{ 0 , 1 \} ^ { N }$ to indicate whether to drop or keep each token, where $N = H W$ is the number of patch embeddings2. We initialize all elements in the decision mask to 1 and update the mask progressively. The prediction modules take the current decision $\hat { \bf D }$ and the tokens $\mathbf { x } \in \mathbb { R } ^ { N \times C }$ as input. We first project the tokens using an MLP:
45
+
46
+ $$
47
+ \begin{array} { r } { \mathbf { z } ^ { \mathrm { l o c a l } } = \mathrm { M L P } ( \mathbf { x } ) \in \mathbb { R } ^ { N \times C ^ { \prime } } , } \end{array}
48
+ $$
49
+
50
+ where $C ^ { \prime }$ can be a smaller dimension and we use $C ^ { \prime } = C / 2$ in our implementation. Similarly, we can compute a global feature by:
51
+
52
+ $$
53
+ \begin{array} { r } { \mathbf { z } ^ { \mathrm { g l o b a l } } = \mathrm { A g g } ( \mathrm { M L P } ( \mathbf { x } ) , \hat { \mathbf { D } } ) \in \mathbb { R } ^ { C ^ { \prime } } , } \end{array}
54
+ $$
55
+
56
+ where Agg is the function which aggregate the information all the existing tokens and can be simply implemented as an average pooling:
57
+
58
+ $$
59
+ \operatorname { A g g } ( \mathbf { u } , \hat { \mathbf { D } } ) = \frac { \sum _ { i = 1 } ^ { N } \hat { \mathbf { D } } _ { i } \mathbf { u } _ { i } } { \sum _ { i = 1 } ^ { N } \hat { \mathbf { D } } _ { i } } , \quad \mathbf { u } \in \mathbb { R } ^ { N \times C ^ { \prime } } .
60
+ $$
61
+
62
+ The local feature encodes the information of a certain token while the global feature contains the context of the whole image, thus both of them are informative. Therefore, we combine both the local and global features to obtain local-global embeddings and feed them to another MLP to predict the probabilities to drop/keep the tokens:
63
+
64
+ $$
65
+ \begin{array} { r } { \mathbf { z } _ { i } = [ \mathbf { z } _ { i } ^ { \mathrm { l o c a l } } , \mathbf { z } _ { i } ^ { \mathrm { g l o b a l } } ] , \quad 1 \leq i \leq N , } \\ { \pi = \mathrm { S o f t m a x } ( \mathrm { M L P } ( \mathbf { z } ) ) \in \mathbb { R } ^ { N \times 2 } , } \end{array}
66
+ $$
67
+
68
+ where $\pi _ { i , 0 }$ denotes the probability of dropping the $i$ -th token and $\pi _ { i , 1 }$ is the probability of keeping it. We can then generate current decision $\mathbf { D }$ by sampling from $\pi$ and update $\hat { \bf D }$ by
69
+
70
+ $$
71
+ \hat { \mathbf { D } } \hat { \mathbf { D } } \odot \mathbf { D } ,
72
+ $$
73
+
74
+ where $\odot$ is the Hadamard product, indicating that once a token is dropped, it will never be used.
75
+
76
+ # 3.3 End-to-end Optimization with Attention Masking
77
+
78
+ Although our target is to perform token sparsification, we find it non-trivial to implement in practice during training. First, the sampling from $\pi$ to get binary decision mask $\mathbf { D }$ is is non-differentiable, which impedes the end-to-end training. To overcome this, we apply the Gumbel-Softmax technique [15] to sample from the probabilities $\pi$ :
79
+
80
+ $$
81
+ \mathbf { D } = \mathrm { G u m b e l - S o f t m a x } ( \pi ) _ { * , 1 } \in \{ 0 , 1 \} ^ { N } ,
82
+ $$
83
+
84
+ where we use the index “1” because $\mathbf { D }$ represents the mask of the kept tokens. The output of GumbelSoftmax is a one-hot tensor, of which the expectation equals $\pi$ exactly. Meanwhile, Gumbel-Softmax is differentiable thus makes it possible for end-to-end training.
85
+
86
+ The second obstacle comes when we try to prune the tokens during training. The decision mask $\hat { \bf D }$ is usually unstructured and the masks for different samples contain various numbers of 1’s. Therefore, simply discarding the tokens where $\hat { \bf D } _ { i } = 0$ would result in a non-uniform number of tokens for samples within a batch, which makes it hard to parallelize the computation. Thus, we must keep the number of tokens unchanged, while cut down the interactions between the pruned tokens and other tokens. We also find that merely zero-out the tokens to be dropped using the binary mask $\hat { \bf D }$ is not feasible, because in the calculation of self-attention matrix [26]
87
+
88
+ $$
89
+ \mathbf { A } = \mathrm { S o f t m a x } \left( { \frac { \mathbf { Q } \mathbf { K } ^ { T } } { \sqrt { C } } } \right)
90
+ $$
91
+
92
+ the zeroed tokens will still influence other tokens through the Softmax operation. To this end, we devise a strategy called attention masking which can totally eliminate the effects of the dropped tokens. Specifically, we compute the attention matrix by:
93
+
94
+ $$
95
+ \begin{array} { r l } & { \mathbf { P } = \mathbf { Q } \mathbf { K } ^ { T } / \sqrt { C } \in \mathbb { R } ^ { N \times N } , } \\ & { \mathbf { G } _ { i j } = \{ 1 , \quad \quad i = j , } \\ & { \hat { \mathbf { D } } _ { j } , \quad i \neq j . } \\ & { \quad \tilde { \mathbf { A } } _ { i j } = \frac { \exp ( \mathbf { P } _ { i j } ) \mathbf { G } _ { i j } } { \sum _ { k = 1 } ^ { N } \exp ( \mathbf { P } _ { i k } ) \mathbf { G } _ { i k } } , } \end{array}
96
+ $$
97
+
98
+ $$
99
+ \begin{array} { l } { 1 \leq i , j \leq N , } \\ { ~ } \\ { 1 \leq i , j \leq N . } \end{array}
100
+ $$
101
+
102
+ By Equation (10) we construct a graph where $\mathbf { G } _ { i j } = 1$ means the $j$ -th token will contribute to the update of the $i$ -th token. Note that we explicitly add a self-loop to each token to improve numerically stability. It is also easy to show the self-loop does not influence the results: if $\bar { \mathbf { D } } _ { j } = 0$ , the $j$ -th token will not contribute to any tokens other than itself. Equation (11) computes the masked attention matrix $\tilde { \mathbf { A } }$ , which is equivalent to the attention matrix calculated by considering only the kept tokens but has a constant shape $N \times N$ during training.
103
+
104
+ # 3.4 Training and Inference
105
+
106
+ We now describe the training objectives of our DynamicViT. The training of DynamicViT includes training the prediction modules such that they can produce favorable decisions and fine-tuning the backbone to make it adapt to token sparsification. Assuming we are dealing with a minibatch of $B$ samples, we adopt the standard cross-entropy loss:
107
+
108
+ $$
109
+ \mathcal { L } _ { \mathrm { c l s } } = \mathrm { C r o s s E n t r o p y } ( \mathbf { y } , \bar { \mathbf { y } } ) ,
110
+ $$
111
+
112
+ where $\mathbf { y }$ is the prediction of the DynamicViT (after softmax) and $\bar { \mathbf { y } }$ is the ground truth.
113
+
114
+ To minimize the influence on performance caused by our token sparsification, we use the original backbone network as a teacher model and hope the behavior of our DynamicViT as close to the teacher model as possible. Specifically, we consider this constraint from two aspects. First, we make the finally remaining tokens of the DynamicViT close to the ones of the teacher model, which can be viewed as a kind of self-distillation:
115
+
116
+ $$
117
+ \mathcal { L } _ { \mathrm { d i s t i l l } } = \frac { 1 } { \sum _ { b = 1 } ^ { B } \sum _ { i = 1 } ^ { N } \hat { \mathbf { D } } _ { i } ^ { b , S } } \sum _ { b = 1 } ^ { B } \sum _ { i = 1 } ^ { N } \hat { \mathbf { D } } _ { i } ^ { b , S } ( \mathbf { t } _ { i } - \mathbf { t } _ { i } ^ { \prime } ) ^ { 2 } ,
118
+ $$
119
+
120
+ Table 1: Main results on ImageNet. We apply our method on three representative vision transformers: DeiT-S, LV-ViT-S and LV-ViT-M. DeiT-S [25] is a widely used vision transformer with the simple architecture. LV-ViT-S and LV-ViT-M [16] are the state-of-the-art vision transformers. We report the top-1 classification accuracy, theoretical complexity in FLOPs and throughput for different ratio $\rho$ . The throughput is measured on a single NVIDIA RTX 3090 GPU with batch size fixed to 32.
121
+
122
+ <table><tr><td rowspan="2">Base Model</td><td rowspan="2">Metrics</td><td colspan="4">Keeping Ratio ρ at each stage</td></tr><tr><td>1.0</td><td>0.9</td><td>0.8</td><td>0.7</td></tr><tr><td rowspan="3">DeiT-S [25]</td><td>ImageNet Acc. (%)</td><td>79.8</td><td>79.8 (-0.0)</td><td>79.6 (-0.2)</td><td>79.3 (-0.5)</td></tr><tr><td>GFLOPs</td><td>4.6</td><td>4.0 (-14%)</td><td>3.4 (-27%)</td><td>2.9 (-37%)</td></tr><tr><td>Throughput (im/s)</td><td>1337.7</td><td>1524.8 (+14%)</td><td>1774.6 (+33%)</td><td>2062.1 (+54%)</td></tr><tr><td rowspan="3">LV-ViT-S [16]</td><td>ImageNet Acc. (%)</td><td>83.3</td><td>83.3 (-0.0)</td><td>83.2 (-0.1)</td><td>83.0 (-0.3)</td></tr><tr><td>GFLOPs</td><td>6.6</td><td>5.8 (-12%)</td><td>5.1 (-22%)</td><td>4.6 (-31%)</td></tr><tr><td>Throughput (im/s)</td><td>993.3</td><td>1108.3 (+12%)</td><td>1255.6 (+26%)</td><td>1417.6 (+43%)</td></tr><tr><td rowspan="3">LV-ViT-M[16]</td><td>ImageNet Acc. (%)</td><td>84.0</td><td>83.9 (-0.1)</td><td>83.9 (-0.1)</td><td>83.8 (-0.2)</td></tr><tr><td>GFLOPs</td><td>12.7</td><td>11.1 (-13%)</td><td>9.6 (-24%)</td><td>8.5 (-33%)</td></tr><tr><td>Throughput (im/s)</td><td>589.5</td><td>688.5 (+17%)</td><td>791.2 (+34%)</td><td>888.2 (+50%)</td></tr></table>
123
+
124
+ where $\mathbf { t } _ { i }$ and $\mathbf { t } _ { i } ^ { \prime }$ denotes the $i$ -th token after the last block of the DynamicViT and the teacher model, respectively. $\hat { \bf D } ^ { b , s }$ is the decision mask for the $b$ -th sample at the $s$ -th sparsification stage. Second, we minimize the difference of the predictions between our DynamicViT and its teacher via the KL divergence:
125
+
126
+ $$
127
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { K L } } = \mathrm { K L } \left( \mathbf { y } \| \mathbf { y } ^ { \prime } \right) , } \end{array}
128
+ $$
129
+
130
+ where $\mathbf { y } ^ { \prime }$ is the prediction of the teacher model.
131
+
132
+ Finally, we want to constrain the ratio of the kept tokens to a predefined value. Given a set of target ratios for $S$ stages $\pmb { \rho } = [ \rho ^ { ( 1 ) } , \dots , \rho ^ { ( S ) } ]$ , we utilize an MSE loss to supervise the prediction module:
133
+
134
+ $$
135
+ \mathcal { L } _ { \mathrm { r a t i o } } = \frac { 1 } { B S } \sum _ { b = 1 } ^ { B } \sum _ { s = 1 } ^ { S } \left( \rho ^ { ( s ) } - \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \hat { \mathbf { D } } _ { i } ^ { b , s } \right) ^ { 2 } .
136
+ $$
137
+
138
+ The full training objective is a combination of the above objectives:
139
+
140
+ $$
141
+ \mathcal { L } = \mathcal { L } _ { \mathrm { c l s } } + \lambda _ { \mathrm { K L } } \mathcal { L } _ { \mathrm { K L } } + \lambda _ { \mathrm { d i s t i l l } } \mathcal { L } _ { \mathrm { d i s t i l l } } + \lambda _ { \mathrm { r a t i o } } \mathcal { L } _ { \mathrm { r a t i o } } ,
142
+ $$
143
+
144
+ where we set $\lambda _ { \mathrm { K L } } = 0 . 5 , \lambda _ { \mathrm { d i s t i l l } } = 0 . 5 , \lambda _ { \mathrm { r a t i o } } = 2$ in all our experiments.
145
+
146
+ During inference, given the target ratio $\rho$ , we can directly discard the less informative tokens via the probabilities produced by the prediction modules such that only exact $m ^ { s } = \lfloor \rho ^ { s } N \rfloor$ tokens are kept at the $s$ -th stage. Formally, for the $s$ -th stage, let
147
+
148
+ $$
149
+ \begin{array} { r } { \mathcal { T } ^ { s } = \mathop { \mathrm { a r g s o r t } } ( \pi _ { * , 1 } ) } \end{array}
150
+ $$
151
+
152
+ be the indices sorted by the keeping probabilities $\pi _ { * , 1 }$ , we can then keep the tokens of which the indices lie in $\mathcal { T } _ { 1 : m ^ { s } } ^ { s }$ while discarding the others. In this way, our DynamicViT prunes less informative tokens dynamically at runtime, thus can reduce the computational costs during inference.
153
+
154
+ # 4 Experimental Results
155
+
156
+ In this section, we will demonstrate the superiority of the proposed DynamicViT through extensive experiments. In all of our experiments, we fix the number of sparsification stages $S = 3$ and apply the target keeping ratio $\rho$ as a geometric sequence $[ \rho , \rho ^ { 2 } , \rho ^ { 3 } ]$ where $\rho$ ranges from $( 0 , 1 )$ . During training DynamicViT models, we follow most of the training techniques used in DeiT [25]. We use the pre-trained vision transformer models to initialize the backbone models and jointly train the whole model for 30 epochs. We set the learning rate of the prediction module to batch size × 0.001 and use $0 . 0 1 \times$ learning rate for the backbone model. We fix the weights of the backbone models in the first 5 epochs. All of our models are trained on a single machine with 8 GPUs. Other training setups and details can be found in the supplementary material.
157
+
158
+ ![](images/3c4ee26faf688f1b0a579c8588783656070e3c3e9b22df42205e8677fd7b8ae5.jpg)
159
+ Figure 3: Model complexity (FLOPs) and top-1 accuracy trade-offs on ImageNet. We compare DynamicViT with the state-of-the-art image classification models. Our models achieve better trade-offs compared to the various vision transformers as well as carefully designed CNN models.
160
+
161
+ ![](images/4ea76cd205a92c4a57c3350183bb6731151d04057f2d04017a636bd911c7d0cb.jpg)
162
+ Figure 4: Comparison of our dynamic token sparsification method with model width scaling. We train our DynamicViT based on DeiT models with embedding dimension varying from 192 to 384 and fix ratio $\rho = 0 . 7$ . We see dynamic token sparsification is more efficient than commonly used model width scaling.
163
+
164
+ # 4.1 Main results
165
+
166
+ One of the most advantages of the DynamicViT is that it can be applied to a wide range of vision transformer architectures to reduce the computational complexity with minor loss of performance. In Table 1, we summarize the main results on ImageNet [7] where we evaluate our DynamicViT used three base models (DeiT-S [25], LV-ViT-S [16] and LV-ViT-M [16]). We report the top-1 accuracy, FLOPs, and the throughput under different keeping ratios $\rho$ . Note that our token sparsification is performed hierarchically in three stages, there are only $\lfloor N \rho ^ { 3 } \rfloor$ tokens left after the last stage. The throughput is measured on a single NVIDIA RTX 3090 GPU with batch size fixed to 32. We demonstrate that our DynamicViT can reduce the computational costs by $3 1 \% \sim 3 7 \%$ and accelerate the inference at runtime by $4 3 \% \sim 5 4 \%$ , with the neglectable influence of performance $( - 0 . 2 \% \sim - 0 . 5 \% )$ .
167
+
168
+ # 4.2 Comparisons with the-state-of-the-arts
169
+
170
+ In Table 2, we compare the DynamicViT with the state-of-the-art models in image classification, including convolutional networks and transformer-like architectures. We use the DynamicViT with LV-ViT [16] as the base model and use the $^ { 6 6 } / \rho ^ { 9 }$ to indicate the keeping ratio. We observe that our DynamicViT exhibits favorable complexity/accuracy trade-offs at all three complexity levels. Notably, we find our DynamicViT-LV-M/0.7 beats the EfficientNet-B5 [24] and NFNet-F0 [1], which are two of the current state-of-the-arts CNN architectures. This can also be shown clearer in Figure 3, where we plot the FLOPS-accuracy curve of DynamicViT series (where we use DyViT for short), along with other state-of-the-art models. We can also observe that DynamicViT can achieve better trade-offs than LV-ViT series, which strongly demonstrates the effectiveness of our method.
171
+
172
+ # 4.3 Analysis
173
+
174
+ DynamicViT for model scaling. The success of EfficientNet [24] shows that we can obtain a model with better complexity/accuracy tradeoffs by scaling the model along different dimensions. While in vision transformers, the most commonly used method to scale the model is to change the number of channels, our DynamicViT provides another powerful tool to perform token sparsification. We analysis this nice property of DynamicViT in Figure 4. First, we train several DeiT [25] models with the embedding dimension varying from 192 (DeiT-Ti) to 384 (DeiT-S). Second, we train our DynamicViT based on those models with the keeping ratio $\rho = 0 . 7$ . We find that after performing token sparsification, the complexity of the model is reduced to be similar to its variant with a smaller embedding dimension. Specifically, we observe that by applying our DynamicViT to DeiT-256, we obtain a model that has a comparable computational complexity to DeiT-Ti, but enjoys around $4 . 3 \%$ higher ImageNet top-1 accuracy.
175
+
176
+ Table 2: Comparisons with the state-of-the-arts on ImageNet. We compare our DynamicViT models with state-of-the-art image classifciation models with comparable FLOPs and number of parameters. We use the DynamicViT with LV-ViT [16] as the base model and use the $" / \rho "$ to indicate the keeping ratio. We also include the results of LV-ViT models as references.
177
+
178
+ <table><tr><td>Model</td><td>Params (M)</td><td>GFLOPs</td><td>Resolution</td><td>Top-1 Acc (%)</td></tr><tr><td>DeiT-S [25]</td><td>22.1</td><td>4.6</td><td>224</td><td>79.8</td></tr><tr><td>PVT-Small [28]</td><td>24.5</td><td>3.8</td><td>224</td><td>79.8</td></tr><tr><td>CoaTMini [29]</td><td>10.0</td><td>6.8</td><td>224</td><td>80.8</td></tr><tr><td>CrossViT-S [4]</td><td>26.7</td><td>5.6</td><td>224</td><td>81.0</td></tr><tr><td>PVT-Medium [28]</td><td>44.2</td><td>6.7</td><td>224</td><td>81.2</td></tr><tr><td>Swin-T [20]</td><td>29.0</td><td>4.5</td><td>766</td><td>81.3</td></tr><tr><td>T2T-ViT-14 [32]</td><td>22.0</td><td>5.2</td><td>224</td><td>81.5</td></tr><tr><td>CPVT-Small-GAP [6]</td><td>23.0</td><td>4.6</td><td>817</td><td>81.5</td></tr><tr><td>CoaT-Lite Small [29]</td><td>20.0</td><td>4.0</td><td>224</td><td>81.9</td></tr><tr><td>LV-ViT-S [16]</td><td>26.2</td><td>6.6</td><td>224</td><td>83.3</td></tr><tr><td>DynamicViT-LV-S/0.5</td><td>26.9</td><td>3.7</td><td>224</td><td>82.0</td></tr><tr><td>DynamicViT-LV-S/0.7</td><td>26.9</td><td>4.6</td><td>224</td><td>83.0</td></tr><tr><td>RegNetY-8G [21]</td><td>39.0</td><td>8.0</td><td>224</td><td>81.7</td></tr><tr><td>T2T-ViT-19 [32]</td><td>39.2</td><td>8.9</td><td>224</td><td>81.9</td></tr><tr><td>Swin-S [20]</td><td>50.0</td><td>8.7</td><td>224</td><td>83.0</td></tr><tr><td>EfficientNet-B5 [24]</td><td>30.0</td><td>9.9</td><td>456</td><td>83.6</td></tr><tr><td>NFNet-F0 [1]</td><td>72.0</td><td>12.4</td><td>256</td><td>83.6</td></tr><tr><td>DynamicViT-LV-M/0.7</td><td>57.1</td><td>8.5</td><td>224</td><td>83.8</td></tr><tr><td>ViT-Base/16 [8]</td><td>86.6</td><td>17.6</td><td>224</td><td>77.9</td></tr><tr><td>DeiT-Base/16 [25]</td><td>86.6</td><td>17.6</td><td>224</td><td>81.8</td></tr><tr><td>CrossViT-B 3[4]</td><td>104.7</td><td>21.2</td><td>224</td><td>82.2</td></tr><tr><td>T2T-ViT-24 [32]</td><td>64.1</td><td>14.1</td><td>224</td><td>82.3</td></tr><tr><td>TNT-B [11]</td><td>66.0</td><td>14.1</td><td>224</td><td>82.8</td></tr><tr><td>RegNetY-16G [21]</td><td>84.0</td><td>16.0</td><td>224</td><td>82.9</td></tr><tr><td>Swin-B [20]</td><td>88.0</td><td>15.4</td><td>224</td><td>83.3</td></tr><tr><td>LV-ViT-M [16]</td><td>55.8</td><td>12.7</td><td>224</td><td>84.0</td></tr><tr><td>Dynamic ViT-LV-M/0.8</td><td>57.1</td><td>9.6</td><td>224</td><td>83.9</td></tr></table>
179
+
180
+ Visualizations. To further investigate the behavior of DynamicViT, we visualize the sparsification procedure in Figure 5. We show the original input image and the sparsification results after the three stages, where the masks represent the corresponding tokens are discarded. We find that through the hierarchically token sparsification, our DynamicViT can gradually drop the uninformative tokens and finally focus on the objects in the images. This phenomenon also suggests that the DynamicViT leads to better interpretability, i.e., it can locate the important parts in the image which contribute most to the classification step-by-step.
181
+
182
+ Besides the sample-wise visualization we have shown above, we are also interested in the statistical characteristics of the sparsification decisions, i.e., what kind of general patterns does the DynamicViT learn from the dataset? We then use the DynamicViT to generate the decisions for all the images in the ImageNet validation set and compute the keep probability of each token in all three stages, as shown in Figure 6. We average pool the probability maps into $7 \times 7$ such that they can be visualized more easily. Unsurprisingly, we find the tokens in the middle of the image tend to be kept, which is reasonable because in most images the objects are located in the center. We can also find that the later stage generally has lower probabilities to be kept, mainly because that the keeping ratio at the $s$ stage is $\rho ^ { s }$ , which decreases exponentially as $s$ increases.
183
+
184
+ ![](images/55b80e501904076240ede75eeecf0aef021e7ba2d7c6f06c24f7b7b13b800a40.jpg)
185
+ Figure 5: Visualization of the progressively sparsified tokens. We show the original input image and the sparsification results after the three stages, where the masks represent the corresponding tokens are discarded. We see our method can gradually focus on the most representative regions in the image. This phenomenon suggests that the DynamicViT has better interpretability.
186
+
187
+ Table 3: Effects of different losses. We provide the results after removing the distillation loss and the KL loss.
188
+
189
+ <table><tr><td>Base Model</td><td>DeiT-S</td><td>LVViT-S</td></tr><tr><td>DynamicViT</td><td>79.3(-0.5)</td><td>83.0(-0.3)</td></tr><tr><td>w/o distill (Eq.13)</td><td>79.3(-0.5)</td><td>82.7(-0.6)</td></tr><tr><td>w/o KL (Eq.14)</td><td>79.2(-0.6)</td><td>82.9(-0.4)</td></tr><tr><td>w/o distill&amp; KL</td><td>79.2(-0.6)</td><td>82.5(-0.8)</td></tr></table>
190
+
191
+ ![](images/d74529d91dbe960e8424f69c73c1efe7a7dcc985e463fd2fa07bb979b059cb31.jpg)
192
+ Figure 6: The keep probabilities of the tokens at each stage.
193
+
194
+ Effects of different losses. We show the effects of different losses in Table 3. We see the improvement brought by the distillation loss and the KL loss is not very significant, but it can consistently further boost the performance of various models.
195
+
196
+ Comparisons of different sparsification strategies. As illustrated in Figure 2, the dynamic token sparsification is unstructured. To discuss whether the dynamic sparsification is better than other strategies, we perform ablation experiments and the results are shown in Table 4. For the structural downsampling, we perform an average pooling with kernel size $2 \times 2$ after the sixth block of the baseline DeiT-S [25] model, which has similar FLOPs to our DynamicViT. The static token sparsification means that the sparsification decisions are not conditioned on the input tokens. We also compare our method with other token removal methods like randomly removing tokens or removing
197
+
198
+ (a) Dynamic sparsification static/structural downsampling.
199
+
200
+ Table 4: Comparisons of different sparsification strategies. We investigate different methods to select redundant tokens based on the DeiT-S model. We report the top-1 accuracy on ImageNet for different methods. We fix the complexity of the accelerated models to 2.9G FLOPs for fair comparisons.
201
+
202
+ <table><tr><td>Model</td><td>Acc. (%)</td></tr><tr><td>Random</td><td>77.5 (-2.3)</td></tr><tr><td>Attention</td><td>78.1 (-1.7)</td></tr><tr><td>Prediction</td><td>79.3 (-0.5)</td></tr></table>
203
+
204
+ (b) Different redundant token removal methods.
205
+
206
+ <table><tr><td>Model</td><td>Acc. (%)</td></tr><tr><td>Structural</td><td>78.2 (-1.6)</td></tr><tr><td>Static</td><td>73.4 (-6.4)</td></tr><tr><td>Dynamic</td><td>79.3 (-0.5)</td></tr></table>
207
+
208
+ (c) Effects of number of sparsification stages.
209
+ Table 5: Results on larger models. We apply our method to the model with larger width (i.e., DeiT-B) and the model with larger input size (i.e., DeiT-S with $3 8 4 \times 3 8 4$ input).
210
+
211
+ <table><tr><td>Model</td><td>Acc. (%)</td></tr><tr><td>Single-stage</td><td>77.4 (-2.4)</td></tr><tr><td>Two-stage</td><td>79.2 (-0.6)</td></tr><tr><td>Three-stage</td><td>79.3 (-0.5)</td></tr></table>
212
+
213
+ (a) Results on DeiT-B.
214
+
215
+ (b) Results on the $3 8 4 \times 3 8 4$ input.
216
+
217
+ <table><tr><td>Model</td><td>GFLOPs</td><td>Acc. (%)</td></tr><tr><td>DeiT-S</td><td>15.5</td><td>81.6</td></tr><tr><td>Dynamic ViT-S/0.7</td><td>9.5 (-39%)</td><td>81.4 (-0.2)</td></tr><tr><td>DynamicViT-S/0.5</td><td>7.0 (-55%)</td><td>80.3 (-1.3)</td></tr></table>
218
+
219
+ <table><tr><td>Model</td><td>GFLOPs</td><td>Acc. (%)</td></tr><tr><td>DeiT-B</td><td>17.5</td><td>81.8</td></tr><tr><td>Dynamic ViT-B/0.7</td><td>11.2 (-36%)</td><td>81.3 (-0.5)</td></tr></table>
220
+
221
+ tokens based the attention score of the class token. We find through the experiments that although other strategies have similar computational complexities, the proposed dynamic token sparsification method achieves the best accuracy. We also show that the progressive sparsification method is significantly better than one-stage sparsification.
222
+
223
+ Accelerating larger models. To show the effectiveness of our method on larger models, we apply our method to the model with larger width (i.e., DeiT-B) and models with larger input size (i.e., DeiT-S with $3 8 4 \times 3 8 4$ input). The results are presented in Table 5. We see our method also works well on the larger DeiT model. The accuracy drop become less significant when we apply our method to the model with larger feature maps. Notably, we can reduce the complexity of the DeiT-S model with $3 8 4 \times 3 8 4$ input by over $50 \%$ with only $1 . 3 \%$ accuracy drop.
224
+
225
+ # 5 Conclusion
226
+
227
+ In this work, we open a new path to accelerate vision transformer by exploiting the sparsity of informative patches in the input image. For each input instance, our DynamicViT model prunes the tokens of less importance in a dynamic way according to the customized binary decision mask output from the lightweight prediction module, which fuses the local and global information containing in the tokens. The prediction module is added to multiple layers such that the token pruning is performed in a hierarchical way. Gumbel-Softmax and attention masking techniques are also incorporated for the end-to-end training of the transformer model together with the prediction module. During the inference phase, our approach can greatly improves the efficiency by gradually pruning $66 \%$ of the input tokens, while the drop of accuracy is less than $0 . 5 \%$ for different transformer backbone. In this paper, we focus on the image classification task. Extending our method to other scenarios like video classification and dense prediction tasks can be interesting directions.
228
+
229
+ # Acknowledgment
230
+
231
+ This work was supported in part by the National Key Research and Development Program of China under Grant 2017YFA0700802, in part by the National Natural Science Foundation of China under Grant 62125603, Grant 61822603, Grant U1813218, Grant U1713214, in part by Beijing Academy of Artificial Intelligence (BAAI), in part by National Science Foundation under grant IIS-1901527, IIS-2008173, IIS-2048280, and in part by a grant from the Institute for Guo Qiang, Tsinghua University.
232
+
233
+ # References
234
+
235
+ [1] Andrew Brock, Soham De, Samuel L Smith, and Karen Simonyan. High-performance largescale image recognition without normalization. arXiv preprint arXiv:2102.06171, 2021. 7, 8
236
+ [2] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, pages 213–229, 2020. 3
237
+ [3] Hila Chefer, Shir Gur, and Lior Wolf. Transformer interpretability beyond attention visualization. arXiv preprint arXiv:2012.09838, 2020. 2
238
+ [4] Chun-Fu Chen, Quanfu Fan, and Rameswar Panda. Crossvit: Cross-attention multi-scale vision transformer for image classification. arXiv preprint arXiv:2103.14899, 2021. 8
239
+ [5] Bowen Cheng, Alexander G. Schwing, and Alexander Kirillov. Per-pixel classification is not all you need for semantic segmentation. NeurIPS, 2021. 3
240
+ [6] Xiangxiang Chu, Zhi Tian, Bo Zhang, Xinlong Wang, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Conditional positional encodings for vision transformers. arXiv preprint arXiv:2102.10882, 2021. 8
241
+ [7] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, pages 248–255, 2009. 3, 7
242
+ [8] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. 3, 8
243
+ [9] Yunchao Gong, Liu Liu, Ming Yang, and Lubomir Bourdev. Compressing deep convolutional networks using vector quantization. arXiv preprint arXiv:1412.6115, 2014. 3
244
+ [10] Qipeng Guo, Xipeng Qiu, Pengfei Liu, Yunfan Shao, Xiangyang Xue, and Zheng Zhang. Star-transformer. arXiv preprint arXiv:1902.09113, 2019. 3
245
+ [11] Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. arXiv preprint arXiv:2103.00112, 2021. 8
246
+ [12] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016. 1
247
+ [13] Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. In ICCV, pages 1389–1397, 2017. 3
248
+ [14] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. 3
249
+ [15] Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. In ICLR, 2017. 2, 5
250
+ [16] Zihang Jiang, Qibin Hou, Li Yuan, Daquan Zhou, Xiaojie Jin, Anran Wang, and Jiashi Feng. Token labeling: Training a $8 5 . 5 \%$ top-1 accuracy vision transformer with 56m parameters on imagenet. arXiv preprint arXiv:2104.10858, 2021. 3, 6, 7, 8
251
+ [17] Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351, 2019. 3
252
+ [18] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. NeurIPS, 25:1097–1105, 2012. 1
253
+ [19] Benlin Liu, Yongming Rao, Jiwen Lu, Jie Zhou, and Cho-Jui Hsieh. Metadistiller: Network self-boosting via meta-learned top-down distillation. In European Conference on Computer Vision, pages 694–709. Springer, 2020. 3
254
+
255
+ [20] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021. 1, 3, 8
256
+
257
+ [21] Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In CVPR, pages 10428–10436, 2020. 8
258
+
259
+ [22] Yongming Rao, Jiwen Lu, Ji Lin, and Jie Zhou. Runtime network routing for efficient image classification. IEEE transactions on pattern analysis and machine intelligence, 41(10):2291– 2304, 2018. 3
260
+
261
+ [23] Yongming Rao, Wenliang Zhao, Zheng Zhu, Jiwen Lu, and Jie Zhou. Global filter networks for image classification. In NeurIPS, 2021. 3
262
+
263
+ [24] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In ICML, pages 6105–6114. PMLR, 2019. 7, 8
264
+
265
+ [25] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020. 1, 2, 3, 6, 7, 8, 9
266
+
267
+ [26] 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. 3, 5
268
+
269
+ [27] Kuan Wang, Zhijian Liu, Yujun Lin, Ji Lin, and Song Han. Haq: Hardware-aware automated quantization with mixed precision. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8612–8620, 2019. 3
270
+
271
+ [28] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021. 8
272
+
273
+ [29] Weijian Xu, Yifan Xu, Tyler Chang, and Zhuowen Tu. Co-scale conv-attentional image transformers. arXiv preprint arXiv:2104.06399, 2021. 8
274
+
275
+ [30] Xiyu Yu, Tongliang Liu, Xinchao Wang, and Dacheng Tao. On compressing deep models by low rank and sparse decomposition. In CVPR, pages 7370–7379, 2017. 3
276
+
277
+ [31] Xumin Yu, Yongming Rao, Ziyi Wang, Zuyan Liu, Jiwen Lu, and Jie Zhou. Pointr: Diverse point cloud completion with geometry-aware transformers. In ICCV, 2021. 3
278
+
279
+ [32] Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. arXiv preprint arXiv:2101.11986, 2021. 8
280
+
281
+ [33] Hengshuang Zhao, Li Jiang, Jiaya Jia, Philip Torr, and Vladlen Koltun. Point transformer. In ICCV, 2021. 3
282
+
283
+ [34] Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip H.S. Torr, and Li Zhang. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In CVPR, 2021. 3
284
+
285
+ [35] Daquan Zhou, Bingyi Kang, Xiaojie Jin, Linjie Yang, Xiaochen Lian, Qibin Hou, and Jiashi Feng. Deepvit: Towards deeper vision transformer. arXiv preprint arXiv:2103.11886, 2021. 3 [36] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020. 1
286
+
287
+ # Checklist
288
+
289
+ 1. For all authors...
290
+
291
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
292
+ (b) Did you describe the limitations of your work? [Yes] See Section 5. In this paper, we only study the dynamic token sparsification problem on the image classification task. Extending our method to a wider range of scenarios like video classification and dense prediction tasks can be interesting future directions.
293
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A] We study a general framework for deep model acceleration. Our method is not for specific applications, which does not directly involve societal issues.
294
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
295
+
296
+ 2. If you are including theoretical results...
297
+
298
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
299
+
300
+ 3. If you ran experiments...
301
+
302
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
303
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
304
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We follow the common practice in previous works, where they didn’t report the error bars.
305
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See our implementation details in the experiment part.
306
+
307
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
308
+
309
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
310
+ (b) Did you mention the license of the assets? [N/A]
311
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
312
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
313
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
314
+
315
+ 5. If you used crowdsourcing or conducted research with human subjects...
316
+
317
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
318
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
319
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/ki4eJ1fSJNq/ki4eJ1fSJNq.md ADDED
@@ -0,0 +1,457 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Fitting large mixture models using stochastic component selection
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Traditional methods for unsupervised learning of finite mixture models require to
11
+ 2 evaluate the likelihood of all components of the mixture. This becomes computa
12
+ 3 tionally prohibitive when the number of components is large, as it is, for example,
13
+ 4 in the sum-product (transform) networks. As a remedy, we propose an approach
14
+ 5 combining the expectation maximization and the Metropolis-Hastings algorithm
15
+ 6 to evaluate only a small number of, stochastically sampled, components, thus
16
+ 7 substantially reducing the computational cost. We put emphasis on generality of
17
+ 8 our method, equipping it with the ability to train both shallow and deep mixture
18
+ 9 models which involve complex, and possibly nonlinear, transformations. The
19
+ 10 performance of our method is illustrated in a variety of synthetic and real-data
20
+ 11 contexts, considering deep models, such as mixtures of normalizing flows and
21
+ 12 sum-product (transform) networks.
22
+
23
+ # 13 1 Introduction
24
+
25
+ 14 Finite mixture models [40] constitute a fundamental class of density estimation models. They
26
+ 15 have been successfully applied in diverse fields, including bioinformatics [49], econometrics [10],
27
+ 16 engineering [33], etc. A mixture model relies on a weighted sum of probability distributions—here
28
+ 17 referred to as components—to cluster $N$ unlabelled datapoints into $K$ categories. The traditional
29
+ 18 maximum likelihood techniques train the model by optimizing either (i) the marginal likelihood via
30
+ 19 gradient-descent [50] or (ii) the evidence lower bound via variational methods [4], including the
31
+ 20 expectation-maximization (EM) [13]. The dependence structure among approximate, variational,
32
+ 21 distributions then ranges from the fully independent (mean-field) [25] to fully dependent [30]. The
33
+ 22 sampling-based techniques target the posterior distribution using sequential Monte Carlo [9] or
34
+ 23 Markov chain Monte Carlo [52], e.g. via the Gibbs [34] or Metropolis-Hastings sampling [38]. The
35
+ 24 computational cost of these methods typically scales with $\mathcal { O } ( T K N D )$ operations, where $N$ and $K$
36
+ 25 are defined above, $T$ is the number of iterations and $D$ is the dimension of data.
37
+ 26 Various methods to decrease the computational cost via any factor in $\mathcal { O } ( T K N D )$ have been proposed.
38
+ 27 $T$ can be lowered by proper initialization, e.g. the optimal seeding [5]; an efficient step-size schedule,
39
+ 28 e.g. the line-search [58]; or increased estimation precision, e.g. the variance reduction [8]. $N$ is often
40
+ 29 reduced using the coreset methods, which approximate the original dataset by a weighted dataset
41
+ 30 such that the exact and approximate marginal likelihoods are close. The weighted variants of the
42
+ 31 variational [17, 59, 6] and sampling-based [39] methods then process the coresets. Reducing $D$ relies
43
+ 32 on the compression of data into smaller representations via random projections [53, 2], which is
44
+ 33 achieved in two ways: (i) each data item is projected into an individual representation [11]; (ii) all
45
+ 34 data items are projected into an overall representation, commonly referred to as sketch [28, 22].
46
+ 35 Nevertheless, all the aforementioned techniques—including those with reduced computational cost—
47
+ 36 evaluate all $K$ components. This is very demanding for large models, and the problem is even more
48
+ 37 severe for mixtures involving intricate models, such as neural networks [21, 42], Gaussian processes
49
+ 38 [57], normalizing flows [48]; or deep mixtures, including sum-product (transform) networks [45, 47],
50
+ 39 deep Gaussian mixture models [55], etc. In spite of this, a little attention has been paid to the design
51
+ 40 of algorithms which does not evaluate all $K$ components. The notable exceptions are the sparse EM
52
+ 41 algorithm [24] and the truncated variational EM algorithm [18], see Table 1 and Section 5 for details.
53
+ 42 Moreover, the methods are mostly tailored for a specific class of mixture models, e.g. the Gaussian
54
+ 43 mixture models.
55
+
56
+ Table 1: The computational features of various EM algorithms. We compare whether the methods (i) perform the computations with a reduced number of data (minibatching), (ii) update a lower number of statistics, (iii) make less evaluations of the conditional likelihood, and (iv) are suitable for training of deep models. Here, EM, SA, S, T, MC and MH stand for expectation-maximization, stochastic approximation, sparse, truncated, Monte Carlo and Metropolis-Hastings, respectively.
57
+
58
+ <table><tr><td>Feature/Algorithm</td><td>EM [13]</td><td>SAEM [44]</td><td>SSAEM [24]</td><td>TSAEM [18]</td><td>MCSAEM [1]</td><td>MHSAEM (ours)</td></tr><tr><td>B&lt;Ndatapoints</td><td>×</td><td></td><td></td><td>√</td><td></td><td></td></tr><tr><td>M&lt;K statistics</td><td>xx</td><td></td><td></td><td></td><td>厂</td><td></td></tr><tr><td>M&lt;Klikelihoods</td><td></td><td>xx</td><td>×</td><td></td><td>X</td><td></td></tr><tr><td>deep models</td><td>×</td><td>×</td><td>×</td><td>X</td><td>×</td><td></td></tr></table>
59
+
60
+ 44 In this paper, we make the following contributions:
61
+
62
+ 45 • We propose an EM-based algorithm which relies on the MH sampler to stochastically evaluate less
63
+ 46 components in mixture models, substantially reducing the computational cost.
64
+ 7 • We design our method to enable optimization of fairly generic EM objective functions, making it
65
+ 48 suitable for training of both shallow and deep mixture models.
66
+ 49 • We apply our approach to Gaussian mixture mdoels (GMMs) and their generalizations: sum
67
+ 50 product-transform networks (SPTNs) and mixtures of real-valued non-volume preserving (real
68
+ 51 NVP) flows [15], reaching approximately $1 0 0 \times$ speed-up compared to state-of-the-art methods.
69
+
70
+ # 52 2 Problem formulation
71
+
72
+ A finite mixture model characterizes the relation between an observed (known) variable, 53 $\boldsymbol { x } \in \times \subseteq \mathbb { R } ^ { D }$ , 54 and a latent (unknown) variable, $z \in Z : = \{ 1 , \dots , K \}$ , via the marginal (incomplete-data) likelihood 55 in the following form:
73
+
74
+ $$
75
+ p _ { \theta } ( x ) = \sum _ { k = 1 } ^ { K } p _ { \eta _ { k } } ( x | z = k ) p _ { \pi _ { k } } ( z = k ) ,
76
+ $$
77
+
78
+ 56 where $\theta : = ( \pi _ { 1 } , \eta _ { 1 } , \dots , \pi _ { K } , \eta _ { K } ) \in \Theta$ are unknown parameters. Here, $\eta _ { z }$ are the parameters of the 57 conditional likelihood, $p _ { \eta _ { z } } ( x | z )$ , and $\pi _ { z }$ is the weight which parameterizes the prior, $p _ { \pi _ { z } } ( z ) = \pi _ { z }$ , and satisfies 58 $0 \leq \pi _ { k } \leq 1$ for each $k \in { \mathord { \mathbb { Z } } }$ and $\textstyle \sum _ { k = 1 } ^ { K } \pi _ { k } = 1$ .
79
+
80
+ 59 Given a set of independent and identically distributed data, $\mathbf { x } : = ( x _ { i } ) _ { i = 1 } ^ { N }$ , our goal is to learn the
81
+ 60 unknown parameters of the marginal log-likelihood,
82
+
83
+ $$
84
+ \mathcal { L } ( \theta ) : = \log p _ { \theta } ( \mathbf { x } ) = \sum _ { i = 1 } ^ { N } \log \sum _ { k = 1 } ^ { K } p _ { \eta _ { k } } ( x _ { i } | z _ { i } = k ) p _ { \pi _ { k } } ( z _ { i } = k ) .
85
+ $$
86
+
87
+ 61 The marginalization in (2) is tractable for almost all forms of $p _ { \eta _ { z } } ( x | z )$ . Indeed, we consider $p _ { \eta _ { z } } ( x | z )$
88
+ 62 to belong to an arbitrary family of $\eta _ { z }$ -differentiable probability distributions. However, we assume that
89
+ 63 $K$ is high, making the marginalization in (2) computationally costly, thus rendering the optimization
90
+ 64 objective presumably intractable. Therefore, we want to design a computationally efficient algorithm,
91
+ 65 requiring only $M < K$ evaluations of $p _ { \eta _ { z } } ( x | z )$ at each iteration.
92
+ 67 The maximum likelihood estimation seeks the parameters maximizing the marginal log-likelihood,
93
+ 68 $\theta ^ { M L } : = \arg \operatorname* { m a x } _ { \theta \in \Theta } \mathcal { L } ( \theta )$ . The traditional EM algorithm [13] addresses this task indirectly, i.e. by
94
+ 69 optimizing the evidence lower bound (ELBO),
95
+
96
+ $$
97
+ \mathcal { L } ( \theta ) \geq \mathcal { Q } ( \theta ) + \mathcal { H } ( \hat { \theta } ) : = \mathrm { E L B O } ( \hat { \theta } ) ,
98
+ $$
99
+
100
+ where 70 $\mathcal { H } ( \hat { \theta } ) : = - \mathsf E _ { p _ { \hat { \theta } } ( \mathbf { z } | \mathbf { x } ) } [ \log p _ { \hat { \theta } } ( \mathbf { z } | \mathbf { x } ) ]$ is the differential entropy at an estimate, $\hat { \theta } \in \Theta$ , and
101
+
102
+ $$
103
+ \mathcal { Q } ( \theta ) : = \mathsf { E } _ { p _ { \hat { \theta } } ( \mathbf { z } | \mathbf { x } ) } [ \log p _ { \theta } ( \mathbf { z } , \mathbf { x } ) ] = \sum _ { i = 1 } ^ { N } \sum _ { k = 1 } ^ { K } p _ { \theta } ( z _ { i } = k | x _ { i } ) \log p _ { \theta } ( z _ { i } = k , x _ { i } )
104
+ $$
105
+
106
+ 71 is the EM objective function. Here, $p _ { \theta } ( \mathbf { z } , \mathbf { x } )$ is the joint (complete-data) likelihood, and $p _ { \theta } ( \mathbf { z } | \mathbf { x } )$ is
107
+ 72 the posterior distribution over the latent variables $\dot { \mathbf { z } } : = ( z _ { i } ) _ { i = 1 } ^ { N }$ . Given an initial value, $\theta _ { 0 }$ , the EM
108
+ 73 algorithm produces a sequence of estimates, $( \theta _ { t } ) _ { t = 1 } ^ { T }$ , by alternating between the expectation (E) and
109
+ 74 maximization (M) steps,
110
+
111
+ $$
112
+ \begin{array} { r l } & { \mathrm { E \mathrm { - } s t e p } ; ~ \mathcal { Q } _ { t - 1 } ( \theta ) , } \\ & { \mathrm { M \mathrm { - } s t e p } ; ~ \theta _ { t } : = \arg \operatorname* { m a x } _ { \theta \in \Theta } \mathcal { Q } _ { t - 1 } ( \theta ) . } \end{array}
113
+ $$
114
+
115
+ 75 This sequence is guaranteed to monotonically tighten the ELBO, arriving at a local optimum of (2)
116
+ 76 under mild regularity assumptions [56].
117
+ 77 The EM algorithm is computationally expensive, since (4) evaluates $p _ { \theta } ( z _ { i } , x _ { i } )$ for each $z _ { i } \in \mathbb { Z }$ and
118
+ 78 $i \in ( 1 , \ldots , N )$ . This has to be performed for all $t \in ( 1 , \ldots , T )$ in (5). Albeit the marginal factor,
119
+ 79 $p _ { \pi _ { z } } ( z )$ , is just the cheap categorical distribution, the conditional factor, $p _ { \eta _ { z } } ( x | z )$ , typically involves
120
+ 80 high-dimensional operations (e.g., the inversion of the full $D \times D$ -dimensional covariance matrices
121
+ 81 in the GMMs). Moreover, the M-step (6) is also expensive for large $K$ . This holds despite that (6)
122
+ 82 can be reduced to closed-form updates of expected sufficient statistics for $p _ { \eta _ { z } } ( x | z )$ belonging to the
123
+ 83 exponential family [44] (again, due to high $D$ ). All in all, the computational complexity of the EM
124
+ 84 algorithm scales with $\mathcal { O } ( T D N K )$ .
125
+
126
+ If (6) cannot be computed under a closed-form solution, one can resort to direct gradient-descent optimization of $\mathcal { Q } ( \boldsymbol { \theta } )$ , where arg max is replaced by one (or more) step(s) of a gradient descent technique. The EM algorithm is then referred to as the generalized EM algorithm [56].
127
+
128
+ # 88 4 The generalized MHSAEM algorithm
129
+
130
+ 89 We design a version of the generalized EM algorithm suitable for scenarios where (4) can represent
131
+ 90 deep, discrete, latent variable models, thus being parameterized by possibly complex nonlinear
132
+ 91 transformations. We particularly focus on decreasing the the number of operations in the generalized
133
+ 92 EM algorithm from $\mathcal { O } ( T D N K )$ to $\mathcal { O } ( T D B M )$ , where $B \ll N$ and $M \ll K$ .
134
+
135
+ # 4.1 E-step
136
+
137
+ 94 We reduce the cost of evaluating the EM objective function (4) by combining the minibatching (as
138
+ 95 used many times before) and the Monte Carlo sampling. Namely, the specific application of the latter
139
+ 96 to generic mixture models is the key contribution of this paper.
140
+ 97 Minibatching. At each iteration, $t$ , we compute the conditional expectation in (4) only for a subset—
141
+ 98 here referred to as a minibatch—of the original full dataset, i.e. $( x _ { i } ) _ { i \in I }$ . Here, $I$ is a set of $B \ll N$
142
+ 99 indices, $i$ , sampled uniformly without replacement from $( 1 , \ldots , \dot { N } )$ . This substantially decreases the
143
+ 100 necessary computations compared to the full sweep over all $N$ datapoints [23].
144
+ 101 Monte Carlo sampling. For each $i \in I$ , we want to draw $M \ll K$ random samples from $p _ { \theta } ( z _ { i } | x _ { i } )$ in
145
+ 102 order to obtain a Monte Carlo estimate of (4). The straightforward way to do this would be to draw
146
+ 103 the samples directly from $p _ { \theta } ( z _ { i } | x _ { i } )$ . However, direct sampling from $p _ { \theta } ( z _ { i } | x _ { i } )$ does not lead to any
147
+ 104 substantial decrease in the number of operations. This is caused by the fact that even for a single
148
+ 105 sample of $z _ { i }$ , we have to first compute the normalizing factor, $p _ { \theta } ( x _ { i } )$ , to obtaining the posterior,
149
+ 106 $p _ { \theta } ( z _ { i } | x _ { i } )$ . This requires $K$ expensive evaluations of $p _ { \theta } ( z _ { i } , x _ { i } )$ , which is precisely what we want to
150
+ 107 avoid. Our approach is to resort to the Markov chain Monte Carlo (MCMC), which allows us to
151
+ 108 sample from $p _ { \theta } ( z _ { i } | x _ { i } )$ , with the computational complexity decreasing to only a single evaluation of
152
+ 109 $p _ { \theta } ( z _ { i } , x _ { i } )$ per a single sample of $z _ { i }$ .
153
+ 110 MCMC methods obviate the computation of the normalizing factor in $p _ { \theta } ( z _ { i } | x _ { i } )$ by simulating a
154
+ 111 Markov chain, $( z _ { i , t } ) _ { t = 1 } ^ { T }$ , from a transition kernel, $z _ { i , t } \sim P ( z _ { i , t - 1 } , \cdot )$ , which leaves $p _ { \theta } ( z _ { i } | x _ { i } )$ as its
155
+ 112 unique stationary (invariant) distribution, starting from an initial value $z _ { i , 0 }$ . The specific form of $P$
156
+ 113 determines the structure of an MCMC method. We chose the Metropolis-Hastings (MH) sampler,
157
+ 114 which represents $P ( z _ { i , t - 1 } , z _ { i , t } )$ as follows: given $\bar { z } _ { i } : = z _ { i , t - 1 }$ , draw a sample from the proposal
158
+ 115 distribution $z _ { i } \sim q ( \cdot | \bar { z } _ { i } )$ , compute the acceptance ratio,
159
+
160
+ $$
161
+ \alpha ( \bar { z } _ { i } , z _ { i } ) : = \operatorname* { m i n } \biggr \{ 1 , \frac { p _ { \eta _ { z _ { i } , t - 1 } } ( x _ { i } | z _ { i } ) \pi _ { z _ { i } , t - 1 } q ( \bar { z } _ { i } | z _ { i } ) } { p _ { \eta _ { \bar { z } _ { i } , t - 1 } } ( x _ { i } | \bar { z } _ { i } ) \pi _ { \bar { z } _ { i } , t - 1 } q ( z _ { i } | \bar { z } _ { i } ) } \biggr \} ,
162
+ $$
163
+
164
+ 116 and, if $u < \alpha \big ( \bar { z } _ { i } , z _ { i } \big )$ —where $u$ is drawn from a uniform distribution, Uniform $( 0 , 1 )$ —accept the
165
+ 117 sample and set $z _ { i , t } = z _ { i }$ ; otherwise, set $z _ { i , t } = \bar { z } _ { i }$ . For each $i \in I$ and $t \in ( 1 , \ldots , T )$ , we repeat
166
+ 118 this process $M$ times, construing a set $\mathbf { z } _ { i , t } = ( z _ { i , t } ^ { 1 } , \dots , z _ { i , t } ^ { M } )$ . Therefore, at every current iteration,
167
+ 119 120 $t$ , we caking $\bar { z } _ { i } = z _ { i , t - 1 } ^ { M }$ extend the chain from the point where we left at the previous iteration, . Under mild regularity assumptions [52], the chain passes the transiti $t - 1$ , byriod
168
+ 121 (the burn-in phase), and the samples can then be used to approximate the conditional expectation in
169
+ 122 (4) as follows:
170
+
171
+ $$
172
+ \widehat { \mathcal { Q } } _ { t - 1 } ( \theta ) = \frac { 1 } { M } \sum _ { i \in I } \sum _ { z \in \mathbf { z } _ { i , t } } \log p _ { \eta _ { z } } ( x _ { i } | z ) \pi _ { z } .
173
+ $$
174
+
175
+ 123 Note that, to ensure this approach is truly efficient, we have to draw only $M \ll K$ samples at each
176
+ 124 iteration, $t$ ; otherwise, for $M \approx K$ , we may rather compute the exact marginalization in (4), since it
177
+ 125 is tractable (but computationally costly).
178
+
179
+ # 4.2 M-step
180
+
181
+ 127 Assume for a moment that (6) with $\mathcal { Q } _ { t - 1 } ( \theta )$ given by (8) has a closed-form solution, yielding an
182
+ 128 estimate of $\theta$ . Such an estimate would have a high variance, converging only for $M \to \infty$ and
183
+ 129 $T \to \infty$ [19]. The main reason is that the samples would not be reused over the iterations, $t$ ,
184
+ 130 thus wasting computational resources. We consider that there is no closed-form solution of (6),
185
+ 131 and—to ensure that the samples (and thus computations) are recycled over the iterations—we use
186
+ 132 the stochastic approximation (SA) [51] to optimize (8). This is analogous to applying a stochastic
187
+ 133 gradient-descent method, $\theta _ { t } = \theta _ { t - 1 } + \gamma _ { t } \nabla _ { \theta } \tilde { \mathcal { Q } } _ { t - 1 } ( \theta )$ , where $\gamma _ { t }$ is the step-size, satisfying the Robbins
188
+ 134 Monro constraints, $\begin{array} { r } { \gamma _ { t } \in [ 0 , 1 ] , \sum _ { t \geq 1 } \gamma _ { t } = \infty , \sum _ { t \geq 1 } \gamma _ { t } ^ { 2 } < \infty , } \end{array}$ and $\nabla _ { \theta }$ is the gradient w.r.t. $\theta$ . In this
189
+ 135 way, the computations made in $\nabla _ { \boldsymbol { \theta } } \widehat { \mathcal { Q } }$ are accumulated via $\theta _ { t }$ and reused over the iterations.
190
+ 136 The parameters $\eta _ { z }$ have a different form based on a specific case of $p _ { \eta _ { z } } ( x | z )$ , whereas $\pi _ { z }$ is a
191
+ 137 permanent structure in (1). Therefore, without loss of generality, we split (6) into a generic part and a
192
+ 138 fixed part as follows:
193
+
194
+ $$
195
+ \begin{array} { r l } & { \eta _ { k , t } = \eta _ { k , t - 1 } + \gamma _ { t } \nabla _ { \eta _ { k } } \widehat { \mathcal { Q } } _ { t - 1 } ( \theta ) , } \\ & { \nu _ { k , t } = \nu _ { k , t - 1 } + \gamma _ { t } \nabla _ { \nu _ { k } } \widehat { \mathcal { Q } } _ { t - 1 } ( \theta ) , } \end{array}
196
+ $$
197
+
198
+ 139 where—to ensure that the probabilities, $( \pi _ { k , t } ) _ { k = 1 } ^ { K }$ , satisfy the constraints (Section 2)—we transform
199
+ 140 $\nabla _ { \pi _ { k } } \widehat { \mathcal { Q } }$ via $\nu _ { k } = \log \pi _ { k }$ and optimize w.r.t. $\nu _ { k }$ . Then, to obtain $( \pi _ { k , t } ) _ { k = 1 } ^ { K }$ from $\nu _ { t } : = ( \nu _ { k , t } ) _ { k = 1 } ^ { K }$ , we
200
+ 141 k b use the softmax function, i.e. $\pi _ { k , t } : = \mathrm { s o f t m a x } ( \pmb { \nu } _ { t } ) _ { k } : = \exp ( \nu _ { k , t } ) / \sum _ { l = 1 } ^ { K } \exp ( \nu _ { l , t } )$ .
201
+
202
+ Computing the gradients for all pairs of $( \nu _ { k } , \eta _ { k } ) _ { k = 1 } ^ { K }$ would be inefficient, especially since ${ \bf z } _ { i , t }$ contains only a small number of unique values of Z for $M \ll K$ . Consequently, we compute $\dot { \nabla } _ { \eta _ { k } } \widehat { \mathcal { Q } }$ and $\nabla _ { \nu _ { k } } \widehat { \mathcal { Q } }$ only for $k \in { \mathrm { u n i q u e } } ( \mathbf { z } _ { i , t } )$ . We summarize the proposed approach in Algorithm 1.
203
+
204
+ # 4.3 Proposal distribution
205
+
206
+ 146 The choice of the proposal distribution has a significant impact on the speed of convergence and the computational cost of the proposed algorithm. Here, we discuss various possible choices of 147 $q \big ( z _ { i } | \bar { z } _ { i } \big )$ .
207
+
208
+ Input: $\theta _ { 0 }$ , $( \mathbf { z } _ { i , 0 } ) _ { i = 1 } ^ { N }$ , $( \mathbf { x } _ { i } ) _ { i = 1 } ^ { N }$
209
+ Output: $( \theta _ { t } ) _ { t = 1 } ^ { T }$ for $t \in ( 1 , \ldots , T )$ or until convergence do form the set $\dot { I } = ( i _ { j } ) _ { j = 1 } ^ { B }$ by sampling (without replacement) $B$ indices $i \sim ( 1 , \dots , N )$ for $i \in I$ do set $\bar { z } _ { i }$ as the last element of $\mathbf { z } _ { i , t - 1 }$ for $j \in ( 1 , \ldots , M )$ do sample $z _ { i } \sim q ( z _ { i } | \bar { z } _ { i } )$ sample $u \sim \mathrm { U n i f o r m } ( 0 , 1 )$ compute $\alpha ( \bar { z } _ { i } , z _ { i } )$ in (7) if $u < \alpha \big ( \bar { z } _ { i } , z _ { i } \big )$ then set $z _ { i , t } ^ { j } = z _ { i }$ and $\bar { z } _ { i } = z _ { i }$ else set $z _ { i , t } ^ { j } = \bar { z } _ { i }$ end if end for set $\mathbf { z } _ { i , t } = ( z _ { i , t } ^ { 1 } , \dots , z _ { i , t } ^ { M } )$ end for compute (8) compute (9) for $k \in { \mathrm { u n i q u e } } ( \mathbf { z } _ { i , t } )$ compute $\pi _ { k , t } : = \mathrm { s o f t m a x } ( \pmb { \nu } _ { t } ) _ { k }$ for $k \in { \mathord { \mathbb { Z } } }$ end for
210
+
211
+ 148 Optimal proposal $( O )$ . The optimal proposal distribution is $q ( z _ { i } | \bar { z } _ { i } ) : = q ( z _ { i } ) : = p _ { \theta } ( z _ { i } | x _ { i } )$ . This
212
+ 149 ensures that the acceptance rate (7) is always $\alpha ( \bar { z } _ { i } , z _ { i } ) = 1$ . However, the need to perform $K$
213
+ 150 expensive evaluations of $p _ { \theta } ( z _ { i } , x _ { i } )$ before sampling from $p _ { \theta } ( z _ { i } | x _ { i } )$ is the reason we resorted to
214
+ 151 the MH sampler in the first place. We consider this case only to set the upper limit on admissible
215
+ 152 computational cost and to study the impact of sub-optimal proposal distribtions.
216
+ 153 Uniform proposal $( U )$ . The uniform distribution on the discrete interval from 1 to $K$ , i.e. $q ( z _ { i } | \bar { z } _ { i } ) : =$
217
+ 154 $q ( z _ { i } ) : = \mathrm { U n i f o r m } ( 1 , K )$ , is the simplest and computationally cheapest variant of the proposal
218
+ 155 distribution. However, due to poor mixing properties, the algorithm may converge slowly for high $K$ .
219
+ 156 Tabular proposal with forgetting $( T F )$ . The key requirement to design a proposal distribution is to
220
+ 157 restrict its computational complexity somewhere between that of the $\mathrm { U }$ and $\mathrm { o }$ proposals. One way to
221
+ 158 satisfy this constraint is to use the Markov chain, $( z _ { i , t } ) _ { t = 1 } ^ { T }$ , to learn a transition kernel, $p ( z _ { i } | \bar { z } _ { i } )$ , see,
222
+ 159 e.g. [3]. Unfortunately, this would require us to store a table with $K ^ { 2 }$ entries for each $i \in ( 1 , \ldots , N )$ ,
223
+ 160 161 which is very demanding evethe Markov chain and define: $q ( z _ { i } | \bar { z } _ { i } ) : = q _ { \alpha _ { i } } ( z _ { i } ) : = \mathcal { C } ( \alpha _ { i } )$ $K$ $N$ herefore, where $\mathcal { C } ( \pmb { \alpha } _ { i } ) \propto \Pi _ { k = 1 } ^ { K } \alpha _ { k , i } ^ { \bar { 1 ( } z _ { i } = k ) }$ nce inis the
224
+ 162 categorical distribution with the weights $\pmb { \alpha } _ { i } : = ( \alpha _ { 1 , i } , \dots , \alpha _ { K , i } )$ . For $\mathcal { L } ( \pmb { \alpha } _ { i } ) : = \Sigma _ { \tau = 1 } ^ { t } \log q _ { \pmb { \alpha } _ { i } } ( z _ { i , \tau } )$
225
+ 163 we obtain an estimate of $\alpha _ { i }$ at iteration $t$ as follows: $\begin{array} { r } { \alpha _ { i , t } : = \mathrm { \ a r g m a x } _ { \alpha _ { i } } \mathcal L ( \alpha _ { i } ) \ = \ \frac { n _ { i , t } } { t } } \end{array}$ t , with
226
+ 164 $n _ { i , t } = \Sigma _ { \tau = 1 } ^ { t } \mathbf { e } _ { z _ { i , t } }$ , where $\mathbf { e } _ { k }$ is the standard basis vector (a one-hot vector) with one at $k$ th position
227
+ 165 and zeros otherwise. This can be further rewritten into a recursive form: $n _ { i , t } = n _ { i , t - 1 } + \mathbf { e } _ { z _ { i , t } }$ or,
228
+ 166 using the Robbins-Monro step-size, $n _ { i , t } = ( { \bf 1 } - { \bf e } _ { z _ { i , t } } \gamma _ { t } ) \odot n _ { i , t - 1 } + \gamma _ { t } { \bf e } _ { z _ { i , t } }$ , where 1 is the vector of
229
+ 167 ones, and $\odot$ is the Hadamard product. We refer to this case simply as “table with forgetting” (TF)
230
+ 168 due to that it represents $N \times K$ table in the memory and $\gamma _ { t }$ is a forgetting factor.
231
+
232
+ # 169 5 Related work
233
+
234
+ Stochastic approximation expectation-maximization. The application of SA to prevent the evaluation
235
+ 1 of all $K$ components in mixture models has been overlooked for a long time. The reason is that the
236
+ 72 original motivation to combine the EM algorithm with SA is to address the analytical intractability
237
+ 73 of the expected value under $p _ { \theta } ( z | x )$ in (4), which is, however, almost always tractable for mixture
238
+ 74 models. The intractability issue is addressed by either the Monte Carlo SAEM (MCSAEM) [12]
239
+ 75 or the Markov chain Monte Carlo SAEM (MCMCSAEM) [31]. Applying the former approach to
240
+ 76 mixture models would be inefficient, since it evaluates $K$ joint distributions, $p _ { \theta } ( z , x )$ , before drawing
241
+ 177 $M$ samples from $p _ { \theta } ( z | x )$ . Therefore, this method reduces only the computational cost of updating the
242
+ 178 sufficient statistics. This is addressed by the latter approach, where $M < K$ samples from a proposal
243
+ 179 distribution, $q ( z | x )$ , is used to calculate $p _ { \theta } ( z , x )$ and also the sufficient statistics. However, all these
244
+ 180 methods process all data at every iteration, providing only a limited advantage over the conventional
245
+ 181 EM algorithm. Minibatch versions of these techniques have recently been proposed [27, 32, 1].
246
+ 182 All the above methods commonly assume $p _ { \theta } ( z , x )$ belonging to the exponential family. This provides
247
+ 183 a convenient, but limiting, property which allows (6) to be computed under a closed-form solution.
248
+ 184 The main contribution of our work is to release this restrictive assumption by admitting that $p _ { \theta } ( z , x )$
249
+ 185 (and thus $\mathcal { Q }$ ) is given by possibly complex and intractable transformations.
250
+ 186 Sparse and truncated variational techniques. There is only a small body of methods explicitly
251
+ 187 reducing the number of evaluated components. Their common aspect is that they follow from the
252
+ 188 variational framework, where the exact posterior, $p _ { \theta } ( z | x )$ , is approximated by a variational posterior,
253
+ 189 $q ( z | x )$ . This sparse, approximate, posterior is defined over a lower number of components, $M \ll K$ ,
254
+ 190 such that only the important components are selected, relying on relaxation of the hard EM algorithm
255
+ 191 from taking a single $M = 1$ assignment [26] to taking multiple $M \ll K$ assignments. The sparse
256
+ 192 SAEM (SSAEM) algorithm [24] selects the components by a quick partial sorting of the posterior
257
+ 193 probabilities, $p _ { \theta } ( z | x )$ . Again, this requires $K$ evaluations of $p _ { \theta } ( z , x )$ before the sorting, thus only
258
+ 194 reducing the amount of updated statistics. Similarly, the truncated SAEM (TSAEM) algorithm [18]
259
+ 195 selects $M < K$ cluster-to-cluster and $\bar { M } < K$ cluster-to-datapoint minimal Euclidean distances,
260
+ 196 preventing the problem in the SSAEM algorithm. However, all these distances are evaluated for all
261
+ 197 components in a pairwise manner, leading to $K ^ { 2 }$ -computational complexity, which makes the saving
262
+ 198 dubious. Similarly as before, these methods assume $p _ { \theta } ( z , x )$ to belong to the exponential family.
263
+
264
+ ![](images/0c516376ee7ecf27c7edaec6674fb19224d829bc10798ac37d421adee064aa0e.jpg)
265
+ Figure 1: The training log-likelihood, $\mathcal { L } ( \boldsymbol { \theta } _ { t } )$ , versus the computational time (in seconds). Here, on the $\mathbf { X }$ -axis, the computational time at a current iteration, $t$ , is obtained by accumulating the time from the previous iterations. corresponds to $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ , where $t _ { 9 5 }$ is the iteration of reaching $9 5 \%$ of max $\mathcal { L } ( \boldsymbol { \theta } _ { t } )$ . The projection of $^ { \circ }$ on the $\mathbf { X }$ -axis gives the time to reach $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ . This experiment was performed with the following settings: $( D , \bar { K } , N , \omega , B , M , T ) = ( 1 0 , 1 0 0 , 1 0 k , 0 . 1 , \bar { 2 } 0 0 , 2 , 2 0 k )$ , see Section 6.1 for details. The results are averaged over five repetitions.
266
+
267
+ 199 We summarize the distinguishing features of the above discussed methods in Table 1.
268
+
269
+ # 6 Experiments
270
+
271
+ To demonstrate the key features of our algorithm—its low computational complexity, competitive learning performance, and generality—we use it below to train: (i) GMMs on synthetic datasets, and (ii) SPTNs [47] and (iii) mixtures of real NVP flows [48] on real datasets. All experiments have been performed on a Slurm cluster equipped with Intel Xeon Scalable Gold 6146 with 384GB of RAM.
272
+
273
+ # 6.1 Gaussian mixture models
274
+
275
+ Consider the special case of a data-generating distribution given by (1), with the components taking the form of the multivariate Gaussian distribution, $p _ { \eta _ { z } } ( x | z ) = \mathcal { N } ( x ; \mu _ { z } , \Sigma _ { z } )$ , where $\mu _ { z }$ is the mean value and $\Sigma _ { z }$ is the covariance matrix. The difficulty of learning GMMs heavily depends on the degree of interaction among all mixture components, hence having the ability to generate synthetic datasets with arbitrary overlap characteristics between all pairs of components is crucial for systematic
276
+
277
+ ![](images/0ced572977ae404a4e785379dc4987ce758b6f6930ca4d73adbe35955ed678b7.jpg)
278
+ Figure 2: The absolute error, $\mathrm { A E } = | \mathcal { L } ( \theta _ { t _ { 9 5 } } ) - \mathcal { L } ( \theta ) |$ , versus the computational time (in seconds). All experiments use the following settings: $( D , K , \dot { N } , \omega , B , M , T ) = \bar { ( } 1 0 , 1 0 0 , 1 0 k , 0 . 1 , 2 0 0 , 2 , 2 0 k )$ , where the number of components, $K$ , (left), the batchsize, $B$ , (middle) and the number of samples, $M$ , (right) change for different values denoted by $( + , \sqsupset , \circ , \pmb { \triangle } )$ . At each of these points (marks), we perform an experiment as illustrated in Figure 1, find $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ to compute the AE, and record the time corresponding to $t _ { 9 5 }$ . The results are averaged over five repetitions.
279
+
280
+ 211 evaluation of performance of learning algorithms [43]. Traditional techniques usually define overlap
281
+ 212 (or separation) of components only in terms of their mean vectors and maximum eigenvalues of the
282
+ 213 covariance matrices, not accounting for their rotation and mixing weights (see [36] for a detailed
283
+ 214 treatment of the problem). We therefore use a more objective measure of the clustering complexity
284
+ 215 defined by the total probability of misclassification [41], which allows to generate data with a
285
+ 216 user-defined degree of maximum pairwise overlap, $\omega$ .
286
+ 217 Experiment settings: We generate the parameters of (1), and the corresponding dataset, uniquely for a
287
+ 218 given quadruple $( D , K , N , \omega )$ . Therefore, the parameters of the generative model are known and we
288
+ 219 can measure and display the convergence of the training log-likelihood, $\mathcal { L } ( \boldsymbol { \theta } _ { t } )$ , compared to the exact
289
+ 220 log-likelihood, $\mathcal { L } ( \boldsymbol { \theta } ) \dot { }$ , for $t = ( 1 , \ldots , T )$ . We are further interested in the absolute error between the
290
+ 221 training log-likelihood at the iteration of reaching $9 5 \%$ of its maximum value, $t _ { 9 5 }$ , and the exact
291
+ 222 log-likelihood, i.e. $\mathrm { A E } = | \mathcal { L } ( \theta _ { t _ { 9 5 } } ) - \mathcal { L } ( \theta ) |$ .
292
+ 23 We also measure the computational time until reaching $t _ { 9 5 }$ . We have used $9 5 \%$ of the maximum
293
+ 24 value instead of the maximum value to prevent cases, where the model oscillate around target value,
294
+ 25 making the estimate of convergence time very noisy (for example MCSAEM in Figure 1).
295
+ 226 Algorithms: The GMMs belong to the exponential family of probability distributions. This allows us
296
+ 227 to find a closed-form, recursive, solution of (6), relying on a Robbins-Monro type of the step-size
297
+ 228 sequence, $( \gamma _ { t } ) _ { t = 1 } ^ { T }$ , [7, 44]. In this setting, we compare our MHSAEM algorithm with a number of
298
+ 229 related methods in Table 1. Note we use the acronyms U and TF to specify the proposal distribution of
299
+ 230 the MHSAEM algorithm (Section 4.3). However, we do not use the O-proposal, since the MHSAEM
300
+ 231 O algorithm is equivalent to the MCSAEM algorithm. All the SA-variants in Table 1 use a minibatch
301
+ 232 of size $B$ . The key quantity to reduce the number of evaluated components and/or sufficient statistics
302
+ 233 in the SSAEM, TSAEM, MCSAEM and MHSAEM algorithms is collectively denoted by $M$ (Section
303
+ 234 5). Note that we always keep $M = \bar { M }$ in the TSAEM algorithm (see Figure 1 and 2 for concrete
304
+ 235 numbers). We use the step-size given by $\gamma _ { t } = 1$ for $t = 1 , \ldots , 5 0$ and $\gamma _ { t } = 0 . 0 5$ otherwise. In
305
+ 236 this section, to counteract the issue of attaining poor local optima, we equip all algorithms with the
306
+ 237 anti-annealing schedule $( \beta _ { t } ) _ { t = 1 } ^ { T }$ , starting with $\beta _ { 1 } = 0 . 1$ , reaching $\beta _ { 2 / 3 T } = 1 . 2$ , and decreasing back
307
+ 238 to $\beta _ { T } = 1 . 0$ , see [43] for details. The initial estimates of: (i) $\mu _ { k }$ are uniformly drawn from the unit
308
+ 239 hyper-cube, (ii) $\Sigma _ { k }$ are fixed to unit diagonal matrix, and (iii) $\pi _ { k }$ are uniformly drawn from the unit
309
+ 240 interval (followed by normalization).
310
+ 241 Results: Figure 1 shows that the EM [13] and SAEM [44] algorithms take the longest time to
311
+ 242 converge, attaining a poor local optima. On the other hand, the MCSAEM [1] and MHSAEM (U
312
+ 243 and TF) algorithms achieve $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ closest to the likelihood $\mathcal { L } ( \boldsymbol { \theta } )$ of the true model. Moreover, both
313
+ 244 MHSAEM algorithms reach this value in the shortest time compared to all the other methods. The
314
+ 245 SSAEM [24] and TSAEM [18] algorithms are comparable in terms of the computational time, but
315
+ 246 they both provide the lowest $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ . In Figure 2, we investigate sensitivity of fitting the model to
316
+ 47 increasing values of $K$ , $B$ and $M$ by measuring the time and the likelihood again. In all the cases,
317
+ 48 the proposed MHSAEM algorithms achieve the lowest AE in the shortest time.
318
+
319
+ SSAEM and TSAEM algorithms failed to converge for $M > 2$ and for $K > 5 0$ respectively. We believe this is caused by selecting only $M$ maximal probabilities in the SSAEM (or distances in the TSAEM) algorithm (Section 5), which prevents certain, but not a negligible number of, components from being updated, thus providing only a crude approximation of $\bar { p } _ { \theta } \bar { ( } z | x )$ . The results then suffer from substantial variational gap to the exact log-likelihood (Figure 1). On the contrary, MH sampler provides samples which consistently approximate $p _ { \theta } ( z | x )$ despite evaluating much lower number of components in each step.
320
+
321
+ # 6.2 Sum-product transform networks
322
+
323
+ The sum product networks (SPNs) are a deep learning extension of finite mixture models. They can be interpreted as a mixture of trees [60], where each tree corresponds to a component. Therefore, they can be cast into the form of (1), but the number of components grows exponentially with their depth. In this section, we use recently proposed SPTNs which introduce additional transformation nodes to provide better expressiveness than the SPNs (SPTNs effectively generalize SPNs and flow models into one large family of models).
324
+
325
+ Experimental settings: We use 19 real datasets from the UCI database [16, 37, 35, 54], preprocessed in the same way as in [46]. For each experiment, we randomly split the data into $64 \%$ , $16 \%$ and $20 \%$ for training, validation and testing, respectively. We calculate the average log-likelihood on the test set and measure again the time to reach $9 5 \%$ of the maximal training log-likelihood, $\mathcal { L } ( \boldsymbol { \theta } _ { t _ { 9 5 } } )$ .
326
+
327
+ To evaluate various (possibly shallow and/or deep) architectures of SPTNs, we fit each dataset with all the following combinations of hyper-parameters1: $s \in ( 8 , 3 2 , 1 2 8 )$ , $b \in ( 2 , 4 , 6 , 8 )$ , $l \in ( 2 , 3 , 4 )$ , where $s$ is the number of children of each sum node, $b$ is the number of partitions of each product node, and $l$ is the number of layers (one layer contains sum and product nodes). The number of components of the SPTN, after its conversion into (1), is given as follows: $K = s ^ { l }$ . Note that the maximum number of components for the investigated parameters of the SPTN is 268,435,456. To reduce the space of possible architectures, we restrict ourselves only to (i) the leaf nodes given by $\mathcal { N } ( 0 , \bf { I } )$ ; (ii) affine transformations fixed to the singular value decomposition, choosing the the Givens parameterization for the unitary matrices [47]; and (iii) no sharing of any type of nodes [47].
328
+
329
+ 276 Algorithms: We evaluate only on the MHSAEM-U algorithm—due to its favourable computational
330
+ 277 complexity and simplicity—and compare it with the stochastic gradient-descent (SGD) algorithm,
331
+ 278 which is routinely used to train SP(T)Ns [45, 47]. In this case, SGD in each iteration performs
332
+ 279 computations over all subtrees of the network, whereas the MHSAEM-U algorithm computes with
333
+ 280 only $M = 1$ subtrees, thus we should observe speed-up of the computations. In our implementation,
334
+ 281 both these methods perform optimization of their respective objective functions—the log-likelihood
335
+ 282 (2) for SGD and the EM objective (8) for MHSAEM-U—via the use of the automatic differentiation
336
+ 283 and the ADAM optimizer [29], using $B = 1 0 0$ and $T = 2 0 0 0 0$ .
337
+
338
+ Results: Since each dataset might benefit from a different architecture, Table 6.2 shows the test log-likelihood of the architectures selected according to the best likelihood measured on the validation set and the corresponding speed-up. The test log-likelihoods reveal that the MHSAEM-U algorithm outperforms the SGD algorithm on 10 out of 19 datasets, which was not originally the goal, but the added stochasticity helps to escape poor local minima. The speed-up demonstrates lower computational complexity of the MHSAEM-U algorithm on 17 out of 19 datasets, which was the main goal. The magic-telescope and wine datasets show approximately $1 0 2 \times$ and $7 5 \times$ speed-up, respectively, while on very small datasets (pima-indians and iris), the SGD is faster due to effective implementation. In the supplementary material, we present Table 3, exhibiting the same trends on a fixed architecture.
339
+
340
+ # 6.3 Mixtures of real NVP flows
341
+
342
+ We consider another class of mixture models (1), where each component $p _ { \eta _ { z } } ( x | z )$ is transformed by the flow model—real NVP [15]. These transformations are parameterized via deep neural networks, allowing for flexible adjustment of the learning capacity of each component.
343
+
344
+ Table 2: The speed-up and test log-likelihood, $\mathcal { L } ^ { \mathrm { t e s t } }$ , for the SGD and MHSAEM-U algorithms. The test log-likelihood (higher is better) is computed for the best model, with the corresponding $K$ , which is selected based on the validation log-likelihood. The speed-up is computed as the ratio of MHSAEM-U to SGD, i.e. their time to reach $9 5 \%$ of the training log-likelihood. The results are averaged over five repetitions. Then, the higher test log-likelihood is highlighted with bold blue, and and no speed-up is highlighted with red. The average rank is computed as the standard competition (“1224”) ranking [14] on each dataset (lower is better).
345
+
346
+ <table><tr><td rowspan="3"></td><td colspan="5">Sum-product transformnetworks</td><td colspan="5">Mixtures of real NVP flows SGD</td></tr><tr><td rowspan="2"></td><td colspan="2">SGD</td><td colspan="2">MHSAEM-U</td><td colspan="2"></td><td colspan="2"></td><td colspan="2">MHSAEM-U</td></tr><tr><td>speed-up</td><td>Ltest</td><td>K</td><td>Ltest</td><td>K</td><td>speed-up</td><td>Ltest</td><td>K 32</td><td>Ltest</td><td>K</td></tr><tr><td>breast-cancer-wisconsin</td><td>4.66</td><td>-4.66</td><td>64</td><td>1.43</td><td>1024</td><td>0.63</td><td>-99.85</td><td></td><td>-39.31</td><td></td><td>128</td></tr><tr><td>cardiotocography</td><td>10.55</td><td>59.52</td><td>512</td><td>31.04</td><td>1024</td><td></td><td>9.85</td><td>54.34</td><td>32</td><td>56.08</td><td>128</td></tr><tr><td>magic-telescope</td><td>102.53</td><td>-3.65</td><td>512</td><td>-5.03</td><td>1024</td><td></td><td>3.74</td><td>-3.97</td><td>8</td><td>-4.22</td><td>8</td></tr><tr><td>pendigits</td><td>4.89</td><td>0.88</td><td>1024</td><td>-4.86</td><td>16384</td><td></td><td>4.17</td><td>1.46</td><td>8</td><td>0.48</td><td>8</td></tr><tr><td>pima-indians</td><td>0.37</td><td>-8.54</td><td>64</td><td>-7.62</td><td></td><td>64</td><td>1.35</td><td>-20.09</td><td>128</td><td>-16.33</td><td>128</td></tr><tr><td>wall-following-robot</td><td>3.43</td><td>1.84</td><td>1024</td><td>-11.3</td><td>16384</td><td></td><td>22.21</td><td>-14.26</td><td>128</td><td>-17.56</td><td>128</td></tr><tr><td>waveform-1</td><td>4.35</td><td>-26.14</td><td>64</td><td>-23.91</td><td>1024</td><td></td><td>3.72</td><td>-34.12</td><td>8</td><td>-33.42</td><td>8</td></tr><tr><td>waveform-2</td><td>4.82</td><td>-26.21</td><td>64</td><td>-23.91</td><td></td><td>1024</td><td>4.12</td><td>-34.15</td><td>8</td><td>-33.64</td><td>8</td></tr><tr><td>yeast</td><td>20.57</td><td>10.26</td><td>512</td><td>5.18</td><td>1024</td><td></td><td>14.49</td><td>6.61</td><td>128</td><td>9.59</td><td>128</td></tr><tr><td>ecoli</td><td>1.86</td><td>-5.5</td><td>64</td><td>-0.22</td><td>1024</td><td></td><td>2.15</td><td>-11.37</td><td>128</td><td>-10.64</td><td>128</td></tr><tr><td>ionosphere</td><td>1.88</td><td>-20.27</td><td>64</td><td>-5.93</td><td></td><td>512</td><td>2.74</td><td>-87.01</td><td>128</td><td>-42.75</td><td>128</td></tr><tr><td>iris</td><td>0.23</td><td>-10.65</td><td>64</td><td>-1.49</td><td>16384</td><td></td><td>3.28</td><td>-16.34</td><td>128</td><td>-9.21</td><td>32</td></tr><tr><td>page-blocks</td><td>12.18</td><td>12.21</td><td>512</td><td>6.84</td><td>1024</td><td></td><td>44.95</td><td>17.13</td><td>128</td><td>17.94</td><td>32</td></tr><tr><td>parkinsons</td><td>1.46</td><td>-21.85</td><td>64</td><td>0.5</td><td></td><td>512</td><td>3.09</td><td>-566.58</td><td>128</td><td>-33.31</td><td>32</td></tr><tr><td>sonar</td><td>2.96</td><td>-95.39</td><td>512</td><td>-69.29</td><td></td><td>64</td><td>2.52</td><td>-622.2</td><td>128</td><td>-88.81</td><td>128</td></tr><tr><td>statlog-segment</td><td>1.44</td><td>47.35</td><td>512</td><td>26.53</td><td>16384</td><td></td><td>38.49</td><td>35.84</td><td>128</td><td>42.04</td><td>32</td></tr><tr><td>statlog-vehicle</td><td>2.97</td><td>-4.25</td><td>64</td><td>-5.45</td><td>1024</td><td></td><td>6.78</td><td>-31.34</td><td>32</td><td>-26.43</td><td>128</td></tr><tr><td>wine rank</td><td>75.42</td><td>-25.99</td><td>1024</td><td>-13.27</td><td></td><td>1024</td><td>2.05</td><td>-171.58</td><td>128</td><td>-25.57</td><td>128</td></tr><tr><td></td><td></td><td>1.56</td><td></td><td>1.44</td><td></td><td></td><td></td><td>1.83</td><td></td><td>1.17</td><td></td></tr></table>
347
+
348
+ 298 Experimental settings: We use the same experimental settings and evaluation metrics as in Section
349
+ 299 6.2. We apply the mixture model on all datasets, changing the number of components as follows:
350
+ 300 $K \in ( 8 , 3 2 , 1 2 8 )$ . Each real NVP-based component in the mixture model has (i) the translation
351
+ 301 function parameterized via multi-layer perceptron with a single hidden layer of dimension 10, using
352
+ 302 the rectified linear activation function; and (ii) the scale function parameterized via the same network
353
+ 303 except with the hyperbolic tangent activation function. We do not use the batch normalization [15] and
354
+ 304 we stack two layers of the translation-scale transformation (we have used implementation from [20]).
355
+
356
+ Algorithms: The algorithms and their settings are the same as those in Section 6.2.
357
+
358
+ 306 Results: The experimental results are presented in right part of Table 6.2. They are similar to those
359
+ 307 obtained in the previous section. In terms of the test log-likelihood, the MHSAEM-U algorithm
360
+ 308 outperforms the SGD algorithm on all but three datasets, and it provides a substantial speed-up on all
361
+ 309 datasets except one. The test likelihood of models with the real NVP flows is most of the time worse
362
+ 310 than that of SPTNs with the affine transformations. As explained in the supplementary, this is due to
363
+ 311 the overfitting, which has been observed in [47].
364
+
365
+ # 312 7 Conclusion
366
+
367
+ 313 This paper has presented a method to decrease computational complexity of fitting mixture models,
368
+ 314 including their generalizations, such as sum-product-(transform) networks and mixtures of flow
369
+ 315 models. The speed-up is achieved by evaluating and updating only a single component (per iteration),
370
+ 316 where the Metropolis-Hasting algorithm ensures sampling of components from a proper posterior. An
371
+ 317 experimental comparison on all three classes of models mentioned above confirmed the theoretical
372
+ 318 expectations. The method significantly speeds-up the fitting time and, importantly, without sacrificing
373
+ 319 the quality of the fit. In fact, the likelihood was better than that of the models fitted by the EM
374
+ 320 algorithm or the SGD algorithm in more than $50 \%$ of cases. We attribute this to higher stochasticity,
375
+ 321 which helps to escape from poor local minima.
376
+ 322 In the experiments, the proposed method has used a uniform proposal distribution in the MH sampler.
377
+ 323 Despite outperforming the alternative methods, we conjecture that this limits the speed of convergence.
378
+ 324 Therefore, we believe that there is still a room for improvement in the implementation. We plan to
379
+ 325 address these issues in future work.
380
+
381
+ The presented method decreases the computational complexity of fitting large (and deep) mixture models, which leads to five to hundred time speed-up depending on a size of the problem (although negative exceptions occurs). We believe this line of research, which we want to continue, to have important benefits. First, it is directly related to decrease in energy consumption and in production of CO2 (we expect similar rates as the speedup). Second, it has a positive effect on financial aspects of deploying (and experimenting with) mixture models. Third, it decreases the hardware requirements, as in all experiments presented above the model was fitted on a single-core.
382
+
383
+ # References
384
+
385
+ [1] S. Allassonnière and J. Chevallier. A new class of stochastic EM algorithms: Escaping local maxima and handling intractable sampling. Computational Statistics & Data Analysis, 159:107159, 2021.
386
+ [2] S. Ayesha, M. K. Hanif, and R. Talib. Overview and comparative study of dimensionality reduction techniques for high dimensional data. Information Fusion, 59:44–58, 2020.
387
+ [3] D. S. Bai. Efficient estimation of transition probabilities in a Markov chain. The Annals of Statistics, pages 1305–1317, 1975.
388
+ [4] D. M. Blei, A. Kucukelbir, and J. D. McAuliffe. Variational inference: A review for statisticians. Journal of the American statistical Association, 112(518):859–877, 2017.
389
+ [5] J. Blömer and K. Bujna. Adaptive seeding for Gaussian mixture models. In Pacific-asia conference on knowledge discovery and data mining, pages 296–308. Springer, 2016.
390
+ [6] T. Campbell and B. Beronov. Sparse variational inference: Bayesian coresets from scratch. arXiv preprint arXiv:1906.03329, 2019.
391
+ [7] O. Cappé and E. Moulines. On-line expectation–maximization algorithm for latent data models. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 71(3):593–613, 2009.
392
+ [8] J. Chen, J. Zhu, Y. Teh, and T. Zhang. Stochastic expectation maximization with variance reduction. Advances in Neural Information Processing Systems, page 7967, 2018.
393
+ [9] N. Chopin. A sequential particle filter method for static models. Biometrika, 89(3):539–552, 2002.
394
+ [10] G. Compiani and Y. Kitamura. Using mixtures in econometric models: A brief review and some new results. The Econometrics Journal, 19(3):C95–C127, 2016.
395
+ [11] S. Dasgupta. Learning mixtures of Gaussians. In 40th Annual Symposium on Foundations of Computer Science (Cat. No. 99CB37039), pages 634–644. IEEE, 1999.
396
+ [12] B. Delyon, M. Lavielle, E. Moulines, et al. Convergence of a stochastic approximation version of the EM algorithm. The Annals of Statistics, 27(1):94–128, 1999.
397
+ [13] A. P. Dempster, N. M. Laird, and D. B. Rubin. Maximum likelihood from incomplete data via the EM algorithm. Journal of the Royal Statistical Society: Series B (Methodological), 39(1):1–22, 1977.
398
+ [14] J. Demšar. Statistical comparisons of classifiers over multiple data sets. The Journal of Machine Learning Research, 7:1–30, 2006.
399
+ [15] L. Dinh, J. Sohl-Dickstein, and S. Bengio. Density estimation using real NVP. In 5th International Conference on Learning Representations, ICLR 2017, 2017.
400
+ [16] D. Dua and C. Graff. UCI machine learning repository, 2017.
401
+
402
+ [17] D. Feldman, M. Faulkner, and A. Krause. Scalable training of mixture models via coresets. In Proceedings of the 24th International Conference on Neural Information Processing Systems, pages 2142–2150, 2011. 372 [18] D. Forster and J. Lücke. Can clustering scale sublinearly with its clusters? A variational EM acceleration of GMMs and k-means. In International Conference on Artificial Intelligence and Statistics, pages 124–132. PMLR, 2018. [19] G. Fort, E. Moulines, et al. Convergence of the Monte Carlo expectation maximization for curved exponential families. Annals of Statistics, 31(4):1220–1259, 2003. [20] J. Franc˚u. Continuousflows.jl. https://github.com/janfrancu/ContinuousFlows.jl, 2020. [21] K. Greff, S. van Steenkiste, and J. Schmidhuber. Neural expectation maximization. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 6694–6704, 2017. [22] R. Gribonval, A. Chatalic, N. Keriven, V. Schellekens, L. Jacques, and P. Schniter. Sketching datasets for large-scale learning (long version). arXiv preprint arXiv:2008.01839, 2020. [23] M. D. Hoffman, D. M. Blei, C. Wang, and J. Paisley. Stochastic variational inference. Journal of Machine Learning Research, 14(5), 2013. [24] M. C. Hughes and E. B. Sudderth. Fast learning of clusters and topics via sparse posteriors. arXiv preprint arXiv:1609.07521, 2016. [25] K. Humphreys and D. Titterington. Approximate Bayesian inference for simple mixtures. In COMPSTAT, pages 331–336. Springer, 2000. [26] B.-H. Juang and L. R. Rabiner. The segmental K-means algorithm for estimating parameters of hidden Markov models. IEEE Transactions on acoustics, speech, and signal Processing, 38(9):1639–1641, 1990. [27] B. Karimi, M. Lavielle, and É. Moulines. On the convergence properties of the mini-batch EM and MCEM algorithms, 2019. [28] N. Keriven, A. Bourrier, R. Gribonval, and P. Pérez. Sketching for large-scale learning of mixture models. Information and Inference: A Journal of the IMA, 7(3):447–508, 2018. [29] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. [30] A. Kucukelbir, D. Tran, R. Ranganath, A. Gelman, and D. M. Blei. Automatic differentiation variational inference. The Journal of Machine Learning Research, 18(1):430–474, 2017. [31] E. Kuhn and M. Lavielle. Coupling a stochastic approximation version of EM with an MCMC procedure. ESAIM: Probability and Statistics, 8:115–131, 2004. [32] E. Kuhn, C. Matias, and T. Rebafka. Properties of the stochastic approximation EM algorithm with mini-batch sampling. Statistics and Computing, 30(6):1725–1739, 2020. [33] A. Lagrange, M. Fauvel, and M. Grizonnet. Large-scale feature selection with Gaussian mixture models for the classification of high dimensional remote sensing images. IEEE Transactions on Computational Imaging, 3(2):230–242, 2017. [34] M. Lavine and M. West. A Bayesian method for classification and discrimination. Canadian Journal of Statistics, 20(4):451–461, 1992. [35] M. Little, P. McSharry, S. Roberts, D. Costello, and I. Moroz. Exploiting nonlinear recurrence and fractal scaling properties for voice disorder detection. Nature Precedings, pages 1–1, 2007. [36] R. Maitra and V. Melnykov. Simulating data to study performance of finite mixture modeling and clustering algorithms. Journal of Computational and Graphical Statistics, 19(2):354–376, 2010.
403
+
404
+ 15 [37] O. L. Mangasarian and W. H. Wolberg. Cancer diagnosis via linear programming. Technical report, University of Wisconsin-Madison Department of Computer Sciences, 1990.
405
+ 17 [38] J.-M. Marin, K. Mengersen, and C. P. Robert. Bayesian modelling and inference on mixtures of distributions. Handbook of statistics, 25:459–507, 2005.
406
+ 19 [39] C. A. McGrory, D. C. Ahfock, J. A. Horsley, and C. L. Alston. Weighted Gibbs sampling for mixture modelling of massive datasets via coresets. Stat, 3(1):291–299, 2014. [40] G. J. McLachlan, S. X. Lee, and S. I. Rathnayake. Finite mixture models. Annual review of statistics and its application, 6:355–378, 2019.
407
+ 423 [41] V. Melnykov, W.-C. Chen, and R. Maitra. MixSim: An R package for simulating data to study performance of clustering algorithms. Journal of Statistical Software, 51(12):1, 2012.
408
+ 25 [42] T. Monnier, T. Groueix, and M. Aubry. Deep transformation-invariant clustering. In Conference on Neural Information Processing Systems (NeurIPS 2020), 2020. [43] I. Naim and D. Gildea. Convergence of the EM algorithm for Gaussian mixtures with unbalanced mixing coefficients. In Proceedings of the 29th International Coference on International Conference on Machine Learning, pages 1427–1431, 2012. [44] H. D. Nguyen, F. Forbes, and G. J. McLachlan. Mini-batch learning of exponential family finite mixture models. Statistics and Computing, pages 1–18, 2020. [45] R. Peharz, A. Vergari, K. Stelzner, A. Molina, X. Shao, M. Trapp, K. Kersting, and Z. Ghahramani. Random sum-product networks: A simple and effective approach to probabilistic deep learning. In Uncertainty in Artificial Intelligence, pages 334–344. PMLR, 2020. [46] T. Pevný. Loda: Lightweight on-line detector of anomalies. Machine Learning, 102(2):275–304, 2016. [47] T. Pevný, V. Šmídl, M. Trapp, O. Polácek, and T. Oberhuber. Sum-product-transform networks: ˇ Exploiting symmetries using invertible transformations. arXiv preprint arXiv:2005.01297, 2020. [48] G. G. Pires and M. A. Figueiredo. Variational mixture of normalizing flows. arXiv preprint arXiv:2009.00585, 2020.
409
+ 42 [49] A. Rau, C. Maugis-Rabusseau, M.-L. Martin-Magniette, and G. Celeux. Co-expression analysis of high-throughput transcriptome sequencing data with Poisson mixture models. Bioinformatics, 31(9):1420–1427, 2015.
410
+ 45 [50] R. A. Redner and H. F. Walker. Mixture densities, maximum likelihood and the EM algorithm. SIAM review, 26(2):195–239, 1984.
411
+ 47 [51] H. Robbins and S. Monro. A stochastic approximation method. The annals of mathematical statistics, pages 400–407, 1951.
412
+ 49 [52] C. Robert and G. Casella. Monte Carlo statistical methods. Springer Science & Business Media, 2013. [53] W. Siblini, P. Kuntz, and F. Meyer. A review on dimensionality reduction for multi-label classification. IEEE Transactions on Knowledge and Data Engineering, 2019.
413
+ 53 [54] J. P. Siebert. Vehicle recognition using rule based methods. 1987. [55] C. Viroli and G. J. McLachlan. Deep gaussian mixture models. Statistics and Computing, 29(1):43–51, 2019.
414
+ 56 [56] C. F. J. Wu. On the convergence properties of the EM algorithm. The Annals of statistics, pages 95–103, 1983.
415
+ 58 [57] D. Wu and J. Ma. An effective EM algorithm for mixtures of Gaussian processes via the MCMC sampling and approximation. Neurocomputing, 331:366–374, 2019.
416
+
417
+ 60 [58] W. Xiang, A. Karfoul, C. Yang, H. Shu, and R. L. B. Jeannès. An exact line search scheme to
418
+ 61 accelerate the EM algorithm: Application to Gaussian mixture models identification. Journal of
419
+ 62 computational science, 41:101073, 2020.
420
+ 63 [59] M. Zhang, Y. Fu, K. M. Bennett, and T. Wu. Computational efficient variational Bayesian Gaus
421
+ 64 sian mixture models via coreset. In 2016 International Conference on Computer, Information
422
+ 65 and Telecommunication Systems (CITS), pages 1–5. IEEE, 2016.
423
+ 66 [60] H. Zhao, P. Poupart, and G. Gordon. A unified approach for learning the parameters of sum
424
+ 67 product networks. In Proceedings of the 30th International Conference on Neural Information
425
+ 68 Processing Systems, pages 433–441, 2016.
426
+
427
+ 1. For all authors...
428
+
429
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
430
+ (b) Did you describe the limitations of your work? [Yes] Our main contribution is computational speedup. Cases where it was not achieved are highlighted in the experimental section.
431
+ (c) Did you discuss any potential negative societal impacts of your work? [No] We do not foresee any potential negative impact.
432
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
433
+
434
+ 2. If you are including theoretical results...
435
+
436
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
437
+
438
+ 3. If you ran experiments...
439
+
440
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code is available in a github repository. All dataset are public from the UCI database.
441
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 6.
442
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We report only average of Monte Carlo repetitions, the error bars were too small to have any visual impact in the reported logarithmic scale.
443
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
444
+
445
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
446
+
447
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We use 20 datasets from UCI, we cite the required papers for each dataset, mostly the UCI database and few additional publications.
448
+ (b) Did you mention the license of the assets? [No] The data are publically available, we comply with the requirement on citing appropriate publications.
449
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
450
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
451
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
452
+
453
+ 5. If you used crowdsourcing or conducted research with human subjects...
454
+
455
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
456
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
457
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/lH2ukHnGDdq/lH2ukHnGDdq.md ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DATA AUGMENTATION FOR DEEP LEARNING BASED AC-CELERATED MRI RECONSTRUCTION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Deep neural networks have emerged as very successful tools for image restoration and reconstruction tasks. These networks are often trained end-to-end to directly reconstruct an image from a noisy or corrupted measurement of that image. To achieve state-of-the-art performance, training on large and diverse sets of images is considered critical. However, it is often difficult and/or expensive to collect large amounts of training images. Inspired by the success of Data Augmentation (DA) for classification problems, in this paper, we propose a pipeline for data augmentation for image reconstruction tasks arising in medical imaging and explore its effectiveness at reducing the required training data in a variety of settings. We focus on accelerated magnetic resonance imaging, where the goal is to reconstruct an image from a few under-sampled linear measurements. Our DA pipeline is specifically designed to utilize the invariances present in medical imaging measurements as naive DA strategies that neglect the physics of the problem fail. We demonstrate the effectiveness of our data augmentation pipeline by showing that for some problem regimes, DA can achieve comparable performance to the state of the art on the fastMRI dataset while using significantly fewer training data. Specifically, for 8-fold acceleration we achieve performance comparable to the state of the art with only $10 \%$ of the training data for multi-coil reconstruction and with only $33 \%$ of the training data for single-coil reconstruction. Our findings show that in the low-data regime DA is beneficial, whereas in the high-data regime it has diminishing returns.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In magnetic resonance imaging (MRI), an extremely popular medical imaging technique, it is common to reduce the acquisition time by subsampling the measurements, because this reduces cost and increases accessibility of MRI to patients. However, since due to the subsampling, there are fewer equations than unknowns, the signal is not uniquely identifiable from the measurements. To overcome this challenge there has been a flurry of activity over the last decade aimed at utilizing prior knowledge about the signal, in a research area referred to as compressed sensing (Candes et al., 2006; Donoho, 2006).
12
+
13
+ Classical compressed sensing methods reduce the required number of measurements by utilizing prior knowledge about the images during the reconstruction process, often via a convex regularization that enforces sparsity in an appropriate transformation of the image. More recently, deep learning techniques have been used to enforce much more nuanced forms of prior knowledge (see Ongie et al. (2020) and references therein for an overview). The most successful of these approaches aim to directly learn the inverse mapping from the measurements to the image by training on a large set of training data consisting of signal/measurement pairs. This approach often enables faster reconstruction of images, but more importantly, deep learning techniques yield significantly higher quality reconstructions. This in turn enables fewer measurements further reducing image acquisition times. For instance, in an accelerated MRI competition known as FastMRI Challenge (Zbontar et al., 2018), all the top contenders used deep learning reconstruction techniques.
14
+
15
+ Contrary to classical compressive sensing approaches, however, deep learning techniques typically rely on large sets of training data often consisting of images along with the corresponding measurement. This is also true about the use of deep learning techniques in other areas such as computer vision and Natural Language Processing (NLP) were superb empirical success has been observed.
16
+
17
+ While large datasets have been harvested and carefully curated by tech companies in areas such as vision and NLP, this is not feasible in many scientific applications including MRI. It is difficult and expensive to collect the necessary datasets for a variety of reasons, including patient confidentiality requirements, cost and time of data acquisition, lack of medical data compatibility standards, and the rarity of certain diseases.
18
+
19
+ A common strategy to reduce reliance on training data in classification tasks is data augmentation. In a classification setting data augmentation consists of adding additional synthetic data obtained by performing invariant alterations to the data (e.g. flips, translations, or rotations) which do not affect the labels. Such data augmentation techniques are commonly used in classification tasks to significantly increase the performance on standard benchmarks such as ImageNet and CIFAR-10. More specific to medical imaging, data augmentation techniques have been successfully applied to registration, classification and segmentation of medical images. More recently, several studies (Zhao et al., 2020b; Karras et al., 2020; Zhao et al., 2020a) have demonstrated that data augmentation can significantly reduce the data needed for GAN training for high quality image generation. In regression tasks such as image reconstruction, however, data augmentation techniques are less common and much more difficult to design in part due to the lack of the aforementioned invariances (e.g., measurements of a rotated image are not the same as measurements from the original image).
20
+
21
+ The goal of this paper is to explore the benefits of data augmentation techniques for accelerated MRI with limited training data. By carefully taking into account the physics behind the MRI acquisition process we design a data augmentation pipeline, which we call MRAugment, that can successfully reduce the amount of training data required. Specifically, our contributions are as follows:
22
+
23
+ • We propose a data augmentation technique tailored to the physics of the MR reconstruction problem. We note that it is not obvious how to perform data augmentation in the context of inverse problems, because by changing an image to enlarge the training set, we do not automatically get a corresponding measurement, contrary to classification problems, where the label is retained. In fact, we demonstrate that naive forms of data augmentation that do not properly take into account the underlying physics do not work. We demonstrate the effectiveness of MRAugment on a benchmark accelerated MRI data set, specifically on the fastMRI (Zbontar et al., 2018) dataset. For 8-fold acceleration and multi-coil measurements (multi-coil measurements are the standard acquisition mode for clinical practice) we can achieve performance comparable to the state of the art with only $1 0 \%$ of the training data. Similarly, again for 8-fold acceleration and single-coil experiments (an acquisition mode popular for experimentation) MRAugment can achieve the performance of reconstructions methods trained on the entire data set while using only $33 \%$ of the training data.
24
+ • We perform experiments showing that in a low-data regime, where we have only limited training data MRAugment is beneficial, whereas in the high-data regime it has diminishing returns. In particular we demonstrate that in a low data regime $\approx 1 \%$ of training data), data augmentation very significantly boosts reconstruction performance and captures diagnostically significant detail that is missed without data augmentation. In a moderate data regime $( \bar { \approx } 1 0 - 3 3 \bar { \% }$ of training data), MRAugment still achieves significant improvement in reconstruction performance and may help to avoid hallucinations caused by overfitting without the use of DA.
25
+ • Finally, while we focus on the top performing neural networks, MRAugment can seamlessly integrate with any deep learning model and therefore it can be useful in a variety of MRI problems.
26
+
27
+ # 2 BACKGROUND AND PROBLEM FORMULATION
28
+
29
+ In this section, we provide a brief background on accelerated MRI and formulate the problem.
30
+
31
+ MRI is a medical imaging technique that exploits strong magnetic fields to form images of the anatomy. MRI is a prominent imaging modality in diagnostic medicine and biomedical research because it does not expose patients to ionizing radiation, contrary to competing technologies such as computed and positron emission tomography (CT and PET).
32
+
33
+ However, performing an MR scan is time intensive, which is problematic for the following reasons. First, patients are exposed to long acquisition times in a confined space with high noise levels. Second, long acquisition times induce reconstruction artifacts caused through patient movement, which sometimes requires patient sedation in particular in pediatric MRI (Vasanawala et al., 2010). Reducing the acquisition time can therefore increase both the accuracy of diagnosis and patient comfort. Furthermore, decreasing the acquisition time needed allows more patients to receive a scan using the same machine. This can significantly reduce patient cost, since each MRI machine comes with a high cost to maintain and operate.
34
+
35
+ Since the invention of MR in the 1980s there has been tremendous research focusing on reducing their acquisition time. The two main ideas are to i) perform multiple acquisitions simultaneously (Sodickson & Manning, 1997; Pruessmann et al., 1999; Griswold et al., 2002) and to ii) subsample the measurements, known as accelerated acquisition or compressive sensing (Lustig et al., 2008). Most modern scanners combine both techniques, and therefore we consider such a setup.
36
+
37
+ # 2.1 ACCELERATED MRI ACQUISITION
38
+
39
+ In magnetic resonance imaging, measurements of a patient’s anatomy are acquired in the Fourierdomain, also called $k$ -space, through receiver coils. In the single-coil acquisition mode, the k-space measurement $\pmb { k } \in \mathbb { C } ^ { n }$ of a complex-valued ground truth image $\pmb { x } ^ { * } \in \mathbb { C } ^ { n }$ is given by
40
+
41
+ $$
42
+ \pmb { k } = \mathcal { F } \pmb { x } ^ { \ast } + \pmb { z } ,
43
+ $$
44
+
45
+ where $\mathcal { F }$ is the two-dimensional Fourier-transform, and $z \in \mathbb { C } ^ { n }$ denotes additive noise arising in the measurement process. In parallel MR imaging, multiple receiver coils are used, each of which captures a different region of the image, represented by a complex-valued sensitivity map $S _ { i }$ . In this multi-coil setup, coils acquire k-space measurements modulated by their corresponding sensitivity maps:
46
+
47
+ $$
48
+ \pmb { k } _ { i } = \mathcal { F } \pmb { S } _ { i } \pmb { x } ^ { * } + \pmb { z } _ { i } , \quad i = 1 , . . , N ,
49
+ $$
50
+
51
+ where $N$ is the number of coils. Obtaining fully-sampled $\mathbf { k }$ -space data is time-consuming, and therefore in accelerated MRI we decrease the number of measurements by undersampling in the Fourier-domain. This undersampling can be represented by a binary mask $M$ that sets all frequency components not sampled to zero:
52
+
53
+ $$
54
+ \tilde { \pmb { k } } _ { i } = M \pmb { k } _ { i } , i = 1 , . . , N .
55
+ $$
56
+
57
+ We can write the overall forward map concisely as
58
+
59
+ $$
60
+ \tilde { \pmb { k } } = \mathcal { A } \left( \pmb { x } ^ { \ast } \right) ,
61
+ $$
62
+
63
+ where $\boldsymbol { \mathcal { A } } \left( \cdot \right)$ is the linear forward operator and $\tilde { k }$ denotes the undersampled coil measurements stacked into a single column vector. The goal in accelerated MRI reconstruction is to recover the image $\mathbf { \boldsymbol { x } } ^ { * }$ from the set of $\mathbf { k }$ -space measurements $\tilde { k }$ . Note that—without making assumptions on the image $\mathbf { \boldsymbol { x } } ^ { * }$ —it is in general impossible to perfectly recover the image, because we have fewer measurements than variables to recover. This recovery problem is known as compressive sensing. To make image recovery potentially possible, recovery methods make structural assumptions about $\mathbf { \boldsymbol { x } } ^ { * }$ , such that it is sparse in some basis or implicitly that it looks similar to images from the set of training images.
64
+
65
+ # 2.2 TRADITIONAL ACCELERATED MRI RECONSTRUCTION METHODS
66
+
67
+ Traditional compressed sensing recovery methods for accelerated MRI are based on assuming that the image $\scriptstyle { \pmb x } ^ { * }$ is sparse in some dictionary, for example the wavelet transform. Recovery is then posed as a typically convex optimization problem:
68
+
69
+ $$
70
+ \pmb { \hat { x } } = \underset { \pmb { x } } { \arg \operatorname* { m i n } } \left\| \pmb { \mathcal { A } } \left( \pmb { x } \right) - \tilde { \pmb { k } } \right\| ^ { 2 } + \mathcal { R } ( \pmb { x } ) ,
71
+ $$
72
+
73
+ where $\mathcal { R } ( \cdot )$ is a regularizer enforcing sparsity in a certain domain. Typical functions used in CS based MRI reconstruction are $\ell _ { 1 }$ -wavelet and total-variation regularizers. These optimization problems can be numerically solved via iterative gradient descent based methods.
74
+
75
+ # 2.3 DEEP LEARNING BASED MRI RECONSTRUCTION METHODS
76
+
77
+ In recent years, several deep learning algorithms have been proposed and convolutional neural networks established new state-of-the-art in MRI reconstruction significantly surpassing the classical baselines. Encoder-decoder networks such as the U-Net (Ronneberger et al., 2015) and its variants were successfully used in various medical image reconstruction (Hyun et al., 2018; Han & Ye, 2018) and segmentation problems (Çiçek et al., 2016; Zhou et al., 2018). These models consist of two sub-networks: the encoder repeatedly filters and downsamples the input image with learned convolutional filters resulting in a concise feature vector. This low-dimensional representation is then fed to the decoder consisting of subsequent upsampling and learned filtering operations. Another approach that can be considered a generalization of iterative compressed sensing reconstructions consists of unrolling gradient descent iterations and mapping them to a cascade of sub-networks (Zhang & Ghanem, 2018). Several variations of this unrolled method have been proposed recently for MR reconstruction, such as i-RIM (Putzky & Welling, 2019), Adaptive-CS-Net (Pezzotti et al., 2019), Pyramid Convolutional RNN (Wang et al., 2019) and E2E VarNet (Sriram et al., 2020), which is at the top of the fastMRI Challenge Leaderboard at the time of the writing of this paper.
78
+
79
+ Another line of work, inspired by the deep image prior (Ulyanov et al., 2018) focuses on using the inductive bias of convolutional networks to perform reconstruction without any training data (Jin et al., 2019; Darestani & Heckel, 2020; Heckel & Soltanolkotabi, 2020; Heckel & Hand, 2019; Van Veen et al., 2018). Those methods do perform significantly better than classical un-trained networks, but do not perform as well as neural networks trained on large sets of training data.
80
+
81
+ # 3 MRAUGMENT: A DATA AUGMENTATION PIPELINE FOR MRI
82
+
83
+ In this section we propose our data augmentation technique, MRAugment, for MRI reconstruction. We emphasize that data augmentation in this setup and for inverse problems in general is substantially different from DA for classification problems. For classification tasks, the label of the augmented image is trivially the same as that of the original image, whereas for inverse problems we have to generate both an augmented target image and the corresponding measurements. This is non-trivial as it is critical to match the noise statistics of the augmented measurements with those in the dataset.
84
+
85
+ We are given training data in the form of fully-sampled MRI measurements in the Fourier domain, and our goal is to generated new training examples consisting of a subsampled $\mathbf { k }$ -space measurement along with a target image. MRAugment is model-agnostic in that the generated augmented training example can be used with any machine learning model and therefore can be seamlessly integrated with existing reconstruction algorithms for accelerated MRI, and potentially beyond MRI.
86
+
87
+ Our data augmentation pipeline, illustrated in Figure 1, generates a new example consisting of a subsampled $\mathbf { k }$ -space measurement $\tilde { k } _ { a }$ along with a target image $\scriptstyle { \bar { \mathbf { x } } } _ { a }$ as follows. We are given training examples as fully-sampled $\mathbf { k }$ -space slices, which we stack into a single column vector $\pmb { k } = \mathrm { c o l } ( \pmb { k } _ { 1 } , \pmb { k } _ { 2 } , . . . , \pmb { k } _ { N } )$ for notational convenience. From these, we obtain the individual coil images by applying the inverse Fourier transform as $\pmb { x } = \mathcal { F } ^ { - 1 } \pmb { k }$ . We generate augmented individual coil images with an augmentation function $\mathcal { D }$ , specified later, as ${ \pmb x } _ { a } = \mathcal { D } ( { \pmb x } )$ . From the augmented images, we generate an undersampled measurement by applying the forward model as $\tilde { \pmb { k } } _ { a } = \mathcal { A } \left( \pmb { x } _ { a } \right)$ . Both $_ { \textbf { \em x } }$ and $\scriptstyle { \mathbf { \mathscr { x } } } _ { a }$ are complex-valued: even though the MR scanner obtains measurements of a real-valued object, due to noise the inverse Fourier-transform of the measurement is complex-valued. Therefore the augmentation function has to generate complex-valued images, which adds an extra layer of difficulty compared to traditional data augmentation techniques pertaining to real-valued images (see Section 3.1 for further details). Finally, the real-valued ground truth image is obtained by combining the coil images ${ \pmb x } _ { a , i }$ by pixel-wise root-sum-squares (RSS) followed by center-cropping $\mathcal { C }$ :
88
+
89
+ $$
90
+ \bar { \pmb { x } } _ { a } = \mathcal { C } \left( \mathrm { R S S } ( \pmb { x } _ { a } ) \right) = \mathcal { C } \left( \sqrt { \sum _ { i = 1 } ^ { N } \left| \pmb { x } _ { a , i } \right| ^ { 2 } } \right) .
91
+ $$
92
+
93
+ In the following two sections we first argue why we generate individual coil images with the data augmentation function, and then discuss the design of the data augmentation function $\mathcal { D }$ itself.
94
+
95
+ # 3.1 DATA AUGMENTATION NEEDS TO PRESERVE NOISE STATISTICS
96
+
97
+ As mentioned before, we are augmenting complex-valued, noisy images. This noise enters in the measurement process when we obtain the fully-sampled measurement of an image $\mathbf { \nabla } _ { \mathbf { \boldsymbol { x } } } \ast \mathbf { \nabla } _ { \mathbf { \boldsymbol { x } } } \cdot \mathbf { \nabla } _ { \mathbf { \boldsymbol { x } } } \cdot \mathbf { \nabla } _ { \mathbf { \boldsymbol { x } } } \cdot \mathbf { \nabla } _ { \mathbf { \boldsymbol { \mathrm { ~ ~ } ~ } } } ^ { \ast }$ as $\pmb { k } = \mathcal { F } \pmb { x } ^ { \ast } + \pmb { z }$ and is well approximated by i.i.d complex Gaussian noise, independent in the real and imaginary parts of each pixel (Nishimura, 1996). Therefore, we can write ${ \pmb x } = { \pmb x } ^ { * } + z ^ { \prime }$ where $z ^ { \prime }$ has the same distribution as $_ z$ due to $\mathcal { F }$ being unitary. Since the noise distribution is characteristic to the instrumental setup (in this case the MR scanner and the acquisition protocol), assuming that the training and test images are produced by the same setup, it is important that the augmentation function preserves the noise distribution of training images as much as possible. Indeed, a large mismatch between training and test noise distribution leads to poor generalization (Knoll et al., 2019).
98
+
99
+ ![](images/1c8365abb77439d3d4b65c527a692460c2ebff3f1a11e32f34d180f7a1142f3a.jpg)
100
+ Figure 1: Flowchart of MRAugment, our data augmentation pipeline for MRI.
101
+
102
+ Let us demonstrate why it is non-trivial to generate augmented measurements for MRI through a simple example. A natural but perhaps naive approach for data augmentation is to augment the real-valued target image $\bar { \pmb x }$ instead of the complex valued $_ { \textbf { \em x } }$ . This would allow us to directly obtain real augmented images from a real target image just as in typical data augmentation. However, this approach leads to different noise distribution in the measurements compared to the test data due to the non-linear mapping from individual coil images to the real-valued target and works poorly as demonstrated in Section 4.
103
+
104
+ In contrast, if we augment the individual coil images $_ { \textbf { \em x } }$ directly with a linear function $\mathcal { D }$ , which is our main focus here, we obtain the augmented $\mathbf { k }$ -space data
105
+
106
+ $$
107
+ \pmb { k } _ { a } = \mathcal { F } \mathcal { D } \pmb { x } = \mathcal { F } \mathcal { D } \big ( \pmb { x } ^ { * } + \pmb { z } ^ { \prime } \big ) = \mathcal { F } \mathcal { D } \pmb { x } ^ { * } + \mathcal { F } \mathcal { D } \pmb { z } ^ { \prime } ,
108
+ $$
109
+
110
+ where $\mathcal { F D } { \boldsymbol { x } } ^ { * }$ represents the augmented signal and the noise $\mathcal { F D z ^ { \prime } }$ is still additive complex Gaussian. A key observation is that in case of transformations such as translation, horizontal and vertical flipping and rotation the noise distribution is exactly preserved. Moreover, for general linear transformations the noise is still Gaussian in the real and imaginary parts of each pixel. This example motivates our choice to i) augment complex-valued images directly derived from the original $\mathbf { k }$ -space measurements and ii) consider simple transformations which preserve the noise distribution. Next we overview the types of augmentations we propose in line with these key observations.
111
+
112
+ # 3.2 TRANSFORMATIONS USED FOR DATA AUGMENTATION
113
+
114
+ We apply the following two types of image transformation $\mathcal { D }$ in our data augmentation pipeline: Pixel preserving augmentations, that do not require any form of interpolation and simply result in a permutation of pixels over the image. Such transformations are vertical and horizontal flipping, translation by integer number of pixels and rotation by multiples of $9 0 ^ { \circ }$ . As we pointed out in Section 3.1, these transformations do not affect the noise distribution on the measurements and therefore are suitable for problems where training and test data are expected to have similar noise characteristics. General affine augmentations, that can be represented by an affine transformation matrix and in general require resampling the transformed image at the output pixel locations. Augmentations in this group are: translation by arbitrary (not necessarily integer) coordinates, arbitrary rotations, scaling and shearing. Scaling can be applied along any of the two spatial dimensions. We differentiate between isotropic scaling, in which the same scaling factor $s$ is applied in both directions $( s > 1$ zoom-in, $s < 1$ : zoom-out) and anisotropic scaling in which different scaling factors $( s _ { x } , s _ { y } )$ are applied along different axes.
115
+
116
+ Figure 2 provides a visual overview of the types of augmentations applied in this paper. Numerous other forms of transformation may be used in this framework such as exposure and contrast adjustment, image filtering (blur, sharpening) or image corruption (cutout, additive noise). However, in addition to the noise considerations mentioned before that have to be taken into account, some of these transformations are difficult to define for complex-valued images and may have subtle effects on image statistics. For instance, brightness adjustment could be applied to the magnitude image, the real part only or both real and imaginary parts, with drastically different effects on the magnitude-phase relationship of the image. That said, we hope to incorporate additional augmentations in our pipeline in the future after a thorough study of how they affect the noise distribution.
117
+
118
+ ![](images/15846fec71fa5c7c3d572ab907f4727d79af3144847a53ac216619e6cdf8d789.jpg)
119
+ Figure 2: Transformations used in MRAugment applied to a ground truth slice.
120
+
121
+ # 3.3 SCHEDULING AND APPLICATION OF DATA AUGMENTATIONS
122
+
123
+ With the different components in place we are now ready to discuss the scheduling and application of the augmentations, as depicted in the bottom half of Figure 1. Recall that MRAugment generates a target image $\scriptstyle { \bar { \mathbf { x } } } _ { a }$ and corresponding under-sampled $\mathbf { k }$ -space measurement $\tilde { k } _ { a }$ from a full $\mathbf { k }$ -space measurement. Which augmentation is applied and how frequently is determined by a parameter $p$ , the common parameter determining the probability of applying a transformation to the ground truth image during training, and the weights $\mathcal { W } = \left( w _ { 1 } , w _ { 2 } , . . . , w _ { K } \right)$ pertaining to the $K$ different augmentations, controlling the weights of transformations relative to each other. We apply a given transformation $t _ { i }$ with probability $p _ { i } = p \cdot w _ { i }$ . The augmentation function is applied to the coil images, specifically the same transformation is applied with the same parameters to the real and imaginary parts $( \Re \{ { \bf \bar { x } } _ { 1 } \} , \Im \{ { \bf x } _ { 1 } \} , \Re \{ { \bf x } _ { 2 } \} , \Im \{ { \bf x } _ { 2 } \} , . . . , \Re \{ { \bf x } _ { N } \} , \Im \{ { \bf x } _ { N } \} )$ of coil images. If a transformation $t _ { i }$ is sampled (recall that we select them with probabilities $p _ { i }$ ), we randomly select the parameters of the transformation from a pre-defined range (for example, rotation angle in $[ 0 , 1 8 0 ^ { \circ } ] )$ . To avoid aliasing artifacts, before transformations that require interpolation we first upsample the image and apply the transformations to the upsampled image. Then the result is downsampled to the original size.
124
+
125
+ A critical question is how to schedule $p$ over training in order to obtain the best model. Intuitively, in initial stages of training no augmentation is needed, since the model can learn from the available (possibly limited) original training data. As training progresses the network learns to fit the original data points and their utility decreases over time. We found schedules starting from $p = 0$ and increasing over epochs to work best. The ideal rate of increase depends on both the model size and amount of available training data. We experimented with linear (ramp) and exponential scheduling and observed that linear functions work best when we have a large amount of training data compared to the model size. In contrast, steeper exponential scheduling helps in the low-data regime.
126
+
127
+ # 4 EXPERIMENTS
128
+
129
+ In this section we explore the effectiveness of MRAugment in the context of accelerated MRI reconstruction in various regimes of available training data sizes on the fastMRI dataset. We present a detailed description of this dataset in Appendix A.
130
+
131
+ ![](images/9952eb1da07398cb29fa22077752c67890c62683ff4f06175f71de7731c7f5a0.jpg)
132
+ Figure 3: Visual comparison of single-coil (top row) and multi-coil (bottom-row) reconstructions using varying amounts of training data with and without data augmentation. We achieve reconstruction quality comparable to the state of the art but using $1 \%$ of the training data. Without DA fine details are completely lost.
133
+
134
+ Experimental setup. We use the state-of-the-art End-to-End VarNet model (Sriram et al., 2020), because it is as of now the best performing neural network on the fastMRI dataset. We measure performance in terms of the structural similarity index measure (SSIM), which is the standard evaluation metric on the fastMRI dataset. We study the performance of MRAugment as a function of the size of the training set. We construct different subsampled training sets by randomly sampling volumes of the original training dataset and adding all slices of the sampled volumes to the new subsampled dataset. The original training set consists of approximately $3 5 k$ MRI slices in 973 volumes and we subsample to $1 \%$ , $1 0 \%$ , $3 3 \%$ and $\cdot$ of the original size. We measure performance on the original validation set separate from the training set. For all experiments, we apply random masks by undersampling whole kspace lines in the phase encoding direction and including $\cdot$ of lowest frequency adjacent kspace lines in order to be consistent with baselines in (Zbontar et al., 2018). For both the baseline experiments and for MRAugment, we generate a new random mask for each slice on-the-fly while training by uniformly sampling kspace lines, but use the same fixed mask for each slice within the same volume on the validation set (different across volumes). This technique is standard for models trained on this dataset and not part of our data augmentation pipeline. For augmentation probability scheduling we use
135
+
136
+ $$
137
+ \cdot
138
+ $$
139
+
140
+ where $\cdot$ is the current epoch, $\cdot$ denotes the total number of epochs, $\cdot$ and $\cdot$ for $\cdot$ training data experiments and $p _ { m a x } \ = \ 0 . 5 5$ in other data augmentation experiments. More experimental details can be found in Appendix B and the source code is attached in the supplementary.
141
+
142
+ Single-coil experiments. For single-coil acquisition we are able to exactly match the performance of the model trained on the full dataset using only a third of the training data as depicted on the left in Fig. 4. Moreover, with only $1 0 \%$ of the training data we achieve $9 9 . 5 \%$ of the SSIM trained on the full dataset. The visual difference between reconstructions with and without data augmentation becomes striking in the low-data regime. As seen in the top row of Fig. 3, the model without DA was unable to reconstruct any of the fine details and the results appear blurry with strong artifacts. Applying MRAugment significantly improves reconstruction quality both in a quantitative and qualitative sense, visually approaching that obtained from training on the full dataset but using hundred times less data.
143
+
144
+ Multi-coil experiments. As depicted on the right in Fig. 4 for multi-coil acquisition we closely match the state of the art while significantly reducing training data. More specifically, we approach the state of the art SSIM within $0 . 6 \%$ using $1 0 \%$ of the training data and within $0 . 2 5 \%$ with $3 3 \%$ of training data. As seen in the bottom row of Fig. 3, when using only $1 \%$ of the training data we successfully reconstruct fine details comparable to that obtained from training on the full dataset, while high frequencies are completely lost without DA. More visual comparisons for both single-coil and multi-coil reconstruction can be found in Appendix D.
145
+
146
+ ![](images/33781577dfc534a7860c40ebc1b7dd353d1456c926213ddb6f854277565f4c23.jpg)
147
+ Figure 4: Single-coil (left) and multi-coil (right) validation SSIM vs. # of training images.
148
+
149
+ ![](images/830c88bc23c618655d29412a0597ab7028e5db85b6c1b210321859e255c0fef9.jpg)
150
+ Figure 5: Hallucinated features appear on reconstructions without data augmentation.
151
+
152
+ Hallucinations. An unfortunate side-effect of deep learning based reconstructions may be the presence of hallucinated details. This is especially problematic in providing accurate medical diagnosis and lessens the trust of medical practicioners in deep learning. We observed that data augmentation has the potential benefit of eliminating hallucinations by preventing overfitting to training data, as seen in Fig. 5.
153
+
154
+ Our empirical observations on data augmentation can be summarized as follows:
155
+
156
+ • In the low data regime $\approx 1 \%$ of training data), data augmentation very significantly boosts reconstruction performance. The improvement is large both in terms of raw SSIM and visual reconstruction quality. Using MRAugment, fine details are recovered that are completely missing from reconstructions without DA. This suggests that DA improves the value of reconstructions for medical diagnosis, since health experts typically look for small features of the anatomy.
157
+ • In the moderate data regime $( \approx 1 0 - 3 3 \%$ of training data), MRAugment still achieves significant improvement in reconstruction SSIM. We want to emphasize the significance of seemingly small differences in SSIM close to the state of the art and invite the reader to visit the FastMRI Challenge Leaderboard that demonstrates how close the best performing models are. Moreover, MRAugment achieves visual improvement in fine details that may have diagnostic value. Fig. 5 shows that in some cases hallucinated details can be avoided in this regime using data augmentation. Additional visual comparison of recovered details is provided in Appendix D.
158
+ Data augmentation applied to the full training dataset has diminishing returns. It does not improve performance if applied to the full dataset, but it does not degrade it either. This suggests that it may be possible to further improve upon the state of the art when using the entire dataset by combining data augmentation with more advanced transformations and larger models. We plan to pursue this exciting direction in our future work.
159
+
160
+ Ablation studies. We performed ablation studies on $\cdot$ training data in order to better understand which augmentations are useful. We use the multi-coil experiment with all augmentations as baseline and tune augmentation probability for other experiments such that the probability that a certain slice is augmented by at least one augmentation is the same across all experiments. We depict results on the validation dataset in Table 1. Both pixel preserving and general (interpolating) affine transformations are useful and can significantly increase reconstruction quality. Furthermore, we observe that their effect is complementary: they are helpful separately, but we achieve peak reconstruction SSIM when all applied together. Finally, the utility of pixel preserving augmentations seems to be lower than that of general affine augmentations, however they come with a negligible additional computational cost.
161
+
162
+ Furthermore, we investigate the effect of varying the augmentation probability scheduling function. The results on the validation dataset are depicted in Table 2, where exponential, $\hat { p }$ denotes the exponential scheduling function in (4.1), with $\cdot$ and constant, $\hat { p }$ means we use a fixed augmentation probability $\hat { p }$ throughout training. We observe that scheduling starting from low augmentation probability and gradually increasing is better than a constant probability, as initially the network does not benefit much from data augmentation as it can still learn from the original samples. Furthermore, too low or too high augmentation probability both degrade performance. If the (a) Naive data augmentation that does not preserve measurement noise distribution leads to significantly degraded reconstruction quality.
163
+
164
+ <table><tr><td>Augmentations</td><td>Val. SSIM</td></tr><tr><td>none pixel preserving only</td><td>0.8396</td></tr><tr><td rowspan="2">interpolating only all augmentations</td><td>0.8585</td></tr><tr><td>0.8731 0.8758</td></tr></table>
165
+
166
+ <table><tr><td>Aug. scheduling</td><td>Val. SSIM</td></tr><tr><td>none exponential, 0.3</td><td>0.8396</td></tr><tr><td>constant, 0.3</td><td>0.8565</td></tr><tr><td></td><td>0.8588</td></tr><tr><td>exponential, 0.6</td><td>0.8758</td></tr><tr><td>constant, 0.6 exponential, 0.8</td><td>0.8611 0.8600</td></tr></table>
167
+
168
+ ![](images/7eec176acbd9779f21eee92f195a4af0de891118e2e674221693d7d02e02d61f.jpg)
169
+ Table 1: Comparison of peak validation SSIM applying various sets of augmentations on $\cdot$ of training data, multi-coil acquisition.
170
+
171
+ ![](images/8d5e4d7b35875373c00c0debd70a11c811ca5cf290b0d3a2a940aef5197f26e2.jpg)
172
+ Table 2: Comparison of peak validation SSIM using different augmentation probability schedules on $1 \%$ of training data, multi-coil acquisition.
173
+ (b) Naive data augmentation degrades generalization performance.
174
+
175
+ Figure 6: Experimental results comparing MRAugment with naive data augmentation.
176
+
177
+ augmentation probability is too low, the network may overfit to training data as more regularization is needed. On the other hand, too much data augmentation hinders reconstruction performance as the network rarely sees images close to the original training distribution.
178
+
179
+ Noise considerations. Finally, we would like to emphasize the importance of applying DA in a way that takes into account the measurement noise distribution. When applied incorrectly, DA leads to significantly worse performance than not using any augmentation. We train a model using DA without considering the measurement noise distribution as described in Section 3.1 by augmenting real-valued target images. We use the same exponential augmentation probability scheduling for MRAugment and the naive approach. As Fig. 6b demonstrates, reconstruction quality degrades over training using the naive approach. This is due to the fact that as augmentation probability increases, the network is being fed less and less original images, whereas the poorly augmented images are detrimental for generalization due to the mismatch in train and validation noise distribution. On the other hand, MRAugment clearly helps and validation performance steadily improves over epochs. Fig. 6a provides a visual comparison of reconstructions using naive DA and our data augmentation method tailored to the problem. Naive DA reconstruction exhibits high-frequency artifacts and low image quality caused by the mismatch in noise distribution. These drastic differences underline the vital importance of taking a careful, physics-informed approach to data augmentation for MR reconstruction.
180
+
181
+ # 5 CONCLUSION
182
+
183
+ In this paper, we develop a physics-based data augmentation pipeline for accelerated MR imaging. We find that DA yields significant gains in a low-data regime which can be beneficial in applications where only little training data is available or where the training data changes quickly. We also demonstrate that even with a moderate amount of training data, DA enables reconstructions that contain diagnostically significant detail and may help avoiding hallucinations caused by overfitting without DA.
184
+
185
+ # REFERENCES
186
+
187
+ Emmanuel J. Candes, Justin K. Romberg, and Terence Tao. Stable signal recovery from incomplete and inaccurate measurements. Communications on Pure and Applied Mathematics: A Journal Issued by the Courant Institute of Mathematical Sciences, 59(8):1207–1223, 2006.
188
+
189
+ Özgün Çiçek, Ahmed Abdulkadir, Soeren S Lienkamp, Thomas Brox, and Olaf Ronneberger. 3D UNet: learning dense volumetric segmentation from sparse annotation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 424–432. Springer, 2016.
190
+
191
+ Mohammad Zalbagi Darestani and Reinhard Heckel. Can Un-trained Neural Networks Compete with Trained Neural Networks at Image Reconstruction? arXiv:2007.02471 [cs, eess, stat], 2020.
192
+
193
+ David L. Donoho. Compressed sensing. IEEE Transactions on information theory, 52(4):1289–1306, 2006.
194
+
195
+ Mark A Griswold, Peter M Jakob, Robin M Heidemann, Mathias Nittka, Vladimir Jellus, Jianmin Wang, Berthold Kiefer, and Axel Haase. Generalized autocalibrating partially parallel acquisitions (GRAPPA). Magnetic Resonance in Medicine: An Official Journal of the International Society for Magnetic Resonance in Medicine, 47(6):1202–1210, 2002.
196
+
197
+ Yoseob Han and Jong Chul Ye. Framing U-Net via deep convolutional framelets: Application to sparse-view CT. IEEE Transactions on Medical Imaging, 37(6):1418–1429, 2018.
198
+
199
+ Reinhard Heckel and Paul Hand. Deep Decoder: Concise Image Representations from Untrained Non-convolutional Networks. In International Conference on Learning Representations, 2019.
200
+
201
+ Reinhard Heckel and Mahdi Soltanolkotabi. Compressive sensing with un-trained neural networks: Gradient descent finds the smoothest approximation. In International Conference on Machine Learning, 2020.
202
+
203
+ Chang Min Hyun, Hwa Pyung Kim, Sung Min Lee, Sungchul Lee, and Jin Keun Seo. Deep learning for undersampled MRI reconstruction. Physics in Medicine & Biology, 63(13):135007, 2018.
204
+
205
+ Kyong Hwan Jin, Harshit Gupta, Jerome Yerly, Matthias Stuber, and Michael Unser. Time-Dependent Deep Image Prior for Dynamic MRI. arXiv:1910.01684 [cs, eess], 2019.
206
+
207
+ Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training generative adversarial networks with limited data. arXiv preprint arXiv:2006.06676, 2020.
208
+
209
+ Florian Knoll, Kerstin Hammernik, Erich Kobler, Thomas Pock, Michael P Recht, and Daniel K Sodickson. Assessment of the generalization of learned image reconstruction and the potential for transfer learning. Magnetic Resonance in Medicine, 81(1):116–128, 2019.
210
+
211
+ Michael Lustig, David L. Donoho, Juan M. Santos, and John M. Pauly. Compressed sensing MRI. IEEE signal processing magazine, 25(2):72–82, 2008.
212
+
213
+ Dwight George Nishimura. Principles of magnetic resonance imaging. Stanford University, 1996.
214
+
215
+ Gregory Ongie, Ajil Jalal, Christopher A. Metzler Richard G. Baraniuk, Alexandros G. Dimakis, and Rebecca Willett. Deep learning techniques for inverse problems in imaging. IEEE Journal on Selected Areas in Information Theory, 2020.
216
+
217
+ Nicola Pezzotti, Elwin de Weerdt, Sahar Yousefi, Mohamed S Elmahdy, Jeroen van Gemert, Christophe Schülke, Mariya Doneva, Tim Nielsen, Sergey Kastryulin, Boudewijn PF Lelieveldt, et al. Adaptive-CS-Net: fastmri with adaptive intelligence. arXiv preprint arXiv:1912.12259, 2019.
218
+
219
+ Klaas P Pruessmann, Markus Weiger, Markus B Scheidegger, and Peter Boesiger. SENSE: sensitivity encoding for fast MRI. Magnetic Resonance in Medicine: An Official Journal of the International Society for Magnetic Resonance in Medicine, 42(5):952–962, 1999.
220
+
221
+ Patrick Putzky and Max Welling. Invert to learn to invert. In Advances in Neural Information Processing Systems, pp. 446–456, 2019.
222
+
223
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical Image Computing and ComputerAssisted Intervention, pp. 234–241. Springer, 2015.
224
+
225
+ Daniel K Sodickson and Warren J Manning. Simultaneous acquisition of spatial harmonics (SMASH): fast imaging with radiofrequency coil arrays. Magnetic Resonance in Medicine: An Official Journal of the International Society for Magnetic Resonance in Medicine, 38(4):591–603, 1997.
226
+
227
+ Anuroop Sriram, Jure Zbontar, Tullie Murrell, Aaron Defazio, C Lawrence Zitnick, Nafissa Yakubova, Florian Knoll, and Patricia Johnson. End-to-end variational networks for accelerated MRI reconstruction. arXiv preprint arXiv:2004.06688, 2020.
228
+
229
+ Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Deep Image Prior. In Conference on Computer Vision and Pattern Recognition, pp. 9446–9454, 2018.
230
+
231
+ Dave Van Veen, Ajil Jalal, Mahdi Soltanolkotabi, Eric Price, Sriram Vishwanath, and Alexandros G Dimakis. Compressed sensing with deep image prior and learned regularization. arXiv preprint arXiv:1806.06438, 2018.
232
+
233
+ Shreyas S Vasanawala, Marcus T Alley, Brian A Hargreaves, Richard A Barth, John M Pauly, and Michael Lustig. Improved pediatric MR imaging with compressed sensing. Radiology, 256(2): 607–616, 2010.
234
+
235
+ Puyang Wang, Eric Z Chen, Terrence Chen, Vishal M Patel, and Shanhui Sun. Pyramid convolutional RNN for MRI reconstruction. arXiv preprint arXiv:1912.00543, 2019.
236
+
237
+ Jure Zbontar, Florian Knoll, Anuroop Sriram, Matthew J Muckley, Mary Bruno, Aaron Defazio, Marc Parente, Krzysztof J Geras, Joe Katsnelson, Hersh Chandarana, et al. fastMRI: An open dataset and benchmarks for accelerated MRI. arXiv preprint arXiv:1811.08839, 2018.
238
+
239
+ Jian Zhang and Bernard Ghanem. ISTA-Net: Interpretable optimization-inspired deep network for image compressive sensing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1828–1837, 2018.
240
+
241
+ Shengyu Zhao, Zhijian Liu, Ji Lin, Jun-Yan Zhu, and Song Han. Differentiable Augmentation for Data-Efficient GAN Training. arXiv:2006.10738, 2020a.
242
+
243
+ Zhengli Zhao, Zizhao Zhang, Ting Chen, Sameer Singh, and Han Zhang. Image Augmentations for GAN Training. arXiv:2006.02595, 2020b.
244
+
245
+ Zongwei Zhou, Md Mahfuzur Rahman Siddiquee, Nima Tajbakhsh, and Jianming Liang. Unet $^ { + + }$ : A nested u-net architecture for medical image segmentation. In Deep Learning in Medical Image Analysis and Multimodal Learning for Clinical Decision Support, pp. 3–11. Springer, 2018.
246
+
247
+ # A THE FASTMRI DATASET
248
+
249
+ The fastMRI dataset (Zbontar et al., 2018) is a large open dataset of knee and brain MRI volumes. The train and validation splits contain fully-sampled $\mathbf { k }$ -space volumes and corresponding target reconstructions for both (simulated) single-coil and multi-coil acquisition. The knee MRI dataset we are focusing on in this paper includes 973 train volumes (34742 slices) and 199 validation volumes (7135 slices). The target reconstructions are fixed size $3 2 0 \times 3 2 0$ center cropped images corresponding to the fully-sampled data of varying sizes. The under-sampling ratio is either $2 5 \%$ ( $4 \times$ acceleration) or $1 2 . 5 \%$ $8 \times$ acceleration). Under-sampling is performed along the phase encoding dimension in $\mathbf { k }$ -space, that is columns in k-space are sampled. A certain neighborhood of adjacent low-frequency lines are always included in the measurement. The size of this fully-sampled region is $8 \%$ of all frequencies in case of $4 \times$ acceleration and $4 \%$ in case of $8 \times$ acceleration.
250
+
251
+ # B EXPERIMENTAL DETAILS
252
+
253
+ Here we provide details of the setup for our main experiments.
254
+
255
+ Datasets. We use the FastMRI (Zbontar et al., 2018) single-coil and multi-coil knee dataset for our experiments. For creating the sub-sampled datasets, we uniformly sample volumes from the training set, and add all slices from the sampled volumes. Our validation results are reported on the whole validation dataset. Images in the dataset have varying dimensions. Due to GPU memory considerations we center-cropped the input images to $6 4 0 \times 3 6 8$ pixels (which covers most of the images). We use random undersampling masks with $8 \times$ acceleration and $4 \%$ fully-sampled lowfrequency band, undersampled in the phase encoding direction by masking whole kspace lines. We generate a new random mask for each slice on-the-fly while training, but use the same fixed mask for each slice within the same volume on the validation set (different across volumes).
256
+
257
+ Model. We train the default E2E-VarNet network from Sriram et al. (2020) with 12 cascades (approx. $3 0 M$ parameters) for both the single-coil and multi-coil reconstruction problems. For single-coil data we remove the Sensitivity Map Estimation sub-network as sensitivity maps are not relevant in this problem.
258
+
259
+ Hyperparameters and training. We use an Adam optimizer with 0.0003 learning rate following Sriram et al. (2020). We train the baseline model on the full training dataset for 50 epochs. For the smaller, sub-sampled datasets we train for the same computational cost as the baseline, that is we train for $N \cdot 5 0$ epochs on $1 / N$ th of the training data. Without data augmentation, we observe a saturation in validation SSIM during this time. With data augmentation we trained $5 0 \%$ longer as we still observe improvement in validation performance after the standard number of epochs. We report the best SSIM on the validation set throughout training. We train on 4 GPUs for single-coil data and on 8 GPUs for multi-coil data. The batch size matches the number of GPUs used for training, since a GPU can only hold a single datapoint.
260
+
261
+ Data augmentation parameters. The transformations and their corresponding probability weights and ranges of values are depicted in Table 3. We adjust the weights so that groups of transformations such as rotation (arbitrary, by $k \cdot 9 0 ^ { \circ } ,$ ), flipping (horizontal or vertical) or scaling (isotropic or anisotropic) have similar probabilities. For both the affine transformations and upsampling we use bicubic interpolation. Due to computational considerations we only use upsampling before transformations for the single-coil experiments.
262
+
263
+ # C COMPARISON OF ADDITIONAL METRICS
264
+
265
+ In order to provide more in-depth comparison for our main experiment, here we provide results on PSNR as an additional image quality metric. We observe significant and consistent improvement in PSNR when applying MRAugment (Fig. 7) with similar trends to SSIM: the improvement is the most prominent in the low-data regime, but still significant in the moderate domain.
266
+
267
+ <table><tr><td>Transformations</td><td>Range of values</td><td>Wi</td></tr><tr><td>Horizontal flip</td><td>flipped/not flipped</td><td>0.5</td></tr><tr><td>Vertical flip</td><td>flipped/not flipped</td><td>0.5</td></tr><tr><td>Rotation by k · 90°</td><td>k ∈{0,1,2,3}</td><td>0.5</td></tr><tr><td>Rotation</td><td>[-180°,180°]</td><td>0.5</td></tr><tr><td>Translation</td><td>width: [-8%,8%],height: [-12.5%,12.5%]</td><td>1.0</td></tr><tr><td>Isotropic scaling</td><td>[0.75,1.25]</td><td>0.5</td></tr><tr><td>Anisotropic scaling</td><td>[0.75,1.25] along each axes</td><td>0.5</td></tr><tr><td>Shearing</td><td>[-12.5°,12.5°]</td><td>1.0</td></tr></table>
268
+
269
+ ![](images/0740267d72198825ced386155a2a93f5e1d079f5a05b470a17ec6a402eb9822e.jpg)
270
+ Table 3: Data augmentation configuration for all experiments.
271
+ Figure 7: Single-coil (left) and multi-coil (right) validation PSNR vs. # of training images.
272
+
273
+ # D MORE EXPERIMENTAL RESULTS
274
+
275
+ Additional reconstructions. In order to demonstrate that MRAugment works well across a wide range of MR slices and the results depicted in Section 4 are not cherry-picked, here we provide additional reconstructions with and without data augmentation. In multi-coil reconstructions the visual differences are more subtle, therefore we magnified regions with fine details for better comparison.
276
+
277
+ Complete version of Figure 3 extended with reconstructions with and without data augmentation for $1 0 \%$ and $3 3 \%$ training data are presented in Figures 9 and 10 respectively.
278
+
279
+ Figures 11 and 12 provide more reconstructed slices randomly sampled from the validation dataset with and without DA.
280
+
281
+ ![](images/37b52c64c8eccf618b7dcbd9c5fc560486303fece361e9b5eabfa5ed62a4bd29.jpg)
282
+ Figure 8: MRAugment recovers additional fine details even in the moderate data regime.
283
+
284
+ Other models. Even though we demonstrated our DA pipeline on E2E-VarNet, the potential of our technique is not limited to a specific model. We performed preliminary experiments on i-RIM Putzky & Welling (2019), another top performing model on single-coil MR reconstruction. We kept the hyperparameters proposed in Putzky & Welling (2019) for the single-coil problem with modifications as follows. Due to computational considerations, we decreased the number of invertible layers to
285
+
286
+ ![](images/6bb0d38acbc8aff87234db0dd23876584ee4a183420249579e64d433b5738632.jpg)
287
+ Figure 9: Visual comparison of single-coil reconstructions depicted in Figure 3 extended with additional images corresponding to various amount of training data.
288
+
289
+ ![](images/f9ccf7ff93df8040ff7c25f7041e3e970da76f3338eebabaef215467d4221c58.jpg)
290
+ Figure 10: Visual comparison of multi-coil reconstructions depicted in Figure 3 extended with additional images corresponding to various amount of training data.
291
+
292
+ 6 with [64, 128, 256, 256, 128, 64] hidden features inside the reversible blocks and $[ 1 , 2 , 4 , 4 , 2 , 1 ]$ kernel strides in each layer, resulting in a model with $2 0 M$ parameters. In order to further reduce training time, we trained on volumes without fat suppression that take up $5 0 \%$ of the full fastMRI knee dataset. We refer to this new reduced dataset ass ’full’ in this section. Finally, we trained on $3 6 8 x 3 6 8$ center crops of input images for each experiment. We used ramp scheduling with augmentation probability linearly increasing from 0 to $p _ { m a x } = 0 . 4$ . The acceleration factor and under-sampling mask were the same as in Section 4 . As depicted in Fig. 13 , our experiments show that applying data augmentation to only $1 0 \%$ of the training data can match the performance of the model trained on the full dataset.
293
+
294
+ ![](images/ca1b4a6a36cca42d9ce7b6c12648f48a8979640521ea3d9e314b4969b7be9050.jpg)
295
+ Figure 11: Visual comparison of single-coil reconstructions using varying amounts of training data with and without data augmentation.
296
+
297
+ ![](images/b036c5cacf3164e522f52a2ea0907134210dbf519455172aa17a87414140b7bd.jpg)
298
+
299
+ ![](images/c19b1a754cc4c5be0bc26eaa3f2af4e8b268ba7f442bc297862d252a0ff3b5e6.jpg)
300
+ Figure 12: Visual comparison of multi-coil reconstructions using varying amounts of training data with and without data augmentation.
301
+
302
+ Figure 13: Experimental results on the i-RIM network. We are able to achieve SSIM comparable to the $1 0 0 \%$ baseline with only $1 0 \%$ of the training data.
303
+
304
+ # E SENSITIVITY MAP PRESERVING AUGMENTATIONS
305
+
306
+ In the multi-coil case, our augmentation pipeline applies transformations to the underlying object modulated by the different coil sensitivity maps. In particular, the fully sampled measurement of the
307
+
308
+ ith coil in the image domain takes the form
309
+
310
+ $$
311
+ \cdot
312
+ $$
313
+
314
+ where $z _ { i } ^ { \prime } = \mathcal { F } ^ { - 1 } z _ { i }$ is i.i.d Gaussian noise obtained via a unitary transform of the original measurement noise. Assuming linear augmentations, the augmented coil image from MRAugment can be written as
315
+
316
+ $$
317
+ -
318
+ $$
319
+
320
+ where the additive noise is still Gaussian and the augmentation is applied to the coil sensitivity maps as well. However, the models we experimented with had no issues learning the proper mapping from transformed sensitivity maps as our experimental results show.
321
+
322
+ It is natural to ask if data augmentation would be possible by directly augmenting the object. If the coil sensitivities are known or are estimated a priori, one may recover the object from the various coils as
323
+
324
+ $$
325
+ x = \sum _ { j = 1 } ^ { N } S _ { j } ^ { * } x _ { j } = \sum _ { j = 1 } ^ { N } S _ { j } ^ { * } \big ( S _ { j } x ^ { * } + z _ { j } ^ { \prime } \big ) = \big ( \sum _ { j = 1 } ^ { N } S _ { j } ^ { * } S _ { j } \big ) x ^ { * } + \sum _ { j = 1 } ^ { N } S _ { j } ^ { * } z _ { j } ^ { \prime } = x ^ { * } + \sum _ { j = 1 } ^ { N } S _ { j } ^ { * } z _ { j } ^ { \prime } ,
326
+ $$
327
+
328
+ where $S _ { j } ^ { * }$ is the complex conjugate of $S _ { j }$ and $\cdot$ due to typical normalization (Sriram et al., 2020). Then, we can apply the augmentation as
329
+
330
+ $$
331
+ \_
332
+ $$
333
+
334
+ Finally, we obtain the augmented coil images as
335
+
336
+ $$
337
+ x _ { a , i } = S _ { i } x _ { a } = S _ { i } \mathcal { D } x ^ { * } + S _ { i } \mathcal { D } \sum _ { j = 1 } ^ { N } S _ { j } ^ { * } z _ { j } ^ { \prime } .
338
+ $$
339
+
340
+ Comparing this result to E.1, one may see that the additive noise has a very different distribution from the original noise distribution, even worse noise on different augmented coil images are now correlated! Moreover, in this last step we modulated the additive noise with the sensitivity map, resulting in regions with low noise variance where the coil is less sensitive and higher variance in more sensitive regions. This does not reflect the i.i.d noise distribution present on the original coil measurements. Finally, the sensitivity maps are typically not known and need to be estimated before we can apply this augmentation technique, which can introduce additional inaccuracies in the augmentation pipeline.
341
+
342
+ # F ROBUSTNESS
343
+
344
+ ![](images/65649775989db0bb113cfed0db6d344864b6d33fecc8d746217e1f3e36459226.jpg)
345
+ Figure 14: Generalization performance of models trained on knee MRI data and evaluated on brain MRI data. Data augmentation improves validation performance on unseen datasets.
346
+
347
+ We observed an additional benefit of data augmentation, namely its potential to improve the robustness of the trained model. First, we trained a VarNet model on the complete fastMRI knee train dataset using the hyperparameters recommended in Sriram et al. (2020), and evaluated the network on the fastMRI brain validation dataset throughout training. We repeated the experiment with the same hyperparameters, but with MRAugment turned on (exponential scheduling, peak probability 0.4). The results can be seen in Fig. 14. The regularizing effect of data augmentation impedes the network to overfit to the training dataset, thus the resulting model is more robust to shifts in test distribution. This results in higher reconstruction quality in terms of SSIM on unseen brain data when using MRAugment.
md/train/r1gl7hC5Km/r1gl7hC5Km.md ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADAPTING AUXILIARY LOSSES USING GRADIENT SIMILARITY
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ One approach to deal with the statistical inefficiency of neural networks is to rely on auxiliary losses that help to build useful representations. However, it is not always trivial to know if an auxiliary task will be helpful for the main task and when it could start hurting. We propose to use the cosine similarity between gradients of tasks as an adaptive weight to detect when an auxiliary loss is helpful to the main loss. We show that our approach is guaranteed to converge to critical points of the main task and demonstrate the practical usefulness of the proposed algorithm in a few domains: multi-task supervised learning on subsets of ImageNet, reinforcement learning on gridworld, and reinforcement learning on Atari games.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Neural networks are extremely powerful function approximators that have excelled on a wide range of tasks (Simonyan and Zisserman, 2015; Mnih et al., 2015; He et al., 2016a; Silver et al., 2016; Vaswani et al., 2017). Despite the state of the art results across domains, they remain data-inefficient and expensive to train. In supervised learning (e.g., image classification), large deep learning (DL) benchmarks with millions of examples are needed for training (Russakovsky et al., 2015) and the additional implication of requiring human intervention to label a large dataset can be prohibitively expensive. In reinforcement learning (RL), agents typically consume millions of frames of experiences before learning to act in complex environments (Silver et al., 2016; Espeholt et al., 2018), which not only puts pressure on compute power but also makes particular domains (e.g., robotics) impractical.
12
+
13
+ Different techniques have been studied for improving data efficiency, from data augmentation (Krizhevsky et al., 2012; Simonyan and Zisserman, 2015; Hauberg et al., 2016) to transfer learning (Taylor and Stone, 2009; Pan et al., 2010). In this work, we focus on a particular setup for transfer learning. We assume that besides the main task, one has access to one or more auxiliary tasks that share some unknown structure with the main task. To improve data efficiency, these additional tasks can be used as auxiliary losses. However, only the performance on the main task is of interest, even though the model is trained simultaneously on all these tasks. Any improvement on the auxiliary losses is useful only to the extent that it helps learning features or behaviors for the main task.
14
+
15
+ Auxiliary tasks have been shown to work well in practice (e.g., Zhang et al., 2016; Jaderberg et al., 2017; Mirowski et al., 2017; Papoudakis et al., 2018). However, their success depends on how well aligned the auxiliary losses are with the main task. Knowing this apriori is typically non-trivial and the usefulness of an auxiliary task can change through the course of training. In this work, we explore a simple yet effective approach for measuring the similarity between an auxiliary task and the main task of interest, given the value of their parameters. We show that this measure can be used to decide which auxiliary losses are helpful and for how long.
16
+
17
+ # 1.1 NOTATION AND PROBLEM DESCRIPTION
18
+
19
+ Assume we have a main task $\mathcal { T } _ { m a i n }$ and an auxiliary task $\mathcal { T } _ { a u x }$ that induce two losses $\mathcal { L } _ { m a i n }$ and $\mathcal { L } _ { a u x }$ . We care about only about maximizing performance on $\mathcal { T } _ { m a i n }$ ; $\mathcal { T } _ { a u x }$ is an auxiliary task which is not of direct interest. The goal is to devise an algorithm that can automatically $( i )$ leverage $\mathcal { T } _ { a u x }$ when it is helpful (e.g. learn faster) and (ii) block negative transfer when $\mathcal { T } _ { a u x }$ is not helpful (i.e. recover the performance of training only on $\mathcal { T } _ { m a i n }$ ). Note that this setup is different from multi-objective optimization in which both the tasks are of interest. We propose to parameterize the solution for $\mathcal { T } _ { m a i n }$ and $\mathcal { T } _ { a u x }$ by two neural networks, $f ( \cdot , \pmb { \theta } , \phi _ { m a i n } )$ and $g ( \cdot , \pmb { \theta } , \phi _ { a u x } )$ , such that they share a subset of parameters denoted here by $\pmb \theta$ . Generally, the auxiliary loss literature proposes to minimize
20
+
21
+ ![](images/148cbdbcc71bcd0dd7cc29120de783f415d0701e52b0737677f8602684b5ba05.jpg)
22
+ Figure 1: Positive example optimization for $L _ { 1 } ( \theta _ { 1 } , \theta _ { 2 } ) = \theta _ { 1 } ^ { 2 } + \theta _ { 2 } ^ { 2 }$ , $L _ { 2 } ( \theta _ { 1 } , \theta _ { 2 } ) = ( \theta _ { 1 } - 1 ) ^ { 2 } + ( \theta _ { 2 } - 1 ) ^ { 2 }$ $\begin{array} { r } { V ( \theta _ { 1 } , \theta _ { 2 } ) = [ - \frac { \theta _ { 2 } } { \theta _ { 1 } ^ { 2 } + \theta _ { 2 } ^ { 2 } } - 2 \theta _ { 1 } , \frac { } { \theta _ { 2 } ^ { 2 } } } \end{array}$ − 2θ1, θ1θ2+θ2 − 2θ2] where the proposed method speeds up the process (compared on all runs). Each colored trajectory represents one optimization run with random initial position. Star represents the convergence point. All experiments use steepest descent method and run 600 iterations with a constant step size of 0.01. Convergence time is defined as number of steps needed to get below 0.1 loss of $L _ { 1 }$ (gray region). Color of each point represents its alignment with $\nabla L _ { 1 }$ (green—positive alignment, red—negative alignment, white—directions are perpendicular). In this example $L _ { 2 }$ is helpful for $L _ { 1 }$ as it reinforces good descent directions in most of the space. However, simple mixing is actually slowing optimization down (or makes it fail completely, see the second row), while the proposed methods (weighted and unweighted variants) converge faster (see the third row). When using non-conservative vector field $V$ one obtains lack of convergence (cyclic behaviour, see the fourth row), while the proposed merging still works well (see the last row).
23
+
24
+ $$
25
+ \operatorname* { a r g m i n } _ { \theta , \phi _ { m a i n } , \phi _ { a u x } } \mathcal { L } _ { m a i n } ( \theta , \phi _ { m a i n } ) + \lambda \mathcal { L } _ { a u x } ( \theta , \phi _ { a u x } )
26
+ $$
27
+
28
+ under the intuition that modifying $\pmb \theta$ to minimize $\mathcal { L } _ { a u x }$ will improve ${ \mathcal { L } } _ { m a i n }$ if the two tasks are ientlyis for . We pgiven the weight . That is, $\lambda$ at each learning iteration each optimization iterati $t$ by how usefuln, we want to
29
+ $\mathcal { T } _ { a u x }$ $\mathcal { T } _ { m a i n }$ $\pmb { \theta } ^ { ( t ) } , \phi _ { m a i n } ^ { ( t ) } , \phi _ { a u x } ^ { ( t ) }$
30
+ efficiently approximate the solution to
31
+
32
+ $$
33
+ \underset { \lambda ^ { ( t ) } } { \arg \operatorname* { m i n } } \mathcal { L } _ { m a i n } \left( \pmb { \theta } ^ { ( t ) } - \alpha \nabla _ { \theta } \big ( \mathcal { L } _ { m a i n } + \lambda ^ { ( t ) } \mathcal { L } _ { a u x } \big ) , \phi _ { m a i n } ^ { ( t ) } - \alpha \nabla _ { \phi _ { m a i n } } \mathcal { L } _ { m a i n } \right) .
34
+ $$
35
+
36
+ Note that the input space of $\mathcal { T } _ { m a i n }$ and $\mathcal { T } _ { a u x }$ do not have to match. In particular, $\mathcal { T } _ { a u x }$ does not need to be defined for an input of $\mathcal { T } _ { m a i n }$ or the other way around.1 Solving equation 2 is expensive. Instead, we look for a cheap heuristic to approximate $\lambda ^ { ( i ) }$ which is better than keeping $\lambda ^ { ( t ) }$ constant and does not require hyper-tuning.
37
+
38
+ # 2 COSINE SIMILARITY BETWEEN GRADIENTS OF TASKS
39
+
40
+ We propose to use the cosine similarity of gradients between tasks as a measure of task similarity and hence for approximating $\lambda ^ { ( t ) }$ . Consider an example where the main function to minimize is $\mathcal { L } _ { m a i n } = ( \theta - 1 \bar { 0 } ) ^ { 2 }$ and the auxiliary function is $\mathcal { L } _ { a u x } = \theta ^ { 2 }$ , their gradients are $\nabla _ { \theta } \mathcal { L } _ { m a i n } = 2 ( \theta - 1 0 )$ and $\nabla _ { \theta } \mathcal { L } _ { a u x } = 2 \theta$ respectively. When $\theta$ is initialized at $\theta = - 2 0$ , the gradients of the main and auxiliary functions point in the same direction and the cosine similarity is 1; minimizing the auxiliary loss is beneficial for minimizing the main. However, at a different point, $\theta = 5$ , the two gradients point in different directions and the cosine similarity is $- 1$ ; minimizing the auxiliary loss would hinder minimizing the main loss (See Figure 7 in Appendix B for an illustration.).
41
+
42
+ This example suggests a natural strategy for approximating $\lambda ^ { ( t ) }$ : minimize the auxiliary loss as long as its gradient has non-negative cosine similarity with the target gradient; otherwise, the auxiliary loss should be ignored. This follows the well-known intuition that if a vector is in the same half-space as the gradient of a function $f$ , then it is a decent direction for $f$ . This reduces our strategy to ask if the gradient of the auxiliary loss is a descent direction for the main loss of interest.
43
+
44
+ Proposition 1. Given any gradient vector field $G ( \pmb \theta ) = \nabla _ { \pmb \theta } \mathcal { L } ( \pmb \theta )$ and any vector field $V ( \pmb \theta )$ (such as the gradient of another loss function, or an arbitrary set of updates), an update rule of the form
45
+
46
+ $$
47
+ \pmb \theta ^ { ( t + 1 ) } : = \pmb \theta ^ { ( t ) } - \alpha ^ { ( t ) } ( G ( \pmb \theta ^ { ( t ) } ) + V ( \pmb \theta ^ { ( t ) } ) \operatorname* { m a x } ( 0 , \cos ( G ( \pmb \theta ^ { ( t ) } ) , V ( \pmb \theta ^ { ( t ) } ) ) )
48
+ $$
49
+
50
+ converges to the local minimum of $\mathcal { L }$ given small enough $\alpha ^ { ( t ) }$ .
51
+
52
+ Proof is provided in Appendix A.1.
53
+
54
+ Note that the above statement does not guarantee any improvement of convergence, but only guarantees lack of divergence. In particular, cosine similarity is not a silver bullet that guarantees positive transfer, but it can drop the “worst-case scenarios”. In principle, one can create example functions where the convergence of the main loss is affected both positively (see Figure 1) and negatively (see Figure 8 in Appendix D). Nevertheless, convergence on the main task is guaranteed for our proposed strategy, as the proposition shows.
55
+
56
+ In addition, it is important to note that simply adding an arbitrary vector field does not have the convergence property. For example, use function $\begin{array} { r } { V ( \pmb { \theta } ) = - \nabla _ { \pmb { \theta } } \mathcal { L } ( \pmb { \theta } ) + \left[ - \frac { \theta _ { 2 } } { \theta _ { 1 } ^ { 2 } + \theta _ { 2 } ^ { 2 } } , \frac { \theta _ { 1 } } { \theta _ { 1 } ^ { 2 } + \theta _ { 2 } ^ { 2 } } \right] ^ { T } } \end{array}$ as a two-dimensional case, which leads to an update rule of $\begin{array} { r } { \pmb { \theta } ^ { ( t + 1 ) } = \pmb { \theta } ^ { ( t ) } - \alpha \left[ - \frac { \theta _ { 2 } } { \theta _ { 1 } ^ { 2 } + \theta _ { 2 } ^ { 2 } } , \frac { \theta _ { 1 } } { \theta _ { 1 } ^ { 2 } + \theta _ { 2 } ^ { 2 } } \right] ^ { T } } \end{array}$ This is a non-conservative vector field which cases the optimizer to follow concentric circles around the origin (see the fourth row in Figure 1). This is crucial to note for some realistic scenarios where one does not always form a gradient field (e.g., the update rule of the Q-learning algorithm in RL).
57
+
58
+ Figure 1 provides a few illustrative examples on quadratic functions using the proposed approach, which helps intuitively understand the kind of scenarios for which the approach could help.
59
+
60
+ The above proposition refers to losses with the same set of parameters $\pmb { \theta }$ , while equation 2 refers to the scenario when each loss has task specific parameters (e.g. $\phi _ { m a i n }$ and $\phi _ { a u x }$ ). The following proposition extends to this scenario:
61
+
62
+ Proposition 2. Given two losses parametrized with $\Theta$ (some of which are shared $\pmb \theta$ and some unique to each loss $\phi _ { m a i n }$ and $\phi _ { a u x }$ ), learning rule:
63
+
64
+ $$
65
+ \begin{array} { r l } & { \mathbf { \Phi } _ { l } ^ { ( t + 1 ) } : = \pmb { \theta } ^ { ( t ) } - \alpha ^ { ( t ) } \big ( \nabla _ { \theta } \mathcal { L } _ { m a i n } ( \pmb { \theta } ^ { ( t ) } ) + \nabla _ { \theta } \mathcal { L } _ { a u x } ( \pmb { \theta } ^ { ( t ) } ) \operatorname* { m a x } \big ( 0 , \cos ( \nabla _ { \theta } \mathcal { L } _ { m a i n } ( \pmb { \theta } ^ { ( t ) } ) , \nabla _ { \theta } \mathcal { L } _ { a u x } ( \pmb { \theta } ^ { ( t ) } ) \big ) \big ) } \\ & { \mathbf { \Phi } _ { m a i n } ^ { ( t + 1 ) } : = \phi _ { m a i n } ^ { ( t ) } - \alpha ^ { ( t ) } \nabla _ { \phi _ { m a i n } } \mathcal { L } _ { m a i n } ( \mathbf { \Theta } _ { } ^ { ( t ) } ) \quad \mathbf { \Phi } _ { a n d } \quad \phi _ { a u x } ^ { ( t + 1 ) } : = \phi _ { a u x } ^ { ( t ) } - \alpha ^ { ( t ) } \nabla _ { \phi _ { a u x } } \mathcal { L } _ { a u x } ( \pmb { \Theta } ^ { ( t ) } ) } \end{array}
66
+ $$
67
+
68
+ leads to convergence to local minimum of $\mathcal { L } _ { m a i n } \ w . r . t .$ . $( \theta , \phi _ { m a i n } )$ given small enough $\alpha ^ { ( t ) }$ .
69
+
70
+ Proof. Comes directly from the previous proposition that $G = \nabla _ { \theta } \mathcal { L } _ { m a i n }$ and $V = \nabla _ { \theta } \mathcal { L } _ { a u x }$ . For any vector fields $A , B , C$ , we have $\langle A , B \rangle \geq 0$ and $\langle C , B \rangle \geq 0$ implies $\langle A + C , B \rangle \geq 0$ . □
71
+
72
+ Analogous guarantees hold for the unweighted version of this algorithm, where instead of weighting by $\cos ( G , V )$ we use a binary weight $( \mathrm { s i g n } ( \cos ( G , V ) ) + 1 ) / \bar { 2 }$ which is equivalent to using $V$ iff $\cos ( G , V ) > 0$ . When training with mini-batches, accurately estimating $\cos ( G , V )$ can be difficult due to mini-batch noise; the unweighted variant only requires $\operatorname { s i g n } ( \cos ( G , V )$ which can be estimated more robustly. Hence, we use this variant in our experiments unless otherwise specified. Additionally, note that there is no guarantee that $\mathcal { L } _ { a u x }$ is optimized. For example, if $\mathcal { L } _ { a u x } = - \mathcal { L } _ { m a i n }$ then $\mathcal { L } _ { a u x }$ is ignored (see a visualization in the last row of Figure 1).
73
+
74
+ Despite its simplicity, the proposed update rule can give rise to interesting phenomena. We can show that the emerging vector field could be non-conservative, which means there does not exist a loss function for which it is a gradient. While this might seem problematic (for gradient-descent-based optimizers), it describes only the global structure—typically used optimizers are local in nature and they do local, linear or quadratic approximations of the function (Shwartz-Ziv and Tishby, 2017). Consequently, in practice, one should not expect any negative effects from this phenomena, as it simply shows that our proposed technique is in fact qualitatively changing the nature of the update rules for training.
75
+
76
+ Proposition 3. In general, the proposed update rule does not have to create a conservative vector field.
77
+
78
+ Proof is provided in Appendix A.2.
79
+
80
+ # 3 APPLICATIONS OF GRADIENT COSINE SIMILARITY
81
+
82
+ In this section, we use the gradient cosine similarity to decide when to train on the auxiliary task. All experiments (unless otherwise stated) follow the unweighted version of our method, summarized in Algorithm 1. The weighted version of our method is summarized in Algorithm 2, Appendix C.
83
+
84
+ # Algorithm 1 Unweighted version of our method.
85
+
86
+ 1: Initialize shared parameters $\pmb { \theta }$ and task specific parameters $\phi _ { m a i n } , \phi _ { a u x }$ randomly.
87
+ 2: for iter $= 1$ : max iter do
88
+ 3: Compute $\nabla _ { \pmb { \theta } } \mathcal { L } _ { m a i n }$ , $\nabla _ { \phi _ { m a i n } } \mathcal { L } _ { m a i n }$ , $\nabla _ { \theta } \mathcal { L } _ { a u x }$ , $\nabla _ { \phi _ { a u x } } \mathcal { L } _ { a u x }$ .
89
+ 4: Update $\phi _ { m a i n }$ and $\phi _ { a u x }$ using corresponding gradients
90
+ 5: if $\cos ( \nabla _ { \pmb { \theta } } \mathcal { L } _ { m a i n } , \nabla _ { \pmb { \theta } } \mathcal { L } _ { a u x } ) \geq 0$ then
91
+ 6: Update $\pmb \theta$ using $\nabla _ { \pmb { \theta } } \mathcal { L } _ { m a i n } + \nabla _ { \pmb { \theta } } \mathcal { L } _ { a u x }$
92
+ 7: else
93
+ 8: Update $\pmb \theta$ using $\nabla _ { \pmb { \theta } } \mathcal { L } _ { m a i n }$
94
+
95
+ # 3.1 EXPERIMENTS ON IMAGE CLASSIFICATION TASKS
96
+
97
+ First, we consider a classification problem on ImageNet (Russakovsky et al., 2015) and design a simple multi-task binary classification task to test our hypothesis that transferable tasks should have high cosine similarity (and vice versa). We take a pair of classes from ImageNet, refer to these as class $A$ and class $B$ ; all the other 998 classes in ImageNet (except $A$ and $B$ ) are referred to as the background. Our tasks $\mathcal { T } _ { m a i n }$ and $\mathcal { T } _ { a u x }$ are then formed as a binary classification of if an image is class $A$ (otherwise background) and if an image is class $B$ (otherwise background) respectively.
98
+
99
+ Ideally, we want to pick groups of class pairs that reflect near or far distance, for the purpose of providing a baseline of transferability. Therefore, we used two distance measures, lowest common ancestor $( L C A )$ in the ImageNet label hierarchy and Frechet Inception Distance (FID) (Heusel et al., 2017) of pre-trained image embedding, to serve as a ground truth of class similarity for selecting class pair $A$ and $B$ . Based on these measures, we picked three pair of classes for near, class 871 (trimaran) vs. 484 (catamaran), 250 (Siberian husky) vs. 249 (malamute), and 238 (Greater Swiss Mountain dog) vs. 241 (Entleucher); and for far, class 920 (traffic light) vs. 62 (rock python), 926 (hotpot) vs. 800 (slot), and 48 (Komodo dragon) vs. 920 (traffic light). Details on the class pair selection are described in Appendix E.
100
+
101
+ We use a modified ResNetV2-18 model (He et al., 2016b) for training in this experiment. All parameters in the convolutional layers are shared (denote as $\pmb { \theta }$ ), followed by task-specific parameters $\phi _ { m a i n }$ and $\phi _ { a u x }$ . First, we use a multi-task learning setup and minimize $\mathcal { L } _ { m a i n } + \mathcal { L } _ { a u x }$ , and measure cosine similarity on $\pmb { \theta }$ through the course of training. Figure 2(a) shows that cosine similarity is higher for near pairs (blue lines) and lower for far pairs (red lines). Next, we compare single-task training, multi-task training, and our proposed variant on two scenarios (i) auxiliary task helps and (ii) auxiliary task hurts. As mentioned earlier, our goal is have a method that can automatically leverage auxiliary tasks when they are helpful and avoid negative transfer when auxiliary tasks are not helpful. Figure 2(b) shows that on a near pair, all variants perform similarly in terms of final performance; furthermore, our method performs similar to multi-task learning and learns faster than single task because the task is transferable. Figure 2(c) shows that on a far pair, multi-task learning leads to poorer performance than single-task learning on the main task due to the potential negative transfer, whereas our method of using gradient cosine similarity blocks negative transfer and automatically achieves performance that is comparable to single-task learning.
102
+
103
+ ![](images/c61cf34feaf0d0382683306cc9465dfc6f98c46145d1c301328f729afaaa9664.jpg)
104
+ Figure 2: Multi-task learning setup on ImageNet class pairs. (a): gradient cosine similarity is higher for near pairs and lower for far pairs. (b) and (c): testing accuracy on single task (dotted), naive multi-task (dashed), and our method (solid). Naive multi-task learning helps in near pairs (see $( b )$ ) but hurts in far pairs (see (c)) because of its lack of the ability to prevent negative effects from the auxiliary task to the main task. Our method can overcome this limitation by dropping the auxiliary task when its gradient direction disagrees with the main task, thus achieving the best of both worlds: matching the multi-task performance on near pairs (see $( b )$ where our method and multi-task learning learn faster than single task only) and the single task performance in far pairs (see (c) where multi-task learning performs poorly, but our method automatically recovers single task performance).
105
+
106
+ # 3.2 EXPERIMENTS ON REINFORCEMENT LEARNING GRIDWORLD TASKS
107
+
108
+ We then consider a typicalfuture discounted rewards (POMDP). There have bee one aims to find a policy in a partially observable proposed to solve this op $\pi$ that maximizes sum ofarkov decision processmization problem, from $\mathbb { E } _ { \pi } [ \sum _ { t ^ { \prime } = 1 } ^ { N } \gamma ^ { t ^ { \prime } - 1 } r _ { t ^ { \prime } } ]$ classical policy gradient (Williams, 1992), Q-Learning (Watkins, 1989), to the more modern Proximal Policy Optimization (Schulman et al., 2017) and V-Trace (Espeholt et al., 2018). Inherently, these techniques are data inefficient due to the complexity of the problem. One way to address this issue is to use transfer learning, such as transfer from pre-trained policies (Rusu et al., 2015). However, a teacher policy is not always available for the main task. When in this scenario, one can train policies in other tasks that share enough similarities and hope for a positive transfer. One way of exploiting this extra information is to use behavioral cloning, or distillation (Hinton et al., 2015; Rusu et al., 2015), to guide the main task in its initial learning phase (Schmitt et al., 2018), although it might be difficult to find a suitable strategy that combines the main and auxiliary losses and/or smoothly transition between them. Typically, the teacher policy can be treated as an auxiliary loss (Schmitt et al., 2018) or a prior (Teh et al., 2017) with a fixed mixing coefficient. However, these techniques become unsound if the teacher policy is helpful only in specific states while hindering in other states.
109
+
110
+ We propose a simple RL experiment to show that our method is capable of finding the strategy of combining the main loss and the auxiliary loss. We define a distribution over a set of $1 5 \times 1 5$ gridworlds, where an agent observes its surrounding (up to four pixels away) and can move in four directions.We randomly place two types of positive rewards, $+ 5$ and $+ 1 0$ points, both terminating an episode. In order to guarantee a finite length of episodes, we add a fixed probability of 0.01 of transitioning to a non-rewarding terminal state. Experiment details are provided in Appendix F.
111
+
112
+ First, we train a Q-learning agent on such a gridworld which gives us a teacher policy $\pi ^ { 2 }$ . Then, we create the main task to which there is a possible positive knowledge transfer by keeping the environment with the same gridworld layout but remove the $+ 1 0$ rewards (and corresponding states are no longer terminating). Consequently, we have two tasks: the auxiliary task $\mathcal { T } _ { a u x }$ where we have a strong teacher policy $\pi ^ { 2 }$ , and the main task $\mathcal { T } _ { m a i n }$ where the $+ 1 0$ rewards are removed. We sample 1, 000 such environment pairs and report expected returns obtained (100 evaluation episodes per evaluation point) using various training regimes. One can use any RL method to solve the main task and learn $\pi$ , here we use episode-level policy gradient (Williams, 1992) with value function as a baseline method, which gives a score of slightly above 1 point after $1 0 , 0 0 0$ steps of training (see the top row of Figure 3).
113
+
114
+ To leverage teacher policies, we define the auxiliary loss to be a distillation loss, which is a per-state cross-entropy between teacher’s and student’s distributions over actions. First, we test using solely the distillation loss while sampling trajectories from the student. We recover a subset of teacher’s behaviors and end up with 0 point—an expected negative transfer as the teacher is guiding us to states that are no longer rewarding. Then, we test simply adding gradients estimated by policy gradient and distillation. The resulting policy learns quickly but saturates at a return of 1 point, showing very limited positive transfer. Lastly, when using our proposed gradient cosine similarity as the measure of transferability, we get a significant performance boost. The learned policies reach baseline performance after just one-third of steps taken by the baseline, and on average obtain 3 points after 10, 000 steps.2 See Figure 3 for all learning curves. In Appendix F, we visualize the environment and show an example solution.
115
+
116
+ This experiment shows that gradient cosine similarity allows using knowledge from other related tasks in an automatic fashion. The agent is simply ignoring teacher signal when it disagrees with policy gradient estimator. If they do agree in terms of which actions to reinforce—teacher logits are used for better replication of useful policies. In particular, in the bottom row of Figure 3, we present an experiment of transfer between the same task $\mathcal { T } _ { m a i n }$ . We see that the cosine similarity experiments underperformed that of simply adding the two losses. This is expected as the noise in the gradients makes it hard to measure if the two tasks are a good fit or not.
117
+
118
+ # 3.3 EXPERIMENTS ON ATARI
119
+
120
+ Finally, we consider a similar RL setup on the Atari domain (Bellemare et al., 2013). For this set of experiments, we follow the same convolutional architecture as in previous works (Mnih et al., 2015; 2016; Espeholt et al., 2018; Hessel et al., 2018) and train using the batched actor-critic with V-trace algorithm (Espeholt et al., 2018). Details on the experiment setup are provided in Appendix G.
121
+
122
+ First, we look at training an agent to play a main task (here, Breakout) given a sub-optimal teacher solution to the task. Analogous to the previous experiment, we leverage information about the task by distilling the teacher’s behaviour with a Kullback-Leibler (KL) loss. As expected, solely relying on distilling from the sub-optimal teacher $( O n l y K L )$ leads to lower performance. Training with both distillation and RL losses $\left( R L + K L ( B a s e l i n e ) \right)$ leads to slightly better but also sub-optimal performance. While both approaches learn very quickly, they plateau much lower than the pure RL approach (RL(Baseline)). In our method $( R L + K L ( O u r M e t h o d ) )$ , the KL penalty is scaled at every time-step by the cosine similarity between the policy gradient and distillation losses; once this falls below a fixed threshold, the loss is ‘turned off’. Figure 4 shows that our approach is able to learn quickly at the start but continue fine-tuning with pure RL loss once the distillation loss is zeroed out.
123
+
124
+ ![](images/a0a7154a29483f61df3c355d609d2e08ae4ab9ffd2eadc83b5a83fbe3048fb51.jpg)
125
+ Figure 3: Top row: expected learning curves for cross-environment distillation experiments, averaged over 1, 000 partially observable gridworlds. Teacher’s policy is based on Q-Learning, its performance in a new environment (with modified positive rewards) is represented by the top dotted line. The bottom dotted line represents random policy score. Each column represents a different temperature applied to the teacher policy. 0 temperature refers to the original deterministic greedy policy given by Q-Learning. We report five methods: reward using just policy gradient in the new task; distill using just distillation cost towards the teacher; add adding the two above; cos using the weighted version of our method (Algorithm 2); strict cos using the unweighted version of our method (Algorithm 1). Bottom row: expected learning curves for same-environment distillation experiments when the teacher is perfect. In this case, the optimal thing is to trust the teacher everywhere.
126
+
127
+ Lastly, we consider a setting where the main task ${ \mathcal { T } } _ { m a i n }$ is to train an agent to play two Atari games, Breakout and Ms. PacMan. Similar to previous experiment, we have access to a teacher trained on just Breakout as the auxiliary task $\mathcal { T } _ { a u x }$ , from which we distill a policy via KL loss. Note that $\mathcal { T } _ { m a i n }$ itself is chosen to be Multitask to illustrate a complex scenario where $\mathcal { T } _ { a u x }$ helps with only part of $\mathcal { T } _ { m a i n }$ , and that too only initially. We consider a distillation loss as was done previously by adding the auxiliary KL loss $\mathcal { L } _ { a u x }$ (between the teacher and student policies) to the RL multi-task loss ${ \mathcal { L } } _ { m a i n }$ at every time step. Intuitively, doing so would result in the agent only be able to solve one of the tasks—the one the teacher knows about, as the gradients from distillation loss would interfere with the policy gradient. Figure 5 shows that, compared to the baseline Multitask and the simple addition of Multitask $R L +$ Distillation approaches where the agent learns one task at the expense of the other, our method of scaling the auxiliary loss by gradient cosine similarity is able to compensate for this by learning from the teacher and then turning off the auxiliary distillation; it learns Ms. PacMan without forgetting Breakout. The evolution of the gradient cosine similarity between Breakout and Ms. PacMan provides a meaningful cue for the usefulness of $\mathcal { L } _ { a u x }$
128
+
129
+ ![](images/1365f698b4d635bda30088c7772115e067ac5cf7e290bd9533e9019377d9edb5.jpg)
130
+ Figure 4: Results on Breakout. We look at the effects of distilling a sub-optimal policy as an auxiliary task.
131
+
132
+ # 4 RELATED WORK
133
+
134
+ Our work is related to the literature on identifying task similarity in transfer learning. It is generally believed that positive transfer can be achieved when source task(s) and target task(s) are related.
135
+
136
+ ![](images/e920a1d5503f5e559d5126ce96d09452eb1bf5f9d33889c078dc5afb3fb34204.jpg)
137
+ Figure 5: Results on Breakout and Ms. PacMan (averaged over 3 seeds). The two plots to the left show performance on Breakout and Ms. PacMan respectively. The third plot shows how the gradient cosine similarity between the two tasks changes during training. The last plot shows an average score of the multi-task performance (normalized independently for each game based on the best score achieved across all experiments). Our method is able to learn both games without forgetting and achieves the best average performance.
138
+
139
+ However, it is usually assumed that this relatedness mapping is provided by human experts (Taylor and Stone, 2009; Pan et al., 2010); few works have addressed the problem of finding a general measure of similarity to predict transferability between tasks. In image classification, Yosinski et al. (2014) defined image similarity in ImageNet by manually splitting classes into man-made versus natural objects. In RL, methods have been proposed to use the Markov decision process (MDP) similarity as a measure of task relatedness (Carroll and Seppi, 2005; Ammar et al., 2014). While in some degree capture task similarity, these measures are often domain-specific and not generalizable. In addition, none of these works have explicitly used the learned similarity metric to improve performance. In our work, we propose to use cosine similarity of gradients as a generalizable measure across domains and show it can be directly leveraged to improve the performance of the main task. One important aspect of task similarity for transfer is that it is highly dependent on the parametrization of the model and current value of the parameters. We exploit this property by providing a heuristic similarity measure for the current parameters, resulting in an approach that relies on an adaptive weight over the updates of the model.
140
+
141
+ Auxiliary tasks have shown to be beneficial in facilitating learning across domains. In image classification, Zhang et al. (2016) used unsupervised reconstruction tasks. In RL, the UNREAL framework (Jaderberg et al., 2017) incorporates unsupervised control tasks along with reward prediction learning as auxiliary tasks. Mirowski et al. (2017) studied auxiliary tasks in the context of navigation. Papoudakis et al. (2018) also explored auxiliary loses for VizDoom. However, these works rely on empirical results and do not address how the auxiliary tasks were selected in the first instance. In this work, we aim to propose a simple yet effective way of explicitly selecting auxiliary tasks by using cosine similarity of task gradients.
142
+
143
+ Our work is also related to multi-task learning (Caruana, 1997), particularly the line of work on using adaptive scaling techniques for multi-objective learning. For example, a recently developed algorithm, GradNorm (Chen et al., 2018), uses gradient magnitude to scale loss function for each task, aiming to learn well for all tasks. Similarly, Kendall et al. (2018) proposed a weighting mechanism by considering the homoscedastic uncertainty of each task. However, our work is different in two ways: first, in our problem setup, we care only about the performance of the main task and we do not care about all tasks; hence, the optimization goal is different from their setup which is more similar to traditional multi-objective optimization. Furthermore, it is important to note that our method differs from aforementioned work in that they scale the losses individually without looking at their interaction (which can lead to poor performance in our problem setup, when the auxiliary task hurts the main task), whereas we look for alignments in the vector field between the main and the auxiliary task, and the auxiliary task is used only when it is well-aligned with the main task.
144
+
145
+ # 5 DISCUSSION
146
+
147
+ In this work, we explored a simple yet efficient technique to ensure that an auxiliary loss does not hurt the learning on the main task. The proposed approach reduces to applying gradients of the auxiliary task only if they are a descent direction of the main task.
148
+
149
+ We discuss here a few shortcomings of this method. First, estimating the cosine similarity between the gradients of tasks could be expensive or noisy and that the threshold for turning off the auxiliary is a fixed constant. These could be addressed by calculating a running average of the cosine similarity to get a smoother result and potentially hyper-tune the threshold instead of setting it as a fixed constant. One might argue that our approach would fail in high-dimensional spaces since random vectors in such spaces tend to be orthogonal, so that cosine similarity will be naturally driven to 0. In fact, this is not the case; if two gradients are meant to be co-linear, the noise components cancel each other thus will not affect the cosine similarity estimation. We empirically explore this in Appendix H. Second, the new loss surface might be less smooth which can be problematic when using optimizers that rely on statistics of the gradients or second order information (e.g. Adam or RMSprop). In these cases, the transition from just the gradient of the main task to the sum of the gradients can affect the statistics of the optimizer in unwanted ways.
150
+
151
+ Lastly, although the proposed approach works well empirically on complex and noisy tasks like Atari games, as discussed in Section 2, it guarantees only that the main task will converge, but not how fast it will be. While removing the worst case scenarios is important and a good first step, one might care more for data efficiency when using auxiliary losses (i.e., faster convergence). Particularly in Appendix D Figure 8, we construct a counter-example where the proposed update rule slows down learning, compared to optimizing the main task alone. Nevertheless, we have empirically shown the potential of using the proposed hypothesis as a simple yet efficient way of picking a suitable auxiliary task. While we have mostly considered scenarios where the auxiliary task helps initially but hurts later, it would be interesting to explore settings where the auxiliary task hurts initially but helps in the end. Examples of such are annealing $\beta$ in $\beta$ -VAE (Higgins et al., 2017) and annealing the confidence penalty in (Pereyra et al., 2017).
152
+
153
+ # REFERENCES
154
+
155
+ H. B. Ammar, E. Eaton, M. E. Taylor, D. C. Mocanu, K. Driessens, G. Weiss, and K. Tuyls. An automated measure of MDP similarity for transfer in reinforcement learning. In Workshops at the Twenty-Eighth AAAI Conference on Artificial Intelligence, 2014.
156
+ M. G. Bellemare, Y. Naddaf, J. Veness, and M. Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, 2013.
157
+ J. L. Carroll and K. Seppi. Task similarity measures for transfer in reinforcement learning task libraries. In Neural Networks, 2005. IJCNN’05. Proceedings. 2005 IEEE International Joint Conference on, volume 2, pages 803–808. IEEE, 2005.
158
+ R. Caruana. Multitask learning. Machine learning, 28(1):41–75, 1997.
159
+ Z. Chen, V. Badrinarayanan, C.-Y. Lee, and A. Rabinovich. Gradnorm: Gradient normalization for adaptive loss balancing in deep multitask networks. In ICML, 2018.
160
+ L. Espeholt, H. Soyer, R. Munos, K. Simonyan, V. Mnih, T. Ward, Y. Doron, V. Firoiu, T. Harley, I. Dunning, et al. IMPALA: Scalable distributed Deep-RL with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018.
161
+ A. Goldstein. Cauchy’s method of minimization. Numerische Mathematik, 4(1):146–150, 1962.
162
+ S. Hauberg, O. Freifeld, A. B. L. Larsen, J. Fisher, and L. Hansen. Dreaming more data: Classdependent distributions over diffeomorphisms for learned data augmentation. In Artificial Intelligence and Statistics, pages 342–350, 2016.
163
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016a.
164
+ K. He, X. Zhang, S. Ren, and J. Sun. Identity mappings in deep residual networks. In European conference on computer vision, pages 630–645. Springer, 2016b.
165
+ M. Hessel, H. Soyer, L. Espeholt, W. Czarnecki, S. Schmitt, and H. van Hasselt. Multi-task deep reinforcement learning with PopArt. arXiv preprint arXiv:1809.04474, 2018.
166
+ M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, G. Klambauer, and S. Hochreiter. GANs trained by a two time-scale update rule converge to a Nash equilibrium. arXiv preprint arXiv:1706.08500, 2017.
167
+ I. Higgins, L. Matthey, A. Pal, C. Burgess, X. Glorot, M. Botvinick, S. Mohamed, and A. Lerchner. $\beta$ -VAE: Learning basic visual concepts with a constrained variational framework. In ICLR, 2017.
168
+ G. Hinton, O. Vinyals, and J. Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
169
+ M. Jaderberg, V. Mnih, W. M. Czarnecki, T. Schaul, J. Z. Leibo, D. Silver, and K. Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. In ICLR, 2017.
170
+ A. Kendall, Y. Gal, and R. Cipolla. Multi-task learning using uncertainty to weigh losses for scene geometry and semantics. In CVPR, 2018.
171
+ A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, 2012.
172
+ P. Mirowski, R. Pascanu, F. Viola, H. Soyer, A. J. Ballard, A. Banino, M. Denil, R. Goroshin, L. Sifre, K. Kavukcuoglu, et al. Learning to navigate in complex environments. In ICLR, 2017.
173
+ V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
174
+ V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In ICML, 2016.
175
+ S. J. Pan, Q. Yang, et al. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10):1345–1359, 2010.
176
+ G. Papoudakis, K. C. Chatzidimitriou, and P. A. Mitkas. Deep reinforcement learning for doom using unsupervised auxiliary tasks. CoRR, abs/1807.01960, 2018.
177
+ G. Pereyra, G. Tucker, J. Chorowski, Ł. Kaiser, and G. Hinton. Regularizing neural networks by penalizing confident output distributions. arXiv preprint arXiv:1701.06548, 2017.
178
+ N. Quadrianto, J. Petterson, T. S. Caetano, A. J. Smola, and S. Vishwanathan. Multitask learning without label correspondences. In NIPS, 2010.
179
+ O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
180
+ A. A. Rusu, S. G. Colmenarejo, C. Gulcehre, G. Desjardins, J. Kirkpatrick, R. Pascanu, V. Mnih, K. Kavukcuoglu, and R. Hadsell. Policy distillation. arXiv preprint arXiv:1511.06295, 2015.
181
+ S. Schmitt, J. J. Hudson, A. Zidek, S. Osindero, C. Doersch, W. M. Czarnecki, J. Z. Leibo, H. Kuttler, A. Zisserman, K. Simonyan, et al. Kickstarting deep reinforcement learning. arXiv preprint arXiv:1803.03835, 2018.
182
+ J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
183
+ R. Shwartz-Ziv and N. Tishby. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810, 2017.
184
+ D. Silver, A. Huang, C. J. Maddison, A. Guez, L. Sifre, G. Van Den Driessche, J. Schrittwieser, I. Antonoglou, V. Panneershelvam, M. Lanctot, et al. Mastering the game of Go with deep neural networks and tree search. nature, 529(7587):484, 2016.
185
+ K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
186
+ M. E. Taylor and P. Stone. Transfer learning for reinforcement learning domains: A survey. JMLR, 2009.
187
+ Y. Teh, V. Bapst, W. M. Czarnecki, J. Quan, J. Kirkpatrick, R. Hadsell, N. Heess, and R. Pascanu. Distral: Robust multitask reinforcement learning. In NIPS, 2017.
188
+ A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. In NIPS, 2017.
189
+ C. J. C. H. Watkins. Learning from delayed rewards. PhD thesis, King’s College, Cambridge, 1989.
190
+ R. J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
191
+ J. Yosinski, J. Clune, Y. Bengio, and H. Lipson. How transferable are features in deep neural networks? In NIPS, 2014.
192
+ Y. Zhang, K. Lee, and H. Lee. Augmenting supervised neural networks with unsupervised objectives for large-scale image classification. In ICML, 2016.
193
+
194
+ # A PROOFS
195
+
196
+ # A.1 PROOF FOR PROPOSITION 1
197
+
198
+ Given any gradient vector field $G ( \pmb \theta ) = \nabla _ { \pmb \theta } \mathcal { L } ( \pmb \theta )$ and any vector field $V ( \pmb \theta )$ (such as gradient of another loss function, but could be arbitrary set of updates), an update rule of the form
199
+
200
+ $$
201
+ \pmb \theta ^ { ( t + 1 ) } : = \pmb \theta ^ { ( t ) } - \alpha ^ { ( t ) } ( G ( \pmb \theta ^ { ( t ) } ) + V ( \pmb \theta ^ { ( t ) } ) \operatorname* { m a x } ( 0 , \cos ( G ( \pmb \theta ^ { ( t ) } ) , V ( \pmb \theta ^ { ( t ) } ) ) )
202
+ $$
203
+
204
+ converges to the local minimum of $\mathcal { L }$ given small enough $\alpha ^ { ( t ) }$ .
205
+
206
+ Proof. Let us denote
207
+
208
+ $$
209
+ \begin{array} { r l } & { G ^ { ( t ) } : = G ( \pmb { \theta } ^ { ( t ) } ) \qquad V ^ { ( t ) } : = V ( \pmb { \theta } ^ { ( t ) } ) \qquad \nabla \mathcal { L } ^ { ( t ) } : = \nabla _ { \pmb { \theta } } \mathcal { L } ( \pmb { \theta } ^ { ( t ) } ) } \\ & { \qquad \Delta \pmb { \theta } ^ { ( t ) } : = G ^ { ( t ) } + V ^ { ( t ) } \operatorname* { m a x } ( 0 , \cos ( G ^ { ( t ) } , V ^ { ( t ) } ) ) . } \end{array}
210
+ $$
211
+
212
+ Our update rule is simply $\pmb { \theta } ^ { ( t + 1 ) } : = \pmb { \theta } ^ { ( t ) } - \alpha ^ { ( t ) } \Delta \pmb { \theta } ^ { ( t ) }$ and we have
213
+
214
+ $$
215
+ \begin{array} { r l } & { \langle \Delta \pmb { \theta } ^ { ( t ) } , \nabla \mathcal { L } ^ { ( t ) } \rangle = \langle G ^ { ( t ) } + V ^ { ( t ) } \operatorname* { m a x } ( 0 , \cos ( G ^ { ( t ) } , V ^ { ( t ) } ) ) , \nabla \mathcal { L } ^ { ( t ) } \rangle } \\ & { \quad \quad \quad \quad \quad = \langle G ^ { ( t ) } , \nabla \mathcal { L } ^ { ( t ) } \rangle + \langle V ^ { ( t ) } \operatorname* { m a x } ( 0 , \cos ( G ^ { ( t ) } , V ^ { ( t ) } ) ) , \nabla \mathcal { L } ^ { ( t ) } \rangle } \\ & { \quad \quad \quad \quad = \| \nabla \mathcal { L } ^ { ( t ) } \| ^ { 2 } + \frac { 1 } { \| V ^ { ( t ) } \| \| \nabla \mathcal { L } ^ { ( t ) } \| } \operatorname* { m a x } ( 0 , \langle \nabla \mathcal { L } ^ { ( t ) } , V ^ { ( t ) } \rangle ) \langle V ^ { ( t ) } , \nabla \mathcal { L } ^ { ( t ) } \rangle \ge 0 . } \end{array}
216
+ $$
217
+
218
+ And it can be 0 if and only if $\| \nabla \mathcal { L } ^ { ( t ) } \| = 0$ (since sum of two non-negative terms is zero iff both are zero, and step from (4) to (5) is only possible if this is not true), thus it is 0 only when we are at the critical point of $\mathcal { L }$ . Thus the method converges due to convergence of steepest descent methods, see “Cauchy’s method of minimization” (Goldstein, 1962). □
219
+
220
+ # A.2 PROOF FOR PROPOSITION 3
221
+
222
+ In general, the proposed update rule does not have to create a conservative vector field.
223
+
224
+ Proof. Proof comes from a counterexample, let us define in 2D space:
225
+
226
+ $$
227
+ \mathcal { L } _ { m a i n } ( \theta _ { 1 } , \theta _ { 2 } ) = a \theta _ { 1 }
228
+ $$
229
+
230
+ $$
231
+ \mathcal { L } _ { a u x } ( \theta _ { 1 } , \theta _ { 2 } ) = \left\{ \begin{array} { l l } { a \theta _ { 1 } } & { \mathrm { i f } \theta _ { 1 } \in [ 1 , 2 ] \wedge \theta _ { 2 } \in [ 0 , 1 ] } \\ { 0 } & { \mathrm { t h e r w i s e } } \end{array} \right.
232
+ $$
233
+
234
+ for some fixed $a \neq 0$ . Let us now define two paths (parametrized by $s$ ) between points $( 0 , 0 )$ and $( 2 , 2 )$ , path $A$ which is a concatenation of a line from $( 0 , 0 )$ to $( 0 , 2 )$ (we call it $U$ , since it goes up) and line from $( 0 , 2 )$ to $( 2 , 2 )$ (which we call $R$ as it goes right), and path $B$ which first goes right and then up. Let $V _ { \mathrm { { c o s } } }$ denote the update rule we follow, then:
235
+
236
+ $$
237
+ \int _ { A } V _ { \mathrm { c o s } } d s = \int _ { A } \nabla { \mathcal { L } } _ { \mathrm { m a i n } } d s = \int _ { U } \nabla { \mathcal { L } } _ { \mathrm { m a i n } } d s + \int _ { R } \nabla { \mathcal { L } } _ { \mathrm { m a i n } } d s = \int _ { R } \nabla { \mathcal { L } } _ { \mathrm { m a i n } } d s = 2 a
238
+ $$
239
+
240
+ At the same time, since gradient of $\mathcal { L } _ { m a i n }$ is conservative by definition:
241
+
242
+ $$
243
+ \int _ { B } V _ { \mathrm { c o s } } d s = \int _ { B } \nabla { \mathcal { L } } _ { \mathrm { m i n } } d s + \int _ { C } \nabla { \mathcal { L } } _ { \mathrm { a u x } } d s = \int _ { A } \nabla { \mathcal { L } } _ { \mathrm { m a n } } d s + \int _ { C } \nabla { \mathcal { L } } _ { \mathrm { a u x } } d s = 2 a + \int _ { C } \nabla { \mathcal { L } } _ { \mathrm { a u x } } d s = 3 a
244
+ $$
245
+
246
+ where $C$ is a part of $B$ that goes through $[ 1 , 2 ] \times [ 0 , 1 ]$ . We conclude that $\textstyle \int _ { A } V _ { \mathrm { c o s } } d s \neq \int _ { B } V _ { \mathrm { c o s } } d s$ , so our vector field is not path invariant, thus by Green’s Theorem it is not conservative, which concludes the proof. See Figure 6 for visualization. □
247
+
248
+ # B ONE-DIMENSIONAL TOY EXAMPLE
249
+
250
+ Figure 7 shows the surfaces along with gradients for the one-dimensional motivating example described in Section 2.
251
+
252
+ ![](images/deda4673d4c45c202800fae049466282a5bb815f1fa2484afbaa142e19788126.jpg)
253
+ Figure 6: Visualization of the counterexample from Proposition 3, stars denote starting (green) and end (black) points. Dotted and dashed lines correspond to paths A and B respectively. Blue arrows represent gradient vector field of the main loss, while the violet ones the merged vector field.
254
+
255
+ ![](images/6c3232392097c1d8fd571f36602beef5833485b4f159a88182dd6c30f312ba46.jpg)
256
+ Figure 7: Illustration of cosine similarity between gradients on synthetic loss surfaces.
257
+
258
+ C WEIGHTED VERSION OF OUR METHOD
259
+
260
+ Algorithm 2 describes the weighted version of our method.
261
+
262
+ # D TOY EXAMPLE SHOWING SLOW-DOWN
263
+
264
+ We discuss here a few potential issues of using cosine similarity of gradients to measure task similarity. First, the method depends on being able to compute cosine between gradients. However, in DL we rarely are able to compute exact gradients in practice, nut instead depend on their high variance estimators (mini batches in supervised learning, or Monte Carlo estimators in RL). Consequently, estimating the cosine similarity might require additional tricks such as keeping moving averages of estimates. Second, adding additional task gradient in selected subset of iterates can lead to very bumpy surface from the perspective of optimizer, causing methods which keep track of gradient statistics/estimate higher order derivatives, can be less efficient. Finally, one can construct specific functions, where despite still minimizing the loss, one significantly slows down optimization process. Figure 8 provides one such function as an example.
265
+
266
+ # E IDENTIFYING NEAR AND FAR CLASSES IN IMAGENET
267
+
268
+ As a ground truth for class similarity, we identify pairs of ImageNet classes to be near or far using, lowest common ancestor (LCA) and Frechet Inception Distance (FID) (Heusel et al., 2017).
269
+
270
+ ImageNet follows a tree hierarchy where each class is a leaf node. We define the distance between a pair of classes as at which tree level their LCA is found. In particular, there are 19 levels in the class tree, each leaf node (i.e. class) is considered to be level 0 while the root node is considered to be level 19. We perform bottom-up search for one pair of random sampled classes and find their LCA node—the class distance is then defined as the level number of this node. For example, class 871 (“trimaran”) and class 484 (“catamaran”) has class distance 1 because their LCA is one level up.
271
+
272
+ # Algorithm 2 Weighted version of our method.
273
+
274
+ 1: Initialize shared parameters $\pmb { \theta }$ and task specific parameters $\phi _ { m a i n }$ , $\phi _ { a u x }$ . randomly.
275
+ 2: for iter $= 1$ : max iter do
276
+ 3: Compute $\nabla _ { \pmb { \theta } } \mathcal { L } _ { m a i n }$ , $\nabla _ { \phi _ { m a i n } } \mathcal { L } _ { m a i n }$ , $\nabla _ { \pmb { \theta } } \mathcal { L } _ { a u x }$ , $\nabla _ { \phi _ { a u x } } \mathcal { L } _ { a u x }$ .
277
+ 4: Update $\phi _ { m a i n }$ and $\phi _ { a u x }$ using corresponding gradients
278
+ 5: Update $\pmb { \theta }$ using $\nabla _ { \theta } \mathcal { L } _ { m a i n } + \operatorname* { m a x } ( 0 , \cos ( \nabla _ { \theta } \mathcal { L } _ { m a i n } , \nabla _ { \theta } \mathcal { L } _ { a u x } ) ) \nabla _ { \theta } \mathcal { L } _ { a u x }$
279
+
280
+ ![](images/8b12dde06eb50e51d552797f0a55ed6ab7ac60a8ba08390cdca9baf64c1852d6.jpg)
281
+ Figure 8: Negative example optimization for $L _ { 1 } ( \theta ) = ( \theta _ { 1 } < 0 ) ( \theta _ { 1 } ^ { 2 } + \theta _ { 2 } ^ { 2 } ) + ( \theta _ { 1 } > 0 ) \Big ( 1 - \exp \bigl ( - 2 ( \theta _ { 1 } ^ { 2 } +$
282
+
283
+ $\theta _ { 2 } ^ { 2 } ) { \big ) }$ and $L _ { 2 } ( \theta ) = ( \theta _ { 1 } - 2 ) ^ { 2 } + ( \theta _ { 2 } - 0 . 5 ) ^ { 2 }$ where the proposed method slows down the process (compared on red runs). For the ease of presentation, we choose $L _ { 1 }$ , which is non-differentiable/smooth when $\theta = 0$ . But one can create any smooth functions with analogous properties. The core idea is, when there exists a flat region on the loss surface, the auxiliary lost tends to push the iterates to this region. Even though this move still decreases the loss (i.e., convergence is guaranteed), the optimization process will be slowed down.
284
+
285
+ FID is used as a second measure of similarity. We obtain the image embedding of a pair of classes using the penultimate layer of a pre-trained ResNetV2-50 model (He et al., 2016b) and then compute the embedding distance using FID, defined in Heusel et al. (2017) as:
286
+
287
+ $$
288
+ \mathrm { F I D } = d ^ { 2 } \big ( ( m _ { 1 } , C _ { 1 } ) , ( m _ { 2 } , C _ { 2 } ) \big ) = \| m _ { 1 } - m _ { 2 } \| _ { 2 } ^ { 2 } + \mathrm { T r } \big ( C _ { 1 } + C _ { 2 } - 2 ( C _ { 1 } C _ { 2 } ) ^ { 1 / 2 } \big ) .
289
+ $$
290
+
291
+ where $m _ { k } , C _ { k }$ denote the mean and covariance of the embeddings from class $k$ .
292
+
293
+ We randomly sampled 50 pairs of classes for each level of $L C A = \{ 1 , 2 , 3 , 4 , 1 6 , 1 7 , 1 8 , 1 9 \}$ (400 pair of classes in total) and compute their FID. Figure 9 shows a plot of LCA $\mathbf { \dot { x } }$ -axis) verses FID (y-axis) over our sampled class pairs. It can be seen that LCA and FID are (loosely) correlated and that they reflect human intuition of task similarity for some pairs. For example, trimaran and catamaran (bottom-left) are similar both visually and conceptually, whereas rock python and traffic light (top-right) are dissimilar both visually and conceptually. However, there are contrary examples where LCA disagrees with FID; monkey pinscher and doberman pinscher (top-left) are visually dissimilar but conceptually similar, whereas bubble and sundial (bottom-right) are visually similar but conceptually dissimilar.
294
+
295
+ Per the observations, in subsequent experiments we pick class pairs that are $\{ L o w L C A , L o w F I D \}$ as near pairs (e.g., trimaran and catamaran), and class pairs that are $\{ h i g h L C A , h i g h F I D \}$ as far pairs (e.g., rock python and traffic light).
296
+
297
+ # F GRIDWORLD EXPERIMENTS
298
+
299
+ We define a distribution over $1 5 \times 1 5$ gridworlds, where an agent observes its surrounding (up to 4 pixels away) and can move in 4 directions (with $10 \%$ transition noise). We randomly place walls (blocking movement) as well as two types of positive rewards: $+ 5$ and $+ 1 0$ points, both terminating an episode. There are also some negative rewards (both terminating and non-terminating) to make problem harder. In order to guarantee (expected) finite length of episodes we add fixed probability of 0.01 of transitioning to a non-rewarding terminal state.
300
+
301
+ ![](images/fe36ff17a2b67dd62d239899161c52bd3667aa497749ef4daa206d4df8c2de61.jpg)
302
+ Figure 9: LCA ( $\scriptstyle { \dot { x } }$ -axis) versus FID $y$ -axis) as a ground truth for class similarity. The measurements reflect human intuition of class similarity; trimaran and catamaran (bottom-left) are similar both visually and conceptually, whereas rock python and traffic light (top-right) are dissimilar both visually and conceptually.
303
+
304
+ For the sake of simplicity we use episode-level policy gradient (Williams, 1992) with value function baseline, with policies parametrized as logits θ of π(a|s) = Pexp(θs,a)exp(θs,b) , baselines as $B _ { s } \in \mathbb { R }$ , with fixed learning rate of $\alpha = 0 . 0 1$ , discount factor $\gamma = 0 . 9 5$ and 10,000 training steps (states visited).
305
+
306
+ For this setup, the update rule for each sequence $\tau = \left( ( s _ { 1 } , a _ { 1 } , r _ { 1 } ) , \dots ( s _ { N } , a _ { N } , r _ { N } ) \right)$ is thus given by
307
+
308
+ $$
309
+ \begin{array} { r } { \begin{array} { l } { \lambda \theta = \alpha \nabla _ { \theta } \log \pi ( a _ { t ^ { \prime } } | s _ { t ^ { \prime } } ) \left[ \displaystyle \sum _ { i = 0 } ^ { N - t ^ { \prime } } r _ { t ^ { \prime } + i } - B _ { s _ { t ^ { \prime } } } \right] = \alpha G ^ { ( t ) } \qquad \Delta B _ { s _ { t ^ { \prime } } } = - \alpha \nabla _ { B _ { s _ { t ^ { \prime } } } } ( B _ { s _ { t ^ { \prime } } } - \displaystyle \sum _ { i = 0 } ^ { N - t ^ { \prime } } r _ { t ^ { \prime } + i } ) ^ { 2 } . } \end{array} } \end{array}
310
+ $$
311
+
312
+ In order to make use of expert policies for $\mathcal { T } _ { a u x }$ we define auxiliary loss as a distillation loss, which is just a per-state cross-entropy between teacher’s and student’s distributions over actions. If we just add gradients estimated by policy gradient, and the ones given by distillation, the update is given by
313
+
314
+ $$
315
+ \Delta \theta = \alpha \left[ G ^ { ( t ) } - \nabla _ { \theta } \mathbf { H } ^ { \times } ( \pi ^ { \mathbb { Q } } ( \cdot | s _ { t ^ { \prime } } ) \| \pi ( \cdot | s _ { t ^ { \prime } } ) ) \right] = \alpha [ G ^ { ( t ) } + \sum _ { a } \pi ^ { \mathbb { Q } } ( a | s _ { t ^ { \prime } } ) \nabla _ { \theta } \log \pi ( a | s _ { t ^ { \prime } } ) ] ,
316
+ $$
317
+
318
+ where $\begin{array} { r } { V ^ { ( t ) } = \sum _ { a } \pi ^ { \mathrm { Q } } ( a | s _ { t ^ { \prime } } ) \nabla _ { \theta } \log \pi ( a | s _ { t ^ { \prime } } ) } \end{array}$ and $\begin{array} { r } { \mathrm { H } ^ { \times } ( p , q ) = - \sum _ { k } p _ { k } \log q _ { k } } \end{array}$ is the cross entropy.
319
+
320
+ However, if we use the proposed gradient cosine similarity, we get the following update
321
+
322
+ $$
323
+ \Delta \pmb { \theta } = \alpha \left[ G ^ { ( t ) } + V ^ { ( t ) } \big ( 2 \cdot \mathrm { s i g n } ( \cos ( G ^ { ( t ) } , V ^ { ( t ) } ) ) - 1 \big ) \right] .
324
+ $$
325
+
326
+ This get a significant boost to performance, and policies that score on average 3 points after 10,000 steps and obtain baseline performance after just one third of steps. Figure 10 shows a depiction of the task and an example solution.
327
+
328
+ # G ATARI EXPERIMENTS
329
+
330
+ For these experiments, we use a convolutional architecture as in previous work (Espeholt et al., 2018; Hessel et al., 2018; Mnih et al., 2015; 2016), trained with batched actor-critic with the V-trace algorithm (Espeholt et al., 2018). We use a learning rate of 0.0006 and an entropy cost of 0.01 for all experiments, with a batch size of 32 and 200 parallel actors.
331
+
332
+ ![](images/f691579f46185135cf781da5d88e704ce7dd4f5d5d187565db40468b05fc85fe.jpg)
333
+ Figure 10: Left most: Initial task ${ \mathcal { T } } _ { m a i n }$ , yellow border denotes starting point and violet ones terminating states. Red states are penalizing with the value in the box while the green ones provide positive reward. Middle Left: Solution found by a single run of Q-learning with uniform exploration policy. Middle Right: Transformed task $\mathcal { T } _ { a u x }$ . Right most: Solution found by gradient cosine similarity driven distillation with policy gradient.
334
+
335
+ For the single game experiment, Breakout, , we use 0.02 for the threshold on the cosine similarity and, for technical reasons we ended up computing the cosine distance on a per-layer basis and then averaged. We additionally need to do a moving average of the cosine over time $( 0 . 9 9 9 c ^ { ( t - 1 ) } +$ $0 . 0 0 1 c ^ { ( t ) }$ ) to ensure there are no sudden spikes in the weighting due to noisy gradients. Same setting is used for the multi-task experiment, just that the threshold is set to 0.01.
336
+
337
+ # H COSINE SIMILARITY IN HIGH DIMENSIONS
338
+
339
+ ![](images/f0fc8d0cbdd0becc77340baa84fbea8c5ef08f2427701bb10258a70bf1fca5da.jpg)
340
+ Figure 11: Cosine similarity as a function of dimensionality. On the left, we generate two random vectors $\theta _ { 1 }$ and $\theta _ { 2 }$ from a Gaussian distribution with zero mean and variance $\sigma ^ { 2 }$ and as expected, the cosine similarity drops to zero very quickly as the number of dimensions increases. On the right, we mimic a scenario where the true gradients of the main and auxiliary are aligned, however we observe only corrupted noisy gradients which are noisy copies of the true underlying vector; we generate $\mu \sim \mathcal { N } ( 0 , I _ { d } )$ and generate $\theta _ { 1 } \sim \mathcal { N } ( \mu , \sigma I _ { d } )$ and $\theta _ { 2 } \sim \mathcal { N } ( \mu , \sigma I _ { d } )$ . In this case, cosine similarity is larger in higher dimensions (as the inner product of the corruption noise goes to zero).
md/train/r1l73iRqKm/r1l73iRqKm.md ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OF WIKIPEDIA: KNOWLEDGE-POWERED CONVERSATIONAL AGENTS
2
+
3
+ Emily Dinan∗, Stephen Roller∗, Kurt Shuster∗, Angela Fan, Michael Auli, Jason Weston
4
+ Facebook AI Research
5
+ {edinan,roller,kshuster,angelafan,michaelauli,jase}@fb.com
6
+
7
+ # ABSTRACT
8
+
9
+ In open-domain dialogue intelligent agents should exhibit the use of knowledge, however there are few convincing demonstrations of this to date. The most popular sequence to sequence models typically “generate and hope” generic utterances that can be memorized in the weights of the model when mapping from input utterance(s) to output, rather than employing recalled knowledge as context. Use of knowledge has so far proved difficult, in part because of the lack of a supervised learning benchmark task which exhibits knowledgeable open dialogue with clear grounding. To that end we collect and release a large dataset with conversations directly grounded with knowledge retrieved from Wikipedia. We then design architectures capable of retrieving knowledge, reading and conditioning on it, and finally generating natural responses. Our best performing dialogue models are able to conduct knowledgeable discussions on open-domain topics as evaluated by automatic metrics and human evaluations, while our new benchmark allows for measuring further improvements in this important research direction.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Arguably, one of the key goals of AI, and the ultimate the goal of natural language research, is for humans to be able to talk to machines. In order to get close to this goal, machines must master a number of skills: to be able to comprehend language, employ memory to retain and recall knowledge, to reason about these concepts together, and finally output a response that both fulfills functional goals in the conversation while simultaneously being captivating to their human speaking partner. The current state-of-the-art approaches, sequence to sequence models of various kinds (Sutskever et al., 2014; Vinyals & Le, 2015; Serban et al., 2016; Vaswani et al., 2017) attempt to address some of these skills, but generally suffer from an inability to bring memory and knowledge to bear; as indicated by their name, they involve encoding an input sequence, providing limited reasoning by transforming their hidden state given the input, and then decoding to an output. To converse intelligently on a given topic, a speaker clearly needs knowledge of that subject, and it is our contention here that more direct knowledge memory mechanisms need to be employed. In this work we consider setups where this can be naturally measured and built.
14
+
15
+ We consider the task of open-domain dialogue, where two speakers conduct open-ended chit-chat given an initial starting topic, and during the course of the conversation the topic can broaden or focus on related themes. During such conversations, an interlocutor can glean new information and personal points of view from their speaking partner, while providing similarly themselves. This is a challenging task as it requires several components not found in many standard models. We design a set of architectures specifically for this goal that combine elements of Memory Network architectures (Sukhbaatar et al., 2015) to retrieve knowledge and read and condition on it, and Transformer architectures (Vaswani et al., 2017) to provide state-of-the-art text representations and sequence models for generating outputs, which we term Transformer Memory Networks.
16
+
17
+ As, to our knowledge, no public domain dataset of requisite scale exists, we build a supervised dataset of human-human conversations using crowd-sourced workers, first crowd-sourcing 1365 diverse discussion topics and then conversations involving 201, 999 utterances about them. Each topic is connected to Wikipedia, and one of the humans (the wizard) is asked to link the knowledge they use to sentences from existing articles. In this way, we have both a natural way to train a knowledgeable conversation agent, by employing a memory component that can recall and ground on this existing text, and a natural way to evaluate models that we build, by assessing their ability at locating and using such knowledge.
18
+
19
+ Our Transformer Memory Network architectures, both in retrieval and generative versions, are tested in this setup using both automatic metrics and human evaluations. We show their ability to execute engaging knowledgeable conversations with humans, compared to a number of baselines such as standard Memory Networks or Transformers. Our new benchmark, publicly in ParlAI (http:// parl.ai/projects/wizard of wikipedia/), aims to encourage and measure further improvements in this important research direction.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ Many existing dialogue tasks do not study the use of knowledge explicitly. For example, popular chit-chat datasets such as Open-Subtitles (Vinyals & Le, 2015), Persona-Chat (Zhang et al., 2018) and Twitter (Sordoni et al., 2015) have tested the ability of sequence-to-sequence models that attend over the recent dialogue history, but do not attempt to recall long-term knowledge beyond encoding it directly into the weights of the feed-forward network.
24
+
25
+ In the area of goal-directed dialogue, separate from open domain chit-chat, such as airline (El Asri et al., 2017) or restaurant booking (Henderson et al., 2014; Wen et al., 2016; Bordes et al., 2017), knowledge conditioning is typically employed by allowing access to a database through API calls or otherwise. In contrast, our work investigates unstructured knowledge across a large, diverse set of topics potentially spanning all of Wikipedia.
26
+
27
+ In question answering one does not produce a dialogue response based on a conversation history, but a factual answer based on a question. In that case, it is clear that retrieving and conditioning knowledge is vital. For example, in SQuAD neural models have been developed that attend to a given paragraph from Wikipedia to answer questions (Rajpurkar et al., 2016), or Open-SQuAD which extends this to answering without being given the paragraph, instead performing retrieval over the entirety of Wikipedia (Chen et al., 2017). Recently, the QuAC dataset investigates similar themes, but as a sequence of questions and answers in dialogue form instead (Choi et al., 2018). In this work we do not address question answering, but focus on natural human dialogues which contain a diverse set of utterances, not just questions and answers.
28
+
29
+ The closest work to ours lies in the area of non-goal directed dialogue incorporating knowledge. The work of Dodge et al. (2016) employed Memory Networks to perform dialogue discussing movies in terms of recommendation and open-ended discussion from Reddit, conditioning on a structured knowledge base. Zhou et al. (2018) also links Reddit to structured knowledge. Both Parthasarathi & Pineau (2018) and Ghazvininejad et al. (2018) use unstructured text instead, as we do: the former to discuss news articles using Wikipedia summaries as knowledge, and the latter to discuss local businesses in two-turn dialogues using Foursquare tips as knowledge. Ghazvininejad et al. (2018) uses an extended Encoder-Decoder where the decoder is provided with an encoding of the context along with the external knowledge encoding. Neither involves dialogue authored with the given knowledge, so it is unclear when knowledge is useful or not. In contrast, in our task, we know the Wikipedia articles and sentences that ground crowdworkers dialogues. Model-wise, Parthasarathi & Pineau (2018) uses a Bag-of-Words Memory Network type fact encoder and an RNN decoder. Our work compares Memory Networks (Sukhbaatar et al., 2015) and Transformers which have been shown to be on-par or superior to RNN encoder-decoders (Vaswani et al., 2017), and develops an architecture that combines these approaches. Concurrently with our work Moghe et al. (2018) proposed a dataset based on the closed domain of movie chats. Our paper shows models working on full multi-turn dialogue in an open-domain setting, which to our knowledge was not shown before.
30
+
31
+ # 3 WIZARD OF WIKIPEDIA
32
+
33
+ We consider the following general open-domain dialogue setting: two participants engage in chitchat, with one of the participants selecting a beginning topic, and during the conversation the topic is allowed to naturally change. The two participants, however, are not quite symmetric: one will play the role of a knowledgeable expert (which we refer to as the wizard) while the other is a curious learner (the apprentice).
34
+
35
+ Apprentice At each stage of the conversation the apprentice talks to the wizard freely, playing the role of a curious learner, eager to chat. Their goal is to go into depth about a chosen topic that interests themselves or their partner, while keeping the conversation engaging and fun. Note that the instruction to delve deeply into a topic makes this different to more “shallow” chit-chat tasks. In this task the use of knowledge is emphasized more.
36
+
37
+ Wizard The wizard is given the following instructions: “You have just met the other person, who seems quite curious, and you are eager to discuss a topic with them!” Their goal is to inform their conversation partner about a topic that one of them will choose. Crucially, the wizard has access to an information retrieval system that shows them paragraphs from Wikipedia possibly relevant to the conversation, which are unobserved by the apprentice. Before each conversation turn the wizard can read these paragraphs and then potentially base their next reply on that observed knowledge. Note, the wizard is particularly instructed not to simply parrot this knowledge, but to use it to craft a relevant reply, and to present any relevant knowledge in a fun and engaging way, if possible.
38
+
39
+ Conversation Flow The flow of the conversation thus takes place as follows.
40
+
41
+ 1. Either the wizard or apprentice is picked to choose the topic and speak first. The other player receives the topic information, and the conversation begins.
42
+ 2. When the apprentice sends the wizard a message, the wizard is shown relevant knowledge (described below), and chooses a relevant sentence in order to construct a response, or else chooses the no sentence used option.
43
+ 3. The Wizard responds to the apprentice basing their response on their chosen sentence.
44
+ 4. The conversation repeats until one of the conversation partners ends the chat (after a minimum of 4 or 5 turns each, randomly chosen beforehand).
45
+
46
+ After collecting data of such wizard-apprentice conversations between humans, the goal is to then replace the human wizard with a learned agent that will speak to a human apprentice instead, similar to the procedure in Wizard of Oz experiments (Bernsen et al., 2012).
47
+
48
+ Topics We crowd-sourced a set of 1365 natural, open-domain dialogue topics, each linked to a Wikipedia article. These include diverse topics such as commuting, Gouda cheese, music festivals, podcasts, bowling, and Arnold Schwarzenegger.
49
+
50
+ Knowledge Retrieval At each step of the dialogue the wizard has access to a set of passages of knowledge which may be relevant to the given dialogue context. While this is a potentially learnable part of the model, we required for this to be fixed so that we could present the results to the annotator when collecting the dataset. We thus used exactly the same retriever that is commonly used for the Open-SQuAD dataset in Chen et al. (2017). It uses a simple inverted index lookup followed by term vector model scoring. Articles and queries are compared as TF-IDF weighted bag-of-word and $n$ -gram vectors, using the hashing trick. We retrieve the top 7 articles (first paragraph only) for the last two turns of dialogue (by wizard and apprentice) and the article (first 10 sentences only) for the original topic, and present these articles to the wizard as knowledge context, along with their titles. Note that while this system is used to build the dataset, a superior method can in principle be learned and used by a model at test time.
51
+
52
+ Knowledge Selection and Response Generation During data collection, the wizard can click on any of the retrieved article titles in the dialogue UI to expand that article, at which point they can click on a sentence that is most relevant to the response they want to make (only one article, and one sentence can be selected on any turn, for simplicity). If they see no relevant article or sentence they can choose no sentence used instead. The wizard then enters their response to the apprentice. An image of the Wizard’s UI is shown in Appendix A.1.
53
+
54
+ Table 1: Dataset statistics of the Wizard of Wikipedia task.
55
+
56
+ <table><tr><td>Wizard of Wikipedia Task</td><td>Train</td><td>Valid</td><td>Test Seen</td><td>Test Unseen</td></tr><tr><td>Number of Utterances</td><td>166,787</td><td>17,715</td><td>8,715</td><td>8,782</td></tr><tr><td>Number of Dialogues</td><td>18,430</td><td>1,948</td><td>965</td><td>968</td></tr><tr><td>Number of Topics</td><td>1,247</td><td>599</td><td>533</td><td>58</td></tr><tr><td>Average T Turns per Dialogue</td><td>9.0</td><td>9.1</td><td>9.0</td><td>9.1</td></tr><tr><td>Knowledge Database</td><td colspan="2">5.4M articles</td><td colspan="2">93M sentences</td></tr></table>
57
+
58
+ Final Dialogue Dataset The final dialogue dataset we collect consists of 22,311 dialogues with 201,999 turns, which we divide into 166,787 for train, 17,715 for validation, and 17,497 for test. The test set is split into two subsets, Test Seen and Test Unseen. Test Seen contains 533 overlapping topics with the training set with new dialogues about those topics. Test Unseen consists of 58 topics never seen before in train or validation. Overall data statistics can be found in Table 1, and further statistics and examples of collected conversations in Appendix A.2. We observe wizards and apprentices both asking and answering questions, and providing each other with a mixture of facts and personal feelings during their general discussion.
59
+
60
+ # 4 MODELS
61
+
62
+ In this work we consider learning dialogue models to replace the wizard in our learning tasks, i.e. the knowledgeable speaker. The dialogue model thus can have access to a knowledge source, in this case Wikipedia, to ground the conversation with. We thus develop extensions of the Memory Network (Sukhbaatar et al., 2015) and Transformer (Vaswani et al., 2017) models that can (i) retrieve from a large memory relevant information conditioned on the dialogue history, (ii) carefully read and attend over the retrieved set of knowledge, and then (iii) generate the next dialogue utterance. This model is then used consecutively on each turn to form an entire dialogue with a user.
63
+
64
+ We develop two classes of models capable of leveraging knowledge: (i) retrieval models that produce an output among a set of candidate responses (the set of utterances from the training set); and (ii) generative models that generate word-by-word (using a beam).
65
+
66
+ The input to either model is the same: at each dialogue turn where the model is intended to make a response, it is given the current dialogue context $x _ { 1 } , \ldots , x _ { t }$ of $t$ dialogue turns, where $x _ { 1 }$ is always the initial starting topic (e.g. “Kurt Cobain”), and the remaining turns swap between the two speakers. The goal at each stage is to output the next utterance $x _ { t + 1 }$ .
67
+
68
+ Knowledge Retrieval We assume a large knowledge base (memory) $\displaystyle m _ { 1 } , \ldots , m _ { N }$ which is hierarchically organized into documents consisting of paragraphs and sentences. As it is infeasible for current neural attention techniques to operate on this scale, we use standard information retrieval (IR) techniques $\displaystyle ( c = \mathrm { I R } ( x , m ) )$ ) as a first step to return a smaller set of candidates $m _ { c _ { 1 } } , \ldots , m _ { c _ { K } }$ for fine-grained selection.
69
+
70
+ In our experiments, we use the IR system provided to the human annotators during dataset creation, detailed in Section 3. The retriever operates on the topic $( x _ { 1 } )$ and the last two turns $\cdot { } _ { x _ { t } }$ and $x _ { t - 1 } )$ ) if they exist, effectively calling the IR system three times with three different queries. Empirically, this provided better performance compared to merging into one query, likely because it can address quite different topics. We retrieve the top 7 articles (first paragraph only) for each lookup and then flatten all the results into separate sentences (i.e. remove the organization of sentences belonging to articles), but prepend every sentence with its article title. In this way the candidates $m _ { c _ { 1 } } , \ldots , m _ { c _ { K } }$ given to the neural model in the next stage can be attended to independently without having to deal with hierarchical issues.
71
+
72
+ Knowledge Attention We use an attention mechanism to perform fine-grained selection of which knowledge sentences will be used to produce the next turn of dialogue. Each sentence in the memory is independently encoded with a Transformer encoder (Vaswani et al., 2017), and the same Transformer is used to encode the dialogue context $x$ . We then perform standard dot-product attention between the memory candidates and the dialogue context.
73
+
74
+ ![](images/a17f14c4002f6bfba89866e30718c0836421211a1d624035dfef77a0acceab44.jpg)
75
+ Figure 1: Generative Transformer Memory Network. An IR system provides knowledge candidates from Wikipedia. Dialogue Context and Knowledge are encoded using a shared encoder. In the Two-stage model, the dialogue and knowledge are re-encoded after knowledge selection.
76
+
77
+ Utterance Prediction Given the hidden state derived from the memory attention process described above, the final stage is to predict the output utterance that will form the next dialogue turn.
78
+
79
+ We consider different variants of the two stages above, knowledge attention and utterance prediction, when considering retrieval and generative variants of our models. We will now detail these in turn.
80
+
81
+ # 4.1 RETRIEVAL TRANSFORMER MEMORY NETWORK
82
+
83
+ This model encodes each knowledge sentence $m _ { c _ { 1 } } , \ldots , m _ { c _ { K } }$ and the dialogue context $x$ with a Transformer, as described above. The final input encoding is calculated by performing dot-product attention over $\mathtt { e n c } ( m _ { c _ { 1 } } ) , \dots , \mathtt { e n c } ( m _ { c _ { K } } )$ and adding the resulting weighted sum of these vectors to enc $( x )$ to get the representation $\mathrm { r e p } _ { \mathrm { L H S } } ( m _ { c _ { 1 } } , \dots , m _ { c _ { K } } , x )$ . The candidate responses $r _ { 1 } , \ldots , r _ { L }$ are encoded with a separate Transformer to get $\mathrm { r e p } _ { \mathrm { R H S } } ( r _ { i } )$ for each $i$ . We choose as a response $r _ { \ell }$ where
84
+
85
+ $$
86
+ \ell = \mathop { \mathrm { a r g } \operatorname* { m a x } } _ { i \in \{ 1 , \dots , L \} } \frac { { \mathrm { r e p } } _ { \mathrm { L H S } } ( m _ { c _ { 1 } } , \cdot \cdot \cdot , m _ { c _ { K } } , x ) } { \| { \mathrm { r e p } } _ { \mathrm { L H S } } ( m _ { c _ { 1 } } , \dots , m _ { c _ { K } } , x ) \| _ { 2 } } \bullet \frac { { \mathrm { r e p } } _ { \mathrm { R H S } } ( r _ { i } ) } { \| { \mathrm { r e p } } _ { \mathrm { R H S } } ( r _ { i } ) \| _ { 2 } } .
87
+ $$
88
+
89
+ The model is trained to minimize the cross-entropy loss, where the negative candidates for each example are the responses to the other examples in the batch (Henderson et al., 2017).
90
+
91
+ # 4.2 GENERATIVE TRANSFORMER MEMORY NETWORK
92
+
93
+ We consider two versions: a Two-stage and an End-to-end version. Both models find the most relevant piece of knowledge $m _ { \mathrm { b e s t } }$ , and then perform an encoding step by concatenating it with the dialogue context, allowing the decoder to attend over both the knowledge and dialogue when formulating its response. We employ a beam search of 5 to select our best response. All generative models employ BPE encoding (Sennrich et al., 2016), which we found effective at enabling generators to copy rare words from Wikipedia sentences (Fan et al., 2018).
94
+
95
+ In the End-to-end version, a shared Transformer encoder is used to encode all candidates $m _ { c _ { i } }$ and the dialogue history. The encoded candidates are flattened into vectors using the normalization from Cer et al. (2018) (summing, and normalizing by the square root of the sentence length in order to balance short and long sentences) to produce an attention prediction over the memory. The full sequence encoding of the single highest selected knowledge $m _ { \mathrm { b e s t } }$ is concatenated with the encoding of the dialogue, and passed into a Transformer decoder. An illustration of our End-to-end model is shown in Figure 1. We train the model to minimize the negative log-likelihood of the response utterance. We can add additional supervision by forcing the knowledge selection to correctly choose the same knowledge candidate as the human wizard in the training set by adding an additional crossentropy loss over the knowledge attention, modulated by a weight $\lambda$ :
96
+
97
+ $$
98
+ \begin{array} { r } { \mathcal { L } = ( 1 - \lambda ) \mathcal { L } _ { \mathrm { N L L } } + \lambda \mathcal { L } _ { \mathrm { k n o w l e d g e } } . } \end{array}
99
+ $$
100
+
101
+ In the Two-stage version, we employ two separately trained models for each of these two tasks, knowledge selection and utterance prediction. As the knowledge selection step creates a hard decision influencing the output of the generator, we find maximizing the performance of this component to be vital. We can also improve performance of the decoder by employing knowledge dropout (K.D.), wherein we artificially prevent the model from attending to knowledge a fraction of the time during training. We find this helps the generator be more resilient to errors at the knowledge selection stage, and makes training faster. K. D. is a novel technique we propose here, however it is similar to many other dropout techniques, e.g. feature dropout used in Wu et al. (2017).
102
+
103
+ Table 2: Test performance of various methods on the Knowledge Selection Task. The models must select the gold knowledge sentences chosen by humans given the dialogue context.
104
+
105
+ <table><tr><td></td><td colspan="2">Seen Test</td><td colspan="2">Unseen Test</td></tr><tr><td>Method</td><td>R@1</td><td>F1</td><td>R@1</td><td>F1</td></tr><tr><td>Random</td><td>2.7</td><td>13.5</td><td>2.3</td><td>13.1</td></tr><tr><td>IR baseline</td><td>5.8</td><td>21.8</td><td>7.6</td><td>23.5</td></tr><tr><td>BoWMemNet</td><td>23.0</td><td>36.3</td><td>8.9</td><td>22.9</td></tr><tr><td>Transformer</td><td>22.5</td><td>33.2</td><td>12.2</td><td>19.8</td></tr><tr><td>Transformer (+Reddit pretraining)</td><td>24.5</td><td>36.4</td><td>23.7</td><td>35.8</td></tr><tr><td>Transformer (+Reddit pretraining,+SQuAD training)</td><td>25.5</td><td>36.2</td><td>22.9</td><td>34.2</td></tr></table>
106
+
107
+ # 5 EXPERIMENTS
108
+
109
+ We describe each of our experimental setups and results. We first investigate the ability of our models to select knowledge appropriately, and then consider the full task of dialogue with knowledge.
110
+
111
+ # 5.1 KNOWLEDGE SELECTION TASK
112
+
113
+ Before looking at the full Wizard dialogue task, we assess the ability of models to predict the knowledge selected by human wizards in the dataset given the dialogue history. This will inform us of the feasibility of this task and the best models to use in a two-stage architecture. We compare Transformers against various baselines including a random baseline; an Information Retrieval (IR) baseline, which uses simple word overlap; and a Bag-of-Words Memory Network (Sukhbaatar et al., 2015). Where noted, the Transformer is pretrained on Reddit data (Mazare et al., 2018), and fine-tuned for ´ our task. The results are shown in Table 2. Transformers work best, as long as they are pretrained on a large dataset (Reddit), while multi-tasking on SQuAD provides marginal impact. Further analysis of this task using other models is provided in Appendix B.1. We use the best performing Transformer model reported here for our two-stage generative Memory Network in the full dialogue task.
114
+
115
+ # 5.2 FULL TASK: DIALOGUE WITH KNOWLEDGE
116
+
117
+ We evaluate our models on the full task of dialogue generation given knowledge in two settings: given the gold knowledge sentence chosen by a human, or where the model needs to predict which knowledge to use. We separately describe experiments for retrieval and generative models.
118
+
119
+ Retrieval Experiments We use similar baselines as in the knowledge selection experiments, but now also apply Transformer Memory Networks, which attend over knowledge. Models are evaluated measuring Recall $@ 1$ when ranking the gold response among 99 randomly chosen candidates, and unigram F1 of the model’s prediction with the gold response. The results are shown in Table 3. We find that the addition of knowledge improves all models (improving Bow MemNet from 56 to 71 $\mathbb { R } \ @ 1$ and the Transformer MemNet from 79 to $8 7 \ : \mathrm { R } \ @ 1 $ ) for predicted knowledge. Performance improves dramatically when models are provided gold knowledge, but otherwise retain similar trends.
120
+
121
+ Generative Experiments We compare our generative End-to-end and Two-stage Transformer Memory Network models to two more baselines: repeating the last utterance, and a generative Transformer model trained to respond to dialogue but without access to knowledge. Models are evaluated using perplexity (PPL) of the gold response and unigram F1.
122
+
123
+ Table 3: Retrieval methods on the full Wizard task. Models must select relevant knowledge and retrieve a response from the training set as a dialogue response. Using knowledge always helps, and the Transformer Memory Network with pretraining performs best.
124
+
125
+ <table><tr><td rowspan="3"></td><td colspan="4">Predicted Knowledge</td><td colspan="2">Gold Knowledge</td></tr><tr><td colspan="2">Test Seen</td><td colspan="2">Test Unseen</td><td>Seen</td><td>Unseen</td></tr><tr><td>R@1</td><td>F1</td><td>R@1</td><td>F1</td><td>R@1</td><td>R@1</td></tr><tr><td>Random</td><td>1.0</td><td>7.4</td><td>1.0</td><td>7.3</td><td>1.0</td><td>1.0</td></tr><tr><td>IR baseline</td><td>17.8</td><td>12.7</td><td>14.2</td><td>11.6</td><td>73.5</td><td>67.5</td></tr><tr><td>BoW MemNet (no knowledge)</td><td>56.1</td><td>14.2</td><td>28.8</td><td>11.6</td><td>56.1</td><td>28.8</td></tr><tr><td>BoWMemNet</td><td>71.3</td><td>15.6</td><td>33.1</td><td>12.3</td><td>84.5</td><td>66.7</td></tr><tr><td>Transformer (no knowledge,w/o Reddit)</td><td>60.8</td><td>13.3</td><td>25.5</td><td>9.7</td><td>60.8</td><td>25.5</td></tr><tr><td>Transformer (no knowledge,w/ Reddit)</td><td>79.0</td><td>15.0</td><td>54.0</td><td>11.6</td><td>79.0</td><td>54.0</td></tr><tr><td>Transformer MemNet (w/Reddit)</td><td>86.8</td><td>15.4</td><td>69.8</td><td>12.4</td><td>91.6</td><td>82.3</td></tr><tr><td>Transformer MemNet (w/ Reddit+SQuAD)</td><td>87.4</td><td>15.4</td><td>69.8</td><td>12.4</td><td>92.3</td><td>83.1</td></tr></table>
126
+
127
+ Table 4: Generative models on the full Wizard Task. The Two-stage model performs best using predicted knowledge, while the End-to-end (E2E) model performs best with gold knowledge.
128
+
129
+ <table><tr><td rowspan="3"></td><td colspan="4">Predicted Knowledge</td><td colspan="4">Gold Knowledge</td></tr><tr><td colspan="2">Test Seen</td><td colspan="2">Test Unseen</td><td colspan="2">Test Seen</td><td colspan="2">Test Unseen</td></tr><tr><td>PPL</td><td>F1</td><td>PPL</td><td>F1</td><td>PPL</td><td>F1</td><td>PPL</td><td>F1</td></tr><tr><td>Repeat last utterance</td><td>=</td><td>13.8</td><td></td><td>13.7</td><td>=</td><td>13.8</td><td>-</td><td>13.7</td></tr><tr><td>Transformer (no knowledge)</td><td></td><td>-</td><td></td><td>-</td><td>41.8</td><td>17.8</td><td>87.0</td><td>14.0</td></tr><tr><td>E2E Transformer MemNet (no auxiliary loss)</td><td>66.5</td><td>15.9</td><td>103.6</td><td>14.3</td><td>24.2</td><td>33.6</td><td>35.5</td><td>29.5</td></tr><tr><td>E2E Transformer MemNet (w/ auxiliary loss)</td><td>63.5</td><td>16.9</td><td>97.3</td><td>14.4</td><td>23.1</td><td>35.5</td><td>32.8</td><td>32.2</td></tr><tr><td>Two-Stage Transformer MemNet</td><td>54.8</td><td>18.6</td><td>88.5</td><td>17.4</td><td>30.0</td><td>30.7</td><td>42.7</td><td>28.6</td></tr><tr><td>Two-Stage Transformer MemNet (w/ K.D.)</td><td>46.5</td><td>18.9</td><td>84.8</td><td>17.3</td><td>28.6</td><td>30.6</td><td>43.7</td><td>28.0</td></tr></table>
130
+
131
+ Table 5: Human Experiments. Evaluations of the best generative and retrieval models on full dialogues with humans. Human ratings are reported as mean (stddev). Wiki F1 measures unigram overlap with the Wikipedia entry for the chosen topic, a measure of knowledge used in conversations.
132
+
133
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Seen</td><td colspan="2">Unseen</td></tr><tr><td>Rating</td><td>Wiki F1</td><td>Rating</td><td>Wiki F1</td></tr><tr><td>Human Performance</td><td>4.13 (1.08)</td><td>11.1</td><td>4.34 (0.98)</td><td>10.6</td></tr><tr><td>Retrieval Transformer (no knowledge)</td><td>3.33 (1.30)</td><td>19.8</td><td>3.12 (1.34)</td><td>13.7</td></tr><tr><td>Generative Transformer (no knowledge)</td><td>2.11 (1.11)</td><td>15.3</td><td>2.54 (1.38)</td><td>10.1</td></tr><tr><td>Retrieval Transformer MemNet</td><td>3.43 (1.10)</td><td>23.4</td><td>3.14 (1.31)</td><td>16.3</td></tr><tr><td>Two-Stage Generative Transformer MemNet</td><td>2.92 (1.33)</td><td>30.0</td><td>2.93 (1.30)</td><td>26.2</td></tr></table>
134
+
135
+ The results are given in Table 4. Our experiments show that both the End-to-end and Two-stage models employ the knowledge in their response predictions, as they outperform their counterpart Transformer without knowledge, and demonstrate substantial improvements when provided the gold knowledge. While the Two-stage model produces significantly stronger perplexity and F1 scores using the predicted knowledge, the End-to-end model outperforms the Two-stage model in the gold knowledge experiments. This suggests that the Two-stage model benefits from the strong knowledge selection module (Section 5.1), but that the End-to-end model is better at employing the selected knowledge. Furthermore, we find that the additional knowledge selection supervision (auxiliary loss) in the End-to-end model improves it on every metric, suggesting that tightly integrating these tasks is beneficial. Knowledge dropout (K. D.) also helps (compare last two rows). More evidence for this is shown in Appendix B.1. Lastly, we note that both Two-stage models give higher F1 scores than any of the retrieval models shown in Table 3.
136
+
137
+ Model: Retrieval Transformer MemNet
138
+
139
+ <table><tr><td>Topic:E-book (seen)</td><td></td></tr><tr><td></td><td>Human: i do not know why, but Ihave never gotten into E-books Model:Same here.Ihavea kindle,butIdon&#x27;tuse it for books.It&#x27;s nicerto hold areal book and turn pages.</td></tr><tr><td></td><td>Human: yes,i like the physical feel and smell of a real book</td></tr><tr><td></td><td>Model:Iactually had a Nook e-book where you had to download the e-book after selecting itonline.I grew</td></tr><tr><td></td><td>out of it,I prefer paper books also.</td></tr><tr><td></td><td>Human: i tried e-books but I do not like reading on a screen,its disorientated for me</td></tr><tr><td></td><td>Model: Yes,reading a book on a tablet just isn&#x27;t the same!</td></tr><tr><td></td><td>Human:plus Ilike owning the physical copy of a real book,I feel like Iown it</td></tr><tr><td></td><td>Model: I prefer print and newsreels.</td></tr><tr><td>Topic:Toga party (seen)</td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>Model: Ilove toga parties!Iusually make my toga out of a bed sheet and wear my sandals.</td></tr><tr><td></td><td>Human: Me too!!!Iusually use some flip flops and my blanket!</td></tr><tr><td></td><td>Model: Toga parties typically have games involving kegs and excessive drinking!</td></tr><tr><td></td><td>Human: Yeah! And getting to wear funny outfits and a crown of leaves!</td></tr><tr><td></td><td>Model: Ilove me some Toga Parties!</td></tr><tr><td></td><td>Human: Ilove me some too!</td></tr><tr><td></td><td>Model: Toga parties are so much fun with the Roman or Greek theme.</td></tr><tr><td></td><td>Human: Yeah!Iespecially like Greek themes</td></tr><tr><td></td><td>Model: Two-Stage Generative Transformer MemNet</td></tr><tr><td>Topic:Shower (unseen)</td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>Human: So I&#x27;ve been looking for a beter showerhead with more water pressure for my shower.</td></tr><tr><td>Human:</td><td>Model: Ilove pressure-versed water at nearly constant temperature to a shower</td></tr><tr><td></td><td>That sounds pretty great!Love those rainshower showers!</td></tr><tr><td></td><td>Model: the ancient greeks were the first people to have showers.</td></tr><tr><td></td><td>Human: Well I knew they were good for something.</td></tr><tr><td></td><td>Model: the original showers were neither indoor structures nor man made but were common.</td></tr><tr><td></td><td>Human: Ah that sounds intimidating!</td></tr><tr><td></td><td></td></tr><tr><td></td><td>Model: it is required manual transport of both fresh and waste water.</td></tr></table>
140
+
141
+ # 5.3 HUMAN EVALUATION
142
+
143
+ We perform human evaluation of our models using crowd-sourced workers. Humans are paired with our models and asked to chat about a specific topic (given a choice of 2–3 topics) for 3–5 dialogue turns. Following their conversation, the humans are asked to rate their dialogue partner on a scale of 1–5, with the rating indicating how much they “liked” the conversation (5 is best), which we refer to as the engagingness rating. Using the collected conversations, we also calculate a metric we call the Wiki F1 sore: the F1 overlap of the model’s utterances with the first 10 sentences of the Wikipedia page for the chosen topic as a proxy for how much knowledge the model exhibits. We seek a model that can be simultaneously engaging and knowledgeable, hence we would like to maximize both these metrics1. For comparison, we also collect 100 human-human conversations, with only one human choosing the topic and performing evaluation. In total, we collect a total of 546 conversations with ratings from 464 distinct workers. These results are shown in Table 5.
144
+
145
+ We find that the retrieval models significantly outperform the generative models on the human engagingness evaluation(Student’s t-test, $p \ < \ . 0 5 )$ . The human engagingness differences between retriever models with and without knowledge are not significant, but note they both trend toward use of knowledge due to the candidate sentences retrieved, with the knowledgeable version obtaining significantly higher Wiki F1 scores in both seen and unseen test sets.
146
+
147
+ For the generative models, we find human engagingness ratings are significantly improved by the use of knowledge $( p < . 0 1 )$ . The significantly higher Wiki F1 scores indicate that (i) these models convey more knowledge than their counterparts without knowledge conditioning; and (ii) on both seen and unseen sets they convey more knowledge than the retrieval models. In particular, on unseen data the gap between retrieval and generative models is larger. This is understandable, as retrieval models are limited to producing a response from the training set where the unseen topic did not appear.
148
+
149
+ There is still a considerable gap to human ratings of other humans compared to all our models (first row of Table 5). Figure 2 shows example conversations with the retrieval and generative models. Additional analysis and examples can be found in Appendix B.3 and C.
150
+
151
+ # 6 CONCLUSION
152
+
153
+ In this work we build dialogue agents which are able to employ large memory systems containing encyclopedic knowledge about the world in order to conduct engaging open-domain conversations. We develop a set of architectures, Transformer Memory Network models, that are capable of retrieving and attending to such knowledge and outputting a response, either in retrieval or generative modes. To train and evaluate such models, we collect the Wizard of Wikipedia dataset, a large collection of open-domain dialogues grounded by Wikipedia knowledge, and demonstrated the effectiveness of our models in automatic and human experiments. Our new publicly available benchmark aims to encourage further model exploration, and we expect such efforts will result in significant advances in this important research direction.
154
+
155
+ There is much future work to be explored using our task and dataset. Some of these include: (i) bridging the gap between the engagingness of retrieval responses versus the ability of generative models to work on new knowledge and topics, (ii) learning to retrieve and reason simultaneously rather than using a separate IR component; and (iii) investigating the relationship between knowledge-grounded dialogue and existing QA tasks which also employ such IR systems. The aim is for those strands to come together to obtain an engaging and knowledgeable conversational agent.
156
+
157
+ # REFERENCES
158
+
159
+ Niels O Bernsen, Hans Dybkjær, and Laila Dybkjær. Designing interactive speech systems: From first ideas to user testing. Springer Science & Business Media, 2012.
160
+
161
+ Antoine Bordes, Y-Lan Boureau, and Jason Weston. Learning end-to-end goal-oriented dialog. In Proceedings of the International Conference on Learning Representations (ICLR), 2017.
162
+
163
+ Daniel Cer, Yinfei Yang, Sheng yi Kong, Nan Hua, Nicole Limtiaco, Rhomni St. John, Noah Constant, Mario Guajardo-Cespedes, Steve Yuan, Chris Tar, Yun-Hsuan Sung, Brian Strope, and Ray Kurzweil. Universal sentence encoder. arXiv preprint arXiv:1803.11175, 2018.
164
+
165
+ Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading wikipedia to answer opendomain questions. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pp. 1870–1879. Association for Computational Linguistics, 2017.
166
+
167
+ Eunsol Choi, He He, Mohit Iyyer, Mark Yatskar, Wen-tau Yih, Yejin Choi, Percy Liang, and Luke Zettlemoyer. QuAC: Question answering in context. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium, October 2018.
168
+
169
+ Jesse Dodge, Andreea Gane, Xiang Zhang, Antoine Bordes, Sumit Chopra, Alexander Miller, Arthur Szlam, and Jason Weston. Evaluating prerequisite qualities for learning end-to-end dialog systems. In Proceedings of the International Conference on Learning Representations (ICLR), 2016.
170
+
171
+ Layla El Asri, Hannes Schulz, Shikhar Sharma, Jeremie Zumer, Justin Harris, Emery Fine, Rahul Mehrotra, and Kaheer Suleman. Frames: a corpus for adding memory to goal-oriented dialogue systems. In Proceedings of the 18th Annual SIGdial Meeting on Discourse and Dialogue, pp. 207–219, Saarbrucken, Germany, August 2017. Association for Computational Linguistics. ¨
172
+
173
+ Angela Fan, David Grangier, and Michael Auli. Controllable abstractive summarization. In Proceedings of the 2nd Workshop on Neural Machine Translation and Generation, pp. 45–54. Association for Computational Linguistics, 2018.
174
+
175
+ Marjan Ghazvininejad, Chris Brockett, Ming-Wei Chang, Bill Dolan, Jianfeng Gao, Wen-tau Yih, and Michel Galley. A knowledge-grounded neural conversation model. In Proceedings of the Conference on Association for the Advancement of Artificial Intelligence (AAAI), 2018.
176
+
177
+ Matthew Henderson, Blaise Thomson, and Jason D Williams. The second dialog state tracking challenge. In Proceedings of the 15th Annual Meeting of the Special Interest Group on Discourse and Dialogue (SIGDIAL), pp. 263–272, 2014.
178
+
179
+ Matthew Henderson, Rami Al-Rfou, Brian Strope, Yun-hsuan Sung, L’aszl’o Luk’acs, Ruiqi Guo, Sanjiv Kumar, Balint Miklos, and Ray Kurzweil. Efficient Natural Language Response Suggestion for Smart Reply. arXiv preprint arXiv:1705.00652, 2017.
180
+
181
+ Jiwei Li, Will Monroe, and Daniel Jurafsky. A simple, fast diverse decoding algorithm for neural generation. arXiv preprint arXiv:1611.08562, 2016.
182
+
183
+ Pierre-Emmanuel Mazare, Samuel Humeau, Martin Raison, and Antoine Bordes. Training millions´ of personalized dialogue agents. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium, October 2018. Association for Computational Linguistics.
184
+
185
+ Nikita Moghe, Siddhartha Arora, Suman Banerjee, and Mitesh M. Khapra. Towards exploiting background knowledge for building conversation systems. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2322–2332. Association for Computational Linguistics, 2018. URL http://aclweb.org/anthology/D18-1255.
186
+
187
+ Prasanna Parthasarathi and Joelle Pineau. Extending neural generative conversational model using external knowledge sources. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium, October 2018.
188
+
189
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2383–2392, Austin, Texas, November 2016. Association for Computational Linguistics.
190
+
191
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pp. 1715–1725, Berlin, Germany, August 2016. Association for Computational Linguistics.
192
+
193
+ Iulian Vlad Serban, Ryan Lowe, Laurent Charlin, and Joelle Pineau. Generative deep neural networks for dialogue: A short review. arXiv preprint arXiv:1611.06216, 2016.
194
+
195
+ Alessandro Sordoni, Michel Galley, Michael Auli, Chris Brockett, Yangfeng Ji, Margaret Mitchell, Jian-Yun Nie, Jianfeng Gao, and Bill Dolan. A neural network approach to context-sensitive generation of conversational responses. arXiv preprint arXiv:1506.06714, 2015.
196
+
197
+ Sainbayar Sukhbaatar, Jason Weston, Rob Fergus, et al. End-to-end memory networks. In Advances in Neural Information Processing Systems, pp. 2440–2448, 2015.
198
+
199
+ 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.
200
+
201
+ 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.
202
+
203
+ Ashwin K. Vijayakumar, Michael Cogswell, Ramprasaath R. Selvaraju, Qing Sun, Stefan Lee, David J. Crandall, and Dhruv Batra. Diverse beam search: Decoding diverse solutions from neural sequence models. arXiv preprint arXiv:1610.02424, 2016.
204
+
205
+ Oriol Vinyals and Quoc Le. A neural conversational model. In Proceedings of the 31st International Conference on Machine Learning, Deep Learning Workshop, Lille, France, 2015.
206
+
207
+ Tsung-Hsien Wen, David Vandyke, Nikola Mrksic, Milica Gasic, Lina M Rojas-Barahona, Pei-Hao Su, Stefan Ultes, and Steve Young. A network-based end-to-end trainable task-oriented dialogue system. arXiv preprint arXiv:1604.04562, 2016.
208
+
209
+ Ledell Wu, Adam Fisch, Sumit Chopra, Keith Adams, Antoine Bordes, and Jason Weston. Starspace: Embed all the things! arXiv preprint arXiv:1709.03856, 2017.
210
+
211
+ 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 Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pp. 2204–2213, Melbourne, Australia, July 2018. Association for Computational Linguistics.
212
+
213
+ Hao Zhou, Tom Young, Minlie Huang, Haizhou Zhao, Jingfang Xu, and Xiaoyan Zhu. Commonsense knowledge aware conversation generation with graph attention. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence (IJCAI), pp. 4623–4629. International Joint Conferences on Artificial Intelligence Organization, 7 2018.
214
+
215
+ A DATASET COLLECTION
216
+
217
+ A.1 HUMAN ANNOTATION INTERFACE (FOR WIZARD)
218
+
219
+ # Chat with Knowledge!
220
+
221
+ # You have just met the other person, who seems quite curious, and you are eager to discuss a topic with them!
222
+
223
+ You will trytoinform yourconversationpartnerabouta topic that oneof you willchoose.Aftera topic ischosen,youwill receive informationaboutthattopicthatwillbevisiblethroughoutthechat
224
+
225
+ # Passage for Chosen Topic
226
+
227
+ # ·Cupcake
228
+
229
+ □Acupcake (also British English: fairy cake; Hiberno-English: bun;Australian English:fairycakeorpattycake)isa small cake designed to serve one person,which may be baked ina small thin paper or aluminum cup.
230
+ □As with larger cakes,icing and other cake decorations such asfruitand candymaybeapplied.
231
+ □The earliest extant description of what is now often calld a cupcake wasin1796,whenarecipe for "a lightcake to bake insmall cups" was written in "American Cookery"by Amelia Simmons.
232
+ □The earliest extant documentation of the term "cuncake"
233
+
234
+ # Relevant Information
235
+
236
+ Click on a topic below to expand it. Then, click the checkbox next to the sentence that you use to craft your response,orcheck'No Sentence Used.' □No Sentence Used
237
+
238
+ # Informationabout your partner'smessage
239
+
240
+ Cupcake √ Hostess CupCake Hostess CupCake is a brand of snack cake formerly produced and distributed by Hostess Brandsandcurrentlyowned by private equityfirmsApollo Global Managementand Metropoulos&Co.Itsmostcommon formisachocolate cupcake withchocolateicingandvanillacremefilng,witheightdistinctivewhitesquiggles across the top. □However,other flavors have beenavailableattimes. □It has been claimed to be the first commercially produced cupcake and has become an iconic American brand.
241
+
242
+ # Informationabout yourmessage
243
+
244
+ Farley's&Sathers Candy Company
245
+ Hi-Chew
246
+ Candy
247
+ Fieldration
248
+ CandyCandy
249
+ Hi-5 (Australian band)
250
+ Drumkit
251
+
252
+ SYSTEM: Your partner has selected the topic. Please look to the left to find the relevant information for this topic.
253
+
254
+ Partner: Hi! Do you have any good recipes for cupcakes?
255
+
256
+ SYSTEM: Please take a look at the relevant information to your left and check the appropriate sentence before answering, but try not to copy the sentence as your whole response.
257
+
258
+ You: Hi! You can add fruit and candy to make them even more delicioius!
259
+
260
+ Partner: That's cool! What's your favorite cupcake?
261
+
262
+ SYSTEM: Please take a look at the relevant information to your left and check the appropriate sentence before answering, buttry not to copy the sentence as your whole response.
263
+
264
+ Ilove Hostess cupcakes - they have chocolate icing and vanill creme filing
265
+
266
+ A.2 WIZARD OF WIKIPEDIA EXAMPLES
267
+
268
+ <table><tr><td rowspan=1 colspan=2>Topic: Lifeguard</td></tr><tr><td rowspan=1 colspan=2>Apprentice: SoIam a lifeguard. Know anything about saving lives in water?Wizard: I&#x27;m impressed! It&#x27;s a big responsibility to supervise other people&#x27;s safety in the water!Tell me more.Apprentice: Well,I help make sure people do not drown or get injured while in or near the water!</td></tr><tr><td rowspan=1 colspan=2>Knowledge: A lifeguard is a rescuer who supervises the safety and rescue of swimmers, surfers,...Lifeguards are strong swimmers and trained in CPR/AED first aid, certified in water ...In some areas, the lifeguard service also carries out mountain rescues, or may function as the primary EMS provider.</td></tr><tr><td rowspan=1 colspan=1>Wizard:</td><td rowspan=1 colspan=1>Wizard: Ive heard that in some places,lifeguards also help with other sorts of emergencies, likemountain rescues!Is that part of your job too?Apprentice: I have!I feel like you know much about this! What brings you to know so much?Wizard: Oh,that&#x27;s about the extent of my knowledge. I&#x27;ve just been around beaches and I&#x27;vealways admired lifeguards. I&#x27;m not a super strong swimmer myself.</td></tr><tr><td rowspan=1 colspan=2>Topic: Armadillo</td></tr><tr><td rowspan=1 colspan=1>Wizard:</td><td rowspan=4 colspan=1>Ilove animals and think armadillos are awesome with their leathery shell.I don&#x27;t think I&#x27;ve ever seen an armadillo in real life!I&#x27;ve seen them at the zoo. Armadillo means litle armored one in Spanish.Are they native to a Spanish-speaking part of the world?</td></tr><tr><td rowspan=1 colspan=1>Apprentice:</td></tr><tr><td rowspan=1 colspan=1>Wizard:</td></tr><tr><td rowspan=1 colspan=1>Apprentice:</td></tr><tr><td rowspan=1 colspan=1>Knowledge:</td><td rowspan=2 colspan=1> Armadillos are New World placental mammals in the order Cingulata ..The word “armadillo” means “little armoured one”in Spanish.The nine-banded armadillo (&quot;Dasypus novemcinctus&quot;),or the nine-banded,long-nosedarmadillo, is a medium-sized mammal found in North, Central,and South America.</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Wizard:</td><td rowspan=1 colspan=1>Yes,they are most commonly found in North,Central,and South America</td></tr><tr><td rowspan=1 colspan=1>Topic:</td><td rowspan=1 colspan=1>Ice cream</td></tr><tr><td rowspan=1 colspan=1>Wizard:</td><td rowspan=2 colspan=1>I just love ice cream.Ilove the types with fruits and flavours.Do you like ice cream?Ilove Ice cream as much as any one.I especially like Gelato,foreign ice cream!</td></tr><tr><td rowspan=1 colspan=1>Apprentice:</td></tr><tr><td rowspan=1 colspan=1>Knowledge</td><td rowspan=2 colspan=1>Ice cream is a sweetened frozen food typically eaten as a snack or desser...It is usually made from dairy products, such as milk and cream, and ...Bacon ice cream (or bacon-and-egg ice cream) is an ice cream generally created by adding bacon to egg custard and freezing the mixture.</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Wizard:</td><td rowspan=3 colspan=1>Wizard: Me too.There are some strange combinations though, have you heard of bacon icecream?where they add bacon and even egg custard to the freezing mixture!Apprentice: Surprisingly bacon ice cream doesn&#x27;t surprise me. That doesn&#x27;t sound appealing to me,but perhaps it could be delicious...</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Apprentice:</td></tr></table>
269
+
270
+ Figure 3: The Wizard of Wikipedia dataset. Examples of collected conversations from the dataset, where both wizard and apprentice are humans. The wizard has access to an information retrieval system over Wikipedia, so that they can ask and answer questions, and make statements relevant to the discussion. For each utterance, knowledge retrieval is performed based on dialogue history, giving ${ \sim } 6 1$ knowledge candidates per turn, with wizards clicking no sentence used $6 . 2 \%$ of the time. Assuming that a question contains a question mark or begins with ’how’, ’why’, ’who’, ’where’, ’what’ or ’when’, in the dataset Apprentices ask questions in $1 3 . 9 \%$ of training set utterances, and answer questions (i.e., the Wizard has asked a question) $3 9 . 5 \%$ of the time, while saying new or follow-on statements (neither asking nor answering a question) $4 9 . 3 \%$ of the time. Hence, the wizard and apprentice conduct conversations with a variety of dialogue acts.
271
+
272
+ # A.3 TOPIC SELECTION
273
+
274
+ To choose between topics that are natural we employed the existing Persona-Chat dataset (Zhang et al., 2018) where crowdworkers where asked to create personas of typical speakers. There are $\mathord { \sim } 1 0 0 0$ personas, each of which consists of 4-5 sentences describing that person’s interests, e.g. “I love watching Game of Thrones”, “I like to eat cheetos” and “I recently got a cat”. These can thus naturally be seen as topics of interest, and using another set of annotators we mapped each sentence to 1 or more relevant Wikipedia pages, if possible, e.g. “Ariel is my favorite princess” was labeled with the Wikipedia page for The Little Mermaid. As some sentences are harder to connect with Wikipedia, e.g. “I am witty”, they are left unlabeled. We thus obtain 1,431 topics in total to use for our task. We retain the persona topic sets and thus present 2-3 related topic choices as conversation starters per dialogue during data collection.
275
+
276
+ # B ADDITIONAL EXPERIMENTS
277
+
278
+ # B.1 KNOWLEDGE SELECTION
279
+
280
+ Table 6: Test performance of the Knowledge Selection Tasks. We also tested the performance of our models trained to do the full dialogue task (see Section 5.2) on the knowledge selection task. For our retrieval system, this refers to the performance of the knowledge attention. The results show that our retrieval system could be improved, and the auxiliary loss clearly helps the generative models.
281
+
282
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Seen Test</td><td colspan="2">Unseen Test</td></tr><tr><td>R@1</td><td>F1</td><td>R@1</td><td>F1</td></tr><tr><td>Random</td><td>2.7</td><td>13.5</td><td>2.3</td><td>13.1</td></tr><tr><td>IR baseline</td><td>5.8</td><td>21.8</td><td>7.6</td><td>23.5</td></tr><tr><td>BoWMemNet</td><td>23.0</td><td>36.3</td><td>8.9</td><td>22.9</td></tr><tr><td>Transformer</td><td>22.5</td><td>33.2</td><td>12.2</td><td>19.8</td></tr><tr><td>Transformer (+Reddit pretraining)</td><td>24.5</td><td>36.4</td><td>23.7</td><td>35.8</td></tr><tr><td>Transformer (+Reddit pretraining,+SQuAD training)</td><td>25.5</td><td>36.2</td><td>22.9</td><td>34.2</td></tr><tr><td>Retrieval Transformer MemNet (no auxiliary loss)</td><td>12.9</td><td>24.6</td><td>14.6</td><td>26.3</td></tr><tr><td>Generative E2E Transformer MemNet (no auxiliary loss)</td><td>13.4</td><td>28.3</td><td>11.8</td><td>25.9</td></tr><tr><td>Generative E2E Transformer MemNet (w/auxiliary loss)</td><td>21.1</td><td>32.8</td><td>14.3</td><td>22.8</td></tr></table>
283
+
284
+ B.2 FULL DIALOGUE WITH RETRIEVAL
285
+
286
+ # B.3 HUMAN EXPERIMENTS
287
+
288
+ # C ERROR ANALYSIS
289
+
290
+ We perform an analysis of the dialogues produced from the human evaluation experiments detailed in Section 5.3. We sample 20 conversations from each experimental setting, split between seen and unseen. Conversations are re-tokenized and lowercased to reduce superficial differences between models, and then analyzed in a single-blind setup. We note of common errors and behaviors exhibited in each of the different conversations.
291
+
292
+ In general, the human-human conversations are starkly different than any of the bot conversations – humans tend to have more small talk, or use the topic of discussion as a mere icebreaker, with neither human behaving as a wizard. This is in contrast to human-human conversations from the Wizard dataset itself, where one human has access to Wikipedia, and the conversation becomes more grounded in factual sentences. Similarly, all models attempt to play the role of wizard and produce more factual sentences too. In some rounds, humans treat the bot as a sort of question-answer machine, suggesting that the models could be improved by additionally employing SQuAD-like training data.
293
+
294
+ The retriever without knowledge is particularly prone to non sequiturs, or rapidly changing the subject. During unseen conversations, it is especially likely to discuss something other than the chosen topic. In contrast, the retriever with knowledge tends to stick to the chosen topic strongly, but has difficulty if the human changes the subject. Frequently in unseen topics, the retriever with knowledge produces similar, but factually inaccurate answers to user queries. For example, when one user asks about parts of Ireland to visit, the model enumerates a list of locations in Greece. Nonetheless, its repertoire of available responses often include inviting responses, allowing the bot to have a more natural conversational flow. Selected conversations with the retriever with knowledge may be found in Figure 4, for both seen and unseen topics.
295
+
296
+ Table 7: Retrieval methods on the full Wizard task. In addition to the models we tested in the paper, we also tested a two-stage retrieval system in which we used our best-performing model on the knowledge selection task to choose a single knowledge sentence to condition on for the dialogue retrieval task. This outperformed our best retrieval method in terms of F1 but not not in terms of Recall $@ 1$ . Furthermore, we compared these results to a two-stage retrieval system in which the dialogue retrieval module is optimized for seeing the gold chosen knowledge sentence. The performance of this system on the gold knowledge task suggests that the retrieval system could be improved by increasing performance on the knowledge selection subtask.
297
+
298
+ <table><tr><td rowspan="3"></td><td colspan="4">Predicted Knowledge</td><td colspan="2">Gold Knowledge</td></tr><tr><td colspan="2">Test Seen</td><td colspan="2">Test Unseen</td><td>Seen</td><td>Unseen</td></tr><tr><td>R@1</td><td>F1</td><td>R@1</td><td>F1</td><td>R@1</td><td>R@1</td></tr><tr><td>Random</td><td>1.0</td><td>7.4</td><td>1.0</td><td>7.3</td><td>1.0</td><td>1.0</td></tr><tr><td>IR baseline</td><td>17.8</td><td>12.7</td><td>14.2</td><td>11.6</td><td>73.5</td><td>67.5</td></tr><tr><td>BoW MemNet (no knowledge)</td><td>56.1</td><td>14.2</td><td>28.8</td><td>11.6</td><td>56.1</td><td>28.8</td></tr><tr><td>BoWMemNet</td><td>71.3</td><td>15.6</td><td>33.1</td><td>12.3</td><td>84.5</td><td>66.7</td></tr><tr><td>Transformer (no knowledge,w/o Reddit)</td><td>60.8</td><td>13.3</td><td>25.5</td><td>9.7</td><td>60.8</td><td>25.5</td></tr><tr><td>Transformer (no knowledge,w/ Reddit)</td><td>79.0</td><td>15.0</td><td>54.0</td><td>11.6</td><td>79.0</td><td>54.0</td></tr><tr><td>Transformer MemNet (w/Reddit)</td><td>86.8</td><td>15.4</td><td>69.8</td><td>12.4</td><td>91.6</td><td>82.3</td></tr><tr><td>Transformer MemNet (w/Reddit+SQuAD)</td><td>87.4</td><td>15.4</td><td>69.8</td><td>12.4</td><td>92.3</td><td>83.1</td></tr><tr><td>Two-stage Transformer (optimized for predicted knowledge)</td><td>84.2</td><td>16.2</td><td>63.1</td><td>13.2</td><td>92.3</td><td>83.1</td></tr><tr><td>Two-stage Transformer (optimized for gold knowledge)</td><td>79.6</td><td>16.6</td><td>60.1</td><td>13.1</td><td>96.3</td><td>88.3</td></tr></table>
299
+
300
+ Table 8: Human Experiments. We calculate the Wiki F1 score for the wizard and apprentice as they appear in the dataset for the sake of comparison to our human evaluations. Note that this differed from the human-human evaluation set-up in the sense that the wizard had direct access to Wikipedia passages in the UI, which explains the higher values of Wiki F1 both for the wizard (who uses Wikipedia) and for the apprentice (who would likely reference that use).
301
+
302
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Seen</td><td colspan="2">Unseen</td></tr><tr><td>Rating</td><td>Wiki F1</td><td>Rating</td><td>Wiki F1</td></tr><tr><td>Human Performance</td><td>4.13 (1.08)</td><td>11.1</td><td>4.34 (0.98)</td><td>10.6</td></tr><tr><td>Wizard Performance (in dataset)</td><td>-</td><td>43.3</td><td>=</td><td>43.1</td></tr><tr><td>Apprentice Performance (in dataset)</td><td>-</td><td>23.2</td><td>-</td><td>23.7</td></tr><tr><td>Retrieval Transformer (no knowledge)</td><td>3.33 (1.30)</td><td>19.8</td><td>3.12 (1.34)</td><td>13.7</td></tr><tr><td>Generative Transformer (no knowledge)</td><td>2.11 (1.11)</td><td>15.3</td><td>2.54 (1.38)</td><td>10.1</td></tr><tr><td>Retrieval TransformerMemNet</td><td>3.43 (1.10)</td><td>23.4</td><td>3.14 (1.31)</td><td>16.3</td></tr><tr><td>Two-Stage Generative Transformer MemNet</td><td>2.92 (1.33)</td><td>30.0</td><td>2.93 (1.30)</td><td>26.2</td></tr></table>
303
+
304
+ The generator without knowledge is particularly prone to many of the typical behaviors of seq2seq systems (Li et al., 2016; Vijayakumar et al., 2016), including local repetition (“cookies are made of flour, oil, oil, and oil”), global repetition (producing the near same utterance for multiple turns), or inconsistencies in its personality (saying it both likes and dislikes movies). The generator with knowledge has significantly fewer issues with repetition, as it errs on the side of copying large fragments from the Wikipedia knowledge. The generator with knowledge can also act as a selfish conversationalist, choosing to respond or detail information without inviting a response. Although it generally produces accurate statements, it sometimes produces statements using an incorrect date, name or word. It also frequently produces formulaic responses, like “I don’t know, but I do know that [Wikipedia excerpt]”. Nonetheless, we find the generator with knowledge is able to successfully generalize to unseen topics using the knowledge from Wikipedia. Selected conversations with the generator with knowledge may be found in Figure 5.
305
+
306
+ # Model: Retrieval Transformer MemNet
307
+
308
+ Figure 4: Retriever with Knowledge conversations. Selected conversations with a human. (\*) indicates clear factual mistakes by the model.
309
+
310
+ <table><tr><td colspan="2">Topic: Arnold Schwarzenegger (seen)</td></tr><tr><td></td><td>Human: Hey are you into the movie The Running Man</td></tr><tr><td></td><td>Model:Yeah!That's one of my favorite movies!Ican't believe that Team America:World Police was made in 2004 -14 years ago!</td></tr><tr><td></td><td>Human: Another one of Arnies movies I like is Terminator 2 JUDGMENT DAY</td></tr><tr><td></td><td>Model:The Terminatoris probably his most iconic role,but he got his start from the movie“Conan the Barbarian",</td></tr><tr><td></td><td>which came out a couple years earlier.Iactually haven't seen that one.</td></tr><tr><td></td><td>Human: Which one? Conan or“Da Terminata" Model:Ilike Arnold Schwarzeneggar as well! Ithought he was afantastic governator,serving from 2003-2011.</td></tr><tr><td></td><td>Human: HAha Governator! Yeah,it's pretty crazy they he held higher office.</td></tr><tr><td></td><td>Model:Yes,he won the LIFETIME ACHIEVEMENT AWARD! Interestingly,he joined the U.S.Army in 1961 and was a paratrooper! (*)</td></tr><tr><td>Topic:Steak (seen)</td><td></td></tr><tr><td></td><td>Human: Hello,it's lunch time here,and I'm in the mood for a great steak</td></tr><tr><td></td><td>Model:Wow that sounds delicious I wish Icould say the same hahah,When the word“steak"is used without</td></tr><tr><td></td><td>qualification, it normally refers to a Beefsteak</td></tr><tr><td></td><td>Human: Interesting,I don't really have a favorite steak, how about you?</td></tr><tr><td></td><td>Model:Ilike rib eyeitis really good specially medium rare,When the word“steak”is used without qualification,</td></tr><tr><td></td><td>it generally refers to a beefsteak</td></tr><tr><td></td><td>Human: Ilike rib eye too! What is it about a rib eye that you enjoy?</td></tr><tr><td></td><td>Model:Most steak cuts are very tender meat but Ithink rib eye can be quite tender</td></tr><tr><td></td><td>Human: They really are.How do you choose a good steak? Model:When it comes to steak and other cuts of meat you have rare,medium rare,medium,welldone and so on</td></tr><tr><td></td><td>Human: How do you prefer your steak prepared?</td></tr><tr><td></td><td>Model:Ilike that you can prepare it many different ways.You can fried it,grillit,or even broil the steak</td></tr><tr><td>Topic:Ireland (unseen)</td><td></td></tr><tr><td></td><td>Model:Hi,have you ever been to Dublin?It is the capital and largest city in Ireland.</td></tr><tr><td></td><td>Human: No,Ihaven't but would love to</td></tr><tr><td></td><td>Model: It is the largest city in Northern Ireland.(*)</td></tr><tr><td></td><td>Human: 've always found Ireland to be fascinating and would love to visit sometime</td></tr><tr><td></td><td>Model: Same here! It is the capital of Ireland too!</td></tr><tr><td></td><td>Human: What is the most popular place to visit in Ireland?</td></tr><tr><td></td><td>Model: I would recommend the Thrace,Crete,and the Ionian Islands as must see places.(*)</td></tr><tr><td></td><td>Human: I don't know anything about the Ionian Islands</td></tr><tr><td></td><td>Model: It was once referred to as the Hellenic Republic! (*)</td></tr><tr><td></td><td>Topic:American football (unseen)</td></tr><tr><td></td><td>Model:American footballcan be traced back to Britain in the mid-19th century.The rules were very similar!</td></tr><tr><td></td><td>Human: Idid not know that. Did they wear equipment back then?</td></tr><tr><td></td><td>Model:Amnot really certain about it but American footballresulted from several major divergences from associa- tion football and rugby football</td></tr><tr><td></td><td>Human: The Philadelphia eagles actually have a rugby player on their team this year. he never played footballuntil</td></tr><tr><td></td><td>this year. Model:Philadelphia isone ofa few cities to have allfour teams,but they love the Eagles more than anything else</td></tr><tr><td></td><td>by a long shot!</td></tr><tr><td></td><td>Human: As a life long Philadelphia sports fan I have to agree with you.</td></tr><tr><td></td><td>Model:I've always been more of a fan of the American Footballteam from Pittsburgh,The Steelers! Human: Being from Philadelphia Iam not much of a pittsburgh fan.</td></tr><tr><td></td><td>Model: Are the Pittsburgh Steelers in the AFC?</td></tr><tr><td></td><td></td></tr><tr><td></td><td>Human: Yes they are.the AFC north to be exact.</td></tr><tr><td></td><td>Topic:List of national parks of the United States (unseen)</td></tr><tr><td></td><td>Human: Ihave never visited a national park in the United States, but I would really like to!</td></tr><tr><td></td><td>Model: Me too.I'd love to live in a national park</td></tr><tr><td></td><td>Human: Which one do you think is the best to visit first?</td></tr><tr><td></td><td>Model:The United Nations isan important place to visit,the Statue ofLiberty,Central park is great also</td></tr><tr><td></td><td>Human: Is the Statue of Liberty considered a National Park?</td></tr><tr><td></td><td>Model:Yes,the statue of Liberty is there on an island - The Liberty Island.</td></tr><tr><td></td><td></td></tr><tr><td></td><td>Human: Ihad no idea that that was a National Park.I have heard Zion National Park is really nice!</td></tr><tr><td></td><td>Model: Yes,it links the shenandoah national park and the great smoky mountains together!(*)</td></tr><tr><td></td><td></td></tr><tr><td colspan="2">Model: Two-Stage Generative Transformer MemNet</td></tr><tr><td>Topic: Circus (seen)</td><td></td></tr><tr><td></td><td>Model: have you ever been to a circus? it is a company of performers who put on diverse entertainment shows.</td></tr><tr><td></td><td>Human: I went to the circus once when I was a child actually.</td></tr><tr><td></td><td>Model:that's great! entertainment is a formof activity that holds the atention and interest of an audience.</td></tr><tr><td></td><td>Human: That's true. Have you ever been to a circus?</td></tr><tr><td></td><td></td></tr><tr><td></td><td>Model:Ihave not, but I know they were built with various types of seating ring,and sometimes a stage. Human: I went to one held in a stadium, so we had box seats.</td></tr><tr><td></td><td>Model: that's awesome! i'm sure you'llhave to go to the circus,with appropriate music.</td></tr><tr><td></td><td>Human: Yes, circuses usually have their own kind of music.</td></tr><tr><td colspan="2">Model: circuses can be done by circuses. Topic: Granny Smith (seen)</td></tr><tr><td></td><td></td></tr><tr><td></td><td>Human: I really love Granny Smith apples,they're my favorite type of apple.</td></tr><tr><td></td><td>Model:Ilove granny smith apples. they have hard,light green skin and a crisp flesh.</td></tr><tr><td></td><td>Human: Yes,Ireally enjoy them.I also like Honeycrisp apples but they're so expensive!</td></tr><tr><td></td><td>Model:they've been grown for thousands of years inasia and europe,and were brought to north americaby euro-</td></tr><tr><td></td><td>pean colonists (*)</td></tr><tr><td></td><td>Human: Oh really? They've been around way longer than I thought!</td></tr><tr><td></td><td>Model: they're also consumed raw,it's one of the most popular cooking apples.</td></tr><tr><td></td><td>Human: I always eat them raw,I hate cooked apples for some reason, even in pie. Model: i'm not sure if it's cooked,but Ido know that they can be cooked raw.</td></tr><tr><td colspan="2">Topic: Culture of Chicago (seen)</td></tr><tr><td></td><td></td></tr><tr><td></td><td>Human: hi do you like chicago</td></tr><tr><td></td><td>Model:Ilove chicago. it's the third most populous city in the us.</td></tr><tr><td></td><td>Human: how many people live there?</td></tr><tr><td></td><td>Model: about 2.7 million residents,it is also the most populous city in the state of illinois.</td></tr><tr><td></td><td>Human: do you like chicago deep dish pizza? Model: chicago-style pizza may be made in deep dish style and as a stuffed pizza.</td></tr><tr><td></td><td>Human: what is the name of the baseball team?</td></tr><tr><td></td><td>Model: dano's pizzeria specializes in chicago style stuffed pizza.</td></tr><tr><td></td><td>Human: Is Dano's pizzaria open everyday?</td></tr><tr><td></td><td>Model:yes it is.it is an american style pizza chain headquartered in midtown brook,illinois.</td></tr><tr><td>Topic:Animals in sport (unseen)</td><td></td></tr><tr><td></td><td>Model:ilove to watch animals.it's the most popular form of animal-related sport.</td></tr><tr><td></td><td>Human: horse racing is the most awesome animal sport!</td></tr><tr><td></td><td>Model: horse racing is an equestrian performance sport, typicall involving two or more horses ridden by jockeys</td></tr><tr><td></td><td>or driven over a set distance for competition.</td></tr><tr><td></td><td>Human: yes, the Kentucky Derby and the triple crown is something I look forward to every year!</td></tr><tr><td></td><td>Model:the horse has evolved over the past 45 to 55 million years from a small multi toed creature</td></tr><tr><td></td><td>Human: that is very interesting, how did people come to domesticate horses for sport?</td></tr><tr><td></td><td>Model: i'm not sure but the domestication is believed to have been widespread by 3000 bc</td></tr><tr><td></td><td>Human: very interesting! I wonder how long people used horses to hunt before deciding to race them. Model: i'm not sure but Ido know that horses have been domesticated for thousands of years.</td></tr><tr><td colspan="2"></td></tr><tr><td></td><td>Topic:Dairy farming (unseen)</td></tr><tr><td></td><td> Human: hi there i was wondering how you felt about farming</td></tr><tr><td></td><td>Model:Ido not like dairy farming butIdo know that in developedcountries,dairy farms typicallyconsistof high</td></tr><tr><td></td><td>dairy products.</td></tr><tr><td></td><td>Human: oh yes they have alot of cows and push out alot of dairy every hour Model: other species used in commercial dairy farming include goats,sheep,and camels</td></tr><tr><td></td><td>Human: i did not know you could get milk a camel</td></tr><tr><td></td><td>Model: camel milk has supported bedouin</td></tr><tr><td></td><td>Human: oh wow thats very interesting</td></tr><tr><td></td><td>Model: in italy they are growing in popularity to produce an alternative milk source for humans</td></tr><tr><td></td><td>Human: i have had goat milk before</td></tr><tr><td></td><td>Model:theearliest evidence of using domesticated cows for dairy production is the seventh millennium bc-the</td></tr><tr><td></td><td>neolithic era</td></tr><tr><td></td><td>Human: thats so neat. i would say cow milk is my favorite</td></tr><tr><td></td><td>Model: Ilove cow milk,especially since the iphone is used in the iphone.</td></tr><tr><td></td><td>Human: iphone and cow milk</td></tr><tr><td></td><td>Model: the iphone was first released in 2007.</td></tr><tr><td></td><td>Human: oh ok well thanks for the talk have a great day</td></tr><tr><td></td><td>Model: no problem! the iphone was first released in 2007.</td></tr></table>
md/train/rJBiunlAW/rJBiunlAW.md ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TRAINING RNNS AS FAST AS CNNS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Common recurrent neural network architectures scale poorly due to the intrinsic difficulty in parallelizing their state computations. In this work, we propose the Simple Recurrent Unit (SRU) architecture, a recurrent unit that simplifies the computation and exposes more parallelism. In SRU, the majority of computation for each step is independent of the recurrence and can be easily parallelized. SRU is as fast as a convolutional layer and $5 { - } 1 0 \mathrm { x }$ faster than an optimized LSTM implementation. We study SRUs on a wide range of applications, including classification, question answering, language modeling, translation and speech recognition. Our experiments demonstrate the effectiveness of SRU and the tradeoff it enables between speed and performance. We open source our implementation in PyTorch and CNTK.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Recurrent neural networks (RNN) are at the core of state-of-the-art approaches for a large number of natural language tasks, including machine translation (Cho et al., 2014; Bahdanau et al., 2015; Jean et al., 2015; Luong et al., 2015), language modeling (Zaremba et al., 2014; Gal & Ghahramani, 2016; Zoph & Le, 2016), opinion mining (Irsoy & Cardie, 2014), situated language understanding (Mei et al., 2016; Misra et al., 2017), and question answering (Seo et al., 2016a; Chen et al., 2017). Key to many of these advancements are architectures of increasing capacity. However, these networks are difficult to scale. During learning, the sequential dependencies that are central to recurrent architectures limit parallelization potential. This results in slow development and makes rigorous parameter tuning intractable. Similar problems occur during deployment when slow inference creates challenges for real-time systems at scale. In this paper, we describe the Simple Recurrent Unit (SRU), a recurrent architecture that balances serial and parallelized computation. We evaluate SRU and show the speed gains it provides generalize across a set of core tasks, while maintaining and even improving overall performance over common architectures.
12
+
13
+ Recurrent networks process sequences of symbols (e.g., words in a sentence) one symbol at a time. In commonly used architectures, including Long Short-term Memory (LSTM; Hochreiter & Schmidhuber, 1997) and Gated Recurrent Units (GRU; Cho et al., 2014), the computation in each step depends on completing the previous step. As a result, in contrast to operations such as convolution and attention, recurrent computations are less amenable to parallelization. We propose to do the majority of the computation for each step without depending on completing previous computations, which allows for to easily parallelize it. The result of this computation are then combined via a fast recurrent structure. Figure 1 illustrates the difference between the approaches.
14
+
15
+ While even a naive implementation of our approach leads to improvements in performance, one of its key advantage is enabling optimization particularly fitting to existing hardware architectures. Removing the dependencies between time steps for the most expensive operations allows to parallelize across different dimensions and time steps. We also perform a CUDA-level optimization by compiling element-wise operations of the computations into a single kernel function call. Figure 2 compares our architecture’s runtimes to common architectures.
16
+
17
+ We experiment with a diverse set of core problems to evaluate our architecture, including text classification, question answering, language modeling, machine translation, and speech recognition. Our approach is competitive and even outperforms common recurrent and convolutional architectures, while delivering significant speedups. We also study the relation between speed and performance, and show SRU provides fine-grained control of the tradeoff between the two.
18
+
19
+ ![](images/8409b3bfbd047704213c0c59d674bd91f4cd24e4f6ead7658016e3d14f64186c.jpg)
20
+ Figure 1: Illustration of the difference between common RNN architectures (left) and our approach (right). In common architectures, the entire computation (gray block) for each step $\mathbf { x } _ { t }$ , $t = 1 , \ldots , n$ depends on completing the previous step. This impedes any parallelization between steps. In contrast, we propose to process the input at each step independently of the other inputs (larger gray block) and do the recurrent combination with relatively lightweight computation (small gray block). The majority of the computation (surrounded by the dashed line) can then be easily parallelized.
21
+
22
+ ![](images/678ec560c93e0b680874c7d7d063b15ec25bbf23aa1eb6fbc7a6be478b7612f5.jpg)
23
+ Figure 2: Average processing time (in milliseconds) of a batch of 32 samples using cuDNN LSTM, word-level convolution conv2d, and the proposed SRU. l number of tokens per sequence, $d$ : feature dimension and $k$ : feature width. See Section 4 for details of the setup used.
24
+
25
+ # 2 METHOD
26
+
27
+ # 2.1 SIMPLE RECURRENT UNITS
28
+
29
+ Most recurrent architectures, including LSTM and GRU, use gating to control the information flow to alleviate vanishing and exploding gradient problems. We define a gate to be composed of a single-layer feed-forward network with a sigmoid activation.The gate output is used in a point-wise multiplication operation to combine two inputs, for example the current and previous time stamps. The computation of the feed-forward network, especially the matrix multiplication, is the most expensive operation in this process, while the point-wise multiplication is relatively lightweight. The key design decision in SRU is making the gate computation dependent only on the current input of the recurrence. This leaves only the point-wise multiplication computation as dependent on previous steps. The matrix multiplications involved in the feed-forward network can then be easily parallelized.
30
+
31
+ The basic form of SRU includes a single forget gate. Given an input $\mathbf { x } _ { t }$ at time $t$ , we compute a linear transformation $\tilde { \mathbf { x } } _ { t }$ (Lei et al., 2017; Lee et al., 2017) and the forget gate $\mathbf { f } _ { t }$ :
32
+
33
+ $$
34
+ \begin{array} { r l } & { \tilde { \mathbf { x } } _ { t } = \mathbf { W } \mathbf { x } _ { t } } \\ & { \mathbf { f } _ { t } = \sigma ( \mathbf { W } _ { f } \mathbf { x } _ { t } + \mathbf { b } _ { f } ) \mathbf { \phi } . } \end{array}
35
+ $$
36
+
37
+ This computation depends on $\mathbf { x } _ { t }$ only, which enables computing it in parallel across all time steps. The forget gate is used to modulate the internal state $\mathbf { c } _ { t }$ , which is used to compute the output state $\mathbf { h } _ { t }$ :
38
+
39
+ $$
40
+ \begin{array} { r l } & { \mathbf { c } _ { t } = \mathbf { f } _ { t } \odot \mathbf { c } _ { t - 1 } + \left( 1 - \mathbf { f } _ { t } \right) \odot \tilde { \mathbf { x } } _ { t } } \\ & { \mathbf { h } _ { t } = g ( \mathbf { c } _ { t } ) \enspace , } \end{array}
41
+ $$
42
+
43
+ where $g ( \cdot )$ is an activation function used to produce the output state $\mathbf { h } _ { t }$ .
44
+
45
+ The complete architecture also includes skip connections, which have been shown to improve training of deep networks with a large number of layers (He et al., 2016; Srivastava et al., 2015; Wu et al., 2016a). We use highway connections (Srivastava et al., 2015), and add a reset gate $\mathbf { r } _ { t }$ computed similar to the forget gate $\mathbf { f } _ { t }$ . The reset gate is used to compute the output state $\mathbf { h } _ { t }$ as a combination of the internal state $g ( \mathbf { c } _ { t } )$ and the input $\mathbf { x } _ { t }$ . The complete architecture is:
46
+
47
+ $$
48
+ \begin{array} { r l } & { \tilde { \mathbf { x } } _ { t } = \mathbf { W } \mathbf { x } _ { t } } \\ & { \mathbf { f } _ { t } = \sigma ( \mathbf { W } _ { f } \mathbf { x } _ { t } + \mathbf { b } _ { f } ) } \\ & { \mathbf { r } _ { t } = \sigma ( \mathbf { W } _ { r } \mathbf { x } _ { t } + \mathbf { b } _ { r } ) } \\ & { \mathbf { c } _ { t } = \mathbf { f } _ { t } \odot \mathbf { c } _ { t - 1 } + ( 1 - \mathbf { f } _ { t } ) \odot \tilde { \mathbf { x } _ { t } } } \\ & { \mathbf { h } _ { t } = \mathbf { r } _ { t } \odot g ( \mathbf { c } _ { t } ) + ( 1 - \mathbf { r } _ { t } ) \odot \mathbf { x } _ { t } } \end{array}
49
+ $$
50
+
51
+ # 2.2 RELATION TO COMMON ARCHITECTURES
52
+
53
+ Existing RNN architectures use the previous output state $\mathbf { h } _ { t - 1 }$ in the recurrence computation. For example, in LSTM, the forget gate vector is computed by $\mathbf { f } _ { t } = \sigma ( \mathbf { W } _ { f } \mathbf { x } _ { t } + \mathbf { R } _ { f } \mathbf { h } _ { t - 1 } + \mathbf { b } _ { f } )$ . Including $\mathbf { R } \mathbf { h } _ { t - 1 }$ breaks independence and parallelization: each dimension of the hidden state $\mathbf { h } _ { t }$ depends on $\mathbf { h } _ { t - 1 }$ , and the computation of $\mathbf { h } _ { t }$ has to wait until $\mathbf { h } _ { t - 1 }$ is fully computed. Similar design choices are present in GRU and other RNN variants, where $\mathbf { h } _ { t - 1 }$ is used throughout the computation.
54
+
55
+ We propose to completely drop the connection between the gating computations of step $t$ and the states of step $t - 1$ , $\mathbf { h } _ { t - 1 }$ and $\mathbf { c } _ { t - 1 }$ . Given a sequence of input vectors $\{ \mathbf { x } _ { 1 } , \cdots , \mathbf { x } _ { n } \}$ , $\left\{ \tilde { \mathbf { x } _ { t } } , \mathbf { f } _ { t } , \mathbf { r } _ { t } \right\}$ for different $t = 1 \cdots n$ are independent and can be computed in parallel. The computation bottleneck of our architecture is the three matrix multiplications in Equations 1-3. After computing $\tilde { \mathbf { x } } _ { t }$ , $\mathbf { f } _ { t }$ and $\mathbf { r } _ { t }$ , Equations 4 and 5, where all operations are element-wise, are fast to compute.
56
+
57
+ # 2.3 CUDA-LEVEL OPTIMIZATION
58
+
59
+ Optimizing SRU is similar to how LSTM is optimized in cuDNN LSTM (Appleyard et al., 2016). The SRU formulation permits two optimizations. First, matrix multiplications across all time steps can be batched, which significantly improves the computation intensity and GPU utilization. Grouping the matrix multiplications in Equations 1-3 into a single batch is formulated as
60
+
61
+ $$
62
+ { \bf U } ^ { \top } = \left( \begin{array} { l } { { \bf W } } \\ { { \bf W } _ { f } } \\ { { \bf W } _ { r } } \end{array} \right) [ { \bf x } _ { 1 } , { \bf x } _ { 2 } , \cdot \cdot \cdot , { \bf x } _ { n } ] ,
63
+ $$
64
+
65
+ where $n$ is the sequence length, $\mathbf { U } \in \mathbb { R } ^ { n \times 3 d }$ is the resulting matrix, and $d$ is the hidden state size. When the input is a mini-batch of $k$ sequences, $\mathbf { U }$ would be a tensor of size $( n , k , 3 d )$ . Second, all element-wise operations of the sequence can be fused into one kernel function and parallelized across the dimensionality of the hidden state $d$ . Without the fusion, operations such as addition $^ +$ and sigmoid activation $\sigma ( )$ would each invoke a separate function call, and incur additional kernel launching latency and data moving costs. Algorithm 1 shows the pseudocode of the fused kernel function. The implementation of a bidirectional SRU is similar: the matrix multiplications of both directions are batched, and a fused kernel is created to handle and parallelize both directions.
66
+
67
+ # 3 RELATED WORK
68
+
69
+ Improving on common architectures for sequence processing has recently received significant attention (Greff et al., 2015; Balduzzi & Ghifary, 2016; Miao et al., 2016; Zoph & Le, 2016; Lee et al., 2017; Vaswani et al., 2017). Our approach is closely related to recent work on recurrent convolutions (RCNN; Lei et al., 2015; 2016), kernel networks (KNN; Lei et al., 2017), and QuasiRNN (Bradbury et al., 2017). Both RCNN and Quasi-RNN incorporate word-level convolutions into recurrent unit with sequential gated pooling. KNN generalizes RCNN and provides a theoretical view by linking the model class to sequence kernels. SRU can be viewed as a simplified version, or a special case, of RCNN, KNN, and Quasi-RNN, where the window size is set to 1 and highway connections Srivastava et al. (2015) are added to facilitate increased network depth. We discuss the relation of SRU to Quasi-RNN in more detail and evaluate the effect of the differences in Appendix A.
70
+
71
+ Various strategies have been proposed to scale network training (Goyal et al., 2017) or specifically to speed up recurrent networks (Diamos et al., 2016; Kuchaiev & Ginsburg, 2017; Shazeer et al., 2017). Our CUDA-level optimization for SRU is inspired by cuDNN LSTM (Appleyard et al., 2016). While cuDNN LSTM requires six optimization steps, SRU only requires two optimizations to produce
72
+
73
+ Algorithm 1 Mini-batch version of the forward pass defined in Equations 1-5.
74
+
75
+ Indices: Sequence length $n$ , $l = 1 , \cdots , n$ ; mini-batch size $k$ , $i = 1 , \cdots , k$ ; hidden state dimension $d$ , $j = 1 , \cdots , d$ ; and $j ^ { \prime } = 1 , \cdots , 3 d$ .
76
+
77
+ Input: Input sequences batch $\mathbf { x } [ l , i , j ]$ ; grouped matrix multiplication result ${ \bf U } [ l , i , j ^ { \prime } ]$ ; bias terms $\bar { \mathbf { b } } _ { f } [ j ]$ and $ { \mathbf { b } } _ { r } [ j ]$ ; and initial state ${ \bf c } _ { 0 } [ i , j ]$ .
78
+
79
+ Output: Output $\mathbf { h } [ \cdot , \cdot , \cdot ]$ and internal $\mathbf { c } [ \cdot , \cdot , \cdot ]$ states. Initialize $\mathbf { h } [ \cdot , \cdot , \cdot ]$ and $\mathbf { \bar { c } } [ \cdot , \cdot , \cdot ]$ as two $n \times k \times d$ tensors. for $i = 1 , \cdots , k ; j = 1 , \cdots , d { \bf d o }$ // Parallelize over $i$ and $j$ $\mathbf { c } ^ { \prime } = \mathbf { c } _ { 0 } [ i , j ]$ for $l = 1 , \cdots , n$ do $f = \sigma \left( \mathbf { U } [ l , i , j + d ] + \mathbf { b } _ { f } [ j ] \right)$ // Forget gate $r = \sigma \left( \mathbf { U } [ l , i , j + d \times 2 ] + \mathbf { b } _ { r } [ j ] \right.$ ) // Reset gate $c = f \times c + ( 1 - f ) \times \mathbf { U } [ l , i , j ]$ // Current internal state $h = f \times g ( c ) + ( 1 - r ) \times \mathbf { x } [ l , i , j ]$ // Current output state c[l, i, j] = c h[l, i, j] = h return h[·, ·, ·] and c[·, ·, ·]
80
+
81
+ significant speed-up. The convolution-based Quasi-RNN architecture (Bradbury et al., 2017) uses similar CUDA-level optimizations such as conv2d operation or batched matrix multiplications. The topic of improving learning times was also studied. For example, Goyal et al. (2017) addressed stability issues of distributed training with large mini-batches to improve training time. Our approach can be combined with such training procedures.
82
+
83
+ The design of simple recurrent architectures, such as SRU and other related architectures, raises questions about representational power. Balduzzi & Ghifary (2016) applies type-preserving transformations to the discuss the capacity of various simplified RNN architectures. Recent work has demonstrated the connection between neural networks and kernels (Anselmi et al., 2015; Daniely et al., 2016; Zhang et al., 2016). In particular, Lei et al. (2017) shows that a broad model class, including SRU and word-level CNN, can be seen as embedding sequence similarity functions, such as string kernels (Lodhi et al., 2002), into a hidden space. Layer stacking can then be interpreted as using higher-order sequence similarities, which introduces more non-linearity and representational power. We empirically show SRU can achieve compelling results by stacking multiple layers.
84
+
85
+ # 4 EXPERIMENTS
86
+
87
+ We evaluate SRU with text classification, question answering, language modeling, machine translation, and speech recognition tasks. This set of tasks provides broad coverage of application and computation challenges. Training time on these benchmarks ranges from minutes (classification) to days (speech).
88
+
89
+ Unless noted otherwise, timing experiments are performed on PyTorch and a desktop machine with a single Nvidia GeForce GTX 1070 GPU, Intel Core i7-7700K Processor, CUDA 8 and cuDNN 6021. We use variational dropout (Gal & Ghahramani, 2016) in addition to the standard dropout for RNN regularization. We set $g ( \cdot ) = \mathtt { t a n h }$ for all our experiments, unless specified otherwise.
90
+
91
+ The main question we study is the performance-speed trade-off SRU provides in comparison to other recurrent architectures. We stack multiple layers of SRU to directly substitute other recurrent or convolutional modules. We minimize hyper-parameter tuning and architecture engineering for a fair comparison. Such efforts have a non-trivial impact on the results, which are beyond the scope of our experiments. As much as possible, the model configurations are identical to prior work.
92
+
93
+ # 4.1 CLASSIFICATION
94
+
95
+ Dataset We use six classification tasks from Kim (2014):1 movie review sentiment (MR; Pang & Lee, 2005), subjectivity (SUBJ; Pang & Lee, 2004), customer reviews polarity (CR; Hu & Liu, 2004), TREC question type (TREC; Li & Roth, 2002), MPQA opinion polarity (MPQA; Wiebe et al.,
96
+
97
+ Table 1: Classification (Section 4.1) test accuracies on six benchmarks.
98
+
99
+ <table><tr><td>Model</td><td>CR</td><td>SUBJ</td><td>MR</td><td>TREC</td><td>MPQA</td><td>SST</td></tr><tr><td>CNN (Kim,2014)</td><td>82.2±2.2</td><td>92.9±0.7</td><td>79.1±1.5</td><td>93.2±0.5</td><td>88.8±1.2</td><td>85.3±0.4</td></tr><tr><td>LSTM</td><td>82.7±2.9</td><td>92.4±0.6</td><td>80.3±1.5</td><td>93.1±0.9</td><td>89.2 ±1.0</td><td>87.9 ±0.6</td></tr><tr><td>SRU</td><td>84.8±1.3</td><td>93.4±0.8</td><td>82.2 ±0.9</td><td>93.9±0.6</td><td>89.7±1.1</td><td>89.1±0.3</td></tr></table>
100
+
101
+ ![](images/15fc4f70d669c3e4d7717fea170264ca2f981f22e5a121c0450fd268e659bf86.jpg)
102
+ Table 2: Mean validation accuracies (y-axis) of LSTM, CNN, and SRU for the first 100 epochs on the six classification benchmarks. X-axis: training time used (in seconds).
103
+
104
+ 2005), and the Stanford sentiment treebank (SST; Socher et al., 2013).2 Following (Kim, 2014), we use word2vec embeddings trained on 100 billion Google News tokens. Word embeddings are normalized to unit vectors and are fixed during training.
105
+
106
+ Setup We train RNN encoders and use the last output state to predict the class label for a given sentence. We use a two-layer RNN encoder with 128 hidden dimensions. For SST, which provides more data, we use a four-layer RNN. We also compare to the CNN model of Kim (2014), with the same filter windows of 3, 4, and 5 as the original work. We use Adam (Kingma & Ba, 2014) with default 0.001 learning rate and 0 weight decay. We train for 100 epochs, and perform 10-fold cross validation when no standard split is specified. The result on SST is averaged over five independent trials. We tune dropout probability among $\{ 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 \}$ and report the best results.
107
+
108
+ Results Table 1 presents test results on the six benchmarks. Our model consistently outperforms the other models across the datasets. Figure 2 shows validation performance relative to training time for SRU, cuDNN LSTM, and the CNN model. Our SRU implementation is significantly faster than cuDNN LSTM. For example, on the movie review task (MR), our model completes 100 training epochs within 40 seconds, while cuDNN LSTM takes more than 450 seconds.
109
+
110
+ <table><tr><td>Model</td><td>#layers</td><td>Dim.</td><td>Size</td><td>Dev EM</td><td>Dev F1</td><td>Time per epoch RNN</td><td>Total</td></tr><tr><td>Chen et al. (2017)</td><td>3</td><td>128</td><td>4.1m</td><td>69.5</td><td>78.8</td><td>1</td><td>1</td></tr><tr><td>Bi-LSTM</td><td>3</td><td>128</td><td>4.1m</td><td>69.6</td><td>78.7</td><td>534s</td><td>670s</td></tr><tr><td>Bi-LSTM</td><td>4</td><td>128</td><td>5.8m</td><td>69.6</td><td>78.9</td><td>729s</td><td>872s</td></tr><tr><td>Bi-SRU</td><td>3</td><td>128</td><td>2.0m</td><td>69.1</td><td>78.4</td><td>60s</td><td>179s</td></tr><tr><td>Bi-SRU</td><td>4</td><td>128</td><td>2.4m</td><td>69.7</td><td>79.1</td><td>74s</td><td>193s</td></tr><tr><td>Bi-SRU</td><td>5</td><td>128</td><td>2.8m</td><td>70.3</td><td>79.5</td><td>88s</td><td>207s</td></tr><tr><td>State-of-the-art Results</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BiDAF (Seo et al., 2016b)</td><td></td><td></td><td></td><td>81.0</td><td>87.4</td><td></td><td></td></tr><tr><td>R-net (Wang et al., 2017)</td><td></td><td>=</td><td></td><td>82.1</td><td>88.1</td><td></td><td></td></tr></table>
111
+
112
+ Table 3: Exact match (EM) and F1 scores of various models on SQuAD (Section 4.2). We also report the total processing time per epoch and the time spent in RNN computations. SRU outperforms the LSTM models, and is more than six times faster than cuDNN LSTM. We also list the state-of-theart test results for the EM and F1 metrics as listed on the leaderboard on December, 2017. Both state-of-the-art methods use RNNs, and can potentially benefit from our approach.
113
+
114
+ # 4.2 QUESTION ANSWERING
115
+
116
+ Dataset We use the Stanford Question Answering Dataset (SQuAD; Rajpurkar et al., 2016). SQuAD is one of the largest machine comprehension datasets, and includes over 100K questionanswer pairs extracted from Wikipedia articles. We use the standard train and development sets.
117
+
118
+ Setup We experiment with the Document Reader model (Chen et al., 2017), and compare variants that use LSTM, as in the original setup, and SRU. We use the open source re-implementation.3 Due to minor differences, this version performs $1 \%$ worse compared to the reported results when using the same training options. Following the author suggestions, we use a learning rate of 0.001 instead of 0.002, the Adamax (Kingma & Ba, 2014) optimizer, and separately tuned dropout rates for the RNN and word embeddings. This gives results comparable to the original paper. All models are trained for up to 50 epochs, batch size 32, a fixed learning rate of 0.001, and hidden dimensionality of 128. We use a dropout of 0.5 for input word embeddings, 0.2 for SRU layers, and 0.3 for LSTM layers.
119
+
120
+ Results Table 3 summarizes our results and state-of-the-art results as of December, 2017. LSTM models achieve $6 9 . 6 \%$ exact match and $7 8 . 9 \%$ F1 score. These results are comparable to the original work (Chen et al., 2017). SRU models achieve $7 0 . 3 \%$ exact match and $7 9 . 5 \%$ F1 score, outperforming the LSTM models. Moreover, SRU exhibits 6x to $1 0 \mathrm { x }$ speed-up, more than $6 9 \%$ reduction in total training time. The most recent state-of-the-art methods both use RNNs to encode text, and can potentially benefit from our approach.
121
+
122
+ # 4.3 LANGUAGE MODELING
123
+
124
+ Dataset We use the Penn Treebank corpus (PTB). The processed data and splits are taken from Mikolov et al. (2010). The data contains about 1M tokens with a truncated vocabulary of 10k. Following standard practice, the training data is treated as a long sequence split to mini batches, the models are trained using truncated back-propagation-through-time (BPTT; Williams & Peng, 1990).
125
+
126
+ Setup We largely follow the configuration of prior work (Zaremba et al., 2014; Gal & Ghahramani, 2016; Zoph & Le, 2016). We use a batch size of 32 and truncated back-propagation with 35 steps. The dropout probability is 0.75 for the input embedding and output softmax layer. The standard dropout and variational dropout probability are 0.2 for stacked RNN layers. We use SGD with an initial learning rate of 1.0 and gradient clipping. We train up to 300 epochs, and start to decrease the learning rate by a factor of 0.98 after 175 epochs. We use the identity activation function for $g ( \cdot )$ .
127
+
128
+ Table 4: Language modeling perplexities on the PTB dataset. Models in comparison are trained using similar regularization and learning strategy: variational dropout is used except for (Zaremba et al., 2014), (Press & Wolf, 2017) and cuDNN LSTM; input and output word embeddings are tied except for (Zaremba et al., 2014); SGD with learning rate decay is used for all models.(Section 4.3). We also report time per training epoch, including for the entire architecture (Total) and for the RNN only.
129
+
130
+ <table><tr><td>Model</td><td>#layers</td><td>Size</td><td>Dev</td><td>Test</td><td>Time per epoch RNN</td><td>Total</td></tr><tr><td>LSTM (Zaremba et al., 2014)</td><td></td><td>66m</td><td>82.2</td><td>78.4</td><td></td><td></td></tr><tr><td>LSTM (Press &amp; Wolf, 2017)</td><td>22</td><td>51m</td><td>75.8</td><td>73.2</td><td></td><td></td></tr><tr><td>LSTM (Inan et al.,2016)</td><td>2</td><td>28m</td><td>72.5</td><td>69.0</td><td></td><td></td></tr><tr><td>RHN (Zilly et al.,2017)</td><td>10</td><td>23m</td><td>67.9</td><td>65.4</td><td></td><td></td></tr><tr><td>KNN (Lei et al., 2017)</td><td>4</td><td>20m</td><td></td><td>63.8</td><td></td><td></td></tr><tr><td>NAS (Zoph &amp; Le,2016)</td><td>1</td><td>25m</td><td>- =</td><td>64.0</td><td></td><td></td></tr><tr><td>NAS (Zoph &amp; Le,2016)</td><td>-</td><td>54m</td><td>1</td><td>62.4</td><td></td><td></td></tr><tr><td>CuDNN LSTM</td><td>2</td><td>24m</td><td>73.3</td><td>71.4</td><td>53s</td><td>73s</td></tr><tr><td>CuDNN LSTM</td><td>3</td><td>24m</td><td>78.8</td><td>76.2</td><td>64s</td><td>79s</td></tr><tr><td>SRU</td><td>3</td><td>24m</td><td>68.0</td><td>64.7</td><td>21s</td><td>44s</td></tr><tr><td>SRU</td><td>4</td><td>24m</td><td>65.8</td><td>62.5</td><td>23s</td><td>44s</td></tr><tr><td>SRU</td><td>5</td><td>24m</td><td>63.9</td><td>61.0</td><td>27s</td><td>46s</td></tr><tr><td>SRU</td><td>6</td><td>24m</td><td>63.4</td><td>60.3</td><td>28s</td><td>47s</td></tr></table>
131
+
132
+ Results Table 4 shows perplexity results. We use a parameter budget of 24 million for a fair comparison. cuDNN LSTM obtains a perplexity of 71.4 with 73-79 seconds per epoch. This result is worse than most prior work. We attribute this difference to the lack of variational dropout support in the cuDNN implementation. SRU obtains better perplexity compared to cuDNN LSTM and prior work, reaching 64.7 with three recurrent layers and 60.3 with six layers.4 SRU also provides better speed-perplexity trade-off: training a six-layer RNN takes 47 seconds per epoch.
133
+
134
+ # 4.4 MACHINE TRANSLATION
135
+
136
+ Dataset We use the WMT 2014 English German translation task. We pre-process the training corpus following standard practice (Peitz et al., 2014; Li et al., 2014; Jean et al., 2015). About 4M translation pairs are left after processing. The news-test-2014 data is used as the test set and the concatenation of news-test-2012 and news-test-2013 is used as the development set.
137
+
138
+ Setup We use OpenNMT (Klein et al., 2017), and extend the Pytorch version5 with our SRU implementation. OpenNMT uses a seq2seq model in a recurrent encoder-decoder architecture with attention (Luong et al., 2015). By default, the model provides $\mathbf { h } _ { t - 1 }$ , the hidden state of decoder at step $t - 1$ , as input to step $t$ . Although this can potentially improve translation quality, it impedes parallelization and slows down training. We disable this option. All models are trained with hidden state and word embedding size of 500, 15 epochs, SGD with initial learning rate of 1.0, and batch size 64. We modify the default of OpenNMT, and use a dropout rate of 0.1 and a weight decay of $1 0 ^ { - 5 }$ . This leads to better results for both RNN implementations.
139
+
140
+ Results Table 5 shows the translation results. We obtain better BLEU scores compared to the reports OpenNMT results (Klein et al., 2017). SRU with 10 stacked layers achieves a BLEU score of 20.7 while cuDNN LSTM achieves 20.45 using more parameters and more training time. SRU scales better, and we can stack many layers of SRU without significant time increase. Each additional SRU layer in encoder and decoder adds four minutes per training epoch, while adding an LSTM layer adds 23 minutes. In comparison, the other operations (e.g., attention and output softmax) take about 95 minutes. We do not observe over-fitting on the development set, even when using 10 layers.
141
+
142
+ Table 5: English-German translation results (Section 4.4). We list the total number of parameters (Size all) and the number excluding word embeddings (Size w/o Emb.). Our setup disables $\mathbf { h } _ { t - 1 }$ input, which significantly reduces the training time. Timings are performed on a single Nvidia Titan X Pascal GPU. We also list recent state-of-the-art results.
143
+
144
+ <table><tr><td>OpenNMT default setup</td><td># layers</td><td>Size all</td><td>Size w/o Emb.</td><td>Test BLEU</td><td>Time in RNNs</td></tr><tr><td>Klein et al. (2017)</td><td>2</td><td>-</td><td>1</td><td>17.60</td><td></td></tr><tr><td>Klein et al. (2017) + BPE</td><td>2</td><td>1</td><td>1</td><td>19.34</td><td></td></tr><tr><td>cuDNN LSTM (wd = 0)</td><td>2</td><td>85m</td><td>10m</td><td>18.04</td><td>149 min</td></tr><tr><td>cuDNN LSTM (wd = 10-5)</td><td>2</td><td>85m</td><td>10m</td><td>19.99</td><td>149 min</td></tr><tr><td colspan="6">Our setup</td></tr><tr><td>cuDNN LSTM</td><td>2</td><td>84m</td><td>9m</td><td>19.67</td><td>46 min</td></tr><tr><td>cuDNN LSTM</td><td>3</td><td>88m</td><td>13m</td><td>19.85</td><td>69 min</td></tr><tr><td>cuDNN LSTM</td><td>5</td><td>96m</td><td>21m</td><td>20.45</td><td>115 min</td></tr><tr><td>SRU</td><td>3</td><td>81m</td><td>6m</td><td>18.89</td><td>12 min</td></tr><tr><td>SRU</td><td>5</td><td>84m</td><td>9m</td><td>19.77</td><td>20 min</td></tr><tr><td>SRU</td><td>6</td><td>85m</td><td>10m</td><td>20.17</td><td>24 min</td></tr><tr><td>SRU</td><td>10</td><td>91m</td><td>16m</td><td>20.70</td><td>40 min</td></tr><tr><td colspan="6">State-of-the-art Results</td></tr><tr><td>GNMT Ensemble (Wu et al., 2016b)</td><td>8</td><td colspan="2"></td><td>26.3</td><td></td></tr><tr><td>ConvS2S Ensemble (Gehring et al., 2017)</td><td>20</td><td colspan="2">-</td><td>26.4</td><td></td></tr><tr><td>Transformer (Vaswani et al., 2017)</td><td>6</td><td colspan="2">64m</td><td>27.3</td><td></td></tr><tr><td>Transformer (Vaswani et al., 2017)</td><td>6</td><td colspan="2">213m</td><td>28.4</td><td></td></tr></table>
145
+
146
+ We also include the most recent state-of-the-art results in Table 5. In our experiments, we use the default model provided by OpenNMT as our baseline architecture. Both RNN and non-RNN architectures have achieved significantly better BLEU scores on the En-Ge translation task than the OpenNMT default model. Combining SRU with state-of-the-art architectures such as Transformer is an important research direction, which we plan to explore in future work. For instance, with SRU only 4 minutes are spent per recurrent layer. This reduction in RNN time enables introducing recurrent computations into the Transformer architecture.
147
+
148
+ # 4.5 SPEECH RECOGNITION
149
+
150
+ Dataset We use the Switchboard-1 corpus (Godfrey et al., 1992). The training data includes about 300 hours of speech from 4, 870 sides of conversations between 520 speakers. The test data includes about two hours of speech from 40 sides of conversations from the 2000 Hub5 evaluation.
151
+
152
+ Setup We use Kaldi (Povey et al., 2011) for feature extraction, decoding, and training of initial HMM-GMM models. We use the standard Kaldi recipes to train maximum likelihood-criterion context-dependent speaker adapted acoustic models with Mel-Frequency Cepstral Coefficient (MFCC). We apply forced alignment to generate labels for neural network acoustic model training. We use the Computational Network Toolkit (CNTK; Yu et al., 2014) instead of PyTorch. We experiment with uni-directional and bi-directional models, with and without state-level Minimum Bayes Risk (sMBR) training (Kingsbury et al., 2012). We use a trigram based language model instead of a RNN based language model on top of the acoustic model. Word error rates are reported after 4-gram LM rescoring of lattices generated using a trigram LM as described in Povey et al. (2016). See Appendix B for the complete setup details.
153
+
154
+ Results Table 6 summarizes the results. CNTK uses a special batching algorithms for RNNs, and hence we were not able to use our customized SRU kernel. However, even without any kernel optimization, the SRU is faster than an LSTM using the same number of parameters. SRU also achieves better results on WER. Adding the highway connections Srivastava et al. (2015) to the LSTM performs slightly worse than the baseline. Removing the dependency on the internal state h in the LSTM can improve the speed but causes a slight decrease in performance. Appendix C includes further experiments with different highway structures and number of layers.
155
+
156
+ <table><tr><td>Model</td><td>#layers</td><td># Parameters</td><td>WER</td><td>Time per epoch</td></tr><tr><td>LSTM</td><td>5</td><td>47M</td><td>11.9</td><td>136 min</td></tr><tr><td>LSTM + Seq</td><td>5</td><td>47M</td><td>10.8</td><td>-</td></tr><tr><td>Bi-LSTM</td><td>5</td><td>60M</td><td>11.2</td><td>273 min</td></tr><tr><td>Bi-LSTM + Seq</td><td>5</td><td>60M</td><td>10.4</td><td></td></tr><tr><td>LSTM with highway (remove h)</td><td>12</td><td>56M</td><td>12.5</td><td>210 min</td></tr><tr><td>LSTM with highway</td><td>12</td><td>56M</td><td>12.2</td><td>296 min</td></tr><tr><td>SRU</td><td>12</td><td>56M</td><td>11.6</td><td>113 min</td></tr><tr><td>SRU+ sMBR</td><td>12</td><td>56M</td><td>10.0</td><td>1</td></tr><tr><td>Bi-SRU</td><td>12</td><td>74M</td><td>10.5</td><td>220 min</td></tr><tr><td>Bi-SRU+ sMBR</td><td>12</td><td>74M</td><td>9.5</td><td>1</td></tr><tr><td>Very Deep CNN + sMBR (Saon et al., 2016)</td><td>10</td><td></td><td>10.5</td><td></td></tr><tr><td>LSTM+ LF-MMI (Povey et al., 2016)</td><td>3</td><td></td><td>10.3</td><td></td></tr><tr><td>Bi-LSTM + LF-MMI (Povey et al., 2016)</td><td>3</td><td></td><td>9.6</td><td></td></tr></table>
157
+
158
+ Table 6: Word error rate (WER) for speech recognition (Section 4.5). The timing numbers are based on a naive implementation of SRU in CNTK. No CUDA-level optimizations are performed.
159
+
160
+ # 5 CONCLUSION
161
+
162
+ We present Simple Recurrent Unit (SRU), a recurrent architecture that is as fast as CNN and easily scales to over 10 layers. Our evaluation on a variety of NLP and speech recognition tasks demonstrates the effectiveness of SRU. We open source our implementation to facilitate future research.
163
+
164
+ # REFERENCES
165
+
166
+ Fabio Anselmi, Lorenzo Rosasco, Cheston Tan, and Tomaso Poggio. Deep convolutional networks are hierarchical kernel machines. preprint arXiv:1508.01084, 2015.
167
+
168
+ Jeremy Appleyard, Tomas Kocisky, and Phil Blunsom. Optimizing performance of recurrent neural networks on gpus. arXiv preprint arXiv:1604.01946, 2016.
169
+
170
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In Proceedings of the International Conference on Learning Representations, 2015.
171
+
172
+ David Balduzzi and Muhammad Ghifary. Strongly-typed recurrent neural networks. In Proceedings of 33th International Conference on Machine Learning (ICML), 2016.
173
+
174
+ James Bradbury, Stephen Merity, Caiming Xiong, and Richard Socher. Quasi-recurrent neural networks. In ICLR, 2017.
175
+
176
+ Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading Wikipedia to answer open-domain questions. In Association for Computational Linguistics (ACL), 2017.
177
+
178
+ Kyunghyun Cho, Bart van Merriënboer, Çaglar Gülçehre, Dzmitry Bahdanau, Fethi Bougares, Holger ˘ Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder–decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1724–1734, 2014.
179
+
180
+ Amit Daniely, Roy Frostig, and Yoram Singer. Toward deeper understanding of neural networks: The power of initialization and a dual view on expressivity. CoRR, abs/1602.05897, 2016.
181
+
182
+ Yann N. Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In Proceedings of the 34th International Conference on Machine Learning, 2017.
183
+
184
+ Greg Diamos, Shubho Sengupta, Bryan Catanzaro, Mike Chrzanowski, Adam Coates, Erich Elsen, Jesse Engel, Awni Hannun, and Sanjeev Satheesh. Persistent rnns: Stashing recurrent weights on-chip. In International Conference on Machine Learning, pp. 2024–2033, 2016.
185
+
186
+ Yarin Gal and Zoubin Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. In Advances in Neural Information Processing Systems 29 (NIPS), 2016.
187
+
188
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. arXiv preprint arXiv:1705.03122, 2017.
189
+
190
+ J. J. Godfrey, E. C. Holliman, and J. McDaniel. Switchboard: Telephone speech corpus for research and development. In Proc. International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 517–520, 1992.
191
+
192
+ Priya Goyal, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
193
+
194
+ Klaus Greff, Rupesh Kumar Srivastava, Jan Koutník, Bas R Steunebrink, and Jürgen Schmidhuber. Lstm: A search space odyssey. arXiv preprint arXiv:1503.04069, 2015.
195
+
196
+ 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.
197
+
198
+ Geoffrey Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. In arXiv, 2012.
199
+
200
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
201
+
202
+ W. Hsu, Y. Zhang, and J. Glass. A prioritized grid long short-term memory rnn for speech recognition. In Proc. SLT, 2016.
203
+
204
+ Minqing Hu and Bing Liu. Mining and summarizing customer reviews. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 168–177. ACM, 2004.
205
+
206
+ Hakan Inan, Khashayar Khosravi, and Richard Socher. Tying word vectors and word classifiers: A loss framework for language modeling. arXiv preprint arXiv:1611.01462, 2016.
207
+
208
+ Ozan Irsoy and Claire Cardie. Opinion mining with deep recurrent neural networks. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 720–728. Association for Computational Linguistics, 2014. doi: 10.3115/v1/D14-1080. URL http://aclanthology.coli.uni-saarland.de/pdf/D/D14/D14-1080.pdf.
209
+
210
+ Sébastien Jean, Kyunghyun Cho, Roland Memisevic, and Yoshua Bengio. On using very large target vocabulary for neural machine translation. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), 2015.
211
+
212
+ Nal Kalchbrenner, Edward Grefenstette, and Phil Blunsom. A convolutional neural network for modelling sentences. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Association for Computational Linguistics, 2014.
213
+
214
+ Yoon Kim. Convolutional neural networks for sentence classification. In Proceedings of the Empiricial Methods in Natural Language Processing (EMNLP 2014), 2014.
215
+
216
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the International Conference on Learning Representations, 2014.
217
+
218
+ Brian Kingsbury, Tara Sainath, and Hagen Soltau. Scalable Minimum Bayes Risk Training of Deep Neural Network Acoustic Models Using Distributed Hessian-free Optimization. In INTERSPEECH, 2012.
219
+
220
+ Guillaume Klein, Yoon Kim, Yuntian Deng, Jean Senellart, and Alexander Rush. Opennmt: Opensource toolkit for neural machine translation. In Proceedings of ACL 2017, System Demonstrations, 2017.
221
+
222
+ Oleksii Kuchaiev and Boris Ginsburg. Factorization tricks for lstm networks. arXiv preprint arXiv:1703.10722, 2017.
223
+
224
+ Kenton Lee, Omer Levy, and Luke Zettlemoyer. Recurrent additive networks. arXiv preprint arXiv:1705.07393, 2017.
225
+
226
+ Tao Lei, Regina Barzilay, and Tommi Jaakkola. Molding cnns for text: non-linear, non-consecutive convolutions. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, 2015.
227
+
228
+ Tao Lei, Hrishikesh Joshi, Regina Barzilay, Tommi Jaakkola, Kateryna Tymoshenko, Alessandro Moschitti, and Lluís Màrquez. Semi-supervised question retrieval with gated convolutions. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. Association for Computational Linguistics, 2016.
229
+
230
+ Tao Lei, Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Deriving neural architectures from sequence and graph kernels. ICML, 2017.
231
+
232
+ Liangyou Li, Xiaofeng Wu, Santiago Cortes Vaillo, Jun Xie, Andy Way, and Qun Liu. The dcu-ictcas mt system at wmt 2014 on german-english translation task. In Proceedings of the Ninth Workshop on Statistical Machine Translation, 2014.
233
+
234
+ Xin Li and Dan Roth. Learning question classifiers. In Proceedings of the 19th international conference on Computational linguistics-Volume 1. Association for Computational Linguistics, 2002.
235
+
236
+ Huma Lodhi, Craig Saunders, John Shawe-Taylor, Nello Cristianini, and Chris Watkins. Text classification using string kernels. Journal of Machine Learning Research, 2(Feb):419–444, 2002.
237
+
238
+ Minh-Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attentionbased neural machine translation. In Empirical Methods in Natural Language Processing (EMNLP). Association for Computational Linguistics, 2015.
239
+
240
+ Hongyuan Mei, Mohit Bansal, and R. Matthew Walter. What to talk about and how? selective generation using lstms with coarse-to-fine alignment. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 2016. doi: 10.18653/v1/N16-1086. URL http://aclweb.org/anthology/ N16-1086.
241
+
242
+ Gábor Melis, Chris Dyer, and Phil Blunsom. On the state of the art of evaluation in neural language models. arXiv preprint arXiv:1707.05589, 2017.
243
+
244
+ Yajie Miao, Jinyu Li, Yongqiang Wang, Shi-Xiong Zhang, and Yifan Gong. Simplifying long shortterm memory acoustic models for fast training and decoding. In Acoustics, Speech and Signal Processing (ICASSP), 2016 IEEE International Conference on, pp. 2284–2288. IEEE, 2016.
245
+
246
+ Tomas Mikolov, Martin Karafiát, Lukas Burget, Jan Cernocky, and Sanjeev Khudanpur. Recurrent \` neural network based language model. In INTERSPEECH 2010, 11th Annual Conference of the International Speech Communication Association, Makuhari, Chiba, Japan, September 26-30, 2010, pp. 1045–1048, 2010.
247
+
248
+ Dipendra Misra, John Langford, and Yoav Artzi. Mapping instructions and visual observations to actions with reinforcement learning. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing (EMNLP). Association for Computational Linguistics, 2017. Arxiv preprint: https://arxiv.org/abs/1704.08795.
249
+
250
+ Bo Pang and Lillian Lee. A sentimental education: Sentiment analysis using subjectivity summarization based on minimum cuts. In Proceedings of the 42nd annual meeting on Association for Computational Linguistics, pp. 271. Association for Computational Linguistics, 2004.
251
+
252
+ Bo Pang and Lillian Lee. Seeing stars: Exploiting class relationships for sentiment categorization with respect to rating scales. In Proceedings of the 43rd annual meeting on association for computational linguistics, pp. 115–124. Association for Computational Linguistics, 2005.
253
+
254
+ Stephan Peitz, Joern Wuebker, Markus Freitag, and Hermann Ney. The rwth aachen german-english machine translation system for wmt 2014. In Proceedings of the Ninth Workshop on Statistical Machine Translation, 2014.
255
+
256
+ Daniel Povey, Arnab Ghoshal, Gilles Boulianne, Lukas Burget, Ondrej Glembek, Nagendra Goel, Mirko Hannenmann, Petr Motlicek, Yanmin Qian, Petr Schwarz, Jan Silovsky, Georg Stemmer, and Karel Vesely. The Kaldi Speech Recognition Toolkit. In Automatic Speech Recognition and Understanding Workshop, 2011.
257
+
258
+ Daniel Povey, Vijayaditya Peddinti, Daniel Galvez, Pegah Ghahremani, Vimal Manohar, Xingyu Na, Yiming Wang, and Sanjeev Khudanpur. Purely sequence-trained neural networks for asr based on lattice-free mmi. In INTERSPEECH, pp. 2751–2755, 2016.
259
+
260
+ Ofir Press and Lior Wolf. Using the output embedding to improve language models. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics (EACL), 2017.
261
+
262
+ P. Rajpurkar, J. Zhang, K. Lopyrev, and P. Liang. Squad: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In Empirical Methods in Natural Language Processing (EMNLP), 2016.
263
+
264
+ Tara N. Sainath, Oriol Vinyals, Andrew Senior, and Hasim Sak. Convolutional, Long Short-Term Memory, Fully Connected Deep Neural Networks. In IEEE International Conference on Acoustics, Speech and Signal Processing, 2015.
265
+
266
+ Hasim Sak, Andrew Senior, and Francoise Françoise. Long Short-Term Memory Recurrent Neural Network Architectures for Large Scale Acoustic Modeling. In INTERSPEECH, 2014.
267
+
268
+ George Saon, Tom Sercu, Steven Rennie, and Hong-Kwang J. Kuo. The ibm 2016 english conversational telephone speech recognition system. In https://arxiv.org/abs/1604.08242, 2016.
269
+
270
+ Frank Seide, Gang Li, Xie Chen, and Dong Yu. Feature engineering in context-dependent deep neural networks for conversational speech transcription. In Automatic Speech Recognition and Understanding (ASRU), 2011 IEEE Workshop on, pp. 24–29. IEEE, 2011.
271
+
272
+ Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional attention flow for machine comprehension. In International Conference on Learning Representations, 2016a.
273
+
274
+ Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional attention flow for machine comprehension. arXiv preprint arXiv:1611.01603, 2016b.
275
+
276
+ Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. arXiv preprint arXiv:1701.06538, 2017.
277
+
278
+ Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Y. $\mathrm { N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pp. 1631–1642, October 2013.
279
+
280
+ Rupesh K Srivastava, Klaus Greff, and Jürgen Schmidhuber. Training very deep networks. In Advances in neural information processing systems, pp. 2377–2385, 2015.
281
+
282
+ 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.
283
+
284
+ Mingxuan Wang, Zhengdong Lu, Hang Li, Wenbin Jiang, and Qun Liu. gencnn: A convolutional architecture for word sequence prediction. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), 2015.
285
+
286
+ Wenhui Wang, Nan Yang, Furu Wei, Baobao Chang, and Ming Zhou. Gated self-matching networks for reading comprehension and question answering. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, 2017.
287
+
288
+ Janyce Wiebe, Theresa Wilson, and Claire Cardie. Annotating expressions of opinions and emotions in language. Language resources and evaluation, 2005.
289
+
290
+ Ronald J Williams and Jing Peng. An efficient gradient-based algorithm for on-line training of recurrent network trajectories. Neural computation, 2(4):490–501, 1990.
291
+
292
+ Huijia Wu, Jiajun Zhang, and Chengqing Zong. An empirical exploration of skip connections for sequential tagging. In Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers, December 2016a.
293
+
294
+ 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, 2016b.
295
+
296
+ D. Yu, A. Eversole, M. Seltzer, K. Yao, B. Guenter, O. Kuchaiev, F. Seide, H. Wang, J. Droppo, Z. Huang, Y. Zhang, G. Zweig, C. Rossbach, J. Currey, J. Gao, A. May, A. Stolcke, and M. Slaney. An introduction to computational networks and the computational network toolkit. Technical Report MSR, Microsoft Research, 2014. http://cntk.codeplex.com.
297
+
298
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
299
+
300
+ Yu Zhang, Dong Yu, Michael L Seltzer, and Jasha Droppo. Speech recognition with predictionadaptation-correction recurrent neural networks. In Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on, pp. 5004–5008. IEEE, 2015.
301
+
302
+ Yuchen Zhang, Jason D. Lee, and Michael I. Jordan. $\ell _ { 1 }$ -regularized neural networks are improperly learnable in polynomial time. In Proceedings of the 33nd International Conference on Machine Learning, 2016.
303
+
304
+ Julian Georg Zilly, Rupesh Kumar Srivastava, Jan Koutník, and Jürgen Schmidhuber. Recurrent highway networks. In Proceedings of the 34th International Conference on Machine Learning (ICML), 2017.
305
+
306
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
307
+
308
+ # A COMPARISON OF MODEL VARIANTS AND QUASI-RNN
309
+
310
+ SRU and Quasi-RNN (Bradbury et al., 2017) both were developed with the goal of speeding up the computation of recurrent neural networks. The Quasi-RNN design aims to combine $k$ -gram convolutions with adaptive pooling (i.e., fo-pooling) instead of traditional order-oblivious pooling, such as max pooling or average pooling. Similar to other convolutional architectures (Kalchbrenner et al., 2014; Kim, 2014; Wang et al., 2015; Dauphin et al., 2017), a $k$ -gram filter width $> 1$ is used throughout the experiments reported.
311
+
312
+ While Quasi-RNN is based on adding light recurrence to convolutional network, SRU is an instance of the recurrent architectures introduced by Lei et al. (2017). While this prior work focused on theoretical characteristics of the networks and their generalization, we focus on the implementation details of SRU, including practical optimizations, and on its applicability to a wide range of tasks. The SRU computation is similar to the degenerate case of setting $k = 1$ in the $k$ -gram filter in Quasi-RNN. The computation is then reduced to a simple feed-forward transformation (matrix multiplication), and loses the properties and quality of a convolution.
313
+
314
+ The SRU architecture and results we present also differ from Quasi-RNN in key technical decisions:
315
+
316
+ • CUDA Optimization: While the Quasi-RNN implementation of fo-pooling is done as a CUDA kernel function. The rest of the element-wise computation is performed via separate function calls on top of the software library (e.g., Chainer). This choice does not allow this type of architecture to achieve its full potential. In contrast, we implement element-wise fusion to enable further speed optimization (Section 2.3). • Activation and Highway Connections: SRU and Quasi-RNN differ in how the non-linear activation function is applied. Quasi-RNN follows the common practice with convolutional models, where the non-linear activation is applied with the convolution operation before pooling (i.e., $\tilde { \mathbf { x } } = \operatorname { t a n h } \left( \mathbf { W } * \mathbf { x } \right) )$ . In contrast, in SRU the activation function $g ( \cdot )$ is applied to compute the internal state (i.e., $\mathbf h _ { t } = g ( \mathbf c _ { t } ) )$ following the derivation in (Lei et al., 2017). SRU also includes highway connections in the architecture for better generalization of deep networks.
317
+
318
+ Effect of Element-wise Fusion We compare the speed of the fo-pooling implementation used in Quasi-RNN and the fused kernel implementation used in SRU. We implement a version of unidirectional and bi-directional SRU that uses fo-pooling and separate element-wise function calls in PyTorch. Figure 3 (left) presents the speed comparison on five classification tasks (Section 4.1) and SQuAD (Section 4.2). The fused element-wise kernel achieves $24 \%$ to $94 \%$ speed improvement across the six benchmarks.
319
+
320
+ Effect of Activation and Highway Connection We compare the performance of SRU variants with different activation functions and Quasi-RNN with filter width $k = 1$ on the classification and SQuAD datasets. For the classification tasks, we train using using the Adam optimizer with default 0.001 learning rate, 0 weight decay, and dropout probability tuned from values $\{ 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 \}$ . We perform three trials for 10-fold cross validation for each model and dataset. We report the average test accuracy of model configurations that achieve the best development results. For SQuAD, we train all models for a maximum of 100 epochs using the Admax optimizer with learning rate 0.001. We perform three independent trials, and report the average performance. Figure 3 (right), Table 4, and Table 5 summarize the results:
321
+
322
+ • SRU performs at least as good as Quasi-RNN, and often outperforms it. This illustrates the advantages of the design choices in SRU, including the highway connections and activation implementation. • We observe that the optimal choice of activation function varies depending on the task. For example, we found ReLU activation to work best on the classification benchmarks, but the identity activation performs the best on SQuAD, while ReLU performs worst. • The effect of highway connections is best highlighted in the question answering dataset. Without the highway connections, we observe a performance decrease when stacking more than four recurrent layers (Table 5). In contrast, adding highway connections results in $> 1 \%$ absolute improvement of exact match score. Figure 3 (right) also shows that no over-fitting occurs on the development set within 100 training epochs. This suggests that models with highway connections are likely to generalize better.
323
+
324
+ ![](images/721b54fbb6d0ab07514de25db80c23286035215eb5f72dfa3f1b7acef9899ec0.jpg)
325
+ Figure 3: Left: relative speed improvement of fused kernel (SRU) over fo-pooling kernel (Quasi-RNN) on various benchmarks. Timings are performed on a desktop machine with GeForce GTX 1070 and Intel Core i7-7700K Processor. Right: mean exact match (EM) score of 5-layer SRU and Quasi-RNN on SQuAD as a function of the number of epochs. Models are trained for a maximum of 100 epochs using Admax optimizer with learning rate 0.001.
326
+
327
+ Figure 4: Comparison between Quasi-RNN and SRU on classification benchmarks. We perform 3 independent trials of 10-fold cross validation $3 \times 1 0$ runs) for each model and dataset. We report the average test accuracy of model configurations that achieve the best dev result. All models are trained using Adam optimizer with default learning rate $= 0 . 0 0 1$ , weight decay $= 0$ and dropout probability tuned from values $\{ 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 \}$ .
328
+
329
+ <table><tr><td>Model</td><td>CR</td><td>SUBJ</td><td>MR</td><td>TREC</td><td>MPQA</td></tr><tr><td>Quasi-RNN (k = 1)</td><td>83.6±2.0</td><td>93.3 ±0.8</td><td>81.6±1.1</td><td>92.7±0.6</td><td>89.6±1.2</td></tr><tr><td>Quasi-RNN (k = 1) + highway</td><td>84.0±1.9</td><td>93.4±0.8</td><td>82.1±1.2</td><td>93.2±0.6</td><td>89.6±1.2</td></tr><tr><td>SRU (identity)</td><td>84.1±1.9</td><td>93.5 ±0.7</td><td>82.1±1.0</td><td>93.8±0.4</td><td>89.7±1.1</td></tr><tr><td>SRU (tanh)</td><td>84.2 ±1.7</td><td>93.5±0.8</td><td>82.1±1.1</td><td>93.9 ��0.6</td><td>89.8±1.0</td></tr><tr><td>SRU (ReLU)</td><td>84.7±1.9</td><td>93.7±0.9</td><td>82.5 ±1.1</td><td>93.7±0.5</td><td>89.8±1.0</td></tr></table>
330
+
331
+ Figure 5: Comparison between Quasi-RNN and SRU on the SQuAD benchmark. We perform 3 independent trials with a maximum of 100 training epochs. We report the average exact match (EM) score of each model configuration. Models are trained using Admax with learning rate 0.001.
332
+
333
+ <table><tr><td>Model</td><td colspan="3">Number of recurrent layers</td></tr><tr><td></td><td>4</td><td>5</td><td>6</td></tr><tr><td>Quasi-RNN (k = 1)</td><td>70.0±0.2</td><td>69.5 ±0.2</td><td>69.3 ±0.1</td></tr><tr><td>Quasi-RNN (k = 1) + highway</td><td>70.1 ±0.1</td><td>70.7±0.2</td><td>70.6 ±0.1</td></tr><tr><td>SRU (ReLU)</td><td>70.0±0.2</td><td>70.1 ±0.1</td><td>70.4±0.2</td></tr><tr><td>SRU (tanh)</td><td>70.3 ±0.1</td><td>70.9 ±0.2</td><td>70.7 ±0.2</td></tr><tr><td>SRU (identity)</td><td>70.5 ±0.2</td><td>71.0±0.1</td><td>71.1 ±0.1</td></tr></table>
334
+
335
+ # B SPEECH RECOGNITION EXPERIMENTAL SETUP DETAILS
336
+
337
+ Following Sainath et al. (2015), all weights are randomly initialized from the uniform distribution with range $[ - 0 . 0 5 , 0 . 0 5 ]$ , and all biases are initialized to 0 without generative or discriminative pre-training (Seide et al., 2011). All neural network models, unless noted otherwise, are trained with a cross-entropy criterion using truncated BPTT. No momentum is used for the first epoch, and a momentum of 0.9 is used for subsequent epochs (Zhang et al., 2015). We apply an $L 2$ constraint regularization with weight $1 0 ^ { - 5 }$ (Hinton et al., 2012) .
338
+
339
+ We experiment with uni-directional and bi-directional models. To train the uni-directional model, we unroll 20 frames and use 80 utterances in each mini-batch. We also delayed the output of the LSTM and SRU by 10 frames as suggested by Sak et al. (2014) to add more context. To train the bidirectional model, we use the latency-controlled method described in Zhang et al. (2015). We set $N _ { c } = 8 0$ and $N _ { r } = 2 0$ and processed 40 utterances simultaneously. In addition to our vanilla model, we also experiment state-level Minimum Bayes Risk (sMBR) training (Kingsbury et al., 2012). To train the recurrent model with the sMBR criterion, we adopted the two-forward-pass method described by Zhang et al. (2015), and processed 40 utterances simultaneously.
340
+
341
+ The input features for all models are 80-dimensional log Mel filterbank features computed every ten milliseconds, with an additional 3-dimensional pitch features. The output targets are 8802-contextdependent triphone states, of which the numbers are determined by the last HMM-GMM training stage.
342
+
343
+ Our setup can potentially improve if we incorporate some recent techniques that are applicable to SRU. For example, LF-MMI for sequence training, i-vectors for speaker adaptation, and speaker perturbation for data augmentation were applied by Povey et al. (2016). All of these techniques can also been used for SRU. Moreover, different highway variants such as grid LSTM (Hsu et al., 2016) can also further boost our model.
344
+
345
+ # C ADDITIONAL SPEECH RECOGNITION ANALYSIS
346
+
347
+ Baseline To identify the LSTM baseline used in Section 4.5, we experiment with varying the number of layers and parameters. Table 7 shows the performance of different settings. We follow the setup of Sak et al. (2014).6 The best LSTM baseline is using five layers with 1024 units in each layer.
348
+
349
+ Table 7: Word error rate (WER) for LSTM baselines on the Switchboard-1 corpus (Section 4.5). LSTM has 1024 cells for each layer, LSTM (S) has 750 cells for each layer, and LSTM (L) has 1560 cells for each layer. LSTM with projection contains 1024 cells and a 512-node linear projection layer is added on top of each layer output.
350
+
351
+ <table><tr><td>Model</td><td># layers</td><td># Parameters</td><td>WER</td></tr><tr><td>LSTM with projection (Sak et al., 2014)</td><td>5</td><td>28M</td><td>12.2</td></tr><tr><td>LSTM</td><td>3</td><td>30M</td><td>12.5</td></tr><tr><td>LSTM (S)</td><td>5</td><td>28M</td><td>12.5</td></tr><tr><td>LSTM</td><td>5</td><td>47M</td><td>11.9</td></tr><tr><td>LSTM (L)</td><td>5</td><td>94M</td><td>12.0</td></tr><tr><td>LSTM</td><td>6</td><td>56M</td><td>12.3</td></tr></table>
352
+
353
+ Effect of Highway Transform for SRU The dimensionality of the input $\mathbf { x } _ { t }$ and $\mathbf { h } _ { t }$ must be equal in the computation of $\mathbf { h } _ { t }$ (Equation 5). However, when this is not the case, for example as in the first layer of the SRU, we can use a linear projection $\mathbf { W } _ { h } ^ { l }$ to match the dimensions at layer $l$ . The
354
+
355
+ modified version of Equation 5 will then be:
356
+
357
+ $$
358
+ \mathbf { h } _ { t } = \mathbf { r } _ { t } \odot g ( \mathbf { c } _ { t } ) + ( 1 - \mathbf { r } _ { t } ) \odot \mathbf { W } _ { h } ^ { l } \mathbf { x } _ { t } \enspace .
359
+ $$
360
+
361
+ We can also use a square matrix $\mathbf { W } _ { h } ^ { l }$ for every layer. Table 8 shows that adding this transformation significantly reduces the word error rate from $\dot { 1 2 } . 6 \%$ to $1 1 . 8 \%$ when using the same number of parameters. This transformation is outside the recurrent loop, and can be parallelized to be computed efficiently.
362
+
363
+ <table><tr><td>Model</td><td># layers</td><td># Parameters</td><td>WER</td></tr><tr><td>SRU (no Wh, &gt; 1)</td><td>16</td><td>56M</td><td>12.6</td></tr><tr><td>SRU</td><td>12</td><td>56M</td><td>11.8</td></tr></table>
364
+
365
+ Table 8: Word error rate (WER) comparison of the effect of transformation in the highway connection. SRU (no $\mathbf { W } _ { h } ^ { l } , l > 1 )$ includes the transform in the first layer only to align the dimensionality. The second line includes the transformation for every layer.
366
+
367
+ Effect of Depth for SRU We study the effect of SRU depth on performance.7 Table 9 shows word error rate for SRU with different number of layers. The SRU model outperforms the LSTM model with 10 layers and the same number of parameters, while provide a $1 . 4 \mathrm { x }$ speed-up, even though it is using a non-optimized implementation in CNTK.8 The speed gains are mainly a result of requiring less matrix multiplications. The best performance is achieved with 12 layers.
368
+
369
+ <table><tr><td>Model</td><td># layers</td><td># Parameters</td><td>WER</td><td>Time per epoch</td></tr><tr><td>LSTM</td><td>5</td><td>47M</td><td>11.9</td><td>136 min</td></tr><tr><td>SRU</td><td>10</td><td>47M</td><td>11.8</td><td>97 min</td></tr><tr><td>SRU</td><td>12</td><td>56M</td><td>11.5</td><td>113 min</td></tr><tr><td>SRU</td><td>16</td><td>72M</td><td>11.5</td><td>146 min</td></tr><tr><td>SRU</td><td>20</td><td>89M</td><td>11.8</td><td>170 min</td></tr></table>
370
+
371
+ Table 9: Word error rate (WER) and time per training epoch as function of SRU depth for speech recognition (Section 4.5). The timing numbers are based on a naive implementation of SRU in CNTK. No CUDA-level optimizations are performed.