ZHANGYUXUAN-zR commited on
Commit
14c97ba
·
verified ·
1 Parent(s): f8f84fb

Add files using upload-large-folder tool

Browse files
md/train/-msETI57gCH/-msETI57gCH.md ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning Causal Semantic Representation for Out-of-Distribution Prediction
2
+
3
+ Chang Liu1∗, Xinwei Sun1, Jindong Wang1, Haoyue Tang2†, Tao Li3†, Tao Qin1, Wei Chen1, Tie-Yan Liu1 1 Microsoft Research Asia, Beijing, 100080. 2 Tsinghua University, Beijing, 100084. 3 Peking University, Beijing, 100871.
4
+
5
+ # Abstract
6
+
7
+ Conventional supervised learning methods, especially deep ones, are found to be sensitive to out-of-distribution (OOD) examples, largely because the learned representation mixes the semantic factor with the variation factor due to their domain-specific correlation, while only the semantic factor causes the output. To address the problem, we propose a Causal Semantic Generative model (CSG) based on a causal reasoning so that the two factors are modeled separately, and develop methods for OOD prediction from a single training domain, which is common and challenging. The methods are based on the causal invariance principle, with a novel design in variational Bayes for both efficient learning and easy prediction. Theoretically, we prove that under certain conditions, CSG can identify the semantic factor by fitting training data, and this semantic-identification guarantees the boundedness of OOD generalization error and the success of adaptation. Empirical study shows improved OOD performance over prevailing baselines.
8
+
9
+ # 1 Introduction
10
+
11
+ Deep learning has initiated a new era of artificial intelligence where the potential of machine learning models is greatly unleashed. Despite the great success, these methods heavily rely on the assumption that data from training and test domains follow the same distribution (i.e., the IID assumption), while in practice the test domain is often out-of-distribution (OOD), meaning that the test data distribute differently from the training data. Popular models for predicting the output (or label, response, outcome) $y$ from the input (or covariate) $x$ have been found erroneous when confronted with a distribution change, even from an essentially irrelevant perturbation like a position shift or background change for images [91, 6, 102, 41, 2, 27]. These phenomena pose serious concerns on the robustness and trustworthiness of machine learning methods and severely impede them from risk-sensitive scenarios.
12
+
13
+ Looking into the problem, although deep learning models allow extracting abstract representation for prediction with their powerful approximation capacity, the representation may unconsciously mix up semantic factors $s$ (e.g., shape of an object) and variation factors $v$ (e.g., background, object position) due to a correlation between them (e.g., desks often appear in a workspace background and beds in bedrooms), so the model also relies on the variation factors $v$ for prediction via this correlation. However, this correlation tends to be superficial and spurious (e.g., a desk can also appear in a bedroom, but this does not make it a bed), and may change drastically in a new domain, making the effect from $v$ misleading. So it is desired to learn a representation that identifies $s$ against $v$ .
14
+
15
+ Formally, the essence of this goal is to leverage causal relations for prediction, since the fundamental distinction between $s$ and $v$ is that only $s$ is the cause of $y$ . Causal relations better reflect basic mechanisms of nature. They bring the merit to machine learning that they tend to be universal and invariant across domains [97, 87, 93, 77, 16, 96, 98], thus provide the most transferable and reliable information to unseen domains. This causal invariance has been shown to lead to proper domain adaptation [97, 123], lower adaptation cost and lighter catastrophic forgetting [87, 9, 56].
16
+
17
+ In this work, we propose a Causal Semantic Generative model (CSG) following a causal consideration to separately model the semantic (cause of prediction) and variation latent factors, and develop OOD prediction methods with theoretical guarantees on identifiability and the boundedness of OOD prediction error. Addressing the complaint that OOD prediction and causality methods often require multi-domain or intervention data, we focus on the most common and also challenging tasks where only one single training domain is available, including $O O D$ generalization and domain adaptation, where in the latter, unsupervised test-domain data are additionally available for training. The methods and theory are based on the causal invariance principle, which suggests to share generative mechanisms across domains, while the latent factor distribution (i.e., the prior $p ( s , v ) _ { , }$ ) changes. We argue that this causal invariance is more reliable than inference invariance in the other direction adopted by many existing methods [33, 101, 2, 66, 79]. For our method, we design novel and delicate reformulations of the ELBO objective so that we avoid the cost to build and learn two inference models. Theoretically, we prove that under certain conditions, CSG can identify the semantic factor on the single training domain, even in presence of an s-v correlation. We further prove the merits from this identification: prediction error is bounded for OOD generalization, and for domain adaptation, the test-domain prior is identifiable which leads to an accurate prediction. To sum up our contributions, • Up to our knowledge, we are the first to show a theoretical guarantee (under appropriate conditions) to identify the latent cause of prediction (i.e., the semantic factor) on a single training domain, and also the first to show the theoretical benefits of this identification for OOD prediction. The results also contribute to generative representation learning for revealing what is learned. We develop effective methods for OOD generalization and domain adaptation, and achieve mostly better performance than prevailing methods on real-world image classification tasks.
18
+
19
+ # 2 Related Work
20
+
21
+ OOD generalization with causality. There are trials that ameliorate discriminative models towards a causal behavior. Bahadori et al. [4] introduce a regularizer that reweights input dimensions based on their approximated causal effects to the output, and Shen et al. [102] reweight training samples by amortizing causal effects among input samples. Their linear input-output assumption is then extended [4, 41] by learning a representation. Some recent works require identity data (finer than label) and enforce inference invariance via variance minimization [42], or leverage a strong domain knowledge to augment images as an independent intervention on variation factors [79]. These methods introduce no additional generative modeling efforts, at the cost of limited capacity for invariant causal mechanisms.
22
+
23
+ Domain adaptation/generalization with causality. There are methods developed under various causal assumptions [97, 123] or using learned causal relations [93, 77]. Zhang et al. [123], Gong et al. [35, 36] also consider certain ways of mechanism change. The considered causality is among directly observed variables, which may not well suit general data like image pixels where causality rather lies in the conceptual latent level [75, 10, 59].
24
+
25
+ To consider latent factors, there are domain adaptation [83, 5, 33, 73, 74] and generalization methods [80, 101, 113] that learn a representation with a domain-invariant marginal distribution. Remarkable results have been achieved. Nevertheless, it is found that this invariance is neither sufficient nor necessary to identify the true semantics or lower the adaptation error ([54, 125]; see also Appx. E). Moreover, these methods are based on inference invariance, which may not be as reliable as causal invariance (see Sec. 3.2).
26
+
27
+ There are also generative methods for domain adaptation/generalization that model latent factors. Cai et al. [18] and Ilse et al. [49] introduce a semantic factor and a domain-feature factor. They assume the two latent factors are independent in both generative and inference models, which is unrealistic. Correlated factors are then considered [3]. But all these works do not adapt the prior for domain change thus resort to inference invariance. Zhang et al. [121] consider a partially observed manipulation variable, while still assuming its independence from the output in both the joint and posterior, and the adaptation is inconsistent with causal invariance. The above methods also do not show guarantees to identify their latent factors. Teshima et al. [108] leverage causal invariance and adapt the prior, yet also assume latent independence and do not separate the semantic factor. They require some supervised test-domain data, and their deterministic and invertible mechanism also indicates inference invariance. In addition, most domain generalization methods require multiple training domains, with exceptions [89] that still seek to augment domains. In contrast, CSG leverages causal invariance, and has guarantee to identify the semantic factor from a single training domain, even with a correlation to the variation factor.
28
+
29
+ ![](images/a8dcff6383a147a171346e43a11b5ec6548372c11164969c3e96cffe2a0d1d25.jpg)
30
+ Figure 1: (a) Graphical structure of the proposed CSG. Solid arrows represent causal mechanisms $p ( \bar { \boldsymbol { x } } | \boldsymbol { s } , \boldsymbol { v } )$ and $p ( y | s )$ , the undirected $s { - } v$ clique represents a domain-specific prior $p ( s , v )$ , and the dashed bended arrows represent the inference model $q ( s , v | x )$ for learning. $( \mathbf { b } , \mathbf { c } )$ Graphical structures of CSG-ind and CSG-DA for prediction on the test domain. An independent prior $p ^ { \underline { { \parallel } } } ( s , v )$ (constructed from $p ( s , v ) \mathrm { , }$ ) and a new prior $\tilde { p } ( s , v )$ (the dotted $_ { s - v }$ clique) are introduced reflecting the intervention on the test domain. Respective inference models $q ^ { \perp } ( s , v | x )$ and $\tilde { q } ( s , v | x )$ are also shown. All three models share the same causal mechanisms $p ( x | s , v )$ and $p ( y | s )$ .
31
+
32
+ Disentangled latent representations is also of interest in unsupervised learning. Despite empirical success [22, 43, 21], Locatello et al. [70] conclude that it is impossible to guarantee the disentanglement in unsupervised settings. Subsequent works then introduce ways of supervision like a few latent variable observations [71] or sample similarity [20, 72, 104]. Identifiable VAE [57] and extensions [58, 117] leverage the data of a cause variable of the latent variables and have established theoretical guarantees under a diversity condition. But the works do not depict domain change thus not suitable for OOD prediction. Instead of disentangling latent factors, we focus on identifying the semantic factor $s$ (Sec. 5.1) and its benefit for OOD prediction. Appx. D shows more related work.
33
+
34
+ # 3 The Causal Semantic Generative Model
35
+
36
+ To develop the model soberly based on causality, we require its formal definition: two variables have a causal relation, denoted as “cause effect”, if intervening the cause (by changing external variables out of the considered system) may change the effect, but not vice versa [85, 88]. We follow this definition to build our model (Fig. 1a) by analyzing the example that an photographer takes a photo in a scene as $x$ and labels it as $y$ . Appx. C provides more explanations under other perspectives.
37
+
38
+ (1) It is likely that neither $y x$ (e.g., intervening the label with noise by distracting the photographer does not change the image) nor $x y$ holds (e.g., intervening an image by breaking a camera sensor unit does not change how the photographer labels it), as also argued in [88, Sec. 1.4; 59]. So we introduce a latent variable $z$ to capture factors with causal relations. Also for this reason, we need a generative model (vs. discriminative model that only learns $x y$ ).
39
+
40
+ (2) The latent variable $z$ as underlying generating factors (e.g., object shape and texture, background and illumination during imaging) is plausible to cause both $x$ (e.g., changing object shape or background makes a different image, but breaking the camera does not change the shape or background) and $y$ (e.g., the photographer would give a different label if the object shape had been different, but noise-corrupting the label does not change the shape). So we orient the edges in the generative direction $z ( x , y )$ , as also adopted in [78, 88, 108]. This is in contrast to prior works [18, 49, 48, 19] that treat $y$ as the cause of a semantic factor, which, when $y$ is also a noisy observation, makes unreasonable implications (e.g., adding noise to the labels in a dataset automatically changes object features and consequently the images, and changing the object features does not change the label). This difference is also discussed in [88, Sec. 1.4; 59].
41
+
42
+ (3) We attribute all $x { - } y$ relation to the existence of some latent factor [68, “purely common cause”; 51] and exclude $x - y$ edges. This can be achieved as long as $z$ holds sufficient information of data (e.g., with shape, background etc. fixed, breaking the camera does not change the label, and noisecorrupting the label does not change the image). Promoting this structure reduces arbitrariness in explaining $x { - } y$ relation thus helps identify (part of) $z$ . This is in contrast to prior works [63, 121, 19] that treat $y$ as a cause of $x$ as no latent variable is introduced between.
43
+
44
+ (4) Not all latent factors are the causes of $y$ (e.g., changing the shape may alter the label, while changing the background does not). We thus split the latent variable as $\boldsymbol { z } = \left( s , v \right)$ and remove the $v y$ edge, where $s$ represents the semantic factor that causes $y$ , and $v$ describes the variation or diversity in generating $x$ . This formalizes the intuition on the concepts in Introduction (Sec. 1).
45
+
46
+ (5) The two factors $s$ and $v$ often have a relation (e.g., a desk/bed shape tends to appear with a workspace/bedroom background), but it is usually a spurious correlation (e.g., putting a desk in a bedroom does not automatically change the room as a workspace, nor does it turn the desk into a bed). So we keep the undirected $s$ -v edge. This is in contrast to prior works [18, 49, 121, 108, 79] which assume independent latent variables. Although $v$ is not a cause of $y$ , modeling it explicitly is worth the effort since otherwise it would still be implicitly mixed into $s$ anyway through the $_ { s - v }$ correlation. We summarize these conclusions in the following definition.
47
+
48
+ Definition 1 (CSG). A Causal Semantic Generative Model (CSG), $p : = \langle p ( s , v ) , p ( x | s , v ) , p ( y | s ) \rangle$ is a generative model on data variables $x \in \mathcal { X } \subseteq \mathbb { R } ^ { d _ { \mathcal { X } } }$ and $y \in \mathcal { V }$ with semantic $s \in \mathcal { S } \subseteq \mathbb { R } ^ { d _ { \mathcal { S } } }$ and variation $v \in \mathcal { V } \subseteq \mathbb { R } ^ { d _ { \mathcal { V } } }$ latent variables, following the graphical structure shown in Fig. 1a.
49
+
50
+ # 3.1 The Causal Invariance Principle
51
+
52
+ Through the above process, we see that the s-v correlation embodied in the prior $p ( s , v )$ tends to change across domains. Under a causal view, this means that the domain change comes from a (soft) intervention on $s$ or $v$ or both, leading to a different prior. On the other hand, the generative processes are likely causal mechanisms, so they enjoy the celebrated Independent Causal Mechanisms principle [88, 98] indicating that they are unaffected under the intervention on prior. This leads to the following causal invariance principle for CSG.
53
+
54
+ Principle 2 (causal invariance). The causal generative mechanisms $p ( x | s , v )$ and $p ( y | s )$ in CSG are invariant across domains, and the change of prior $p ( s , v )$ is the only source of domain change.
55
+
56
+ This invariance reflects the universality of basic laws of nature and is considered in some prior works [97, 88, 10, 16]. Other works instead introduce domain index [18, 49, 48, 19] or manipulation variables [121, 57, 58] to model distribution change explicitly. They then require multiple training domains or additional observations, while such changes can also be explained under causal invariance as long as the latent variables include all changing factors.
57
+
58
+ # 3.2 Comparison with Inference Invariance
59
+
60
+ Most domain adaptation and generalization methods (incl. domain-invariant-representation based [33, 101], invariantlatent-predictor based [2, 66, 79]) use a shared representation extractor across domains. This effectively assumes the invariance in the other direction, i.e. inferring latent factors $z$ from observed data $x$ . We note in its supportive examples (e.g., inferring object position from image, extracting the fundamental frequency from audio), the causal mechanism $p ( x | z )$ is nearly deterministic and invertible such that it preserves the information of $z$ . Formally, for a given $x$ , only one single $z$ value achieves a positive $p ( x | z )$ while all other values lead to zero. The inferred representation given by the posterior via the Bayes rule $p ( z | x ) \propto p ( z ) p ( x | z )$ then concentrates on this $z$ value, which is determined by the causal mechanism $p ( x | z )$ alone, regardless of the domain-specific prior $p ( z )$ . Causal invariance then implies inference invariance.
61
+
62
+ ![](images/35ca21b02faf8e1f334ba2ef6f1e5d815eeae23b16577148ad4a2320126c74dd.jpg)
63
+ Figure 2: Examples of noisy (left) or degenerate (right) generating mechanisms that lead to ambiguity in inference. Left: handwritten digit that may be generated as either $\mathbf { \ddot { \delta } } ^ { 6 } 3 ^ { \mathit { * } }$ or $\mathbf { \Delta } ^ { 6 6 } 5 ^ { , 9 }$ . Right: Schröder’s stairs that may be generated with either A or B being the nearer surface. Inference results notably rely on the prior on the digits/surfaces, which is domain-specific.
64
+
65
+ In more general cases, the causal mechanism may be noisy or degenerate (Fig. 2), such that there are multiple $z$ values that give a positive $p ( x | z )$ , i.e. they all could generate the same $x$ . Inference is then ambiguous, and the posterior relies on the prior to choose from these $z$ values. Since the prior changes across domains (e.g., different labelers have different mindset), the inference rule then changes by nature and is not invariant,3 while the causal invariance is rather more fundamental and reliable. To leverage causal invariance, we use a different prior for the test domain (CSG-ind and CSG-DA), which gives a different and more reliable prediction than following inference invariance.
66
+
67
+ # 4 Method
68
+
69
+ We now develop methods based on variational Bayes [55, 62] for OOD generalization and domain adaptation using CSG. Appx. F.1 shows all details.
70
+
71
+ # 4.1 Method for OOD Generalization
72
+
73
+ For OOD generalization, one only has supervised data from the underlying data distribution $p ^ { * } ( x , y )$ on the training domain. Fitting a CSG $p : = \langle p ( s , v ) , p ( x | s , v ) , p ( y | s ) \rangle$ to data by maximizing likelihood $\mathbb { E } _ { p ^ { * } ( x , y ) } [ \log p ( x , y ) ]$ is intractable, since $\begin{array} { r } { p ( x , y ) : = \int p ( s , v , x , y ) \mathrm { d } s \mathrm { d } \iota } \end{array}$ where $p ( s , v , x , y ) : = p ( s , v ) p ( x | s , v ) p ( y | s )$ d to estimate. The Evidence Lower BOund (ELBO)[55, 112] is a tractable surrogate with the help of an $\begin{array} { r } { \mathcal { L } _ { p , q _ { s , v | x , y } } ( x , y ) : = \mathbb { E } _ { q ( s , v | x , y ) } [ \log \frac { p ( s , v , x , y ) } { q ( s , v | x , y ) } ] } \end{array}$ inference model $q ( s , v | x , y )$ that enjoys easy sampling and density evaluation. It is known that maxqs,v|x,y Lp, qs,v|x,y (x, y) drives q(s, v|x, y) towards the posterior p(s, v|x, y) := p(s,v,x,y)p(x,y) , meanwhile makes $\mathcal { L } _ { p , q _ { s , v \left| x , y \right. } } ( x , y )$ a tighter lower bound of $\log p ( x , y )$ for optimizing CSG $p$ .
74
+
75
+ However, the subtlety with supervised learning is that prediction is still hard, as the introduced model $q ( s , v | x , y )$ does not help estimate $p ( y | x )$ . To address this, we propose to employ an auxiliary model $q ( s , v , y | x )$ targeting $p ( s , v , y | x )$ . It allows easy sampling of $y$ given $x$ for prediction, and can also serve as the required inference model: $\begin{array} { r } { q ( s , v | x , y ) = \frac { q ( s , v , y | x ) } { q ( y | x ) } } \end{array}$ , where $\begin{array} { r } { q ( y | x ) : = \int q ( s , v , y | x ) \mathrm { d } s \mathrm { d } v } \end{array}$ is also determined by $q ( s , v , y | x )$ . The ELBO objective $\mathbb { E } _ { p ^ { * } ( x , y ) } [ \mathcal { L } _ { p , q _ { s , v | x , y } } ( x , y ) ]$ then becomes:
76
+
77
+ $$
78
+ \mathbb { E } _ { p ^ { * } ( x ) } \mathbb { E } _ { p ^ { * } ( y | x ) } [ \log q ( y | x ) ] + \mathbb { E } _ { p ^ { * } ( x ) } \mathbb { E } _ { q ( s , v , y | x ) } [ \frac { p ^ { * } ( y | x ) } { q ( y | x ) } \mathrm { l o g } \frac { p ( s , v , x , y ) } { q ( s , v , y | x ) } ] .
79
+ $$
80
+
81
+ As a functional of $q ( s , v , y | x )$ (instead of $q ( s , v | x , y ) )$ and the $\mathbf { \boldsymbol { C } } \mathbf { \boldsymbol { S } } \mathbf { \boldsymbol { G } } ~ p$ , this objective also drives them towards their targets: the first term is the negative of the standard cross entropy (CE) loss which drives $q ( y | x )$ towards $p ^ { * } ( y | x )$ , and once this is achieved, the second term becomes the expected ELBO $\mathbb { E } _ { p ^ { * } ( x ) } [ \mathcal { L } _ { p , q _ { s , v , y | x } } ( x ) ]$ that drives $q ( s , v , y | x )$ towards $p ( s , v , y | x )$ and $p ( x )$ towards $p ^ { * } ( x )$ . Furthermore, as the target of $q ( s , v , y | x )$ factorizes as $p ( s , v , y | x ) = p ( s , v | x ) p ( y | s )$ (due to Fig. 1a) where $p ( y | s )$ is already known (part of the CSG), we can instead employ a lighter inference model $q ( s , v | x )$ for the minimally intractable component $p ( s , v | x )$ therein, and use $\bar { \boldsymbol { q } } ( s , v | x ) p ( y | s )$ as $q ( s , v , y | x )$ . This turns the objective Eq. (1) to:
82
+
83
+ $$
84
+ \operatorname* { m a x } _ { p , q _ { s , v \mid x } } \mathbb { E } _ { p ^ { * } ( x , y ) } \Big [ \log q ( y | x ) + \frac { 1 } { q ( y | x ) } \mathbb { E } _ { q ( s , v | x ) } \Big [ p ( y | s ) \log \frac { p ( s , v ) p ( x | s , v ) } { q ( s , v | x ) } \Big ] \Big ] ,
85
+ $$
86
+
87
+ where $q ( y | x ) : = \mathbb { E } _ { q ( s , v | x ) } [ p ( y | s ) ]$ . The expectations can be estimated by Monte Carlo after applying the reparameterization trick [62]. This is the basic CSG method.
88
+
89
+ CSG-ind To actively improve OOD generalization performance, we consider using an independent prior $p ^ { \underline { { \parallel } } } ( s , v ) : = p ( s ) \overline { { p ( v ) } }$ for prediction in the test domain (Fig. 1b), where $p ( s )$ and $p ( v )$ are the marginals of the training-domain prior $p ( s , v )$ . Intuitively, $p ^ { \underline { { \parallel } } } ( s , v )$ discards the spurious correlation between $s$ and $v$ on the training domain (e.g., the “desk-workspace”, “bed-bedroom” association), and promotes a cautious neutral belief on the unknown test-domain correlation in defence against all possibilities (e.g., a “desk-bedroom”, “bed-workspace” association). Formally, $p ^ { \underline { { \parallel } } } ( s , \bar { v } )$ has a larger entropy than $p ( s , v )$ [24, Thm. 2.6.6], so it reduces training-domain-specific information and encourages reliance on the causal mechanisms for better generalization. It also amounts to applying the do-operator [85] to Fig. 1a, representing a randomized experiment by independently soft-intervening $s$ or $v$ . In this way, causal invariance is properly leveraged, making a different and more reliable prediction than following inference invariance. Our theory below also shows that $p ^ { \underline { { \parallel } } } ( s , v )$ leads to a smaller generalization error bound (Thm. 6 Remark).
90
+
91
+ Methodologically, we need the test-domain inference model $q ^ { \perp } ( s , v | x )$ for prediction $p ^ { \underline { { \parallel } } } ( y | x ) \approx$ $\mathbb { E } _ { q ^ { \perp } ( s , v \mid x ) } [ p ( y \mid s ) ]$ , but also need $q ( s , v | x )$ for learning on the training domain. To save the cost of building and learning two inference models, we propose to use $q ^ { \perp } ( s , v | x )$ to represent $q ( s , v | x )$ . Noting that their targets are related by $\begin{array} { r } { p ( s , v | x ) = \frac { p ( s , v ) } { p ^ { \perp } ( s , v ) } \frac { p ^ { \perp } ( x ) } { p ( x ) } p ^ { \perp } ( s , v | x ) } \end{array}$ , we formulate $q ( s , v | x ) =$ $\begin{array} { r } { \frac { p ( s , v ) } { p ^ { \perp } ( s , v ) } \frac { p ^ { \perp } ( x ) } { p ( x ) } q ^ { \perp } ( s , v | x ) } \end{array}$ accordingly, so that this $q ( s , v | x )$ achieves its target if and only if $q ^ { \perp } ( s , v | x )$
92
+
93
+ does. The objective Eq. (1) then becomes:
94
+
95
+ $$
96
+ \operatorname* { m a x } _ { p , q _ { s , v | x } ^ { \mathrm { A } } } \mathbb { E } _ { p ^ { s } ( x , y ) } \Big [ \log \pi ( y | x ) + \frac { 1 } { \pi ( y | x ) } \mathbb { E } _ { q ^ { \perp } ( s , v | x ) } \Big [ \frac { p ( s , v ) } { p ^ { \perp } ( s , v ) } p ( y | s ) \log \frac { p ^ { \perp } ( s , v ) p ( x | s , v ) } { q ^ { \perp } ( s , v | x ) } \Big ] \Big ] ,
97
+ $$
98
+
99
+ where $\begin{array} { r } { \pi ( y | x ) : = \mathbb { E } _ { q ^ { \perp } ( s , v | x ) } \big [ \frac { p ( s , v ) } { p ^ { \perp } ( s , v ) } p ( y | s ) \big ] } \end{array}$ . (Note $p ^ { \underline { { \parallel } } } ( s , v )$ is determined by $p ( s , v )$ in the $\operatorname { C S G } p$
100
+
101
+ # 4.2 Method for Domain Adaptation
102
+
103
+ In domain adaptation, one also has unsupervised data from the underlying data distribution $\tilde { p } ^ { * } ( x )$ on the test domain. We can leverage them for better prediction. According to the causal invariance principle (2), we only need a new prior $\tilde { p } ( s , v )$ for the test-domain CSG $\bar { p } : = \langle \tilde { p } ( s , v ) , p ( x | s , v ) , p ( \bar { y } | s ) \rangle$ (Fig. 1c). Fitting test-domain data can be done through the standard ELBO objective with the test-domain inference model $\tilde { q } ( s , v | x )$ :
104
+
105
+ $$
106
+ \operatorname* { m a x } _ { \tilde { p } , \tilde { q } _ { s , v \mid x } } \mathbb { E } _ { \tilde { p } ^ { * } ( x ) } [ \mathcal { L } _ { \tilde { p } , \tilde { q } _ { s , v \mid x } } ( x ) ] , \mathrm { w h e r e } \ \mathcal { L } _ { \tilde { p } , \tilde { q } _ { s , v \mid x } } ( x ) = \mathbb { E } _ { \tilde { q } ( s , v \mid x ) } \Bigl [ \log \frac { \tilde { p } ( s , v ) p ( x \mid s , v ) } { \tilde { q } ( s , v \mid x ) } \Bigr ] .
107
+ $$
108
+
109
+ Prediction is given by $\tilde { p } ( y | x ) \approx \mathbb { E } _ { \tilde { q } ( s , v | x ) } [ p ( y | s ) ]$ . Similar to the CSG-ind case, we still need $q ( s , v | x )$ for fitting training-domain data, and we can also avoid a separate $q ( s , v | x )$ model by representing it using $\tilde { q } ( s , v | x )$ . Following the same relation between their targets, we let $q ( s , v | x ) =$ $\begin{array} { r } { \frac { \tilde { p } ( x ) } { p ( x ) } \frac { p ( s , v ) } { \tilde { p } ( s , v ) } \tilde { q } ( s , v | x ) } \end{array}$ , which reformulates the same training-domain objective Eq. (1) as:
110
+
111
+ $$
112
+ \operatorname* { m a x } _ { p , \tilde { q } _ { s , v \mid x } } \mathbb { E } _ { p ^ { * } ( x , y ) } \Big [ \log \pi ( y | x ) + \frac { 1 } { \pi ( y | x ) } \mathbb { E } _ { \bar { q } ( s , v | x ) } \Big [ \frac { p ( s , v ) } { \tilde { p } ( s , v ) } p ( y | s ) \log \frac { \tilde { p } ( s , v ) p ( x | s , v ) } { \tilde { q } ( s , v | x ) } \Big ] \Big ] ,
113
+ $$
114
+
115
+ where $\pi ( \boldsymbol { y } | \boldsymbol { x } ) : = \mathbb { E } _ { \boldsymbol { \tilde { q } } ( \boldsymbol { s } , \boldsymbol { v } | \boldsymbol { x } ) } \left[ \frac { p ( \boldsymbol { s } , \boldsymbol { v } ) } { \tilde { p } ( \boldsymbol { s } , \boldsymbol { v } ) } p ( \boldsymbol { y } | \boldsymbol { s } ) \right]$ . The resulting method, termed CSG-DA, solves both optimization problems Eqs. (4, 5) simultaneously.
116
+
117
+ # 4.3 Implementation and Model Selection
118
+
119
+ To implement the three CSG methods, we only need one inference model in each. Appx. F.2 shows its construction from a general discriminative model (e.g., how to select its hidden nodes as $s$ and $v$ ). In practice $x$ often has a much larger dimension than $y$ , making the first supervision term overwhelmed by the second unsupervised term in Eqs. (2,3,5). So we downscale the second term.
120
+
121
+ As recently emphasized [39], an OOD method should include a model selection method, since it is nontrivial and significantly affects performance [95, 120]. For our methods, we use a validation set from the training domain for model selection. This complies with the OOD setup, and is also suggested by our theory below which gives guarantees based on a good fit to the training-domain data distribution. For CSG-ind/DA, the learned predictor targets the test domain, so we do not use it directly for evaluating validation accuracy, but by normalizing $\pi ( \boldsymbol { y } | \boldsymbol { x } )$ . Appx. F.3 shows details.
122
+
123
+ # 5 Theory
124
+
125
+ We now establish theory for the identification of the semantic factor (cause of prediction) and subsequent merits for OOD generalization and domain adaptation. We focus on the distribution-level generalization instead of from finite samples to unseen samples under the same distribution, so we only consider the infinite-data regime. Appx. A shows all the proofs and auxiliary theory.
126
+
127
+ Latent variable identification is hard [65, 81, 116, 70] as it is beyond observational relations [51, 88].
128
+ Assumptions are thus required to draw definite conclusions.
129
+
130
+ Assumption 3. (Additive noise) There exist nonlinear functions $f$ and $g$ with bounded derivatives up to the third-order, and independent random variables $\mu$ and $\nu$ , such that $p ( x | s , v ) = p _ { \mu } ( x - f ( s , v ) { \bar { ) } }$ , and $p ( y | s ) = p _ { \nu } ( y - g ( s ) )$ for continuous $y$ or $p ( y | s ) = \mathrm { C a t } ( y | g ( s ) )$ for categorical $y$ .
131
+
132
+ (Bijectivity) Assume $f$ is bijective and $g$ is injective.
133
+
134
+ The additive noise assumption is widely adopted in causal discovery [51, 17]. It disables expressing the same joint in the other direction [122, Thm. 8; 86, Prop. 23] so that CSG unnecessarily indicates inference invariance. For this reason, we exclude GAN [37] and flow-based [61] implementations. Bijectivity is a common assumption for identifiability [51, 100, 57, 68]. It is sufficient [86, Prop. 17; 88, Prop. 7.4] for the more fundamental [86, Prop. 7; 88, p.109] requirement of causal minimality [86, p.2012; 88, Def. 6.33]. Particularly, $s$ and $v$ may otherwise have dummy dimensions that $f$ and $g$ simply ignore, raising another ambiguity against identifiability. On the other hand, according to the commonly acknowledged manifold hypothesis [115, 31], we can take $\mathcal { X }$ as the lower-dimensional data manifold and such a bijection exists as a coordinate map, which is an injection to the original data space and also allows $d _ { S } + d _ { \mathcal { V } } < d _ { \mathcal { X } }$ .
135
+
136
+ # 5.1 Identifiability Theory
137
+
138
+ We first formalize the goal of identifying the semantic factor.
139
+
140
+ Definition 4 (semantic-identification). We say a learned CSG $p$ is semantic-identified, if there exists a homeomorphism4 $\Phi$ on $s \times \nu$ , such that (i) its output dimensions in $s$ is constant of $v$ : $\Phi ^ { S } ( s , v ) =$ $\Phi ^ { S } ( s , v ^ { \prime } ) , \forall \bar { v } , v ^ { \prime } \in \mathcal { V }$ (hence denote $\Phi ^ { S } ( s , v )$ as $\bar { \Phi ^ { S } } ( s ) )$ , and (ii) it is a reparameterization of the ground-truth CSG $p ^ { * }$ $\boldsymbol { \mathbf { \rho } } ) ^ { * } \colon \Phi _ { \# } [ p _ { s , v } ^ { * } ] = p _ { s , v }$ , $p ^ { * } ( x | s , v ) = p ( x | \Phi ( s , v ) )$ and $p ^ { * } ( \dot { y } | s ) = p ( y | \Phi ^ { S } ( s ) )$ .
141
+
142
+ Here, $\Phi _ { \# } [ p _ { s , v } ^ { * } ]$ denotes the pushed-forward distribution5 of $p _ { s , v } ^ { * }$ by $\Phi$ , i.e. the distribution of $\Phi ( s , v )$ when $( s , v ) \sim p _ { s , v } ^ { * }$ . As the ground-truth CSG could at most provide its information via the data distribution $p ^ { * } ( x , y )$ , a well-learned CSG that achieves $p ( x , y ) = p ^ { * } ( x , y )$ still has the degree of freedom in parameterizing $( s , v )$ . This is described by this reparameterization $\Phi$ (Appx. Lemma 9). At the heart of the definition, the $v$ -constancy of $\Phi ^ { S }$ implies that $\Phi$ is semantic-preserving: the learned model does not mix the ground-truth $v$ into its $s$ , so that the learned $s$ holds equivalent information to the ground-truth $s$ . The definition can thus be seen as the semantic equivalence (Appx. Def. 10, Prop. 14) to the ground-truth $\mathbf { C S G } p ^ { * }$ .
143
+
144
+ For related concepts, this identification cannot be characterized by the statistical independence between $s$ and $v$ (vs. [18, 49, 121]), which is not sufficient [70] nor necessary (due to the existence of spurious correlation). It is also weaker than disentanglement [44, 11], which additionally requires the learned $v$ to be constant of the ground-truth $s$ . The following theorem shows that semanticidentification can be achieved on a single domain under certain conditions.
145
+
146
+ Theorem 5 (semantic-identifiability). With Assumption 3, a CSG $p$ is semantic-identified, if it is well-learned such that $p ( x , y ) = p ^ { * } ( x , y )$ , under the conditions that $\log p ( s , v )$ and $\log p ^ { * } ( s , v )$ are bounded up to the second-order, and that6 (i) $1 / \sigma _ { \mu } ^ { 2 } \infty$ where $\sigma _ { \mu } ^ { 2 } : = \mathbb { E } [ \mu ^ { \top } \mu ]$ , or (ii) $p _ { \mu }$ (e.g., $a$ Gaussian) has an a.e. non-zero characteristic function.
147
+
148
+ Remarks. (1) (Condition and Intuition) Compared with the multi-domain case [87, 93, 2], identifiability on a single training domain comes at a cost and requires certain conditions. One may imagine that in some extreme cases e.g., all desks appear in workspace and all beds in bedrooms, it is impossible to distinguish whether $y$ labels the object or the background (unlearnable OOD problem [119]). The theorem finds an appropriate condition that excludes such cases: when $\log p ^ { * } ( s , v )$ is bounded, deterministic $_ { s - v }$ relations are not allowed as they concentrate $\boldsymbol { p } ^ { * } ( s , v )$ on a lower-dimensional subspace in $s \times \nu$ thus make it unbounded.
149
+
150
+ It also leads to the intuition of identifiability: a bounded $\log p ^ { * } ( s , v )$ indicates a stochastic s-v relation, so mixing the ground-truth $v$ into the learned $s$ makes the inference of $s$ more noisy due to the intrinsic diversity/uncertainty of this $v$ . As prediction is made via the inferred $s$ , this worsens prediction accuracy thus violates the “well-learned” requirement. Compared with discriminative models, CSG makes more faithful inference, and its causal structure leads to a proper description of domain change.
151
+
152
+ (2) In condition (i), $1 / \sigma _ { \mu } ^ { 2 }$ measures the intensity of the causal mechanism $p ( x | s , v )$ . When it is large, the “strong” $p ( x | s , v )$ helps disambiguating values of $( s , v )$ in generating a given $x$ . The formal version in Appx. Thm. $5 '$ shows a quantitative reference for large enough intensity, and Appx. B gives a non-asymptotic extension showing how the intensity trades-off the tolerance of equalities in Def. 4. Condition (ii) goes beyond inference invariance. It roughly implies that different $( s , v )$ values a.s. produce different $p ( x | s , v )$ , so their roles in generating $x$ become clear which helps identification.
153
+
154
+ (3) The theorem does not contradict the impossibility result by Locatello et al. [70], which considers disentangling each latent dimension with an unconstrained $( \dot { s } , v ) ( x , y )$ , while we only identify $s$ as a whole, with the $v y$ edge removed which breaks the s-v symmetry.
155
+
156
+ # 5.2 OOD Generalization Theory
157
+
158
+ Now we show the benefit of semantic-identification for OOD generalization that the prediction error is bounded. Note the optimal predictor $\tilde { \mathbb { E } } ^ { * } [ y | x ] ^ { \eta }$ on the test domain is defined by the corresponding ground-truth CSG $\tilde { p } ^ { * }$ , which differs from $p ^ { * }$ only in the test-domain prior $\tilde { p } ^ { * } ( s , v )$ (Principle 2).
159
+
160
+ Theorem 6 (OOD generalization error). 8 With Assumption 3, for a semantic-identified CSG $p$ on the training domain with semantic-preserving reparameterization $\Phi$ , we have up to $O ( \sigma _ { \mu } ^ { 4 } )$ ,
161
+
162
+ $$
163
+ \begin{array} { r } { \mathbb { E } _ { \tilde { p } ^ { * } ( x ) } \| \mathbb { E } [ y | x ] - \tilde { \mathbb { E } } ^ { * } [ y | x ] \| _ { 2 } ^ { 2 } \leqslant \sigma _ { \mu } ^ { 4 } B _ { f ^ { - 1 } } ^ { \prime 4 } B _ { g } ^ { \prime 2 } \mathbb { E } _ { \tilde { p } _ { s , v } } \big \| \nabla \log ( \tilde { p } _ { s , v } / p _ { s , v } ) \big \| _ { 2 } ^ { 2 } , } \end{array}
164
+ $$
165
+
166
+ where $B _ { f ^ { - 1 } } ^ { \prime }$ and $B _ { g } ^ { \prime }$ bound the 2-norms9 of the Jacobians of $f ^ { - 1 }$ and $g$ , respectively, and $\widetilde { p } _ { s , v } : =$ $\Phi _ { \# } [ \tilde { p } _ { s , v } ^ { * } ]$ is the test-domain prior under the parameterization of the $C S G p$ .
167
+
168
+ In the bound, the term $\mathbb { E } _ { \tilde { p } _ { s , v } } \left\| \nabla \log ( \tilde { p } _ { s , v } / p _ { s , v } ) \right\| _ { 2 } ^ { 2 }$ is the Fisher divergence measuring the difference between the two priors. As the prior change is the only source of domain change, this term also measures the “OODness” in terms of the effect on prediction. The bound also shows that when the causal mechanism $p ( x | s , v )$ is strong (small $\sigma _ { \mu }$ ), it dominates prediction over the prior change, as the generalization error becomes small. Compared with other methods, using a CSG enforces causal invariance, so the boundedness of OOD generalization error becomes more plausible in practice.
169
+
170
+ Remark. The bound also shows the advantage of CSG-ind (Sec. 4.1). The Fisher divergence is revealed [28] to have a similar behavior as the forward KL divergence $p _ { s , v } \mapsto \mathrm { K L } ( \tilde { p } _ { s , v } \Vert p _ { s , v } )$ that it is very sensitive to the insufficient coverage of $p _ { s , v }$ on the support of $\tilde { p } _ { s , v }$ [46, 109], since $\log ( \tilde { p } _ { s , v } / p _ { s , v } )$ is infinitely large on the uncovered region. As the independent prior $p _ { s , v } ^ { \perp }$ has a larger support than $p _ { s , v }$ , it is less likely to miss the support of $\tilde { p } _ { s , v }$ , so it induces a generally smaller Fisher divergence. CSG-ind thus generally has a smaller OOD generalization error bound than CSG.
171
+
172
+ # 5.3 Domain Adaptation Theory
173
+
174
+ CSG-DA (Sec. 4.2) learns a new prior $\tilde { p } _ { s , v }$ by fitting unsupervised test-domain data, with causal mechanisms shared. If the mechanisms are semantic-identified, the ground-truth test-domain prior $\tilde { p } _ { s , v } ^ { * }$ can also be identified under the learned parameterization, and prediction is made precise.
175
+
176
+ Theorem 7 (domain adaptation error). With conditions of Thm. 5, for a semantic-identified $C S G p$ on the training domain with semantic-preserving reparameterization $\Phi$ , if its new prior $\tilde { p } _ { s , v }$ is well
177
+
178
+ learned such that $\tilde { p } ( x ) = \tilde { p } ^ { * } ( x )$ , then $\tilde { p } _ { s , v } = \Phi _ { \# } [ \tilde { p } _ { s , v } ^ { * } ]$ , and $\tilde { \mathbb { E } } [ y | x ] = \tilde { \mathbb { E } } ^ { * } [ y | x ]$ for any $x \in \mathrm { s u p p } ( \tilde { p } _ { x } ^ { * } )$
179
+
180
+ Different from existing domain adaptation bounds (Appx. E), Theorems 6,7 allow different inference models in the two domains, thus go beyond inference invariance.
181
+
182
+ # 6 Experiments
183
+
184
+ For OOD generalization baselines, there is not much choice beyond the standard CE loss optimization, as domain adaptation methods require test-domain data and most domain generalization methods degenerate to CE with one training domain. The exception within our scope is a causal discriminative method CNBB [41]. For domain adaptation, we consider well-acknowledged methods DANN [33], DAN [73], CDAN [74] and recent compelling methods MDD [124] and BNM [25] (shown in Appx. Tables 2,3). Appx. G shows more details, results, and discussions. 10
185
+
186
+ Shifted-MNIST. We first consider an OOD prediction task on MNIST to classify digits $\mathbf { \bar { \theta } } ^ { 6 6 }$ ”s and “1”s. To make a spurious correlation, in the training data, we horizontally shift each $ { { } ^ { 6 } } 0 ^ { 9 }$ at random by $\delta _ { 0 } \sim \mathcal { N } ( - 5 , 1 ^ { 2 } )$ pixels, while each “1” by $\delta _ { 1 } \sim \bar { \mathcal { N } } ( 5 , 1 ^ { 2 } )$ pixels. We consider two test domains with different digit-position distributions: each digit is not moved $\delta _ { 0 } = \delta _ { 1 } = 0$ in the first, and is shifted at random by $\bar { \delta _ { 0 } } , \delta _ { 1 } \sim \mathcal { N } ( 0 , 2 ^ { 2 } )$ pixels in the second. We implement all methods using a multilayer perceptron which is not naturally shift invariant. We use a larger architecture for non-generative methods to compensate the additional generative component of generative methods.
187
+
188
+ The performance is shown in Table 1(top 2 rows). For OOD generalization, CE is misled by the more noticeable position factor due to the spurious correlation to digits, and resorts to random guess (even worse) when position is not informative for prediction. CNBB ameliorates the position confusion, but not as thoroughly without modeling causal mechanisms. In contrast, our CSG gives more genuine predictions in unseen domains, thanks to the identification of the semantic factor. CSG-ind performs even better, justifying the merit of using an independent prior for prediction. For domain adaptation, CSG-DA achieves the best results. Existing adaptation methods even worsen the result (negative transfer), as the misleading position representation gets strengthened on the unsupervised test data. CSG is benefited from adaptation in a proper way that identifies the semantic factor.
189
+
190
+ Table 1: Test accuracy $( \% )$ by various methods (ours in bold) for OOD generalization (left 4 cols) and domain adaptation (right 5 cols) on Shifted-MNIST (top 2 rows), ImageCLEF-DA (middle 4 rows) and PACS (bottom 4 rows) datasets. Averaged over 10 runs. Appx. Tables 2,3 show more results.
191
+
192
+ <table><tr><td>task</td><td>CE</td><td>CNBB</td><td>CSG</td><td>CSG-ind</td><td>DANN</td><td>DAN</td><td>CDAN</td><td>MDD</td><td>CSG-DA</td></tr><tr><td>8=δ1=0</td><td>42.9±3.1</td><td>54.7±3.3</td><td>81.4±7.4</td><td>82.6±4.0</td><td>40.9±3.0</td><td>40.4±2.0</td><td>41.0±0.5</td><td>41.9±0.8</td><td>97.6±4.0</td></tr><tr><td>80,~N(0,2²)</td><td>47.8±1.5</td><td>59.2±2.4</td><td>61.7±3.6</td><td>62.3±2.2</td><td>46.2±0.7</td><td>45.6±0.7</td><td>46.3±0.6</td><td>45.8±0.3</td><td>72.0±9.2</td></tr><tr><td>C→P</td><td>65.5±0.3</td><td>72.7±1.1</td><td>73.6±0.6</td><td>74.0±1.3</td><td>74.3±0.5</td><td>69.2±0.4</td><td>74.5±0.3</td><td>74.1±0.7</td><td>75.1±0.5</td></tr><tr><td>P→C</td><td>91.2±0.3</td><td>91.7±0.2</td><td>92.3±0.4</td><td>92.7±0.2</td><td>91.5±0.6</td><td>89.8±0.4</td><td>93.5±0.4</td><td>92.1±0.6</td><td>93.4±0.3</td></tr><tr><td>I→P</td><td>74.8±0.3</td><td>75.4±0.6</td><td>76.9±0.3</td><td>77.2±0.2</td><td>75.0±0.6</td><td>74.5±0.4</td><td>76.7±0.3</td><td>76.8±0.4</td><td>77.4±0.3</td></tr><tr><td>P→I</td><td>83.9±0.1</td><td>88.7±0.5</td><td>90.4±0.3</td><td>90.9±0.2</td><td>86.0±0.3</td><td>82.2±0.2</td><td>90.6±0.3</td><td>90.2±1.1</td><td>91.1±0.5</td></tr><tr><td>others→P</td><td>97.8±0.0</td><td>96.9±0.2 97.7±0.2</td><td></td><td>97.8±0.2</td><td>[97.6±0.2</td><td>97.6±0.4</td><td>97.0±0.4</td><td>97.6±0.3</td><td>97.9±0.2</td></tr><tr><td>others→A</td><td>88.1±0.1</td><td>73.1±0.3</td><td>88.5±0.6</td><td>88.6±0.6</td><td>85.9±0.5</td><td>84.5±1.2</td><td>84.0±0.9</td><td>88.1±0.8</td><td>88.8±0.7</td></tr><tr><td>others-C</td><td>77.9±1.3</td><td>50.2±1.2 84.4±0.9</td><td></td><td>84.6±0.8</td><td>79.9±1.4 81.9±1.9</td><td></td><td>78.5±1.5 83.2±1.1</td><td></td><td>84.7±0.8</td></tr><tr><td>others-→S</td><td>79.1±0.9</td><td>43.3±1.2 80.7±1.0</td><td></td><td>81.1±1.2</td><td>75.2±2.8 77.4±3.1</td><td></td><td>71.8±3.9 80.2±2.2</td><td></td><td>81.4±0.8</td></tr></table>
193
+
194
+ ImageCLEF-DA is a standard benchmark for domain adaptation [1]. It has 12 classes and three domains of real-world images: Caltech-256, ImageNet, Pascal VOC 2012. We select four OOD prediction tasks $\mathbf { C } { } \mathbf { P }$ , $\mathbf { I } { } \mathbf { P }$ that have not seen good enough results. We adopt the same setup as [74]. As shown in Table 1(middle 4 rows), CSG-ind again achieves the best OOD generalization results, and even outperforms some domain adaptation methods. Our CSG also outperforms the baselines mostly. For domain adaptation, CSG-DA is the best in most cases and on par with the best in others.
195
+
196
+ PACS is a more recent benchmark dataset [69]. It has 7 classes and is named after its four domains: Photo, Art, Cartoon, Sketch; each contains images of a certain style. We follow the same setup as [39]; particularly, we pool together all domains but the test one as the single training domain. Results in Table 1(bottom 4 rows) show the same trend. CSG-DA even outperforms most domain generalization methods reported in [39], which are fed with more information. Appx. Tables 2,3 also show the results on an even larger dataset VLCS [30], which present a similar observation.
197
+
198
+ Visualization. Appx. Fig. 5 visualizes the learned models using LIME [91]. The results show our methods focus more on the semantic regions and shapes, indicating a causal representation is learned.
199
+
200
+ Dataset analysis. The results indicate our methods are more powerful on shifted-MNIST and PACS (and VLCS) than ImageCLEF-DA. This meets the intuition of identifiability (Thm. 5 Remark (1)): the random position or pooled training domain shows a diverse $v$ for each $s$ (while with a misleading spurious correlation), so identification is better guaranteed to overcome the spurious correlation.
201
+
202
+ Ablation study. To show the benefit of modeling $s$ and $v$ separately, we compare with a counterpart of CSG that treats $s$ and $v$ as a whole (equivalently, $v y$ is kept; see Appx. F.1.4 for method details). Appx. Tables 2,3 show that our methods outperform this baseline in all cases. This shows the separate modeling makes CSG consciously drive semantic representation into the dedicated variable $s$ .
203
+
204
+ # 7 Conclusion and Discussion
205
+
206
+ We propose a Causal Semantic Generative model for single-domain OOD prediction tasks, which builds upon a causal reasoning, and models the semantic (cause of prediction) and variation factors separately. By the causal invariance principle, we develop novel and efficient learning and prediction methods, and prove the semantic-identifiability and the subsequent bounded generalization error and the success of adaptation. Experiments show the improved performance over prevailing baselines.
207
+
208
+ Notably, we answered the questions in the recent farseeing paper [98] on causal representation learning: we found an appropriate condition under which “causal variables can be recovered”, and provided “compelling evidence on the advantages (of causal modeling) in terms of generalization”. Also, separating semantics from variation extends to broader examples. Neural nets are found to change their prediction under a different texture [34, 15]. Adversarial vulnerability [107, 38, 67] extends variation factors to human-imperceptible features, i.e. adversarial noise, which is found to have a strong correlation to the semantics [50]. The separation also matters for fairness when a sensitive variation factor may affect prediction. This work also inspires the dual connection between causal representation learning (“fill in the blanks” given a graph) and causal discovery (“link the nodes” given observed variables). Our theory shows the identifiability condition for causal discovery (the additive noise assumption) also makes causal representation identifiable. Studying the general connection between the two tasks is an interesting future work.
209
+
210
+ # References
211
+
212
+ [1] The imageclef-da challenge 2014. https://www.imageclef.org/2014, 2014.
213
+ [2] M. Arjovsky, L. Bottou, I. Gulrajani, and D. Lopez-Paz. Invariant risk minimization. arXiv preprint arXiv:1907.02893, 2019.
214
+ [3] Y. Atzmon, F. Kreuk, U. Shalit, and G. Chechik. A causal view of compositional zero-shot recognition. Advances in Neural Information Processing Systems, 33, 2020.
215
+ [4] M. T. Bahadori, K. Chalupka, E. Choi, R. Chen, W. F. Stewart, and J. Sun. Causal regularization. arXiv preprint arXiv:1702.02604, 2017.
216
+ [5] M. Baktashmotlagh, M. T. Harandi, B. C. Lovell, and M. Salzmann. Unsupervised domain adaptation by domain invariant projection. In Proceedings of the IEEE International Conference on Computer Vision, pages 769–776, 2013.
217
+ [6] S. Beery, G. Van Horn, and P. Perona. Recognition in terra incognita. In Proceedings of the European Conference on Computer Vision (ECCV), pages 456–473, 2018.
218
+ [7] S. Ben-David, J. Blitzer, K. Crammer, A. Kulesza, F. Pereira, and J. W. Vaughan. A theory of learning from different domains. Machine learning, 79(1-2):151–175, 2010.
219
+ [8] S. Ben-David, T. Lu, T. Luu, and D. Pál. Impossibility theorems for domain adaptation. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pages 129–136, 2010.
220
+ [9] Y. Bengio, T. Deleu, N. Rahaman, N. R. Ke, S. Lachapelle, O. Bilaniuk, A. Goyal, and C. J. Pal. A meta-transfer objective for learning to disentangle causal mechanisms. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020, 2020.
221
+ [10] M. Besserve, N. Shajarisales, B. Schölkopf, and D. Janzing. Group invariance principles for causal generative models. In International Conference on Artificial Intelligence and Statistics, pages 557–565. PMLR, 2018.
222
+ [11] M. Besserve, A. Mehrjou, R. Sun, and B. Schölkopf. Counterfactuals uncover the modular structure of deep generative models. In Proceedings of the International Conference on Learning Representations (ICLR 2020), 2020.
223
+ [12] I. Biederman. Recognition-by-components: a theory of human image understanding. Psychological review, 94(2):115, 1987.
224
+ [13] P. Billingsley. Probability and Measure. John Wiley & Sons, New Jersey, 2012. ISBN 978-1-118-12237-2.
225
+ [14] C. M. Bishop. Pattern recognition and machine learning. springer, 2006.
226
+ [15] W. Brendel and M. Bethge. Approximating CNNs with bag-of-local-features models works surprisingly well on ImageNet. In Proceedings of the International Conference on Learning Representations (ICLR 2019), 2019.
227
+ [16] P. Bühlmann. Invariance, causality and robustness. arXiv preprint arXiv:1812.08233, 2018.
228
+ [17] P. Bühlmann, J. Peters, J. Ernest, et al. CAM: Causal additive models, high-dimensional order search and penalized regression. The Annals of Statistics, 42(6):2526–2556, 2014.
229
+ [18] R. Cai, Z. Li, P. Wei, J. Qiao, K. Zhang, and Z. Hao. Learning disentangled semantic representation for domain adaptation. In Proceedings of the Conference of IJCAI, volume 2019, page 2060. NIH Public Access, 2019.
230
+ [19] D. C. Castro, I. Walker, and B. Glocker. Causality matters in medical imaging. Nature Communications, 11(1):1–10, 2020.
231
+ [20] J. Chen and K. Batmanghelich. Weakly supervised disentanglement by pairwise similarities. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 3495–3502, 2020.
232
+ [21] R. T. Chen, X. Li, R. B. Grosse, and D. K. Duvenaud. Isolating sources of disentanglement in variational autoencoders. In Advances in Neural Information Processing Systems, pages 2610–2620, 2018.
233
+ [22] X. Chen, Y. Duan, R. Houthooft, J. Schulman, I. Sutskever, and P. Abbeel. InfoGAN: Interpretable representation learning by information maximizing generative adversarial nets. In Advances in Neural Information Processing Systems, pages 2172–2180, 2016.
234
+ [23] C.-Y. Chuang, A. Torralba, and S. Jegelka. Estimating generalization under distribution shifts via domain-invariant representations. In International Conference on Machine Learning, pages 1984–1994. PMLR, 2020.
235
+ [24] T. M. Cover and J. A. Thomas. Elements of information theory. John Wiley & Sons, 2006.
236
+ [25] S. Cui, S. Wang, J. Zhuo, L. Li, Q. Huang, and Q. Tian. Towards discriminability and diversity: Batch nuclear-norm maximization under label insufficient situations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3941–3950, 2020.
237
+ [26] B. Dai and D. Wipf. Diagnosing and enhancing VAE models. In International Conference on Learning Representations, 2019.
238
+ [27] A. D’Amour, K. Heller, D. Moldovan, B. Adlam, B. Alipanahi, A. Beutel, C. Chen, J. Deaton, J. Eisenstein, M. D. Hoffman, et al. Underspecification presents challenges for credibility in modern machine learning. arXiv preprint arXiv:2011.03395, 2020.
239
+ [28] C. Durkan and Y. Song. On maximum likelihood training of score-based generative models. arXiv preprint arXiv:2101.09258, 2021.
240
+ [29] D. M. Endres and J. E. Schindelin. A new metric for probability distributions. IEEE Transactions on Information theory, 49(7):1858–1860, 2003.
241
+ [30] C. Fang, Y. Xu, and D. N. Rockmore. Unbiased metric learning: On the utilization of multiple datasets and web images for softening bias. In Proceedings of the IEEE International Conference on Computer Vision, pages 1657–1664, 2013.
242
+ [31] C. Fefferman, S. Mitter, and H. Narayanan. Testing the manifold hypothesis. Journal of the American Mathematical Society, 29(4):983–1049, 2016.
243
+ [32] Y. Gal and Z. Ghahramani. Dropout as a Bayesian approximation: Representing model uncertainty in deep learning. In Proceedings of the International Conference on Machine Learning, pages 1050–1059, 2016.
244
+ [33] Y. Ganin, E. Ustinova, H. Ajakan, P. Germain, H. Larochelle, F. Laviolette, M. Marchand, and V. Lempitsky. Domain-adversarial training of neural networks. Journal of Machine Learning Research, 17:1–35, 2016.
245
+ [34] R. Geirhos, P. Rubisch, C. Michaelis, M. Bethge, F. A. Wichmann, and W. Brendel. ImageNettrained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In Proceedings of the International Conference on Learning Representations (ICLR 2019), 2019.
246
+ [35] M. Gong, K. Zhang, T. Liu, D. Tao, C. Glymour, and B. Schölkopf. Domain adaptation with conditional transferable components. In International Conference on Machine Learning, pages 2839–2848, 2016.
247
+ [36] M. Gong, K. Zhang, B. Huang, C. Glymour, D. Tao, and K. Batmanghelich. Causal generative domain adaptation networks. arXiv preprint arXiv:1804.04333, 2018.
248
+ [37] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems, pages 2672–2680, Montréal, Canada, 2014. NIPS Foundation.
249
+ [38] I. J. Goodfellow, J. Shlens, and C. Szegedy. Explaining and harnessing adversarial examples. In Proceedings of the International Conference on Learning Representations (ICLR 2015), 2015.
250
+ [39] I. Gulrajani and D. Lopez-Paz. In search of lost domain generalization. arXiv preprint arXiv:2007.01434, 2020.
251
+ [40] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770– 778, 2016.
252
+ [41] Y. He, Z. Shen, and P. Cui. Towards non-i.i.d. image classification: A dataset and baselines. arXiv preprint arXiv:1906.02899, 2019.
253
+ [42] C. Heinze-Deml and N. Meinshausen. Conditional variance penalties and domain shift robustness. stat, 1050:13, 2019.
254
+ [43] 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 Proceedings of the International Conference on Learning Representations (ICLR 2017), 2017.
255
+ [44] I. Higgins, D. Amos, D. Pfau, S. Racaniere, L. Matthey, D. Rezende, and A. Lerchner. Towards a definition of disentangled representations. arXiv preprint arXiv:1812.02230, 2018.
256
+ [45] P. O. Hoyer, S. Shimizu, A. J. Kerminen, and M. Palviainen. Estimation of causal effects using linear non-gaussian causal models with hidden variables. International Journal of Approximate Reasoning, 49(2):362–378, 2008.
257
+ [46] F. Huszár. How (not) to train your generative model: Scheduled sampling, likelihood, adversary? arXiv preprint arXiv:1511.05101, 2015.
258
+ [47] A. Hyvärinen. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research, 6(Apr):695–709, 2005.
259
+ [48] M. Ilse, J. M. Tomczak, and P. Forré. Designing data augmentation for simulating interventions. arXiv preprint arXiv:2005.01856, 2020.
260
+ [49] M. Ilse, J. M. Tomczak, C. Louizos, and M. Welling. DIVA: Domain invariant variational autoencoders. In Medical Imaging with Deep Learning, pages 322–348. PMLR, 2020.
261
+ [50] A. Ilyas, S. Santurkar, D. Tsipras, L. Engstrom, B. Tran, and A. Madry. Adversarial examples are not bugs, they are features. In Advances in Neural Information Processing Systems, pages 125–136, 2019.
262
+ [51] D. Janzing, J. Peters, J. M. Mooij, and B. Schölkopf. Identifying confounders using additive noise models. In Proceedings of the 25th Conference on Uncertainty in Artificial Intelligence (UAI 2009), pages 249–257. AUAI Press, 2009.
263
+ [52] D. Janzing, E. Sgouritsa, O. Stegle, J. Peters, and B. Schölkopf. Detecting low-complexity unobserved causes. In 27th Conference on Uncertainty in Artificial Intelligence (UAI 2011), pages 383–391. AUAI Press, 2011.
264
+ [53] J. Jiang, B. Fu, and M. Long. Transfer-learning-library. https://github.com/thuml/ Transfer-Learning-Library, 2020.
265
+ [54] F. D. Johansson, D. Sontag, and R. Ranganath. Support and invertibility in domain-invariant representations. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 527–536, 2019.
266
+ [55] M. I. Jordan, Z. Ghahramani, T. S. Jaakkola, and L. K. Saul. An introduction to variational methods for graphical models. Machine learning, 37(2):183–233, 1999.
267
+ [56] N. R. Ke, O. Bilaniuk, A. Goyal, S. Bauer, H. Larochelle, C. Pal, and Y. Bengio. Learning neural causal models from unknown interventions. arXiv preprint arXiv:1910.01075, 2019.
268
+ [57] I. Khemakhem, D. P. Kingma, R. P. Monti, and A. Hyvärinen. Variational autoencoders and nonlinear ICA: A unifying framework. In S. Chiappa and R. Calandra, editors, The 23rd International Conference on Artificial Intelligence and Statistics, AISTATS 2020, 26-28 August 2020, Online [Palermo, Sicily, Italy], volume 108 of Proceedings of Machine Learning Research, pages 2207–2217, 2020.
269
+ [58] I. Khemakhem, R. P. Monti, D. P. Kingma, and A. Hyvärinen. ICE-BeeM: Identifiable conditional energy-based deep models. arXiv preprint arXiv:2002.11537, 2020.
270
+ [59] N. Kilbertus, G. Parascandolo, and B. Schölkopf. Generalization in anti-causal learning. arXiv preprint arXiv:1812.00524, 2018.
271
+ [60] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
272
+ [61] D. P. Kingma and P. Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In Advances in Neural Information Processing Systems, 2018.
273
+ [62] D. P. Kingma and M. Welling. Auto-encoding variational Bayes. In Proceedings of the International Conference on Learning Representations (ICLR 2014), Banff, Canada, 2014. ICLR Committee.
274
+ [63] D. P. Kingma, S. Mohamed, D. J. Rezende, and M. Welling. Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems, pages 3581–3589, 2014.
275
+ [64] M. Kocaoglu, S. Shakkottai, A. G. Dimakis, C. Caramanis, and S. Vishwanath. Entropic latent variable discovery. arXiv preprint arXiv:1807.10399, 2018.
276
+ [65] T. C. Koopmans and O. Reiersol. The identification of structural characteristics. The Annals of Mathematical Statistics, 21(2):165–181, 1950.
277
+ [66] D. Krueger, E. Caballero, J.-H. Jacobsen, A. Zhang, J. Binas, R. L. Priol, and A. Courville. Outof-distribution generalization via risk extrapolation (REx). arXiv preprint arXiv:2003.00688, 2020.
278
+ [67] A. Kurakin, I. Goodfellow, and S. Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
279
+ [68] C. M. Lee, C. Hart, J. G. Richens, and S. Johri. Leveraging directed causal discovery to detect latent common causes. arXiv preprint arXiv:1910.10174, 2019.
280
+ [69] D. Li, Y. Yang, Y.-Z. Song, and T. M. Hospedales. Deeper, broader and artier domain generalization. In Proceedings of the IEEE international conference on computer vision, pages 5542–5550, 2017.
281
+ [70] F. Locatello, S. Bauer, M. Lucic, G. Raetsch, S. Gelly, B. Schölkopf, and O. Bachem. Challenging common assumptions in the unsupervised learning of disentangled representations. In K. Chaudhuri and R. Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 4114–4124, Long Beach, California, USA, 09–15 Jun 2019. PMLR.
282
+ [71] F. Locatello, M. Tschannen, S. Bauer, G. Rätsch, B. Schölkopf, and O. Bachem. Disentangling factors of variation using few labels. arXiv preprint arXiv:1905.01258, 2019.
283
+ [72] F. Locatello, B. Poole, G. Rätsch, B. Schölkopf, O. Bachem, and M. Tschannen. Weaklysupervised disentanglement without compromises. In International Conference on Machine Learning, pages 6348–6359. PMLR, 2020.
284
+ [73] M. Long, Y. Cao, J. Wang, and M. Jordan. Learning transferable features with deep adaptation networks. In International conference on machine learning, pages 97–105, 2015.
285
+ [74] M. Long, Z. Cao, J. Wang, and M. I. Jordan. Conditional adversarial domain adaptation. In Advances in Neural Information Processing Systems, pages 1640–1650, 2018.
286
+ [75] D. Lopez-Paz, R. Nishihara, S. Chintala, B. Schölkopf, and L. Bottou. Discovering causal signals in images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6979–6987, 2017.
287
+ [76] C. Louizos, U. Shalit, J. M. Mooij, D. Sontag, R. Zemel, and M. Welling. Causal effect inference with deep latent-variable models. In Advances in Neural Information Processing Systems, pages 6446–6456, 2017.
288
+ [77] S. Magliacane, T. van Ommen, T. Claassen, S. Bongers, P. Versteeg, and J. M. Mooij. Domain adaptation by using causal inference to predict invariant conditional distributions. In Advances in Neural Information Processing Systems, pages 10846–10856, 2018.
289
+ [78] J. D. Mcauliffe and D. M. Blei. Supervised topic models. In Advances in Neural Information Processing Systems, pages 121–128, Vancouver, Canada, 2008. NIPS Foundation.
290
+ [79] J. Mitrovic, B. McWilliams, J. C. Walker, L. H. Buesing, and C. Blundell. Representation learning via invariant causal mechanisms. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $\cdot ^ { = }$ 9p2ekP904Rs.
291
+ [80] K. Muandet, D. Balduzzi, and B. Schölkopf. Domain generalization via invariant feature representation. In International Conference on Machine Learning, pages 10–18, 2013.
292
+ [81] K. P. Murphy. Machine learning: a probabilistic perspective. MIT press, 2012.
293
+ [82] R. M. Neal. Bayesian learning for neural networks. PhD thesis, University of Toronto, 1995.
294
+ [83] S. J. Pan, I. W. Tsang, J. T. Kwok, and Q. Yang. Domain adaptation via transfer component analysis. IEEE Transactions on Neural Networks, 22(2):199–210, 2010.
295
+ [84] 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.
296
+ [85] J. Pearl. Causality. Cambridge university press, 2009.
297
+ [86] J. Peters, J. M. Mooij, D. Janzing, and B. Schölkopf. Causal discovery with continuous additive noise models. Journal of Machine Learning Research, 15(1):2009–2053, 2014.
298
+ [87] J. Peters, P. Bühlmann, and N. Meinshausen. Causal inference by using invariant prediction: identification and confidence intervals. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 78(5):947–1012, 2016.
299
+ [88] J. Peters, D. Janzing, and B. Schölkopf. Elements of causal inference: foundations and learning algorithms. MIT press, 2017.
300
+ [89] F. Qiao, L. Zhao, and X. Peng. Learning to learn single domain generalization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12556– 12565, 2020.
301
+ [90] A. Radford, L. Metz, and S. Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In Y. Bengio and Y. LeCun, editors, 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016. [91] M. T. Ribeiro, S. Singh, and C. 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, San Francisco, CA, USA, August 13-17, 2016, pages 1135–1144, 2016. [92] T. Richardson, P. Spirtes, et al. Ancestral graph Markov models. The Annals of Statistics, 30 (4):962–1030, 2002. [93] M. Rojas-Carulla, B. Schölkopf, R. Turner, and J. Peters. Invariant models for causal transfer learning. The Journal of Machine Learning Research, 19(1):1309–1342, 2018.
302
+ [94] J.-W. Romeijn and J. Williamson. Intervention and identifiability in latent variable modelling. Minds and machines, 28(2):243–264, 2018.
303
+ [95] D. Rothenhäusler, N. Meinshausen, P. Bühlmann, and J. Peters. Anchor regression: heterogeneous data meets causality. arXiv preprint arXiv:1801.06229, 2018. [96] B. Schölkopf. Causality for machine learning. arXiv preprint arXiv:1911.10500, 2019. [97] B. Schölkopf, D. Janzing, J. Peters, E. Sgouritsa, K. Zhang, and J. M. Mooij. On causal and anticausal learning. In International Conference on Machine Learning (ICML 2012), pages 1255–1262. International Machine Learning Society, 2012. [98] B. Schölkopf, F. Locatello, S. Bauer, N. R. Ke, N. Kalchbrenner, A. Goyal, and Y. Bengio. Toward causal representation learning. Proceedings of the IEEE, 109(5):612–634, 2021.
304
+ [99] E. Sgouritsa, D. Janzing, J. Peters, and B. Schölkopf. Identifying finite mixtures of nonparametric product distributions and causal inference of confounders. In Proceedings of the 29th Conference on Uncertainty in Artificial Intelligence (UAI 2013), pages 556–575. AUAI Press, 2013.
305
+ [100] U. Shalit, F. D. Johansson, and D. Sontag. Estimating individual treatment effect: generalization bounds and algorithms. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 3076–3085. JMLR.org, 2017.
306
+ [101] S. Shankar, V. Piratla, S. Chakrabarti, S. Chaudhuri, P. Jyothi, and S. Sarawagi. Generalizing across domains via cross-gradient training. In Proceedings of the International Conference on Learning Representations (ICLR 2018), 2018.
307
+ [102] Z. Shen, P. Cui, K. Kuang, B. Li, and P. Chen. Causally regularized learning with agnostic data selection bias. In 2018 ACM Multimedia Conference on Multimedia Conference, pages 411–419. ACM, 2018.
308
+ [103] I. Shpitser, R. J. Evans, T. S. Richardson, and J. M. Robins. Introduction to nested Markov models. Behaviormetrika, 41(1):3–39, 2014.
309
+ [104] R. Shu, Y. Chen, A. Kumar, S. Ermon, and B. Poole. Weakly supervised disentanglement with guarantees. In International Conference on Learning Representations, 2020.
310
+ [105] P. Spirtes, C. N. Glymour, R. Scheines, and D. Heckerman. Causation, prediction, and search. MIT press, 2000.
311
+ [106] 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.
312
+ [107] C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus. Intriguing properties of neural networks. In Proceedings of the International Conference on Learning Representations (ICLR 2014), 2014.
313
+ [108] T. Teshima, I. Sato, and M. Sugiyama. Few-shot domain adaptation by causal mechanism transfer. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pages 9458–9469, 2020.
314
+ [109] L. Theis, A. van den Oord, and M. Bethge. A note on the evaluation of generative models. In International Conference on Learning Representations (ICLR 2016), pages 1–10, 2016.
315
+ [110] T. Tieleman and G. Hinton. Lecture 6.5-RMSprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 4(2):26–31, 2012.
316
+ [111] T. Verma and J. Pearl. Equivalence and synthesis of causal models. UCLA, Computer Science Department, 1991.
317
+ [112] M. J. Wainwright, M. I. Jordan, et al. Graphical models, exponential families, and variational inference. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 1(1–2):1–305, 2008.
318
+ [113] J. Wang, C. Lan, C. Liu, Y. Ouyang, and T. Qin. Generalizing to unseen domains: A survey on domain generalization. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI-21, pages 4627–4635. International Joint Conferences on Artificial Intelligence Organization, 2021. Survey Track.
319
+ [114] Y. Wang and D. M. Blei. The blessings of multiple causes. Journal of the American Statistical Association, 114(528):1574–1596, 2019.
320
+ [115] K. Q. Weinberger and L. K. Saul. Unsupervised learning of image manifolds by semidefinite programming. International Journal of Computer Vision, 70(1):77–90, 2006.
321
+ [116] Y. Yacoby, W. Pan, and F. Doshi-Velez. Learning deep bayesian latent variable regression models that generalize: When non-identifiability is a problem. arXiv preprint arXiv:1911.00569, 2019.
322
+ [117] M. Yang, F. Liu, Z. Chen, X. Shen, J. Hao, and J. Wang. CausalVAE: Structured causal disentanglement in variational autoencoder. arXiv preprint arXiv:2004.08697, 2020.
323
+ [118] L. Yao, S. Li, Y. Li, M. Huai, J. Gao, and A. Zhang. Representation learning for treatment effect estimation from observational data. In Advances in Neural Information Processing Systems, pages 2633–2643, 2018.
324
+ [119] H. Ye, C. Xie, T. Cai, R. Li, Z. Li, and L. Wang. Towards a theoretical framework of out-of-distribution generalization. arXiv preprint arXiv:2106.04496, 2021.
325
+ [120] K. You, X. Wang, M. Long, and M. Jordan. Towards accurate model selection in deep unsupervised domain adaptation. In International Conference on Machine Learning, pages 7124–7133, 2019.
326
+ [121] C. Zhang, K. Zhang, and Y. Li. A causal view on robustness of neural networks. In Advances in Neural Information Processing Systems, 2020.
327
+ [122] K. Zhang and A. Hyvärinen. On the identifiability of the post-nonlinear causal model. In Proceedings of the 25th Conference on Uncertainty in Artificial Intelligence (UAI 2009), pages 647–655. AUAI Press, 2009.
328
+ [123] K. Zhang, B. Schölkopf, K. Muandet, and Z. Wang. Domain adaptation under target and conditional shift. In International Conference on Machine Learning, pages 819–827, 2013.
329
+ [124] Y. Zhang, T. Liu, M. Long, and M. Jordan. Bridging theory and algorithm for domain adaptation. In International Conference on Machine Learning, pages 7404–7413, 2019.
330
+ [125] H. Zhao, R. T. Des Combes, K. Zhang, and G. Gordon. On learning invariant representations for domain adaptation. In International Conference on Machine Learning, pages 7523–7532, 2019.
md/train/B1hcZZ-AW/B1hcZZ-AW.md ADDED
@@ -0,0 +1,497 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # N2N LEARNING: NETWORK TO NETWORK COMPRESSION VIA POLICY GRADIENT REINFORCEMENT LEARNING
2
+
3
+ Anubhav Ashok Robotics Institute Carnegie Mellon University bhav@cmu.edu
4
+
5
+ Nicholas Rhinehart Robotics Institute Carnegie Mellon University nrhineha@cs.cmu.edu
6
+
7
+ Fares Beainy
8
+ Volvo Construction Equipment Volvo Group
9
+ fares.beainy@volvo.com
10
+
11
+ Kris M. Kitani Robotics Institute Carnegie Mellon University kkitani@cs.cmu.edu
12
+
13
+ # ABSTRACT
14
+
15
+ While wider and deeper neural network architectures continue to advance the state-of-the-art for many computer vision tasks, real-world adoption of these networks is impeded by hardware and speed constraints. Conventional model compression methods attempt to address this problem by modifying the architecture manually or using pre-defined heuristics. Since the space of all reduced architectures is very large, modifying the architecture of a deep neural network in this way is a difficult task. In this paper, we tackle this issue by introducing a principled method for learning reduced network architectures in a data-driven way using reinforcement learning. Our approach takes a larger ‘teacher’ network as input and outputs a compressed ‘student’ network derived from the ‘teacher’ network. In the first stage of our method, a recurrent policy network aggressively removes layers from the large ‘teacher’ model. In the second stage, another recurrent policy network carefully reduces the size of each remaining layer. The resulting network is then evaluated to obtain a reward – a score based on the accuracy and compression of the network. Our approach uses this reward signal with policy gradients to train the policies to find a locally optimal student network. Our experiments show that we can achieve compression rates of more than $1 0 \times$ for models such as ResNet34 while maintaining similar performance to the input ‘teacher’ network. We also present a valuable transfer learning result which shows that policies which are pre-trained on smaller ‘teacher’ networks can be used to rapidly speed up training on larger ‘teacher’ networks.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ While carefully hand-designed deep convolutional networks continue to increase in size and in performance, they also require significant power, memory and computational resources, often to the point of prohibiting their deployment on smaller devices. As a result, researchers have developed model compression techniques based on Knowledge Distillation to compress a large (teacher) network to a smaller (student) network using various training techniques (e.g., soft output matching, hint layer matching, uncertainty modeling). Unfortunately, state-of-the-art knowledge distillation methods share a common feature: they require carefully hand-designed architectures for the student model. Hand-designing networks is a tedious sequential process, often loosely guided by a sequence of trial-and-error based decisions to identify a smaller network architecture. This process makes it very difficult to know if the resulting network is optimal. Clearly, there is a need to develop more principled methods of identifying optimal student architectures.
20
+
21
+ ![](images/e47dd5c04d343b25d0b7ab3408802f24cfe8610069d8d2668c8fd923f7c0279c.jpg)
22
+ Figure 1: Layer Removal Policy removes layers of Teacher network architecture (stage-1 candidates) then Layer Shrinkage Policy reduces parameters (stage-2 candidates).
23
+
24
+ Towards a more principled approach to network architecture compression, we present a reinforcement learning approach to identify a compressed high-performance architecture (student) given knowledge distilled from a larger high-performing model (teacher). We make a key conceptual assumption that formulates the sequential process of converting a teacher network to a student network as a Markov Decision Process (MDP). Under this model, a state $s$ represents the network architecture. Clearly, the domain of the state $s$ is very large since it contains every possible reduced architecture of the teacher network. A deterministic transition in this state space, $T ( s ^ { \prime } | s , a )$ , is determined by selecting the action $a$ , e.g., removing a convolutional filter or reducing the size of a fully connected layer. Each action will transform one architecture $s$ to another architecture $s ^ { \prime }$ . Under the MDP, the strategy for selecting an action given a certain state is represented by the policy $\pi ( a | s )$ , which stochastically maps a state to an action. The process of reinforcement learning is used to learn an optimal policy based on a reward function $r ( s )$ defined over the state space. In our work, we define the reward function based on the accuracy and the compression rate of the specified architecture $s$ .
25
+
26
+ A straightforward application of reinforcement learning to this problem can be very slow depending on the definition of the action space. For example, an action could be defined as removing a single filter from every layer of a convolutional neural network. Since the search space is exponential in the size of the action space and sequence length, it certainly does not scale to modern networks that have hundreds of layers.
27
+
28
+ Our proposed approach addresses the problem of scalability in part, by introducing a two-stage action selection mechanism which first selects a macro-scale “layer removal” action, followed by a micro-scale “layer shrinkage” action. In this way we enable our reinforcement learning process to efficiently explore the space of reduced networks. Each network architecture that is generated by our policy is then trained with Knowledge Distillation (Hinton et al., 2015). Figure 1 illustrates our proposed approach.
29
+
30
+ To the best of our knowledge, this is the first paper to provide a principled approach to the task of network compression, where the architecture of the student network is obtained via reinforcement learning. To facilitate reinforcement learning, we propose a reward function that encodes both the compression rate and the accuracy of the student model. In particular, we propose a novel formulation of the compression reward term based on a relaxation of a constrained optimization problem, which encodes the hardware-based computational budget items in the form of linear constraints.
31
+
32
+ We demonstrate the effectiveness of our approach over several network architectures and several visual learning tasks of varying difficulty (MNIST, SVHN, CIFAR-10, CIFAR-100, Caltech-256). We also demonstrate that the compression policies exhibit generalization across networks with similar architectures. In particular, we use a policy trained on a ResNet-18 model on a ResNet-34 model and show that it greatly accelerates the reinforcement learning process.
33
+
34
+ # 2 RELATED WORK
35
+
36
+ We first discuss methods for compressing models to a manually designed network (pruning and distillation). Towards automation, we discuss methods for automatically constructing highperformance networks, orthogonal to the task of compression.
37
+
38
+ Pruning: Pruning-based methods preserve the weights that matter most and remove the redundant weights LeCun et al. (1989), Hassibi et al. (1993), Srinivas & Babu (2015), Han et al. (2015b), Han et al. (2015a), Mariet & Sra (2015), Anwar et al. (2015), Guo et al. (2016). While pruning-based approaches typically operate on the weights of the teacher model, our approach operates on a much larger search space over both model weights and model architecture. Additionally, our method offers greater flexibility as it allows the enforcement of memory, inference time, power, or other hardware constraints. This allows our approach to find the optimal architecture for the given dataset and constraints instead of being limited to that of the original model.
39
+
40
+ Knowledge Distillation: Knowledge distillation is the task of training a smaller network (a “student”) to mimic a “teacher” network, performing comparably to the input network (a “teacher”) Bucilu et al. (2006), Ba & Caruana (2014), Hinton et al. (2015), Romero et al. (2014), Urban et al. (2016). The work of Hinton et al. (2015) generalized this idea by training the student to learn from both the teacher and from the training data, demonstrating that this approach outperforms models trained using only training data. In Romero et al. (2014), the approach uses Knowledge Distillation with an intermediate hint layer to train a thinner but deeper student network containing fewer parameters to outperform the teacher network. In previous Knowledge Distillation approaches, the networks are hand designed, possibly after many rounds of trial-and-error. In this paper, we train a policy to learn the optimal student architecture, instead of hand-designing one. In a sense, we automate Knowledge Distillation, employing the distillation method of Ba & Caruana (2014) as a component of our learning process. In the experiments section we show that our learned architectures outperform those described in Romero et al. (2014) and Hinton et al. (2015).
41
+
42
+ Architecture Search: There has been much work on exploring the design space of neural networks Saxe et al. (2011), Zoph & Le (2016), Baker et al. (2016), Ludermir et al. (2006), Miikkulainen et al. (2017), Real et al. (2017), Snoek et al. (2012), Snoek et al. (2015), Stanley & Miikkulainen (2002), Jozefowicz et al. (2015), Murdock et al. (2016), Feng & Darrell (2015), Warde-Farley et al. (2014), Iandola et al. (2016). The principal aim of previous work in architecture search has been to build models that maximize performance on a given dataset. On the other hand, our goal is to find a compressed architecture while maintaining reasonable performance on a given dataset. Our approach also differs from existing architecture search method since we use the teacher model as the search space for our architecture instead of constructing networks from scratch. Current methods that construct networks from scratch either operate on a very large search space, making it computationally expensive Zoph & Le (2016), Real et al. (2017), Miikkulainen et al. (2017), Jozefowicz et al. (2015) or operate on a highly restricted search space Baker et al. (2016), Snoek et al. (2015). Our approach instead leverages the idea that since the teacher model is able to achieve high accuracy on the dataset, it already contains the components required to solve the task well and therefore is a suitable search space for the compressed architecture.
43
+
44
+ # 3 APPROACH
45
+
46
+ Our goal is to learn an optimal compression strategy (policy) via reinforcement learning, that takes a Teacher network as input and systematically reduces it to output a small Student network.
47
+
48
+ # 3.1 MARKOV DECISION PROCESS
49
+
50
+ We formulate the sequential process of finding a reduced architecture as a sequential decision making problem. The decision process is modeled as a Markov Decision Process (MDP). Formally, the MDP is defined as the tuple $\mathcal { M } = \{ \boldsymbol { S } , \mathcal { A } , T , r , \gamma \}$ .
51
+
52
+ States: $s$ is the state space, a finite set consisting of all possible reduced network architectures that can be derived from the Teacher model. For example, a VGG network (Simonyan & Zisserman,
53
+
54
+ ![](images/2d429d21620b19a0dca8de598f32786e8a492c5c2a28119a919b35e7f793643f.jpg)
55
+ Figure 2: a) Layer removal policy network, b) Layer shrinkage policy network
56
+
57
+ 2014) represents the state $s \in S$ (the initial state) and by removing one convolutional filter from the first layer we obtain a new network architecture $s ^ { \prime }$ .
58
+
59
+ Actions: $\mathcal { A }$ is a finite set of actions that can transform one network architecture into another network architecture. In our approach there are two classes of action types: layer removal actions and layer parameter reduction actions. The definition of these actions are further described in Section 3.2.1 and 3.2.2.
60
+
61
+ Transition Function: $T : S \times A S$ is the state transition dynamic. Here, $T$ is deterministic since an action $a$ always transforms a network architecture $s$ to the resulting network architecture $s ^ { \prime }$ with probability one.
62
+
63
+ Discount Factor: $\gamma$ is the discount factor. We use $\gamma = 1$ so that all rewards contribute equally to the final return.
64
+
65
+ Reward: $r : \mathcal { S } \mathbb { R }$ is the reward function. The rewards of network architecture $r ( s )$ can be interpreted to be a score associated with a given network architecture s. Note that we define the reward to be 0 for intermediate states, which represent “incomplete” networks, and only compute a non-trivial reward for the final state. The reward function is described in detail in Section 3.4.
66
+
67
+ # 3.2 STUDENT-TEACHER REINFORCEMENT LEARNING
68
+
69
+ Under this MDP, the task of reinforcement learning is to learn an optimal policy $\pi : { \mathcal { S } } A$ , such that it maximizes the expected total reward, with the total reward given by:
70
+
71
+ $$
72
+ R ( \vec { s } ) = \sum _ { i = 0 } ^ { L = | \vec { s } | } r ( s _ { i } ) = r ( s _ { L } ) .
73
+ $$
74
+
75
+ We take a policy gradient reinforcement learning approach and iteratively update the policy based on sampled estimates of the reward. The design of the action space is critical for allowing the policy gradient method to effectively search the state space. If the actions are selected to be very incremental, a long sequence of actions would be needed to make a significant change to the network architecture, making credit assignment difficult. To address this issue, we propose a two stage reinforcement learning procedure. In the first stage a policy selects a sequence of actions deciding whether to keep or remove each layer of the teacher architecture. In the second stage, a different policy selects a sequence of discrete actions corresponding to the magnitude by which to attenuate configuration variables of each remaining layer. In this way, we are able to efficiently explore the state space to find the optimal student network.
76
+
77
+ # Algorithm 1 Student-Teacher Reinforcement Learning
78
+
79
+ <table><tr><td colspan="2"></td></tr><tr><td colspan="2">1: procedure STUDENT-TEACHER RL(S,A,T,r,γ)</td></tr><tr><td>2:</td><td>So←Teacher</td></tr><tr><td>3: 4:</td><td>fori=1 to N do</td></tr><tr><td></td><td>for t = 1 to Li do</td></tr><tr><td>5:</td><td>at ~ Tremove(St-1; 0remove,i-1)</td></tr><tr><td>6:</td><td>St←T(St-1,at)</td></tr><tr><td>7:</td><td>end for</td></tr><tr><td>8:</td><td>R←r(sL1)</td></tr><tr><td>9:</td><td>0remove,i ←θremove,i-1J(0remove,i-1)</td></tr><tr><td>10:</td><td>end for</td></tr><tr><td>11:</td><td>So ← Stage-1 Candidate</td></tr><tr><td>12:</td><td>fori=1 to N2 do</td></tr><tr><td>13:</td><td>for t = 1 to L2 do</td></tr><tr><td>14: 15:</td><td>at ~ Tshrink(St-1; 0shrink,i-1)</td></tr><tr><td>16:</td><td>St←T(St-1,at)</td></tr><tr><td></td><td>end for</td></tr><tr><td>17:</td><td>R←r(sL2)</td></tr><tr><td>18: 19:</td><td>shrink,i←sriniJ(shink)</td></tr><tr><td>20:</td><td>end for</td></tr><tr><td></td><td>Output: Compressed model</td></tr><tr><td>21: end procedure</td><td></td></tr></table>
80
+
81
+ A sketch of the algorithm is given in Algorithm 3.2. For both layer removal and shrinkage policies, we repeatedly sample architectures and update the policies based on the reward achieved by the architectures. We now describe the details of the two stages of student-teacher reinforcement learning.
82
+
83
+ # 3.2.1 LAYER REMOVAL
84
+
85
+ In the layer removal stage, actions $a _ { t }$ correspond to the binary decision to keep or remove a layer. The length of the trajectory for layer removal is $T = L$ , the number of layers in the network. At each step $t$ of layer removal, the Bidirectional LSTM policy (See Figure 2a) observes the hidden states, $h _ { t - 1 } , h _ { t + 1 }$ , as well as information $x _ { t }$ about the current layer: $\pi _ { \mathrm { r e m o v e } } ( a _ { t } | h _ { t - 1 } , h _ { t + 1 } , x _ { t } )$ . Information about the current layer $l$ is given as
86
+
87
+ $$
88
+ x _ { t } = ( l , k , s , p , n , s _ { \mathrm { s t a r t } } , s _ { \mathrm { e n d } } ) ,
89
+ $$
90
+
91
+ where $l$ is the layer type, $k$ kernel size, $s$ stride, $p$ padding and $n$ number of outputs (filters or connections). To model more complex architectures, such as ResNet, $s _ { \mathrm { s t a r t } }$ and $s _ { \mathrm { e n d } }$ are used to inform the policy network about skip connections. For a layer inside a block containing a skip connection, $s _ { \mathrm { s t a r t } }$ is the number of layers prior to which the skip connection began and $s _ { \mathrm { e n d } }$ is the number of layers remaining until the end of the block. Additionally it is to be noted that although actions are stochastically sampled from the outputs at each time step, the hidden states that are passed on serve as a sufficient statistic for $x _ { 0 } , a _ { 0 } . . . x _ { t - 1 } , a _ { t - 1 }$ (Wierstra et al., 2010).
92
+
93
+ # 3.2.2 LAYER SHRINKAGE
94
+
95
+ The length of the trajectory for layer shrinkage is $\begin{array} { r } { T \ = \ \sum _ { l = 1 } ^ { L } H _ { l } } \end{array}$ , where $H$ is the number of configuration variables for each layer. At each step $t$ of layer shrinkage, the policy observes the hidden state $h _ { t - 1 }$ , the previously sampled action $a _ { t - 1 }$ and current layer information $x _ { t }$ : $\pi _ { \mathrm { s h r i n k } } \big ( a _ { t } \big | a _ { t - 1 } , h _ { t - 1 } , x _ { t } \big )$ . The parameterization of $x _ { t }$ is similar to layer removal except that the previous action is appended to the representation in an autoregressive manner (See Figure 2b). The action space for layer shrinkage is defined as $a _ { t } \in [ 0 . 1 , 0 . 2 , \ldots , 1 ]$ (each action corresponds to how much to shrink a layer parameter) and an action is produced for each configurable variable for each layer. Examples include kernel size, padding, and number of output filters or connections.
96
+
97
+ # 3.3 REWARD FUNCTION
98
+
99
+ The design of the reward function plays a critical role in learning the policies. A poorly designed reward that provides no discrimination between good and bad student architectures prevents policies from learning the trade-offs in architecture space. The objective of model compression is to maximize compression while maintaining a high accuracy. Since there is no benefit in producing highly compressed models which have bad performance, we want to provide a harsher penalty for a model with high compression $^ +$ low accuracy than one with low compression $^ +$ high accuracy. Furthermore we would also like to define a general reward function that does not depend on dataset/model specific hyperparameters. Additional discussion on the design of the reward function is provided in the appendix.
100
+
101
+ In our approach, we define the reward function as follows:
102
+
103
+ $$
104
+ \begin{array} { l } { R = R _ { c } \cdot R _ { a } } \\ { \quad = C ( 2 - C ) \cdot \frac { A } { A _ { \mathrm { t e a c h e r } } } } \end{array}
105
+ $$
106
+
107
+ Where $C$ is the relative compression ratio of the student model, $A$ is the validation accuracy of the student model and $A _ { \mathrm { t e a c h e r } }$ is the validation accuracy of the teacher model provided defined as a constant. $R _ { c }$ and $R _ { a }$ refer to the compression and accuracy reward respectively. We compute the reward as a product of the compression and accuracy reward since we want the reward to scale with both quantities dependently. The compression reward, $R _ { c } = C ( 2 - C )$ , is computed using a non-linear function that biases the policy towards producing models that maintain accuracy while optimizing for compression. The relative compression $C \in [ 0 , 1 )$ is defined in terms of the ratio of trainable parameters of each model: C = 1 − #params(student)# ( ) . It is noted here that other compression methods that use quantization or coding define compression ratio in terms of number of bits instead of parameters. The accuracy reward, Ra, is defined with respect to the teacher model as Ra = AAteacher , where $A \in [ 0 , 1 ]$ refers to the validation accuracy of the student model and $A _ { \mathrm { t e a c h e r } }$ refers to the validation accuracy of the teacher model. We note that both accuracy and compression rewards are normalized with respect to the teacher and thus do not require additional hyperparameters to perform task-specific weighting. Lastly, it is possible that the policies may produce degenerate architectures in such cases, a reward if $^ { - 1 }$ is assigned (details in appendix).
108
+
109
+ # 3.3.1 CONSTRAINTS AS REWARDS
110
+
111
+ Our approach allows us to incorporate pre-defined hardware or resource budget constraints by rewarding architectures that meet the constraints and discouraging those that do not. Formally, our constrained optimization problem is
112
+
113
+ $$
114
+ \begin{array} { r } { \operatorname* { m a x } E _ { a _ { 1 : T } } [ R ] } \\ { \mathrm { s u b j e c t ~ t o ~ } A x \leq b , } \end{array}
115
+ $$
116
+
117
+ where $A$ and $b$ form our constraints, and $x$ is vector of constrained variables. We relax these hard constraints by redefining our reward function as:
118
+
119
+ $$
120
+ R = { \left\{ \begin{array} { l l } { R _ { a } \cdot R _ { c } } & { { \mathrm { i f ~ } } A x \leq b } \\ { - 1 } & { { \mathrm { o t h e r w i s e . } } } \end{array} \right. }
121
+ $$
122
+
123
+ The introduction of the non-smooth penalty may result in a reduced exploration of the search space and hence convergence to a worse local minimum. To encourage early exploration gradually incorporate constraints over time:
124
+
125
+ $$
126
+ R = { \left\{ \begin{array} { l l } { R _ { a } \cdot R _ { c } } & { { \mathrm { i f ~ } } A x \leq b } \\ { \epsilon _ { t } ( R _ { a } \cdot R _ { c } + 1 ) - 1 } & { { \mathrm { o t h e r w i s e } } , } \end{array} \right. }
127
+ $$
128
+
129
+ where $\epsilon _ { t } \in [ 0 , 1 ]$ monotonically decreases with $t$ and $\epsilon _ { 0 } = 1$ . As it is possible to incorporate a variety of constraints such as memory, time, power, accuracy, label-wise accuracy, our method is flexible enough to produce models practically viable in a diversity of settings. This is in contrast to conventional model compression techniques which require many manual repetitions of the algorithm in order to find networks that meet the constraints as well as optimally balance the accuracy-size tradeoff.
130
+
131
+ # 3.4 OPTIMIZATION
132
+
133
+ We now describe the optimization procedure for each our stochastic policies, $\pi _ { \mathrm { r e m o v e } }$ and $\pi _ { \mathrm { s h r i n k } }$ . The procedure is the same for each policy, thus we use $\pi$ in what follows. Each policy network is parameterized by its own $\theta$ .
134
+
135
+ Our objective function is the expected reward over all sequences of actions $a _ { 1 : T }$ , i.e.:
136
+
137
+ We use the REINFORCE policy gradient algorithm from Williams (1992) to train both of our policy networks.
138
+
139
+ $$
140
+ \begin{array} { l } { { \displaystyle \nabla _ { \theta } J ( \theta ) = \nabla _ { \theta } E _ { a _ { 1 : T } \sim P _ { \theta } } ( R ) } } \\ { ~ } \\ { { \displaystyle = \sum _ { t = 1 } ^ { T } E _ { a _ { 1 : T } \sim P _ { \theta } } [ \nabla _ { \theta } \log P _ { \theta } ( a _ { t } | a _ { 1 : ( t - 1 ) } ) R ] } } \\ { { \displaystyle ~ \approx \frac { 1 } { m } \sum _ { k = 1 } ^ { m } \sum _ { t = 1 } ^ { T } [ \nabla _ { \theta } \log P _ { \theta } ( a _ { t } | h _ { t } ) R _ { k } ] } } \end{array}
141
+ $$
142
+
143
+ where $m$ is the number of rollouts for a single gradient update, $T$ is the length of the trajectory, $P _ { \theta } { \left( { a _ { t } } | { h _ { t } } \right) }$ is the probability of selecting action $a _ { t }$ given the hidden state $h _ { t }$ , generated by the current stochastic policy parameterized by $\theta$ and $R _ { k }$ is the reward of the $k ^ { \mathrm { { t h } } }$ rollout.
144
+
145
+ The above is an unbiased estimate of our gradient, but has high variance. A common trick is to use a state-independent baseline function to reduce the variance:
146
+
147
+ $$
148
+ \nabla _ { \theta } J ( \theta ) \approx \frac { 1 } { m } \sum _ { k = 1 } ^ { m } \sum _ { t = 1 } ^ { T } [ \nabla _ { \theta } \log P _ { \theta } ( a _ { t } | h _ { t } ) ( R _ { k } - b ) ]
149
+ $$
150
+
151
+ We use an exponential moving average of the previous rewards as the baseline $b$ . An Actor-Critic policy was also tested. While there was a minor improvement in stability, it failed to explore as effectively in some cases, resulting in a locally optimal solution. Details are in the appendix.
152
+
153
+ # 3.5 KNOWLEDGE DISTILLATION
154
+
155
+ Student models are trained using data labelled by a teacher model. Instead of using hard labels, we use the un-normalized log probability values (the logits) of the teacher model. Training using the logits helps to incorporate dark knowledge (Hinton et al., 2015) that regularizes students by placing emphasis on the relationships learned by the teacher model across all of the outputs.
156
+
157
+ As in Ba & Caruana (2014), the student is trained to minimize the mean $L _ { 2 }$ loss on the training data $\left\{ \left( x ^ { i } , z ^ { i } \right) \right\} _ { i = 1 } ^ { N }$ . Where $z ^ { i }$ are the logits of the teacher model.
158
+
159
+ $$
160
+ \mathcal { L } _ { \mathrm { K D } } ( f ( x ; W ) , z ) = \frac { 1 } { N } \sum _ { i } | | f ( x ^ { ( i ) } ; W ) - z ^ { ( i ) } | | _ { 2 } ^ { 2 }
161
+ $$
162
+
163
+ where W represents the weights of the student network and $f ( x ^ { ( i ) } ; W )$ is the model prediction on the $i ^ { t h }$ training data sample.
164
+
165
+ Final student models were trained to convergence with hard and soft labels using the following loss function.
166
+
167
+ $$
168
+ \mathcal { L } ( \mathcal { W } ) = \mathcal { L } _ { \mathrm { h a r d } } ( f ( x ; W ) , y _ { \mathrm { t r u e } } ) + \lambda * \mathcal { L } _ { \mathrm { K D } } ( f ( x ; W ) , z )
169
+ $$
170
+
171
+ Where $\mathcal { L } _ { \mathrm { h a r d } }$ is the loss function used for training with hard labels (in our case cross-entropy) and $y _ { \mathrm { t r u e } }$ are the ground truth labels.
172
+
173
+ # 4 EXPERIMENTS
174
+
175
+ In the following experiments, we first show that our method is able to find highly compressed student architectures with high performance on multiple datasets and teacher architectures, often exceeding performance of the teacher model. We compare the results obtained to current baseline methods of model compression, showing competitive performance. Then we demonstrate the viability of our method in highly resource constrained conditions by running experiments with strong model size constraints. Finally, we show that it is possible to rapidly speed up training when using larger teacher models by reusing policies that are pretrained on smaller teacher models.
176
+
177
+ Table 1: Summary of Compression results.
178
+
179
+ <table><tr><td colspan="6">MNIST</td></tr><tr><td colspan="6">Architecture</td></tr><tr><td rowspan="2">VGG-13</td><td>Teacher</td><td>Acc. 99.54%</td><td>#Params △Acc.Compr. 9.4M</td><td></td><td></td></tr><tr><td>Student (Stage1)</td><td>99.55%</td><td>73K</td><td>+0.01% 127x</td><td></td></tr><tr><td colspan="6">CIFAR-10</td></tr><tr><td rowspan="3">VGG-19</td><td></td><td>91.97%</td><td>20.2M</td><td></td><td></td></tr><tr><td>Teacher Student (Stage1)</td><td>92.05%</td><td>1.7M</td><td>+0.08% 11.8x</td><td></td></tr><tr><td>Student (Stagel+Stage2)</td><td>91.64%</td><td>984K</td><td>-0.33%</td><td>20.53x</td></tr><tr><td rowspan="3">ResNet-18</td><td></td><td>92.01%</td><td>11.17M</td><td></td><td></td></tr><tr><td>Teacher Student (Stage1)</td><td>91.97%</td><td>2.12M</td><td>-0.04%</td><td>5.26x</td></tr><tr><td>Student (Stagel+Stage2)</td><td>91.81%</td><td>1.00M</td><td>-0.2%</td><td>11.10x</td></tr><tr><td rowspan="3">ResNet-34</td><td>Teacher</td><td>92.05%</td><td>21.28M</td><td></td><td></td></tr><tr><td>Student (Stage1)</td><td>93.54%</td><td>63.87M</td><td>+1.49%</td><td>5.5x</td></tr><tr><td>Student (Stage1+Stage2) 92.35% 2.07M</td><td></td><td></td><td>+0.30%</td><td>10.2x</td></tr><tr><td colspan="6">SVHN</td></tr><tr><td rowspan="3">ResNet-18</td><td>Teacher</td><td>95.24% 11.17M</td><td></td><td></td><td></td></tr><tr><td>Student (Stage1) Student (Stage1+Stage2) 95.38% 564K</td><td></td><td>95.66% 2.24M</td><td>+0.42%</td><td>4.97x</td></tr><tr><td>CIFAR-100</td><td></td><td></td><td>+0.18%</td><td>19.8x</td></tr><tr><td colspan="6"></td></tr><tr><td rowspan="3">ResNet-18</td><td>Teacher</td><td>72.22% 11.22M</td><td></td><td></td><td></td></tr><tr><td>Student (Stage1)</td><td>69.64% 4.76M</td><td></td><td>-2.58%</td><td>2.35x</td></tr><tr><td>Student (Stage1+Stage2)</td><td>68.01%</td><td>2.42M</td><td>-4.21%</td><td>4.64x</td></tr><tr><td rowspan="2">ResNet-34</td><td>Teacher</td><td>72.86%</td><td>21.33M</td><td></td><td></td></tr><tr><td>Student (Stage1)</td><td>70.11%</td><td>4.25M</td><td>-2.75%</td><td>5.02x</td></tr><tr><td colspan="6">Caltech256</td></tr><tr><td rowspan="3">ResNet-18</td><td>Teacher</td><td>47.65%</td><td>11.31M</td><td></td><td></td></tr><tr><td>Student (Stage1)</td><td>44.71% 3.62M</td><td></td><td></td><td>-2.94% 3.12x</td></tr><tr><td>Student (Stage1+Stage2) 44.63% 2.45M</td><td></td><td></td><td>-3.02%</td><td>64.61x</td></tr><tr><td colspan="6">ImageNet32x32</td></tr><tr><td>ResNet-34</td><td>Teacher</td><td>30.87% 21.79M</td><td></td><td></td><td></td></tr><tr><td></td><td>Student (Stage1)</td><td>30.22% 3.34M</td><td></td><td>-0.65%</td><td>6.51x</td></tr></table>
180
+
181
+ # 4.1 DATASETS
182
+
183
+ MNIST The MNIST (LeCun et al., 1998) dataset consists of $2 8 \times 2 8$ pixel grey-scale images depicting handwritten digits. We use the standard 60,000 training images and 10,000 test images for experiments. Although MNIST is easily solved with smaller networks, we used a high capacity models (e.g., VGG-13) to show that the policies learned by our approach are able to effectively and aggressively remove redundancies from large network architectures.
184
+
185
+ CIFAR-10 The CIFAR-10 (Krizhevsky & Hinton, 2009) dataset consists of 10 classes of objects and is divided into 50,000 train and 10,000 test images $3 2 \mathrm { x } 3 2$ pixels). This dataset provides an incremental level of difficulty over the MNIST dataset, using multi-channel inputs to perform model compression.
186
+
187
+ SVHN The Street View House Numbers (Netzer et al., 2011) dataset contains 3232 colored digit images with 73257 digits for training, 26032 digits for testing. This dataset is slightly larger that CIFAR-10 and allows us to observe the performance on a wider breadth of visual tasks.
188
+
189
+ CIFAR-100 To further test the robustness of our approach, we evaluated it on the CIFAR-100 dataset. CIFAR-100 is a harder dataset with 100 classes instead of 10, but the same amount of data, 50,000 train and 10,000 test images (32x32). Since there is less data per class, there is a steeper size-accuracy tradeoff. We show that our approach is able to produce solid results despite these limitations.
190
+
191
+ Caltech-256 To test the effectiveness of our approach in circumstances where data is sparse, we run experiments on the Caltech-256 dataset (Griffin et al., 2007). This dataset contains more classes and less data per class than CIFAR-100, containing 256 classes and a total of 30607 images $( 2 2 4 \mathbf { x } 2 2 4 )$ . We trained the networks from scratch instead of using pretraining in order to standardize our comparisons across datasets.
192
+
193
+ ImageNet32x32 To test the efficiency of our approach, an experiment was conducted on a large scale dataset, ImageNet32x32 (Chrabaszcz et al., 2017). This dataset contains the same training/validation splits as the original ImageNet (Krizhevsky et al., 2012) dataset. It consists of 1.28 million training images and 50,000 validation images with 1000 object classes. However, unlike the original ImageNet dataset which uses $2 2 4 { \mathrm { x } } 2 2 4 { \mathrm { R G B } }$ images, ImageNet32x32 uses 32x32 RGB images, which reduces training time while increasing the difficulty of the task.
194
+
195
+ # 4.2 TRAINING DETAILS
196
+
197
+ In the following experiments, student models were trained as described in Section 3.5. We observed heuristically that 5 epochs was sufficient to compare performance.
198
+
199
+ The layer removal and layer shrinkage policy networks were trained using the Adam optimizer with a learning rate of 0.003 and 0.01 respectively. Both recurrent policy networks were trained using the REINFORCE algorithm (batch size $^ { : = 5 }$ ) with standard backpropagation through time. A grid search was done to determine the ideal learning rate and batch size (details in appendix).
200
+
201
+ # 4.3 COMPRESSION EXPERIMENTS
202
+
203
+ In this section we evaluate the ability of our approach to learn policies to find compressed architectures without any constraints. In the following experiments, we expect that the policies learned by our approach will initially start out as random and eventually tend towards an optimal size-accuracy trade-off which results in a higher reward. Definitions of architectures are available in the appendix.
204
+
205
+ ![](images/b13694a26e9e9e4bc04ca2da035b1dcf2b44e404aacfb104fe819ee81a5bb61e.jpg)
206
+ Figure 3: Student learning on MNIST. Reward, Accuracy, Compression vs Iteration (Top: Stage 1, Bottom: Stage 2)
207
+
208
+ MNIST To evaluate the compression performance we use (1) a Conv4 network consisting of 4 convolutional layers and (2) a high capacity VGG-13 network.
209
+
210
+ Figure 3 shows the results of our compression approach for each teacher network. The lines represent the compression (blue), accuracy (green) and reward (orange). The y-axis represents the score of those quantities, between 0 and 1. The $\mathbf { X }$ -axis is the iteration number. We also highlight the largest and smallest models with red circles to give a sense of the magnitude of compression. This experiment appears to confirm our original expectation that the policies would improve over time.
211
+
212
+ ![](images/156459651a49b48038906e448cb2020faf5fe1cbb170594b9fa9f387594ff757.jpg)
213
+ Figure 4: Student learning on CIFAR-10. Reward, Accuracy, Compression vs Iteration (Top: Stage 1, Bottom: Stage 2)
214
+
215
+ CIFAR-10 On the CIFAR-10 dataset we ran experiments using the following teacher networks: (1) VGG-19, (2) ResNet-18 and (3) ResNet-34 networks. The experimental results are shown in Figure 4. It is interesting to note that on CIFAR-10, our learned student networks perform almost as well or better the teacher networks despite a $1 0 \mathrm { x }$ compression rate.
216
+
217
+ SVHN On the SVHN dataset, we ran experiments using ResNet-18 network as the teacher model. We observed that the reward and compression steadily increased while the accuracy remained stable, confirming similar results to that of CIFAR-10. This is a promising indication that our approach works for a breadth of tasks and isn’t dataset specific. Results are in the appendix.
218
+
219
+ CIFAR-100 We also verified our approach on a harder dataset, CIFAR-100 to show how our approach performs with less data per class (Figure 5). Considering the largely reduced number of parameters, the compressed network achieves reasonably high accuracy. A notable aspect of many of the final compressed models is that ReLU layers within residual blocks were removed. Another interesting result is that the compressed ResNet-34 student model outperforms the ResNet-18 model despite having fewer parameters. This can likely be explained by the increased number of residual blocks in the ResNet-34 model.
220
+
221
+ Caltech-256 The Caltech-256 experiments (appendix) show the performance of our approach when training data is scarce. We would like to verify that our approach does not overly compress the network by overfitting to the small number of training examples. As with the other experiments, the policies appears to learn to maximize reward over time, although the positive trend is not as pronounced due to the lack of training data. This is expected since less data means the reward signal is less robust to sources of noise, which in turn affects training of the policy.
222
+
223
+ ImageNet32x32 We conducted an experiment on the ImageNet32x32 dataset to test the performance of our approach on a large scale dataset. Due to the increased difficulty of this dataset, the teacher model (ResNet-34) achieved a top-1 accuracy of $3 0 . 8 7 \%$ after training for 40 epochs. Despite the difficulty of the dataset, our approach was still able to find a compressed model with similar performance (- $. 0 . 6 5 \%$ drop). The runtime for 100 iterations of the layer removal policy on a ResNet-34 teacher and a batch size of 3 was approximately 272 hours. More details regarding the runtime can be found in Section 12.
224
+
225
+ ![](images/73ae4251ed68d46b78b8fafe7597ee6574aab78f4e72be975e2302560700a117.jpg)
226
+ Figure 5: Student learning on CIFAR-100.
227
+
228
+ # 4.4 BASELINES
229
+
230
+ We compare the performance of our approach to current model compression methods, namely pruning and Knowledge Distillation (with hand-designed model). We note here that compression rate is defined as the ratio of number of parameters instead of number of bits, which some other compression methods (quantization, coding) use. To provide a fair comparison with our method, the same trained teacher models used in our method were used.
231
+
232
+ # 4.4.1 PRUNING
233
+
234
+ Table 2: Pruning (Baseline)
235
+
236
+ <table><tr><td>Model</td><td>Acc.</td><td>#Params</td><td>Compr. △ Acc.</td><td></td></tr><tr><td>Teacher (MNIST/VGG-13)</td><td>99.54%</td><td>9.4M</td><td></td><td></td></tr><tr><td>Pruning</td><td>99.12%</td><td>162K</td><td>58x</td><td>-0.42%</td></tr><tr><td>Ours</td><td>99.55%</td><td>73K</td><td>127x</td><td>+0.01%</td></tr><tr><td>Teacher (CIFAR-10/VGG-19)</td><td>91.97%</td><td>20.2M</td><td></td><td></td></tr><tr><td>Pruning</td><td>91.06%</td><td>2.3M</td><td>8.7x</td><td>-0.91%</td></tr><tr><td>Ours</td><td>92.05%</td><td>1.7M</td><td>11.8x</td><td>+0.08%</td></tr></table>
237
+
238
+ We compare our method to pruning, which is a model compression approach that operates directly on the weight space of a network, removing redundant weights or filters. We perform pruning based on Molchanov et al. (2016), which removes filters using a greedy criteria based approach and then finetunes the network. With pruning, the performance of the final model can vary depending on the degree to which it was pruned. To ensure a fair comparison, we stop pruning when 1. accuracy drops below $1 \%$ of the student model obtained by our method or 2. the number of parameters is less than our method. Pruning is done 5 times to control for variance and the best performing model is reported.
239
+
240
+ The results of this experiment, reported in Table 2, show that while the pruned models show good compression rates, our approach outperforms this baseline on both datasets. These results could indicate that operating on the architecture space of the model might result in more consistent results than using heuristics to operate on the weight space directly.
241
+
242
+ # 4.4.2 KNOWLEDGE DISTILLATION
243
+
244
+ Table 3: Knowledge distillation with hand designed models (Baseline)
245
+
246
+ <table><tr><td>Model</td><td>Acc.</td><td>#Params</td><td>Compr. △ Acc.</td><td></td></tr><tr><td>Teacher (SVHN/ResNet-18)</td><td>95.24%</td><td>11.17M</td><td></td><td></td></tr><tr><td>SqueezeNet1.1</td><td>89.34%</td><td>727K</td><td>15x</td><td>-5.90%</td></tr><tr><td>Ours</td><td>95.38%</td><td>564K</td><td>19.8x</td><td>+0.18%</td></tr><tr><td>Teacher (CIFAR-10/ResNet-18)</td><td>92.01%</td><td>11.17M</td><td></td><td></td></tr><tr><td>FitNet-4</td><td>91.33%</td><td>1.2M</td><td>9.3x</td><td>-0.63%</td></tr><tr><td>VGG-small</td><td>83.93%</td><td>1.06M</td><td>10.5x</td><td>-8.08%</td></tr><tr><td>Ours</td><td>91.81%</td><td>1.00M</td><td>11.0x</td><td>-0.20%</td></tr></table>
247
+
248
+ We also tested the validity of our hypothesis that hand designed models may not be optimal for Knowledge distillation. We compare models generated by our method to hand designed models that contain a similar number of parameters. We perform experiments with 3 hand designed model architectures, FitNet-4, SqueezeNet and a reduced network based on VGG, (VGG-small) which contains 10 layers. These networks were then trained to convergence with Knowledge Distillation on the CIFAR-10 dataset and the SVHN datasets.
249
+
250
+ For the implementation of FitNet-4 (17 layers), we used the same model architecture described in Mishkin & Matas (2015) with the ReLU activation and Xavier initialization. The paper reported a baseline accuracy of 90.63 when trained from scratch and $1 . 2 \mathbf { M }$ parameters (Table 3 in Mishkin & Matas (2015)). For SqueezeNet, we implemented the 1.1 version described in Iandola et al. (2016), which contained 727K parameters after adapting it to CIFAR-10. We benchmarked VGG-small and FitNet on the CIFAR-10 dataset and SqueezeNet on the SVHN dataset in order to provide a fair comparison with our best models in terms of the number of parameters.
251
+
252
+ From the results reported in Table 3, we observe that our method performs better than the handdesigned models on both datasets despite containing fewer parameters. The CIFAR-10 results seem to indicate that model selection is an important factor in Knowledge Distillation. Our model and the FitNet-4 model both outperform the VGG-small model, further confirming our hypothesis that hand-designing models may not be the optimal approach for use with Knowledge Distillation.
253
+
254
+ # 4.5 COMPRESSION WITH SIZE CONSTRAINTS
255
+
256
+ Table 4: Model Compression with Size Constraints
257
+
258
+ <table><tr><td>Model</td><td>Acc.</td><td>#Params</td><td>Compr.</td><td>Constr.</td></tr><tr><td>Teacher (MNIST/VGG-13)</td><td>99.54%</td><td>9.4M</td><td>1x</td><td>N/A</td></tr><tr><td>Student (Stage 1 &amp; 2)</td><td>98.91%</td><td>17K</td><td>553x</td><td>20K</td></tr><tr><td>Teacher (CIFAR-10/VGG-19)</td><td>91.97%</td><td>20.2M</td><td>1x</td><td>N/A</td></tr><tr><td>Student (Stage 1 &amp; 2)</td><td>90.8%</td><td>573K</td><td>35x</td><td>1M</td></tr></table>
259
+
260
+ While the experiments to this point used no explicit constraints, in this experiment, we add a size constraint in terms of the number of parameters via the reward function as in Section 3.3.1. We expect the optimization to be harder because the range of acceptable architectures is reduced.
261
+
262
+ Results are summarized in Table 4. These promising results suggest that the compression policies are able to produce sensible results despite being heavily constrained, thus demonstrating the viability of the approach in practice.
263
+
264
+ # 4.6 TRANSFER LEARNING
265
+
266
+ Naively applying our approach to a new teacher network means that the compression policies must be learned from scratch for each new problem. We would like to know if layer removal and shrinkage policy networks can be reused to accelerate compression for new teacher architectures. In the following experiments, we train a policy on an initial teacher model and then apply it to another teacher model to test whether the policy has learned a general strategy for compressing a network. Since both a pretrained policy and a randomly initialized policy is expected to eventually converge to a locally optimal policy given enough iterations, we provide performance measures over the the first 10 policy update iterations.
267
+
268
+ Table 5: Transfer Learning Performance during first 10 iterations.
269
+
270
+ <table><tr><td></td><td colspan="3">ResNet18→ResNet34</td><td colspan="3">ResNet34→ResNet18</td><td colspan="3">VGG11→VGG19</td></tr><tr><td></td><td></td><td>Reward Comp.</td><td>. Acc.</td><td>Reward Comp. Acc.</td><td></td><td></td><td>Reward Comp. Acc.</td><td></td><td></td></tr><tr><td>Pre-trained</td><td>d 0.81</td><td>78.1%</td><td>79.5%</td><td>0.76</td><td>65.5%</td><td>82.3%</td><td>0.52</td><td>46.0%</td><td>71.7%</td></tr><tr><td>Scratch</td><td>0.50</td><td>34.8%</td><td>82.4%</td><td>0.53</td><td>39.7%</td><td>82.8%</td><td>-0.07</td><td>20.2%</td><td>42.5 %</td></tr></table>
271
+
272
+ Results are summarized in Table 5. The slight drop in accuracy (third subcolumn) in models produced by the pretrained policy is expected due to the tradeoff between compression and accuracy. However, the average reward (first subcolumn) is always higher when we use a pretrained policy. Note that in the VGG experiment, the reward is negative since the non-pretrained policy starts off by producing degenerate models. However, the pretrained policy starts off from a different initialization that does not.
273
+
274
+ This is an important result as it shows promising evidence that we can even transfer learned knowledge from a smaller model to a larger model, rapidly accelerating the policy search procedure on very deep networks.
275
+
276
+ # 5 CONCLUSION
277
+
278
+ We introduced a novel method for compressing neural networks. Our approach employs a two-stage layer removal and layer shrinkage procedure to learn how to compress large neural networks. By leveraging signals for accuracy and compression as supervision, our method efficiently learns to search the space of model architectures. We show that our method performs well over a variety of datasets and architectures. We also observe generalization capabilities of our method through transfer learning, allowing our procedure to be made even more efficient. Our method is also able to incorporate other practical constraints, such as power or inference time, thus showing potential for application in a real world setting.
279
+
280
+ # ACKNOWLEDGEMENTS
281
+
282
+ This work was sponsored in part by IARPA (D17PC00340).
283
+
284
+ # REFERENCES
285
+
286
+ Sajid Anwar, Kyuyeon Hwang, and Wonyong Sung. Structured pruning of deep convolutional neural networks. arXiv preprint arXiv:1512.08571, 2015.
287
+
288
+ Jimmy Ba and Rich Caruana. Do deep nets really need to be deep? In Advances in neural information processing systems, pp. 2654–2662, 2014.
289
+
290
+ Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. arXiv preprint arXiv:1611.02167, 2016.
291
+
292
+ Cristian Bucilu, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 535–541. ACM, 2006.
293
+
294
+ Patryk Chrabaszcz, Ilya Loshchilov, and Frank Hutter. A downsampled variant of imagenet as an alternative to the cifar datasets. arXiv preprint arXiv:1707.08819, 2017.
295
+
296
+ David Cox and Nicolas Pinto. Beyond simple features: A large-scale feature search approach to unconstrained face recognition. In Automatic Face & Gesture Recognition and Workshops (FG 2011), 2011 IEEE International Conference on, pp. 8–15. IEEE, 2011.
297
+
298
+ Jiashi Feng and Trevor Darrell. Learning the structure of deep convolutional networks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2749–2757, 2015.
299
+
300
+ Gregory Griffin, Alex Holub, and Pietro Perona. Caltech-256 object category dataset. 2007.
301
+
302
+ Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient dnns. In Advances In Neural Information Processing Systems, pp. 1379–1387, 2016.
303
+
304
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015a.
305
+
306
+ Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In Advances in Neural Information Processing Systems, pp. 1135–1143, 2015b.
307
+
308
+ Babak Hassibi, David G Stork, and Gregory J Wolff. Optimal brain surgeon and general network pruning. In Neural Networks, 1993., IEEE International Conference on, pp. 293–299. IEEE, 1993.
309
+
310
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
311
+
312
+ Forrest N Iandola, Song Han, Matthew W Moskewicz, Khalid Ashraf, William J Dally, and Kurt Keutzer. Squeezenet: Alexnet-level accuracy with $5 0 \mathrm { x }$ fewer parameters and¡ $0 . 5 \mathrm { m b }$ model size. arXiv preprint arXiv:1602.07360, 2016.
313
+
314
+ Kevin Jarrett, Koray Kavukcuoglu, Yann LeCun, et al. What is the best multi-stage architecture for object recognition? In Computer Vision, 2009 IEEE 12th International Conference on, pp. 2146–2153. IEEE, 2009.
315
+
316
+ Rafal Jozefowicz, Wojciech Zaremba, and Ilya Sutskever. An empirical exploration of recurrent network architectures. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 2342–2350, 2015.
317
+
318
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
319
+
320
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
321
+
322
+ Yann LeCun, John S Denker, Sara A Solla, Richard E Howard, and Lawrence D Jackel. Optimal brain damage. In NIPs, volume 2, pp. 598–605, 1989.
323
+
324
+ Yann LeCun, Corinna Cortes, and Christopher JC Burges. The mnist database of handwritten digits, 1998.
325
+
326
+ Teresa B Ludermir, Akio Yamazaki, and Cleber Zanchettin. An optimization methodology for neural network weights and architectures. IEEE Transactions on Neural Networks, 17(6):1452–1459, 2006.
327
+
328
+ Zelda Mariet and Suvrit Sra. Diversity networks. arXiv preprint arXiv:1511.05077, 2015.
329
+
330
+ Risto Miikkulainen, Jason Liang, Elliot Meyerson, Aditya Rawal, Dan Fink, Olivier Francon, Bala Raju, Arshak Navruzyan, Nigel Duffy, and Babak Hodjat. Evolving deep neural networks. arXiv preprint arXiv:1703.00548, 2017.
331
+
332
+ Dmytro Mishkin and Jiri Matas. All you need is a good init. arXiv preprint arXiv:1511.06422, 2015.
333
+
334
+ Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient inference. 2016.
335
+
336
+ Calvin Murdock, Zhen Li, Howard Zhou, and Tom Duerig. Blockout: Dynamic model selection for hierarchical deep networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2583–2591, 2016.
337
+
338
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS workshop on deep learning and unsupervised feature learning, volume 2011, pp. 5, 2011.
339
+
340
+ Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon Suematsu, Quoc Le, and Alex Kurakin. Large-scale evolution of image classifiers. arXiv preprint arXiv:1703.01041, 2017.
341
+
342
+ Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. Fitnets: Hints for thin deep nets. arXiv preprint arXiv:1412.6550, 2014.
343
+
344
+ Andrew Saxe, Pang W Koh, Zhenghao Chen, Maneesh Bhand, Bipin Suresh, and Andrew Y Ng. On random weights and unsupervised feature learning. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 1089–1096, 2011.
345
+
346
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
347
+
348
+ Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. In Advances in neural information processing systems, pp. 2951–2959, 2012.
349
+
350
+ Jasper Snoek, Oren Rippel, Kevin Swersky, Ryan Kiros, Nadathur Satish, Narayanan Sundaram, Mostofa Patwary, Mr Prabhat, and Ryan Adams. Scalable bayesian optimization using deep neural networks. In International Conference on Machine Learning, pp. 2171–2180, 2015.
351
+
352
+ Suraj Srinivas and R Venkatesh Babu. Data-free parameter pruning for deep neural networks. arXiv preprint arXiv:1507.06149, 2015.
353
+
354
+ Kenneth O Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary computation, 10(2):99–127, 2002.
355
+
356
+ Gregor Urban, Krzysztof J Geras, Samira Ebrahimi Kahou, Ozlem Aslan, Shengjie Wang, Rich Caruana, Abdelrahman Mohamed, Matthai Philipose, and Matt Richardson. Do deep convolutional nets really need to be deep and convolutional? arXiv preprint arXiv:1603.05691, 2016.
357
+
358
+ David Warde-Farley, Andrew Rabinovich, and Dragomir Anguelov. Self-informed neural network structure learning. arXiv preprint arXiv:1412.6563, 2014.
359
+
360
+ Daan Wierstra, Alexander Forster, Jan Peters, and J ¨ urgen Schmidhuber. Recurrent policy gradients. ¨ Logic Journal of IGPL, 18(5):620–634, 2010.
361
+
362
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
363
+
364
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
365
+
366
+ # APPENDIX
367
+
368
+ # 6 ACTOR-CRITIC
369
+
370
+ Policy gradient based Actor-Critic algorithms have been shown to improve the stability of the policy search. This is achieved by replacing the baseline with a learned estimate of the value function at each time step.
371
+
372
+ Formally, with vanilla REINFORCE we have,
373
+
374
+ $$
375
+ \nabla _ { \boldsymbol { \theta } } J ( \boldsymbol { \theta } ) \approx \frac { 1 } { m } \sum _ { k = 1 } ^ { m } \sum _ { t = 1 } ^ { T } [ \nabla _ { \boldsymbol { \theta } } \log P _ { \boldsymbol { \theta } } ( a _ { t } | h _ { t } ) ( R _ { k } - b _ { k } ) ]
376
+ $$
377
+
378
+ In the Actor-Critic algorithm we replace $b _ { k }$ with $V _ { k } ^ { \theta }$ , resulting in a new gradient estimate,
379
+
380
+ $$
381
+ \nabla _ { \boldsymbol { \theta } } J ( \boldsymbol { \theta } ) \approx \frac { 1 } { m } \sum _ { k = 1 } ^ { m } \sum _ { t = 1 } ^ { T } [ \nabla _ { \boldsymbol { \theta } } \log P _ { \boldsymbol { \theta } } ( a _ { t } | h _ { t } ) ( R _ { k } - V _ { k } ^ { \boldsymbol { \theta } } ) ]
382
+ $$
383
+
384
+ We implement the Critic network by adding an additional fully-connected layer that takes as input the hidden state of the LSTM and outputs a single scalar value. Figures 6-7 the results of the experiments performed.
385
+
386
+ ![](images/7074e9df4c49ee87b50190d86386f2f25c211b10553f94d82662a3cee13f27d7.jpg)
387
+ Figure 6: MNIST Left: Actor-critic Right: REINFORCE, averaged over 3 runs
388
+
389
+ ![](images/b17d932b16361feddd051f9d170a3c75befff3442b3af0bd3dd7c10ac1c222de.jpg)
390
+ Figure 7: CIFAR-10 Left: Actor-critic Right: REINFORCE, averaged over 3 runs
391
+
392
+ For the MNIST dataset, our results show that there is a slight improvement in stability, although they both converge at a similar rate.
393
+
394
+ For the CIFAR-10 dataset, although the Actor-critic version was more stable, it did not perform as well as the vanilla REINFORCE algorithm.
395
+
396
+ # 7 LEARNING RATE AND BATCH SIZE
397
+
398
+ The learning rate and batch size were selected via a grid search. The following graphs show the rate of convergence for different learning rates and batch sizes.
399
+
400
+ # 7.1 LEARNING RATE
401
+
402
+ In order to determine the learning rate, we performed a grid search over 0.03, 0.003, 0.0003. We performed this grid search on the MNIST dataset using the VGG-13 network to save time. For the stage-1 policy, it was observed that $_ { \mathrm { l r = 0 . 0 3 } }$ did not converge while $\scriptstyle 1 \mathrm { r } = 0 . 0 0 0 3$ converged too slowly. Thus we used $\scriptstyle 1 \mathrm { r } = 0 . 0 0 3$ as the learning rate.
403
+
404
+ ![](images/e81925cf3b855c3b9ada0a3a5ad9f6cae13ebcfe98c7827cd16194e6507441cd.jpg)
405
+ Figure 8: Average reward over 3 runs for various learning rates on the MNIST dataset
406
+
407
+ # 7.2 BATCH SIZE
408
+
409
+ Similarly we performed a grid search to determine the optimal batch size over 1, 5, 10. A batch size of 1 was too unstable while a batch size of 10 offered no substantial improvements to justify the additional computation. Thus we observed that a batch size of 5 worked the best.
410
+
411
+ ![](images/6a61abd58bafa44e0225d7dc414bdef0ba2cb96614f4c8b311425c5dfc740967.jpg)
412
+ Figure 9: Average reward over 3 runs for batch sizes Left: 1, Middle: 5, Right: 10 on the MNIST dataset
413
+
414
+ # 8 TRANSFER LEARNING EXPERIMENTS
415
+
416
+ Below are the results of the transfer learning experiments, as observed, the pretrained policies start off with a high reward unlike the policies trained from scratch.
417
+
418
+ ![](images/a8fd4d223af6985eeadb5db2e039d3df78532441e4fdd269239a927d56b53397.jpg)
419
+ Figure 10: Transfer learning experiments
420
+
421
+ # 9 ADDITIONAL EXPERIMENTS
422
+
423
+ The following section contains results about additional compression experiments that were conducted.
424
+
425
+ ![](images/a6a110550cfe01d050c64692cd3201d96cbc3d80e316b03ed85ed32df937b3c3.jpg)
426
+ Figure 11: ResNet-18 experiments on SVHN, (Left: Stage 1, Right: Stage 2)
427
+
428
+ ![](images/941c13e1e544894790036473e20166058c2c7db0052bd427d393e0138ba6948e.jpg)
429
+ Figure 12: ResNet-18 experiments on Caltech, (Left: Stage 1, Right: Stage 2)
430
+
431
+ # 10 IMPLEMENTATION DETAILS
432
+
433
+ The following section contains the implementation details required to replicate the experiments. All of the experiments were implemented in PyTorch with 1 NVIDIA TitanX GPU.
434
+
435
+ ![](images/93e3983f27fea08cd4906a6875de05052ee41021acf95f66aa3ae5ebfbf2bd1e.jpg)
436
+ Figure 13: Stage1 ResNet-34 experiments on ImageNet32x32
437
+
438
+ # 10.1 POLICIES
439
+
440
+ Removal policy The removal policy was implemented with 2 hidden layers and 30 hidden units and trained with the Adam optimizer and a learning rate of 0.003. The shrinkage policy was implemented with 2 hidden layers and 50 hidden units and trained with the Adam optimizer and with a learning rate of 0.1. These policies were each trained for at least 100 epochs for each experiment. Batch size of 5 rollouts was used.
441
+
442
+ # 10.2 TEACHER MODELS
443
+
444
+ MNIST Teacher models for MNIST were trained for 50 epochs with a starting learning rate of 0.01.
445
+ The learning rate is reduced by a factor of 10 in the 30th epoch. A batch size of 64 was used.
446
+
447
+ CIFAR-10/100 Teacher models for CIFAR-10/100 were trained for 150 epochs with a starting learning rate of 0.001. The learning rate is decreased by a factor of 10 in the 80th and 120th epochs. Standard data augmentation with horizontal mirroring $\scriptstyle ( \mathrm { p } = 0 . 5 )$ , random cropping with padding of 4 pixels and mean subtraction of (0.5, 0.5, 0.5). A batch size of 128 was used.
448
+
449
+ SVHN Teacher models for SVHN were trained for 150 epochs with a starting learning rate of 0.001. The learning rate is decreased by a factor of 10 in the 80th and 120th epochs. Mean subtraction of (0.5, 0.5, 0.5) and a batch size of 128 was used.
450
+
451
+ Caltech256 To make the experiments controlled over all datasets the Caltech256 models were trained from scratch. It is to be noted that Caltech256 models are usually initialized with pre-trained ImageNet weights since data is sparse. The training procedure consisted of 50 epochs with an initial learning rate of 0.01. It was reduced to 0.001 after the 50th epoch. Data augmentation such as horizontal flipping and random cropping alongside mean subtraction was used. ImageNet32x32 The ResNet-34 teacher model for the ImageNet32x32 experiment was trained using a method similar to that described in Chrabaszcz et al. (2017). It was trained for 40 epochs with a starting learning rate of 0.01. The learning rate was reduced by a factor of 5.0 every 10 epochs. Mean subtraction was used with a batch size of 128.
452
+
453
+ # 11 REWARD DESIGN
454
+
455
+ In this section we go into greater detail regarding the design of the chosen reward function compared to a naive reward. For our objective of model compression, we want the reward to reflect the following qualitative heuristics.
456
+
457
+ 1. A model with $\uparrow$ compression but $\downarrow$ accuracy should be penalized more than a model with ↓ compression and $\uparrow$ accuracy. Since we do not want to produce highly compressed models which do not perform well on the task, we do not want to let the compression score dominate the reward.
458
+
459
+ 2. The reward function should montonically increase with both compression and accuracy.
460
+
461
+ Defining a naive, symmetrical reward function results in the following failure case. Suppose we define our reward as:
462
+
463
+ $$
464
+ R = A * C
465
+ $$
466
+
467
+ where $A , C$ are the relative validation accuracy and compression achieved by the student model. Let us consider the following 2 cases:
468
+
469
+ 1. $\uparrow$ accuracy, $\downarrow$ compression. $\mathbf A = 1$ , $C = 0 . 2 5$
470
+ 2. ↓ accuracy, $\uparrow$ compression. $\mathbf { A } = 0 . 2 5 , \mathbf { C } = 1$
471
+
472
+ In both cases $R = A * C = 0 . 2 5$ , which we do not want. If we use the reward function defined in the paper we get a reward of 0.25 and 0.4375 for each of the cases, which is closer to our true objective. In our empirical experiments, the non-linear reward outperformed the naive one. Other more complex reward functions that respect the above criteria may also work well.
473
+
474
+ The visualization of the reward manifold in Figure 14 better illustrates the difference. As observed, a naive reward function is symmetric while our reward function returns a lower reward for low accuracy, high compression models compared to high accuracy, low compression models. Both functions are monotonically increasing.
475
+
476
+ ![](images/d0a6d064f55e93c61fd3dc020caadddaac9649e52cad65213e39d264c5ede48e.jpg)
477
+ Figure 14: Reward manifold of naive reward vs. our reward
478
+
479
+ # 11.2 DEGENERATE CASES
480
+
481
+ The following section outlines a few of the cases which are considered degenerate and for which a fixed reward of -1 is assigned.
482
+
483
+ 1. Empty architecture - Depending on how it is implemented, the policies could possibly output ”remove” actions for each layer during the layer removal stage. In this case, the output would be an empty architecture with no trainable parameters. 2. Large FC layer - If too many layers are removed in the feature extraction portion of the convolutional neural network, the size of the feature map before the fully connected layers would be large. In this case, although we have a well defined reward, training the network could be impractical 3. Specialized architectures - When dealing with more complex architectures, there may be inter-layer dependencies which impose certain requirements. For example, in a ResNet, the dimensionality of the feature maps at the start and end of each residual block has to match.
484
+
485
+ # 12 TOTAL TRAINING TIME
486
+
487
+ To give the reader an approximate estimate of the time taken to train the policies, we have included Table 6 which shows the time taken to train a layer removal policy for 100 iterations. These experiments were done in PyTorch with a single NVIDIA TitanX GPU and an Intel Xeon E5-2660
488
+
489
+ Table 6: Training time of Layer Removal policy (100 iterations)
490
+
491
+ <table><tr><td rowspan=1 colspan=1>Architecture Time (hrs)</td></tr><tr><td rowspan=1 colspan=1>MNIST</td></tr><tr><td rowspan=1 colspan=1>VGG-13 4</td></tr><tr><td rowspan=1 colspan=1>CIFAR-10</td></tr><tr><td rowspan=1 colspan=1>VGG-19 17ResNet-18 17ResNet-34 54</td></tr><tr><td rowspan=1 colspan=1>SVHN</td></tr><tr><td rowspan=1 colspan=1>ResNet-18 22</td></tr><tr><td rowspan=1 colspan=1>CIFAR-100</td></tr><tr><td rowspan=1 colspan=1>ResNet-18 20ResNet-34 55</td></tr><tr><td rowspan=1 colspan=1>Caltech256</td></tr><tr><td rowspan=1 colspan=1>ResNet-18 175</td></tr><tr><td rowspan=1 colspan=1>ImageNet32x32</td></tr><tr><td rowspan=1 colspan=1>ResNet-34 (batch_size=3) 272</td></tr></table>
492
+
493
+ CPU. We note that runtime varies based on many factors such as hardware, machine usage and the inherent stochasticity in the approach. The times listed are simply an approximate estimate to how long the method takes on average.
494
+
495
+ # 13 FUTURE DIRECTIONS
496
+
497
+ This paper introduces a general method to generate an architecture that optimizes the size-capacity trade-off with respect to a particular task. The current limitation with this method is that we need to train each student model for a few epochs to determine a reward for it. This step can be computationally expensive depending on the dataset. Results from Saxe et al. (2011), Jarrett et al. (2009) and Cox & Pinto (2011) seem to suggest that initializing models with random weights could be an efficient way to evaluate architectures provided the right non-linearities and pooling are used. Another way to provide a better initialization could be to use a hypernetwork which takes the student model architecture as input and produces weights for the model. Other methods that select an informative subset of the training and test dataset to efficiently evaluate the network could also be interesting to explore. Another interesting direction would be to use the pretrained policies for transfer learning on different architecture search problems (apart from compression) to see if any generalizable information about deep architectures is being learned.
md/train/B1l2bp4YwS/B1l2bp4YwS.md ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WHAT GRAPH NEURAL NETWORKS CANNOT LEARN: DEPTH VS WIDTH
2
+
3
+ Andreas Loukas Ecole Polytechnique F ´ ed´ erale Lausanne ´ andreas.loukas@epfl.ch
4
+
5
+ # ABSTRACT
6
+
7
+ This paper studies the expressive power of graph neural networks falling within the message-passing framework $( G N N _ { \mathsf { m p } } )$ . Two results are presented. First, $\mathsf { G N N } _ { \mathsf { m p } }$ are shown to be Turing universal under sufficient conditions on their depth, width, node attributes, and layer expressiveness. Second, it is discovered that $\mathsf { G N N } _ { \mathsf { m p } }$ can lose a significant portion of their power when their depth and width is restricted. The proposed impossibility statements stem from a new technique that enables the repurposing of seminal results from distributed computing and leads to lower bounds for an array of decision, optimization, and estimation problems involving graphs. Strikingly, several of these problems are deemed impossible unless the product of a $\mathsf { G N N } _ { \mathsf { m p } }$ ’s depth and width exceeds a polynomial of the graph size; this dependence remains significant even for tasks that appear simple or when considering approximation.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ A fundamental question in machine learning is to determine what a model can and cannot learn. In deep learning, there has been significant research effort in establishing expressivity results for feedforward (Cybenko, 1989; Hornik et al., 1989; Lu et al., 2017) and recurrent neural networks (Neto et al., 1997), as well as more recently for Transformers and Neural GPUs (Perez et al., 2019). ´ We have also seen the first results studying the universality of graph neural networks, i.e., neural networks that take graphs as input. Maron et al. (2019b) derived a universal approximation theorem over invariant functions targeted towards deep networks whose layers are linear and equivariant to permutation of their input. Universality was also shown for equivariant functions and a particular shallow architecture (Keriven & Peyre, 2019). ´
12
+
13
+ Universality statements allow us to grasp the expressive power of models in the limit. In theory, given enough data and the right training procedure, a universal network will be able to solve any task that it is presented with. Nevertheless, the insight brought by such results can also be limited. Knowing that a sufficiently large network can be used to solve any problem does not reveal much about how neural networks should be designed in practice. It also cannot guarantee that said network will be able to solve a given task given a particular training procedure, such as stochastic gradient descent.
14
+
15
+ On the other hand, it might be easier to obtain insights about models by studying their limitations. After all, the knowledge of what cannot be computed (and thus learned) by a network of specific characteristics applies independently of the training procedure. Further, by helping us comprehend the difficulty of a task in relation to a model, impossibility results can yield practical advice on how to select model hyperparameters. Take, for instance, the problem of graph classification. Training a graph classifier entails identifying what constitutes a class, i.e., finding properties shared by graphs in one class but not the other, and then deciding whether new graphs abide to said learned properties. However, if the aforementioned decision problem is shown to be impossible by a graph neural network of certain depth then we can be certain that the same network will not learn how to classify a sufficiently diverse test set correctly, independently of which learning algorithm is employed. We should, therefore, focus on networks deeper that the lower bound when performing experiments.
16
+
17
+ Table 1: Summary of main results. Subgraph verification\* entails verifying one of the following predicates for a given subgraph: is connected, contains a cycle, forms a spanning tree, is bipartite, is a cut, is an $^ { s - t }$ cut. All problems are defined in Appendix A.
18
+
19
+ <table><tr><td>problem</td><td>bound</td><td>problem</td><td>bound</td></tr><tr><td>cycle detection (odd)</td><td>dw = Ω(n/log n)</td><td>shortest path</td><td>dw = Ω(√n/log n)</td></tr><tr><td>cycle detection (even)</td><td>dw = Ω(√n/log n)</td><td>max. indep.set</td><td>dw = Ω(n²/log² n) for w = O(1)</td></tr><tr><td>subgraph verification*</td><td>d√w = Ω(√n/ log n)</td><td>min.vertex cover</td><td>dw = Ω(n²/log²n) for w = O(1)</td></tr><tr><td>min. spanning tree</td><td>d√w = Ω(√n/log n)</td><td>perfect coloring</td><td>dw = Ω(n²/log²n) for w = O(1)</td></tr><tr><td>min. cut</td><td>d√w = Ω(√n/log n)</td><td>girth 2-approx.</td><td>dw = Ω(√n/log n)</td></tr><tr><td>diam.computation</td><td>dw = Ω(n/log n)</td><td>diam. 3/2-approx.</td><td>dw = Ω(√n/log n)</td></tr></table>
20
+
21
+ # 1.1 MAIN RESULTS
22
+
23
+ This paper studies the expressive power of message-passing graph neural networks $( G N N _ { \mathsf { m p } } )$ ) (Gilmer et al., 2017). This model encompasses several state-of-the-art networks, including GCN (Kipf & Welling, 2016), gated graph neural networks (Li et al., 2015), molecular fingerprints (Duvenaud et al., 2015), interaction networks (Battaglia et al., 2016), molecular convolutions (Kearnes et al., 2016), among many others. Networks using a global state (Battaglia et al., 2018) or looking at multiple hops per layer (Morris et al., 2019; Liao et al., 2019; Isufi et al., 2020) are not directly $\mathsf { G N N } _ { \mathsf { m p } }$ , but they can often be re-expressed as such. The provided contributions are two-fold:
24
+
25
+ I. What $\mathsf { G N N } _ { \mathsf { m p } }$ can compute. Section 3 derives sufficient conditions such that a $G N N _ { \mathsf { m p } }$ can compute any function on its input that is computable by a Turing machine. This result compliments recent universality results (Maron et al., 2019b; Keriven & Peyre, 2019) that considered approximation ´ (rather than computability) over specific classes of functions (permutation invariant and equivariant) and particular architectures. The claim follows in a straightforward manner by establishing the equivalence of $\mathsf { G N N } _ { \mathsf { m p } }$ with LOCAL (Angluin, 1980; Linial, 1992; Naor & Stockmeyer, 1993), a classical model in distributed computing that is itself Turing universal. In a nutshell, $\mathsf { G N N } _ { \mathsf { m p } }$ are shown to be universal if four strong conditions are met: there are enough layers of sufficient expressiveness and width, and nodes can uniquely distinguish each other. Since Turing universality is a strictly stronger property than universal approximation, Chen et al. (2019)’s argument further implies that a Turing universal $\mathsf { G N N } _ { \mathsf { m p } }$ can solve the graph isomorphism problem (a sufficiently deep and wide network can compute the isomorphism class of its input).
26
+
27
+ II. What $\mathsf { G N N } _ { \mathsf { m p } }$ cannot compute (and thus learn). Section 4 analyses the implications of restricting the depth $d$ and width $w$ of $\mathsf { G N N } _ { \mathsf { m p } }$ that do not use a readout function. Specifically, it is proven that $G N N _ { \mathsf { m p } }$ lose a significant portion of their power when the product $d w$ , which I call capacity, is restricted. The analysis relies on a new technique that enables repurposing impossibility results from the context of distributed computing to the graph neural network setting. Specifically, lower bounds for the following problems are presented: (i) detecting whether a graph contains a cycle of specific length; (ii) verifying whether a given subgraph is connected, contains a cycle, is a spanning tree, is bipartite, is a simple path, corresponds to a cut or Hamiltonial cycle; (iii) approximating the shortest path between two nodes, the minimum cut, and the minimum spanning tree; (iv) finding a maximum independent set, a minimum vertex cover, or a perfect coloring; (v) computing or approximating the diameter and girth. The bounds are summarized in Table 1 and the problem definitions can be found in Appendix A. Section 5 presents some empirical evidence of the theory.
28
+
29
+ Though formulated in a graph-theoretic sense, the above problems are intimately linked to machine learning on graphs. Detection, verification, and computation problems are relevant to classification: knowing what properties of a graph a $G N N _ { \mathsf { m p } }$ cannot see informs us also about which features of a graph can it extract. Further, there have been attempts to use $\mathsf { G N N } _ { \mathsf { m p } }$ to devise heuristics for graph-based optimization problems (Khalil et al., 2017; Battaglia et al., 2018; Li et al., 2018; Joshi et al., 2019; Bianchi et al., 2019), such as the ones discussed above. The presented results can then be taken as a worst-case analysis for the efficiency of $G N N _ { \mathsf { m p } }$ in such endeavors.
30
+
31
+ # 1.2 DISCUSSION
32
+
33
+ The results of this paper carry several intriguing implications. To start with, it is shown that the capacity dw of a $G N N _ { m p }$ plays a significant role in determining its power. Solving many problems is shown to be impossible unless $d w = \tilde { \Omega } ( n ^ { \delta } )$ , where $\delta \in [ 1 / 2 , 2 ]$ , $n$ is the number of nodes of the graph, and $f ( n ) = { \tilde { \Omega } } ( g ( n ) )$ is interpreted as $f ( n )$ being, up to logarithmic factors, larger than $g ( n )$ as $n$ grows. This reveals a direct trade-off between the depth and width of a graph neural network. Counter-intuitively, the dependence on n can be significant even if the problem appears local in nature or one only looks for approximate solutions. For example, detecting whether $G$ contains a short cycle of odd length cannot be done unless $d w = \tilde { \Omega } ( n )$ . Approximation helps, but only to a limited extent; computing the graph diameter requires $\Dot { d w } = \tilde { \Omega } ( n )$ and this reduces to $d w = \tilde { \Omega } ( \sqrt { n } )$ for any $^ 3 / 2$ -factor approximation. Further, it is impossible to approximate within any constant factor the shortest path, the minimum cut, and the minimum spanning tree, all three of which have polynomial-time solutions, unless $d \sqrt { w } = \tilde { \Omega } ( \sqrt { n } )$ . Finally, for truly hard problems, the capacity may even need to be super-linear on $n$ . Specifically, it is shown that, even if the layers of the $G N N _ { \mathsf { m p } }$ are allowed to take exponential time, solving certain NP-hard problems necessitates $d = \tilde { \Omega } ( n ^ { 2 } )$ depth for any constant-width network.
34
+
35
+ Relation to previous impossibility results. In contrast to universality (Maron et al., 2019b; Keriven & Peyre, 2019), the limitations of ´ $\mathsf { G N N } _ { \mathsf { m p } }$ have been much less studied. In particular, the bounds presented here are the first impossibility results that (i) explicitly connect $\mathsf { G N N } _ { \mathsf { m p } }$ properties (depth and width) with graph properties and that (ii) go beyond isomorphism by addressing decision, optimization, and estimation graph problems. Three main directions of related work can be distinguished. First, Dehmamy et al. (2019) bounded the ability of graph convolutional networks (i.e., $\mathsf { G N N } _ { \mathsf { m p } }$ w/o messaging functions) to compute specific polynomial functions of the adjacency matrix, referred to as graph moments by the authors. Second, Xu et al. (2018) and Morris et al. (2019) established the equivalence of anonymous $\mathsf { G N N } _ { \mathsf { m p } }$ (those that do not rely on node identification) to the Weisfeiler-Lehman (WL) graph isomorphism test. The equivalence implies that anonymous networks are blind to the many graph properties that WL cannot see: e.g., any two regular graphs with the same number of nodes are identical from the perspective of the WL test (Arvind et al., 2015; Kiefer et al., 2015). Third, in parallel to this work, Sato et al. (2019) utilized a connection to LOCAL to derive impossibility results for the ability of a class of novel partially-labeled $G N N _ { \mathsf { m p } }$ to find good approximations for three NP-hard optimization problems. Almost all of the above negative results occur due to nodes being unable to distinguish between neighbors at multiple hops (see Appendix D). With discriminative attributes $\mathsf { G N N } _ { \mathsf { m p } }$ become significantly more powerful (without necessarily sacrificing permutation in/equivariance). Still, as this work shows, even in this setting certain problems remain impossible when the depth and width of the $\mathsf { G N N } _ { \mathsf { m p } }$ is restricted. For instance, though cycles can be detected (something impossible in anonymous networks ( $\mathrm { { X u } }$ et al., 2018; Morris et al., 2019)), even for short cycles one now needs $d w = \tilde { \Omega } ( n )$ . Further, in contrast to Sato et al. (2019), an approximation ratio below 2 for the minimum vertex cover is not impossible, but necessitates $d w = \tilde { \Omega } ( n ^ { 2 } )$ .
36
+
37
+ Limitations. First, all lower bounds are of a worst-case nature: a problem is deemed impossible if there exists a graph for which it cannot be solved. The discovery of non worst-case capacity bounds remains an open problem. Second, rather than taking into account specific parametric functions, each layer is assumed to be sufficiently powerful to compute any function of its input. This strong assumption does not significantly limit the applicability of the results, simply because all lower bounds that hold with universal layers also apply to those that are limited computationally. Lastly, it will be assumed that nodes can uniquely identify each other. Node identification is compatible with permutation invariance/equivariance as long as the network output is asked to be invariant to the particular way the ids have been assigned. In the literature, one-hot encoded node ids are occasionally useful (Kipf & Welling, 2016; Berg et al., 2017). When attempting to learn functions across multiple graphs, ids should be ideally substituted by sufficiently discriminative node attributes (attributes that uniquely identify each node within each receptive field it belongs to can serve as ids). Nevertheless, similar to the unbounded computation assumption, if a problem cannot be solved by a graph neural network in the studied setting, it also cannot be solved without identifiers and discriminative attributes. Thus, the presented lower bounds also apply to partially and fully anonymous networks.
38
+
39
+ Notation. I consider connected graphs $G = ( \nu , \mathcal { E } )$ consisting of $n = | \nu |$ nodes. The edge going from $v _ { j }$ to $v _ { i }$ is written as $e _ { i j }$ and it is asserted that if $e _ { i j } \in \mathcal { E }$ then also $e _ { j i } \in \mathcal { E }$ . The neighborhood ${ \mathcal { N } } _ { i }$ of a node $v _ { i } \in \mathcal V$ consists of all nodes $v _ { j }$ for which $e _ { i j } \in \mathcal { E }$ . The degree of $v _ { i }$ is denoted by $\deg _ { i }$ , $\Delta$ is the maximum degree of all nodes and the graph diameter $\delta _ { G }$ is the length of the longest shortest path between any two nodes. In the self-loop graph $G ^ { * } = ( \nu , { \mathcal { E } } ^ { * } )$ , the neighborhood set of $v _ { i }$ is given by ${ \mathcal { N } } _ { i } ^ { * } = { \mathcal { N } } _ { i } \cup v _ { i }$ .
40
+
41
+ # 2 THE GRAPH NEURAL NETWORK COMPUTATIONAL MODEL
42
+
43
+ Graph neural networks are parametric and differentiable learning machines. Their input is usually an attributed graph $G _ { a } = ( G , ( a _ { i } : v _ { i } \in \mathcal { V } )$ , $( a _ { i j } : e _ { i j } \in \mathcal { E } )$ ), where vectors $a _ { 1 } , \ldots , a _ { n }$ encode relevant node attributes and $a _ { i j }$ are edge attributes, e.g., encoding edge direction.
44
+
45
+ Model 1 formalizes the graph neural network operation by placing it in the message passing model (Gilmer et al., 2017). The computation proceeds in layers, within which a message $m _ { i j }$ is passed along each directed edge $e _ { i j } \in \mathcal { E }$ going from $v _ { j }$ to $v _ { i }$ and each node updates its internal representation by aggregating its state with the messages sent by its incoming neighbors $v _ { j } \in \mathcal N _ { i }$ . The network output can be either of two things: a vector $x _ { i }$ for each node $v _ { i }$ or a single vector $x _ { G }$ obtained by combining the representations of all nodes using a readout function. Vectors $x _ { i } / x _ { G }$ could be scalars (node/graph regression), binary variables (node/graph classification) or multi-dimensional (node/graph embedding). I use the symbols $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ and $G N N _ { \mathrm { m p } } ^ { \mathrm { g } }$ to distinguish between models that return a vector per node and one per graph, respectively.
46
+
47
+ <table><tr><td>Computational model 1 Message passing graph neural network (GNNmp)</td><td></td></tr><tr><td></td><td rowspan="3"></td></tr><tr><td>forlayerl=1,...,d do for every edge ei←j ∈ ε* (in parallel) do</td></tr><tr><td>(e) MsGe xi (l-1) ,x (l-1) mij ,Ui,Uj,ai←j)</td></tr></table>
48
+
49
+ The operation of a $\mathsf { G N N } _ { \mathsf { m p } }$ is primarily determined by the messaging, update, and readout functions. I assume that $\mathbf { M } \mathbf { S } \mathbf { G } _ { \ell }$ and $\mathrm { U } \mathrm { P } _ { \ell }$ are general functions that act on intermediate node representations and node ids (the notation is overloaded such that $v _ { i }$ refers to both the $i$ -th node as well as its unique id). As is common in the literature (Lu et al., 2017; Battaglia et al., 2018), these functions are instantiated by feed-forward neural networks. Thus, by the universal approximation theorem and its variants (Cybenko, 1989; Hornik et al., 1989), they can approximate any general function that maps vectors onto vectors, given sufficient depth and/or width. Function READ is useful when one needs to retrieve a representation that is invariant of the number of nodes. The function takes as an input a multiset, i.e., a set with possibly repeating elements, and returns a vector. Commonly, READ is chosen to be a dimension squashing operator, such as a sum or a histogram, followed by a feed-forward neural network $\mathrm { { X u } }$ et al., 2018; Seo et al., 2019).
50
+
51
+ Depth and width. The depth $d$ is equal to the number of layers of the network. Larger depth means that each node has the opportunity to learn more about the rest of the graph (i.e., it has a larger receptive field). The width $w$ of a $G N N _ { \mathsf { m p } }$ is equal to the largest dimension of state $x _ { i } ^ { ( l ) }$ over all layers $l$ and nodes $v _ { i } \in \mathcal V$ . Since nodes need to be able to store their own unique ids, in the following it is assumed that each variable manipulated by the network is represented in finite-precision using $p = \Theta ( \log n )$ bits (though this is not strictly necessary for the analysis).
52
+
53
+ # 3 SUFFICIENT CONDITIONS FOR TURING UNIVERSALITY
54
+
55
+ This section studies what graph neural networks can compute. It is demonstrated that, even without readout function, a network is computationally universal1 if it has enough layers of sufficient
56
+
57
+ width, nodes can uniquely distinguish each other, and the functions computed within each layer are sufficiently expressive. The derivation entails establishing that $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ is equivalent to LOCAL, a classical model used in the study the distributed algorithms that is itself Turing universal.
58
+
59
+ # 3.1 THE LOCAL COMPUTATIONAL MODEL
60
+
61
+ A fundamental question in theoretical computer science is determining what can and cannot be computed efficiently by a distributed algorithm. The LOCAL model, initially studied by Angluin (1980), Linial (1992), and Naor & Stockmeyer (1993), provides a common framework for analyzing the effect of local decision. Akin to $G N N _ { \mathsf { m p } }$ , in LOCAL a graph plays a double role: it is both the input of the system and captures the network topology of the distributed system that solves the problem. In this spirit, the nodes of the graph are here both the machines where computation takes place as well as the variables of the graph-theoretic problem we wish to solve—similarly, edges model communication links between machines as well as relations between nodes. Each node $v _ { i } \in \mathcal V$ is given a problem-specific local input and has to produce a local output. The input contains necessary the information that specifies the problem instance. All nodes execute the same algorithm, they are fault-free, and they are provided with unique identifiers.
62
+
63
+ A pseudo-code description is given in Model 2. Variables $s _ { i } ^ { ( l ) }$ and s(l)i←j refer respectively to the state of $v _ { i }$ in round $l$ and to the message sent by $v _ { j }$ to $v _ { i }$ in the same round. Both are represented as strings. The computation starts simultaneously and unfolds in synchronous rounds $l = 1 , \ldots , d$ Three things can occur within each round: each node receives a string of unbounded size from its incoming neighbors; each node updates its internal state by performing some local computation; and each node sends a string to every one of its outgoing neighbors. Functions $\mathbf { A L G } _ { l } ^ { 1 }$ and $\dot { \mathrm { A L G } } _ { l } ^ { 2 }$ are algorithms computed locally by a Turing machine running on node $v _ { i }$ . Before any computation is done, each node $v _ { i }$ is aware of its own attribute $a _ { i }$ as well as of all edge attributes $\{ \bar { a } _ { i j } : \overline { { v _ { j } } } \in \mathcal { N } _ { i } ^ { * } \}$
64
+
65
+ <table><tr><td>Computational model 2 LOCAL (computed distributedly by each node Ui ∈ V).</td></tr><tr><td>Initialization: Set s (0) = (ai, Ui) and sj (0) = (aj,Uj) for all ei←j ∈ε.</td></tr><tr><td>for roundl=1,...,d do Receive S←j (e-1) from Uj ∈N*,compute</td></tr><tr><td>s(=ALl({(s),i):Nt},u),</td></tr><tr><td>and send s() = ALG² (s,ui) to Uj ∈N.</td></tr></table>
66
+
67
+ In LOCAL, there are no restrictions on how much information a node can send at every round.
68
+ Asserting that each message $s _ { i j } ^ { ( \ell ) }$ is at most $b$ bits yields the CONGEST model (Peleg, 2000).
69
+
70
+ # 3.2 TURING UNIVERSALITY
71
+
72
+ The reader might have observed that LOCAL resembles closely $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ in its structure, with only a few minor differences: firstly, whereas a LOCAL algorithm A may utilize messages in any way it chooses, a $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ network $\mathsf { N }$ always sums received messages before any local computation. The two models also differ in the arguments of the messaging function and the choice of information representation (string versus vector). Yet, as the following theorem shows, the differences between $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ and LOCAL are inconsequential when seen from the perspective of their expressive power:
73
+
74
+ Theorem 3.1 (Equivalence). Let $N _ { \ell } ( G _ { a } )$ be the binary representation of the state $( x _ { 1 } ^ { ( \ell ) } , \ldots , x _ { n } ^ { ( \ell ) } )$ of a $G N N _ { m p } ^ { n }$ network N and $\mathbf { \delta A } _ { \ell } ( G _ { a } ) = ( s _ { 1 } ^ { ( \ell ) } , \ldots , s _ { n } ^ { ( \ell ) } )$ that of a LOCAL algorithm A. If $\mathbf { M } \mathbf { S } \mathbf { G } _ { \ell }$ and $\mathrm { U P } _ { \ell }$ are Turing complete functions, then, for any algorithm $A$ there exists $N$ (resp. for any N there exists $A$ ) such that
75
+
76
+ $\pmb { A } _ { \ell } ( G _ { a } ) = N _ { \ell } ( G _ { a } )$ for every layer $\ell$ and $G _ { a } \in \mathcal { G } _ { a }$ where ${ \mathcal { G } } _ { a }$ is the set of all attributed graphs.
77
+
78
+ This equivalence enables us to reason about the power of $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ by building on the well-studied properties of LOCAL. In particular, it is well known in distributed computing that, as long as the number of rounds $d$ of a distributed algorithm is larger than the graph diameter $\delta _ { G }$ , every node in a LOCAL can effectively make decisions based on the entire graph (Linial, 1992). Together with Theorem 3.1, the above imply that, if computation and memory are not an issue, one may construct a $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ that effectively computes any computable function w.r.t. its input.
79
+
80
+ Corollary 3.1. $G N N _ { m p } ^ { n }$ can compute any Turing computable function over connected attributed graphs if the following conditions are jointly met: each node is uniquely identified; $\mathbf { M } \mathbf { S } \mathbf { G } _ { l }$ and $\mathrm { U } \mathrm { P } _ { l }$ are Turing-complete for every layer $\ell$ ; the depth is at least $d \geq \delta _ { G }$ layers; and the width is unbounded.
81
+
82
+ Why is this result relevant? From a cursory review, it might seem that universality is an abstract result with little implication to machine learning architects. After all, the utility of a learning machine is usually determined not with regards to its expressive power but with its ability to generalize to unseen examples. Nevertheless, it can be argued that universality is an essential property of a good learning model. This is for two main reasons: First, universality guarantees that the learner does not have blind-spots in its hypothesis space. No matter how good the optimization algorithm is, how rich the dataset, and how overparameterized the network is, there will always be functions which a non universal learner cannot learn. Second, a universality result provides a glimpse on how the size of the learner’s hypothesis space is affected by different design choices. For instance, Corollary 3.1 puts forth four necessary conditions for universality: the $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ should be sufficiently deep and wide, nodes should be able to uniquely and consistently identify each other, and finally, the functions utilized in each layer should be sufficiently complex. The following sectimportance of two of these universality conditions. It will be shown that $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ es further into thelose a significant portion of their power when the depth and width conditions are relaxed.
83
+
84
+ The universality of $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { g } }$ . Though a universality result could also be easily derived for networks with a readout function, the latter is not included as it deviates from how graph neural networks are meant to function: given a sufficiently powerful readout function, a $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { g } }$ of $d = 1$ depth and $O ( \Delta )$ width can be used to compute any Turing computable function. The nodes should simply gather one hop information about their neighbors; the readout function can then reconstruct the problem input based on the collective knowledge and apply any computation needed.
85
+
86
+ # 4 IMPOSSIBILITY RESULTS AS A FUNCTION OF DEPTH AND WIDTH
87
+
88
+ This section analyzes the effect of depth and width in the expressive power of $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ . Specifically, I will consider problems that cannot be solved by a network of a given depth and width.
89
+
90
+ To be able to reason in terms of width, it will be useful to also enforce that the message size in LOCAL at each round is at most $b$ bits. This model goes by the name CONGEST in the distributed computing literature (Peleg, 2000). In addition, it will be assumed that nodes do not have access to a random generator. With this in place, the following theorem shows us how to translate impossibility results from CONGEST to $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ :
91
+
92
+ Theorem 4.1. If a problem $P$ cannot be solved in less than d rounds in CONGEST using messages of at most $b$ bits, then $P$ cannot be solved by a $G N N _ { m p } ^ { n }$ of width $w \leq ( b - \log _ { 2 } n ) / p = \bar { O } ( b / \log n )$ and depth $d$ .
93
+
94
+ The $p = \Theta ( \log n )$ factor corresponds to the length of the binary representation of every variable—the precision needs to depend logarithmically on $n$ for the node ids to be unique. With this result in place, the following sections re-state several known lower bounds in terms of a $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ ’s depth and width.
95
+
96
+ # 4.1 IMPOSSIBILITY RESULTS FOR DECISION PROBLEMS
97
+
98
+ I first consider problems where one needs to decide whether a given graph satisfies a certain property (Feuilloley $\&$ Fraigniaud, 2016). Concretely, given a decision problem $P$ and a graph $G$ , the $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ should output $x _ { i } \in \{ t r u e , f a l s e \}$ for all $v _ { i } \in \mathcal V$ . The network then accepts the premise if the logical conjunction of $\{ x _ { 1 } , \ldots , x _ { n } \}$ is true and rejects it otherwise. Such problems are intimately connected to graph classification: classifying a graph entails identifying what constitutes a class from some training set and using said learned definition to decide the label of graphs sampled from the test set. Instead, I will suppose that the class definition is available to the classifier and I will focus on the corresponding decision problem. As a consequence, every lower bound presented below for a decision problem must also be respected by a $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ classifier that attains zero error on the corresponding graph classification problem.
99
+
100
+ Subgraph detection. In this type of problems, the objective is to decide whether $G$ contains a subgraph belonging to a given family. I focus specifically on detecting whether $G$ contains a cycle $C _ { k }$ , i.e., a simple undirected graph of $k$ nodes each having exactly two neighbors. As the following result shows, even with ids, cycle detection remains relatively hard:
101
+
102
+ Corollary 4.1 (Repurposed from (Drucker et al., 2014; Korhonen & Rybicki, 2018)). There exists√ graph $G$ on which every $G N N _ { m p } ^ { n }$ of width w requires depth at least $d \stackrel { . } { = } \Omega ( \sqrt { n } / ( w \log n ) )$ and $d =$ $\Omega ( n / ( w \log n ) )$ ) to detect if $G$ contains a cycle $C _ { k }$ for even $k \geq 4$ and odd $k \geq 5$ , respectively.
103
+
104
+ Whereas an anonymous $\mathsf { G N N } _ { \mathsf { m p } }$ cannot detect cycles (e.g., distinguish between two $C _ { 3 }$ vs one $C _ { 6 }$ (Maron et al., 2019a)), it seems that with ids the product of depth and width should exhibit an (at least) linear dependence on $n$ . The intuition behind this bound can be found in Appendix C and empirical evidence in support of the theory are presented in Section 5.
105
+
106
+ Subgraph verification. Suppose that the network is given a subgraph $H = ( \mathcal V _ { H } , \mathcal E _ { H } )$ of $G$ in its input. This could, for instance, be achieved by selecting the attributes of each node and edge to be a one-hot encoding of their membership on $\nu _ { H }$ and ${ \mathcal { E } } _ { H }$ , respectively. The question considered is whether the neural network can verify a certain property of $H$ . More concretely, does a graph neural network exist that can successfully verify $H$ as belonging to a specific family of graphs w.r.t. $G 2$ In contrast to the standard decision paradigm, here every node should reach the same decision—either accepting or rejecting the hypothesis. The following result is a direct consequence of the seminal work by Sarma et al. (2012):
107
+
108
+ Corollary 4.2 (Repurposed from (Sarma et al., 2012)). There exists a graph $G$ on which every $G N N _ { m p } ^ { n }$ of width w requires depth at least $\begin{array} { r } { d = \Omega ( \sqrt { \frac { n } { w \log ^ { 2 } n } } + \delta _ { G } ) } \end{array}$ to verify if some subgraph $H$ of $G$ is connected, contains a cycle, forms a spanning tree of $G$ , is bipartite, is a cut of $G$ , or is an s-t cut of G. Furthermore, the depth should be at least $\begin{array} { r } { d = \bar { \Omega } \left( \left( \frac { n } { w \log n } \right) ^ { \gamma } + \delta _ { G } \right) } \end{array}$ with γ = 12 − 12(δ 0 −1) to verify if $H$ is a Hamiltonian cycle or a simple path.
109
+
110
+ Therefore, even if one knows where to look in $G$ , verifying whether a given subgraph meets a given property can be non-trivial, and this holds for several standard graph-theoretic properties. For instance, if we constrain ourselves to networks of constant width, detecting whether a subgraph is√ connected can, up to logarithmic factors, require $\Omega ( { \sqrt { n } } )$ depth in the worst case.
111
+
112
+ # 4.2 IMPOSSIBILITY RESULTS FOR OPTIMIZATION PROBLEMS
113
+
114
+ I turn my attention to the problems involving the exact or approximate optimization of some graphtheoretic objective function. From a machine learning perspective, the considered problems can be interpreted as node/edge classification problems: each node/edge is tasked with deciding whether it belongs to the optimal set or not. Take, for instance, the maximum independent set, where one needs to find the largest cardinality node set, such that no two of them are adjacent. Given only information identifying nodes, $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ will be asked to classify each node as being part of the maximum independent set or not.
115
+
116
+ Polynomial-time problems. Let me first consider three problems that possess known polynomialtime solutions. To make things easier for the $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ , I relax the objective and ask for an approximate solution rather than optimal. An algorithm (or neural network) is said to attain an $\alpha$ -approximation if it produces a feasible output whose utility is within a factor $\alpha$ of the optimal. Let OPT be the utility of the optimal solution and ALG that of the $\alpha$ -approximation algorithm. Depending on whether the problem entails minimization or maximization, the ratio ALG/OPT is at most $\alpha$ and at least $1 / \alpha$ , respectively.
117
+
118
+ According to the following corollary, it is non-trivial to find good approximate solutions:
119
+
120
+ Corollary 4.3 (Repurposed from (Sarma et al., 2012; Ghaffari & Kuhn, 2013)). There exists graphs $G$ and $G ^ { \prime }$ of diameter $\delta _ { G } = \Theta ( \log n )$ and $\delta _ { G ^ { \prime } } = { \cal O } ( 1 )$ on which every $G N N _ { m p } ^ { n }$ of width w requires depth at least $\begin{array} { r } { d = \Omega ( \sqrt { \frac { n } { w \log ^ { 2 } n } } ) } \end{array}$ and $\begin{array} { r } { d ^ { \prime } = \Omega ( ( \frac { n } { w \log n } ) ^ { \gamma } ) } \end{array}$ with $\begin{array} { r } { \gamma = \frac { 1 } { 2 } - \frac { 1 } { 2 ( \delta _ { G ^ { \prime } } - 1 ) } } \end{array}$ 12(δ 0 −1) , respectively, to approximate within any constant factor: the minimum cut problem, the shortest s-t path problem, or the minimum spanning tree problem.
121
+
122
+ Thus, even for simple problems (complexity-wise), in the worst case a constant width $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ should be almost $\Omega ( { \sqrt { n } } )$ deep even if the graph diameter is exponentially smaller than $n$ .
123
+
124
+ NP-hard problems. So what about truly hard problems? Clearly, one cannot expect a $G N N _ { \mathsf { m p } }$ to solve an NP-hard time in polynomial time2. However, it might be interesting as a thought experiment to consider a network whose layers take exponential time on the input size—e.g., by selecting the $\mathbf { M } \mathbf { S } \mathbf { G } _ { l }$ and $\mathrm { U } \mathrm { P } _ { l }$ functions to be feed-forward networks of exponential depth and width. Could one ever expect such a $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ to arrive at the optimal solution?
125
+
126
+ The following corollary provides necessary conditions for three well-known NP-hard problems:
127
+
128
+ Corollary 4.4 (Repurposed from (Censor-Hillel et al., 2017)). There exists a graph $G$ on which every $G N N _ { m p } ^ { n }$ of width $w = O ( 1 )$ requires depth at least $d = \Omega ( n ^ { 2 } / \log ^ { 2 } n )$ to solve: the minimum vertex cover problem; the maximum independent set problem; the perfect coloring problem.
129
+
130
+ Thus, even if each layer is allowed to take exponential time, the depth should be quadratically larger than the graph diameter $\delta _ { G } = { \cal { O } } ( n )$ to have a chance of finding the optimal solution. Perhaps disappointingly, the above result suggests that it may not be always possible to exploit the distributed decision making performed by $\mathsf { G N N } _ { \mathsf { m p } }$ architectures to find solutions faster than classical (centralized) computational paradigms.
131
+
132
+ # 4.3 IMPOSSIBILITY RESULTS FOR ESTIMATION PROBLEMS
133
+
134
+ Finally, I will consider problems that involve the computation or estimation of some real function that takes as an input the graph and attributes. The following corollary concerns the computation of two well-known graph invariants: the diameter $\delta _ { G }$ and the girth. The latter is defined as the length of the shortest cycle and is infinity if the graph has no cycles.
135
+
136
+ Corollary 4.5 (Repurposed from (Frischknecht et al., 2012)). There exists a graph $G$ on which every $G N N _ { m p } ^ { n }$ of width w requires depth at least $d = \Omega ( n / ( w \log n ) + \delta _ { G } )$ to compute the graph diameter $\delta _ { G }$ and $d = \Omega ( \sqrt { n } / ( w \log n ) + \delta _ { G } )$ to approximate the graph diameter and girth within a factor of $^ 3 / 2$ and 2, respectively.
137
+
138
+ Term $\delta _ { G }$ appears in the lower bounds because both estimation problems require global information. Further, approximating the diameter within a $\%$ factor seems to be simpler than computing it. Yet, in both cases, one cannot achieve this using a $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ whose capacity is constant. As a final remark, the graphs giving rise to the lower bounds of Corollary 4.5 have constant diameter and $\Theta ( n ^ { 2 } )$ edges. However, similar bounds can be derived also for graphs with $O ( n \log n )$ edges (Abboud et al., 2016). For the case of exact computation, the lower bound is explained in Appendix C.
139
+
140
+ # 5 EMPIRICAL EVIDENCE
141
+
142
+ This section aims to empirically test the connection between the capacity $d w$ of a $\mathsf { G N N } _ { \mathsf { m p } }$ , the number of nodes $n$ of its input, and its ability to solve a given task. In particular, I considered the problem of 4-cycle classification and tasked the neural network with classifying graphs based on whether they contained a cycle of length four. Following the lower bound construction described in Appendix A, I generated five distributions over graphs with $n \in ( 8 , 1 6 , 2 4 , 3 2 , 4 4 )$ nodes and an average diameter of $( 4 , 6 , 8 , 9 , 1 1 )$ , respectively (this was achieved by setting $p \in ( 6 , 8 , 1 0 , 1 2 , 1 4 )$ , see Figure 3a). For each such distribution, I generated a training and test set consisting respectively of 1000 and 200 examples. Both sets were exactly balanced, i.e., any example graph from the training and test set had exactly $5 0 \%$ chance of containing a 4-cycle.
143
+
144
+ The experiment aimed to evaluate how able were $\mathsf { G N N } _ { \mathsf { m p } }$ of different capacities to attain high accuracy on the test set. To this end, I performed grid search over the hyperparameters $w \in ( 2 , 1 0 , 2 0 )$ and $d \in ( 5 , 1 0 , 2 0 , 1 5 )$ . To reduce the dependence on the initial conditions and training length, for each hyperparameter combination, I trained 4 networks independently (using Adam and learning rate decay) for 4000 epochs. The $\mathsf { G N N } _ { \mathsf { m p } }$ chosen was that proposed by $\mathrm { X u }$ et al. (2018), with the addition of residual connections—this network outperformed all others that I experimented with.
145
+
146
+ ![](images/9c0b68c7d53cfa7504ecdca7b601197823b7b36e49a1c5952c915b0f68b568ce.jpg)
147
+ Figure 1: Accuracy as a function of $\mathsf { G N N } _ { \mathsf { m p } }$ capacity $d w$ and $n$ . (Best seen in color.)
148
+
149
+ It is important to stress that empirically verifying lower bounds for neural networks is challenging, because it involves searching over the space of all possible networks in order to find the ones that perform the best. For this reason, an experiment such as the one described above cannot be used to verify3 the tightness of the bounds: we can never be certain whether the results obtained are the best possible or whether the optimization resulted in a local minimum. In that view, the following results should be interpreted in a qualitative sense. The question that I will ask is: to which extend do the trends uncovered match those predicted by the theory? More specifically, does the ability of a network to detect 4-cycles depend on the relation between $d w$ and $n$ ?
150
+
151
+ To answer this question, Figure 1 depicts the training and test accuracy as a function of the capacity $d w$ for all the 240 networks trained (5 distributions $\times 3$ widths $\times ~ 4$ depths $\times ~ 4$ iterations). The accuracy of the best performing networks with the smallest capacity is shown in Figures 1c and 1d. It is important to stress that, based on Weisfeiler-Lehman analyses, anonymous $\mathsf { G N N } _ { \mathsf { m p } }$ cannot solve the considered task. However, as it seen in the figures, the impossibility is annulled when using node ids4. Indeed, even small neural networks could consistently classify all test examples perfectly (i.e., achieving $100 \%$ test accuracy) when $n \leq 1 6$ . Moreover, as the theoretical results predicted, there is a strong correlation between the test accuracy, $d w$ and $n$ (recall that Corollary 4.1 predicts $d w = \tilde { \Omega } ( \sqrt { n } ) )$ . Figure 1d shows that networks of the same capacity were consistently less accurate on the test set as $n$ increased (even though the cycle length remained 4 in all experiments). It is also striking to observe that even the most powerful networks considered could not achieve a test accuracy above $9 5 \%$ for $n > 1 6$ ; for $n = 4 0$ their best accuracy was below $80 \%$ .
152
+
153
+ ![](images/31952bba08cbf07926ecadfc216461eeb454c8004884b1386ca08f53b2de511f.jpg)
154
+ Figure 2: (a) GNNs are significantly more powerful when given discriminative node attributes. (b) Test accuracy indicated by color as a function of normalized depth and width. Points in highlighted areas correspond to networks with super-critical capacity, whereas the diagonal line separates networks that more deep than wide. (For improved visibility, points are slightly perturbed. Best seen in color.)
155
+
156
+ Effect of anonymity. Figure 2a plots example training and test curves for $G N N _ { \mathsf { m p } }$ trained with four different node attributes: no attributes (anonymous), a one-hot encoding of the node degrees (degree), a one-hot encoding of node ids (unique id), and a one-hot encoding of node ids that changed across graphs (random unique id). It can be clearly observed that there is a direct correlation between accuracy and the type of attributes used. With non- or partially-discriminative attributes, the network could not detect cycles even in the training set. The cycle detection problem was solved exactly with unique ids, but when the latter were inconsistently assigned, the network could not learn to generalize.
157
+
158
+ Exchangeability of depth and width. Figure 2b examines further the relationship between depth, width, and test accuracy. This time, networks were separated depending on their depth and width normalized by the square root of the “critical capacity”. For each $n$ , the critical capacity is the minimum $d w$ of a network that was able to solve the task on a graph of $n$ nodes—here, solving amounts to a test accuracy above $9 5 \%$ . In this way, a network of depth √ $d$ and width $w$ tested on $n$ nodes corresponds to a point positioned at $x = \overset { \cdot } { d } / \sqrt { \mathrm { c r i t i c a l } } , y = \overset { \cdot } { w } / \sqrt { \mathrm { c r i t i c a l } }$ and no network positioned at $x y < 1$ can solve the task (non-highlighted region in the bottom left corner). As seen, there is a crisp phase transition between the regime of under- and super-critical capacity: almost every network meeting the condition $d w \ge$ critical was able to solve the task, irrespective of whether the depth or width was larger. Note that, the exchangeability of depth and width cannot be guaranteed by the proposed theory which asserts that the condition $\hat { d w } = \tilde { \Omega ( \sqrt { n } ) }$ is necessary—but not sufficient. The empirical results however do agree with the hypothesis that, for 4-cycle classification, depth and width are indeed exchangeable.
159
+
160
+ # 6 CONCLUSION
161
+
162
+ This work studied the expressive power of graph neural networks falling within the message-passing framework. Two results were derived. First, sufficient conditions were provided such that $G N N _ { \mathsf { m p } }$ can compute any function computable by a Turing machine with the same connected graph as input. Second, it was discovered that the product of a $\mathsf { G N N } _ { \mathsf { m p } }$ ’s depth and width plays a prominent role in determining whether the network can solve various graph-theoretic problems. Specifically, it was shown that $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ with $d w = \tilde { \Omega } ( n ^ { \delta } )$ and $\delta \in [ 0 . 5 , 2 ]$ cannot solve a range of decision, optimization, and estimation problems involving graphs. Overall, the proposed results demonstrate that the power of graph neural networks depends critically on their capacity and illustrate the importance of using discriminative node attributes.
163
+
164
+ Acknowledgements. I thank the Swiss National Science Foundation for supporting this work in the context of the project “Deep Learning for Graph-Structured Data” (grant number PZ00P2 179981).
165
+
166
+ # REFERENCES
167
+
168
+ Amir Abboud, Keren Censor-Hillel, and Seri Khoury. Near-linear lower bounds for distributed distance computations, even in sparse networks. In International Symposium on Distributed Computing, pp. 29–42. Springer, 2016.
169
+
170
+ Dana Angluin. Local and global properties in networks of processors (extended abstract). In Proceedings of the Twelfth Annual ACM Symposium on Theory of Computing, STOC ’80, pp. 82–93, New York, NY, USA, 1980. ACM. ISBN 0-89791-017-6. doi: 10.1145/800141.804655. URL http://doi.acm.org/10.1145/800141.804655.
171
+
172
+ Vikraman Arvind, Johannes Kobler, Gaurav Rattan, and Oleg Verbitsky. On the power of color ¨ refinement. In International Symposium on Fundamentals of Computation Theory, pp. 339–350. Springer, 2015.
173
+
174
+ Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, et al. Interaction networks for learning about objects, relations and physics. In Advances in neural information processing systems, pp. 4502–4510, 2016.
175
+
176
+ 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.
177
+
178
+ Rianne van den Berg, Thomas N Kipf, and Max Welling. Graph convolutional matrix completion. arXiv preprint arXiv:1706.02263, 2017.
179
+
180
+ Filippo Maria Bianchi, Daniele Grattarola, and Cesare Alippi. Mincut pooling in graph neural networks. arXiv preprint arXiv:1907.00481, 2019.
181
+
182
+ Keren Censor-Hillel, Seri Khoury, and Ami Paz. Quadratic and near-quadratic lower bounds for the congest model. arXiv preprint arXiv:1705.05646, 2017.
183
+
184
+ Zhengdao Chen, Soledad Villar, Lei Chen, and Joan Bruna. On the equivalence between graph isomorphism testing and function approximation with gnns. arXiv preprint arXiv:1905.12560, 2019.
185
+
186
+ Benny Chor and Oded Goldreich. Unbiased bits from sources of weak randomness and probabilistic communication complexity. SIAM Journal on Computing, 17(2):230–261, 1988.
187
+
188
+ George Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of control, signals and systems, 2(4):303–314, 1989.
189
+
190
+ Nima Dehmamy, Albert-Laszl ´ o Barab ´ asi, and Rose Yu. Understanding the representation power of ´ graph neural networks in learning graph topology. arXiv preprint arXiv:1907.05008, 2019.
191
+
192
+ Andrew Drucker, Fabian Kuhn, and Rotem Oshman. On the power of the congested clique model. In Proceedings of the 2014 ACM symposium on Principles of distributed computing, pp. 367–376. ACM, 2014.
193
+
194
+ David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alan´ Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In Advances in neural information processing systems, pp. 2224–2232, 2015.
195
+
196
+ Laurent Feuilloley and Pierre Fraigniaud. Survey of distributed decision. arXiv preprint arXiv:1606.04434, 2016.
197
+
198
+ Pierre Fraigniaud, Amos Korman, and David Peleg. Towards a complexity theory for local distributed computing. Journal of the ACM (JACM), 60(5):35, 2013.
199
+
200
+ Silvio Frischknecht, Stephan Holzer, and Roger Wattenhofer. Networks cannot compute their diameter in sublinear time. In Proceedings of the twenty-third annual ACM-SIAM symposium on Discrete Algorithms, pp. 1150–1162. Society for Industrial and Applied Mathematics, 2012.
201
+
202
+ Mohsen Ghaffari and Fabian Kuhn. Distributed minimum cut approximation. In International Symposium on Distributed Computing, pp. 1–15. Springer, 2013.
203
+
204
+ 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, pp. 1263–1272. JMLR. org, 2017.
205
+
206
+ Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989.
207
+
208
+ Elvin Isufi, Fernando Gama, and Alejandro Ribeiro. Edgenets:edge varying graph neural networks, 2020.
209
+
210
+ Chaitanya K Joshi, Thomas Laurent, and Xavier Bresson. An efficient graph convolutional network technique for the travelling salesman problem. arXiv preprint arXiv:1906.01227, 2019.
211
+
212
+ Bala Kalyanasundaram and Georg Schintger. The probabilistic communication complexity of set intersection. SIAM Journal on Discrete Mathematics, 5(4):545–557, 1992.
213
+
214
+ Steven Kearnes, Kevin McCloskey, Marc Berndl, Vijay Pande, and Patrick Riley. Molecular graph convolutions: moving beyond fingerprints. Journal of computer-aided molecular design, 30(8): 595–608, 2016.
215
+
216
+ Nicolas Keriven and Gabriel Peyre. Universal invariant and equivariant graph neural networks. ´ arXiv preprint arXiv:1905.04943, 2019.
217
+
218
+ Elias Khalil, Hanjun Dai, Yuyu Zhang, Bistra Dilkina, and Le Song. Learning combinatorial optimization algorithms over graphs. In Advances in Neural Information Processing Systems, pp. 6348–6358, 2017.
219
+
220
+ Sandra Kiefer, Pascal Schweitzer, and Erkal Selman. Graphs identified by logics with counting. In International Symposium on Mathematical Foundations of Computer Science, pp. 319–330. Springer, 2015.
221
+
222
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
223
+
224
+ Janne H Korhonen and Joel Rybicki. Deterministic subgraph detection in broadcast congest. In 21st International Conference on Principles of Distributed Systems (OPODIS 2017). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2018.
225
+
226
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
227
+
228
+ Zhuwen Li, Qifeng Chen, and Vladlen Koltun. Combinatorial optimization with graph convolutional networks and guided tree search. In Advances in Neural Information Processing Systems, pp. 539–548, 2018.
229
+
230
+ Renjie Liao, Zhizhen Zhao, Raquel Urtasun, and Richard S Zemel. Lanczosnet: Multi-scale deep graph convolutional networks. In International Conference on Learning Representations (ICLR), 2019.
231
+
232
+ Nathan Linial. Locality in distributed graph algorithms. SIAM Journal on Computing, 21(1):193–201, 1992.
233
+
234
+ Zhou Lu, Hongming Pu, Feicheng Wang, Zhiqiang Hu, and Liwei Wang. The expressive power of neural networks: A view from the width. 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. 6231–6239. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/ 7203-the-expressive-power-of-neural-networks-a-view-from-the-width. pdf.
235
+
236
+ Sitao Luan, Mingde Zhao, Xiao-Wen Chang, and Doina Precup. Break the ceiling: Stronger multiscale deep graph convolutional networks. arXiv preprint arXiv:1906.02174, 2019.
237
+
238
+ Haggai Maron, Heli Ben-Hamu, Hadar Serviansky, and Yaron Lipman. Provably powerful graph networks. arXiv preprint arXiv:1905.11136, 2019a.
239
+ Haggai Maron, Ethan Fetaya, Nimrod Segol, and Yaron Lipman. On the universality of invariant networks. arXiv preprint arXiv:1901.09342, 2019b.
240
+ Christopher Morris, Martin Ritzert, Matthias Fey, William L Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and leman go neural: Higher-order graph neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 4602–4609, 2019.
241
+ Moni Naor and Larry J. Stockmeyer. What can be computed locally? In STOC, 1993.
242
+ J Pedro Neto, Hava T Siegelmann, J Felix Costa, and CP Su ´ arez Araujo. Turing universality of neural ´ nets (revisited). In International Conference on Computer Aided Systems Theory, pp. 361–366. Springer, 1997.
243
+ D. Peleg. Distributed Computing: A Locality-Sensitive Approach. Society for Industrial and Applied Mathematics, 2000. doi: 10.1137/1.9780898719772.
244
+ Jorge Perez, Javier Marinkovi ´ c, and Pablo Barcel ´ o. On the turing completeness of modern neural ´ network architectures. arXiv preprint arXiv:1901.03429, 2019.
245
+ Atish Das Sarma, Stephan Holzer, Liah Kor, Amos Korman, Danupon Nanongkai, Gopal Pandurangan, David Peleg, and Roger Wattenhofer. Distributed verification and hardness of distributed approximation. SIAM Journal on Computing, 41(5):1235–1265, 2012.
246
+ Ryoma Sato, Makoto Yamada, and Hisashi Kashima. Approximation ratios of graph neural networks for combinatorial problems. In Advances in Neural Information Processing Systems, 2019.
247
+ Jochen Seidel. Anonymous distributed computing: computability, randomization and checkability. PhD thesis, ETH Zurich, 2015.
248
+ Younjoo Seo, Andreas Loukas, and Nathanael Peraudin. Discriminative structural graph classification. arXiv preprint arXiv:1905.13422, 2019.
249
+ Jukka Suomela. Survey of local algorithms. ACM Computing Surveys (CSUR), 45(2):24, 2013.
250
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
251
+
252
+ # A GRAPH THEORY DEFINITIONS
253
+
254
+ The main graph-theoretic terms encountered in this work are:
255
+
256
+ • $k$ -cycle detection: a $k$ -cycle is a subraph of $G$ consisting of $k$ nodes, each with degree two. The $k$ -cycle detection problem entails determining if $G$ contains a $k$ -cycle.
257
+ • Hamiltonian cycle: a cycle of length $n$
258
+ • (minimum) spanning tree: a spanning tree is a tree subgraph of $G$ consisting of $n$ nodes. The minimum spanning tree problem entails finding the spanning tree of $G$ of minimum weight (the weight of a tree is equal to the sum of its edge weights).
259
+ • (minimum) cut: a cut is a subgraph of $G$ that when deleted leaves $G$ disconnected. The minimum cut problem entails finding the cut of minimum weight (the weight of a cut is equal to the sum of its edge weights).
260
+ • $s$ -t cut: a subgraph of $G$ such that removing all subgraph edges from $G$ will leave the nodes $s$ and $t$ of $G$ disconnected.
261
+ • (shortest) path: a simple path is subgraph of $G$ where all nodes have degree 2 except from the two endpoint nodes whose degree is one. The shortest path problem entails finding the simple path of minimum weight that connects two given nodes (the weight of a path is equal to the sum of its edge weights).
262
+
263
+ • (maximum) independent set: an independent set is a set of nodes in a graph no two of which are adjacent. The maximum independent set problem entails finding the independent set of maximum cardinality.
264
+
265
+ • (minimum) vertex cover: a vertex cover of $G$ is a set of nodes such that each edge of $G$ is incident to at least one node in the set. The minimum vertex cover problem entails finding the vertex cover of minimum cardinality.
266
+
267
+ • (perfect) coloring: a coloring of $G$ is a labeling of the nodes with distinct colors such that no two adjacent nodes are colored using same color. The perfect coloring problem entails finding a coloring with the smallest number of colors.
268
+
269
+ • diameter: the diameter $\delta _ { G }$ of $G$ equals the length of the longest shortest path.
270
+
271
+ • girth: the girth of $G$ equals the length of the shortest cycle. It is infinity if no cycles are present.
272
+
273
+ # B DEFERRED PROOFS
274
+
275
+ # B.1 PROOF OF THEOREM 3.1
276
+
277
+ The claim is proven by expressing the state of node $v _ { i }$ in the two models in the same form. It is not difficult to see that for each layer of the $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ one has
278
+
279
+ $$
280
+ \begin{array} { r l r } { { x _ { i } ^ { ( l ) } = \operatorname { U P } _ { \ell } \Big ( \sum _ { v _ { j } \in \mathcal { N } _ { i } ^ { \ast } } m _ { i j } ^ { ( \ell ) } \Big ) } } \\ & { } & { = \operatorname { U P } _ { \ell } \Bigg ( \sum _ { v _ { j } \in \mathcal { N } _ { i } ^ { \ast } } \operatorname { M S G } _ { \ell } \Big ( x _ { i } ^ { ( \ell - 1 ) } , x _ { j } ^ { ( \ell - 1 ) } , v _ { i } , v _ { j } , a _ { i j } \Big ) \Big ) } \\ & { } & { = \operatorname { A G G } _ { \ell } ( \Big \{ \Big ( x _ { i } ^ { ( \ell - 1 ) } , x _ { j } ^ { ( \ell - 1 ) } , v _ { i } , v _ { j } , a _ { i j } \Big ) : v _ { j } \in \mathcal { N } _ { i } ^ { \ast } \Big \} ) , \quad \mathrm { ( f r o m ~ ( X u ~ e t ~ a l . ~ 2 0 1 8 , L e m m a ~ 5 ) ) } } \end{array}
281
+ $$
282
+
283
+ where $\mathbf { A G G } _ { \ell }$ is an aggregation function, i.e., a map from the set of multisets onto some vector space. In the last step, I used a result of $\mathrm { X u }$ et al. $\mathrm { X u }$ et al. (2018) stating that each aggregation function can be decomposed as an element-wise function over each element of the multiset, followed by summation of all elements, and then a final function.
284
+
285
+ Similarly, one may write:
286
+
287
+ (by definition)
288
+
289
+ $$
290
+ \begin{array} { r l } & { s _ { i } ^ { ( \ell ) } = \mathrm { A L G } _ { \ell } ^ { 1 } ( \{ ( s _ { i j } ^ { ( \ell - 1 ) } , a _ { i j } ) : v _ { j } \in \mathcal { N } _ { i } ^ { * } \} , v _ { i } ) } \\ & { \quad \quad = \mathrm { A L G } _ { \ell } ^ { 1 } ( \{ ( \mathrm { A L G } _ { \ell - 1 } ^ { 2 } ( s _ { j } ^ { ( \ell - 1 ) } , v _ { j } ) , a _ { i j } ) : v _ { j } \in \mathcal { N } _ { i } ^ { * } \} , v _ { i } ) } \\ & { \quad \quad = \mathrm { A L G } _ { \ell } ( \{ ( s _ { j } ^ { ( \ell - 1 ) } , v _ { i } , v _ { j } , a _ { i j } ) : v _ { j } \in \mathcal { N } _ { i } ^ { * } \} ) , } \end{array}
291
+ $$
292
+
293
+ with the last step following by restructuring the input and defining $\mathbf { A L G } _ { \ell }$ as the Turning machine that simulates the action of both $\mathbf { \bar { A } L G } _ { \ell } ^ { 2 }$ and $\mathbf { A L G } _ { \ell - 1 } ^ { 1 }$ .
294
+
295
+ Since one may encode any vector into a string and vice versa, w.l.o.g. one may assume that the state of each node in LOCAL is encoded as a vector $x _ { i }$ . Then, to complete the proof, one still needs to demonstrate that the functions
296
+
297
+ $$
298
+ \begin{array} { r } { \mathrm { A G G } ( \{ ( x _ { i } , x _ { j } , v _ { i } , v _ { j } , a _ { i j } ) : v _ { j } \in \mathcal { N } _ { i } ^ { * } \} ) \quad \mathrm { a n d } \quad \mathrm { A L G } ( \{ ( x _ { j } , v _ { i } , v _ { j } , a _ { i j } ) : v _ { j } \in \mathcal { N } _ { i } ^ { * } \} ) } \end{array}
299
+ $$
300
+
301
+ are equivalent (in the interest of brevity the layer/round indices have been dropped). If this holds then each layer of $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ is equivalent to a round of LOCAL and the claim follows.
302
+
303
+ I first note that, since its input is a multiset, $\mathbf { A L G } _ { l }$ is also an aggregation function. To demonstrate equivalence, one thus needs to show that, despite not having identical inputs, each of the two aggregation functions can be used to replace the other. For the forward direction, it suffices to show that for every aggregation function AGG there exists ALG with the same output. Indeed, one may always construct $\mathbf { A L G } = \mathbf { A G G } \circ g$ , where $g$ takes as input $\{ ( x _ { j } , v _ { i } , v _ { j } , a _ { i j } ) : v _ { j } \in \mathcal { N } _ { i } ^ { * } \}$ , identifies $x _ { i }$ (by searching for $v _ { i } , v _ { i } )$ and appends it to each element of the multiset yielding $\{ ( x _ { i } , x _ { j } , v _ { i } , v _ { j } , a _ { i j } ) : v _ { j } \in \mathcal { N } _ { i } ^ { * } \}$ . The backward direction can also be proven with an elementary construction: given ALG, one sets $\mathbf { A G G } = \mathbf { A L G } \circ h$ , where $h$ deletes $x _ { i }$ from each element of the multiset.
304
+
305
+ # B.2 PROOF OF COROLLARY 3.1
306
+
307
+ In the LOCAL model the reasoning is elementary (Linial, 1992; Fraigniaud et al., 2013; Seidel, 2015): suppose that the graph is represented by a set of edges and further consider that $\mathbf { A L G } _ { l }$ amounts to a union operation. Then in $d = \delta _ { G }$ rounds, the state of each node will contain the entire graph. The function $\mathbf { A L G } _ { d } ^ { 1 }$ can then be used to make the final computation. This argument also trivially holds for node/edge attributes. The universality of $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ then follows by the equivalence of LOCAL and GNNnmp.
308
+
309
+ # B.3 PROOF OF THEOREM 4.1
310
+
311
+ First note that, since the $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ and LOCAL models are equivalent, if no further memory/width restrictions are placed, an impossibility for one implies also an impossibility for the other. It can also be seen in Theorem 3.1 that there is a one to one mapping between the internal state of each node at each level between the two models (i.e., variables $x _ { i } ^ { \bar { ( l ) } }$ and $s _ { i } ^ { ( l ) }$ ). As such, impossibility results that rely on restrictions w.r.t. state size (in terms of bits) also transfer between the models.
312
+
313
+ To proceed, I demonstrate that a depth lower bound in the CONGEST model (i.e., in the LOCAL model with bounded message size) also implies the existence of a depth lower bound in the LOCAL model with a bounded state size—with this result in place, the proof of the main claim follows directly. As in the statement of the theorem, one starts by assuming that $P$ cannot be solved in less than $d$ rounds when messages are bounded to be at most $b$ bits. Then, for the sake of contradiction, it is supposed that there exists an algorithm $A \in { \mathsf { L O C A L } }$ that can solve $P$ in less than $d$ rounds with a state of at most $c$ bits, but unbounded message size. I argue that the existence of this algorithm also implies the existence of a second algorithm $A ^ { \prime }$ whose messages are bounded by $c + \log _ { 2 } n$ : since each message s(l)j←i is the output of a universal Turing machine $\mathbf { A L G } _ { l } ^ { 2 }$ that takes as input the tuple $( s _ { i } ^ { ( l ) } , v _ { i } )$ , algorithm $A ^ { \prime }$ directly sends the input and relies on the universality of $\mathbf { A L G } _ { l + 1 } ^ { 1 }$ to simulate the action of $\mathbf { A L G } _ { l } ^ { 2 }$ . The message size bound follows by adding the size $c$ of the state with that of representing the node id $( \log _ { 2 } n$ bits suffice for unique node ids). This line of reasoning leads to a contradiction when $c \leq b - \log _ { 2 } n$ , as it implies that there exists an algorithm (namely $A ^ { \prime }$ ) that can solve $P$ in less than $d$ rounds while using messages of at most $b$ bits. Hence, no algorithm whose state is less than $b - \log _ { 2 } n$ bits can solve $P$ in LOCAL, and the width of $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ has to be at least $( b - \log _ { 2 } n ) / p$ .
314
+
315
+ # C AN EXPLANATION OF THE LOWER BOUNDS FOR CYCLE DETECTION AND DIAMETER ESTIMATION
316
+
317
+ A common technique for obtaining lower bounds in the CONGEST model is by reduction to the set-disjointness problem in two-player communication complexity: Suppose that Alice and Bob are each given some secret string ( $. s _ { a }$ and $s _ { b }$ ) of $q$ bits. The two players use the string to construct a set by selecting the elements from the base set $\{ 1 , 2 , \ldots , q \}$ for which the corresponding bit is one. It is known that Alice and Bob cannot determine whether their sets are disjoint or not without exchanging at least $\Omega ( q )$ bits (Kalyanasundaram $\&$ Schintger, 1992; Chor & Goldreich, 1988).
318
+
319
+ The reduction involves constructing a graph that is partially known by each player. Usually, Alice and Bob start knowing half of the graph (red and green induced subgraphs in Figure 3). The players then use their secret string to control some aspect of their private topology (subgraphs annotated in dark gray). Let the resulting graph be $G ( s _ { a } , s _ { b } )$ and denote by cut the number of edges connecting the subgraphs controlled by Alice and Bob. To derive a lower bound for some problem $P$ , one needs to prove that a solution for $P$ in $G ( s _ { a } , s _ { b } )$ would also reveal whether the two sets are disjoint or not. Since each player can exchange at most ${ \dot { O } } ( b \cdot \operatorname { c u t } )$ bits per round, at least $\Omega ( q / ( b \cdot \mathrm { c u t } ) )$ rounds are needed in total ilower bound for EST. By Theorem 4.1, one then obtains a . $d = \Omega ( q / ( w \log n \cdot \mathbf { c u t } ) )$ ) depth $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$
320
+
321
+ The two examples in Figure 3 illustrate the graphs $G ( s _ { a } , s _ { b } )$ giving rise to the lower bounds for even $k$ -cycle detection and diameter estimation. To reduce occlusion, only a subset of the edges are shown.
322
+
323
+ ![](images/334052ccd1ea255b8f322db9884932a7383060b9bf5027131d74c6d05939d850.jpg)
324
+ Figure 3: Examples of graphs giving rise to lower bounds.
325
+
326
+ (a) In the construction of Korhonen & Rybicki (2018), each player starts from a complete bipartite graph of $p = { \sqrt { q } }$ nodes (nodes annotated in dark grey) with nodes numbered from 1 to $2 p$ . The nodes with the same id are connected yielding a cut of size $2 p$ . Each player then uses its secret (there are as many bits as bipartite edges) to decide which of the bipartite edges will be deleted (corresponding to zero bits). Remaining edges are substituted by a path of length $k / 2 - 1$ . This happens in a way that ensures that $G ( s _ { a } , s _ { b } )$ contains a cycle of length $k$ (half known by Alice and half by Bob) if and only if the two sets are disjoint: the cycle will pass through nodes $t$ and $p + t$ of each player to signify that the $t { \cdot }$ -th bits of $s _ { a }$ and $s _ { b }$ are both one. It can then be shown that $n \doteq \dot { \Theta } ( p ^ { 2 } )$ from which it follows that:√ CONGEST requires at least $d = \Omega ( q / ( b \cdot \mathbf { c u t } ) ) = \Omega ( n / ( b \cdot p ) ) = \Omega ( \sqrt { n } / b )$ bits to decide if there is a cycle of length $k$ ; and $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ has to have $d = \Omega ( \sqrt { n } / ( w \log n ) )$ depth to do the same.
327
+
328
+ (b) In the construction of Abboud et al. (2016), each string consists of $q = \Omega ( n )$ bits. The strings are used to encode the connectivity of subgraphs annotated in dark gray: an edge exists between the red nodes $i$ and $q$ if and only if the $i$ -th bit of $s _ { a }$ is one (and similarly for green). Due to the graph construction, the cut between Alice and Bob has $O ( \log { q } )$ edges. Moreover, About et al. proved that $G ( s _ { a } , s _ { b } )$ has diameter at least five if and only if the sets defined by $s _ { a }$ and $s _ { b }$ are disjoint. This implies that $d = \Omega ( n / ( w \log ^ { 2 } n ) )$ depth is necessary to compute the graph diameter in $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ .
329
+
330
+ # D THE COST OF ANONYMITY
331
+
332
+ There is a striking difference between the power of anonymous networks and those in which nodes have the ability to uniquely identify each other, e.g., based on ids or discriminative attributes (see the survey by Suomela (2013)).
333
+
334
+ To illustrate this phenomenon, I consider a thought experiment where a node is tasked with reconstructing the graph topology in the LOCAL model. In the left, Figure 4 depicts the red node’s knowledge after two rounds (equivalent to a $\mathsf { G N N } _ { \mathsf { m p } } ^ { \mathsf { n } }$ having $d = 2$ ) when each node has a unique identifier (color). At the end of the first round, each node is aware of its neighbors and after two rounds the entire graph has been successfully reconstructed in red’s memory.
335
+
336
+ In the right subfigure, nodes do not possess ids (as in the analysis of (Xu et al., 2018; Morris et al., 2019)) and thus cannot distinguish which of their neighbors are themselves adjacent. As such, the red node cannot tell whether the graph contains cycles: after two rounds there are at least two plausible topologies that could explain its observations.
337
+
338
+ ![](images/ad2fa39385f3ec73579ebc093a2176cac62316873a1efcbbbdbecc3e9a632134.jpg)
339
+ Figure 4: Toy example of message exchange from the perspective of the red node. The arrows show where each received message comes from and the message content is shown in light gray boxes. Red’s knowledge of the graph topology is depicted at the bottom.
md/train/BJ9fZNqle/BJ9fZNqle.md ADDED
@@ -0,0 +1,407 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MULTI-MODAL VARIATIONAL ENCODER-DECODERS
2
+
3
+ Iulian V. Serban†∗, Alexander G. Ororbia $\mathbf { I I } ^ { \times }$ ∗, Joelle Pineau‡, Aaron Courville†
4
+
5
+ † Department of Computer Science and Operations Research, Universite de Montreal
6
+ ×College of Information Sciences & Technology, Penn State University
7
+ ‡ School of Computer Science, McGill University
8
+ iulian[DOT]vlad[DOT]serban[AT]umontreal[DOT]ca
9
+ ago109[AT]psu[DOT]edu
10
+ jpineau[AT]cs[DOT]mcgill[DOT]ca
11
+ aaron[DOT]courville[AT]umontreal[DOT]ca
12
+
13
+ # ABSTRACT
14
+
15
+ Recent advances in neural variational inference have facilitated efficient training of powerful directed graphical models with continuous latent variables, such as variational autoencoders. However, these models usually assume simple, unimodal priors — such as the multivariate Gaussian distribution — yet many realworld data distributions are highly complex and multi-modal. Examples of complex and multi-modal distributions range from topics in newswire text to conversational dialogue responses. When such latent variable models are applied to these domains, the restriction of the simple, uni-modal prior hinders the overall expressivity of the learned model as it cannot possibly capture more complex aspects of the data distribution. To overcome this critical restriction, we propose a flexible, simple prior distribution which can be learned efficiently and potentially capture an exponential number of modes of a target distribution. We develop the multi-modal variational encoder-decoder framework and investigate the effectiveness of the proposed prior in several natural language processing modeling tasks, including document modeling and dialogue modeling.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ With the development of the variational autoencoding framework (Kingma & Welling, 2013; Rezende et al., 2014), a tremendous amount of progress has been made in learning large-scale, directed latent variable models. This approach has lead to improved performance in applications ranging from computer vision (Gregor et al., 2015; Larsen et al., 2015) to natural language processing (Mnih & Gregor, 2014; Miao et al., 2015; Bowman et al., 2015; Serban et al., 2016b). Furthermore, these models naturally incorporate a Bayesian modeling perspective, by enabling the integration of problem-dependent knowledge in the form of a prior on the generating distribution.
20
+
21
+ However, the majority of models proposed assume an extremely simple prior in the form of a multivariate Gaussian distribution in order to maintain mathematical and computational tractability. Although this assumption on the prior has lead to favorable results on several tasks, it is clearly a restrictive and often unrealistic assumption. First, it imposes a strong uni-modal structure on the latent variable space; latent samples from the generating model (prior distribution) all cluster around a single mean. Second, it encourages local smoothness on the latent variables; the similarity between two latent variables decreases exponentially as their distance increase. Thus, for complex, multi-modal distributions — such as the distribution over topics in a text corpus, or natural language responses in a dialogue system — the uni-modal Gaussian prior inhibits the model’s ability to extract and represent important structure in the data. To learn more powerful and expressive models — in particular, models with multi-modal latent variable structures for natural language processing applications — we seek a suitable and flexible prior than can be automatically adapted to model multiple modes of a target distribution.
22
+
23
+ In this paper, we propose the multi-modal variational encoder-decoder framework, introducing an efficient, flexible prior distribution that is suitable for distributions such as those found in natural language text. We demonstrate the effectiveness of our multi-modal variational architectures in two representative tasks: document modeling and dialogue modeling. We find that our prior is able to capture elements of a target distribution that simpler priors — such as the uni-modal Gaussian — cannot model, thus allowing neural latent variable models to extract richer structure from data. In particular, we achieve state-of-the-art results on several document modeling tasks.
24
+
25
+ # 2 RELATED WORK
26
+
27
+ The idea of using an artificial neural network to approximate an inference model dates back to the 90s (Hinton & Zemel, 1994; Hinton et al., 1995; Dayan & Hinton, 1996). However, initial attempts at such an approach were hindered by the lack of low-bias, low-variance estimators of parameter gradients. Traditionally, researchers resorted to Markov chain Monte Carlo methods (MCMC) (Neal, 1992) which do not scale well and mix slowly, or to variational approaches which require a tractable, factored distribution to approximate the true posterior distribution, usually under-fitting it (Jordan et al., 1999). Others have since proposed using feed-forward inference models to efficiently initialize the mean-field inference algorithm for incrementally training Boltzmann architectures (Salakhutdinov & Larochelle, 2010; Ororbia II et al., 2015b). However, these approaches are limited by the mean-field inference’s inability to model structured posteriors. Recently, Mnih & Gregor (2014) proposed the neural variational inference and learning (NVIL) approach to match the true posterior directly without resorting to approximate inference. NVIL allows for the joint training of an inference network and directed generative model, maximizing a variational lower-bound on the data log-likelihood and facilitating exact sampling of the variational posterior. Simultaneously with this work, the variational autoencoder framework was proposed by Kingma & Welling (2013) and Rezende et al. (2014). This framework is the motivation of this paper, and will be discussed in detail in the next section.
28
+
29
+ With respect to document modeling, it has recently been demonstrated that neural architectures can outperform well-established, standard topic models such as Latent Dirichlet Allocation (LDA) (Blei et al., 2003). For example, it has been demonstrated that models based on the Boltzmann machine, which learn semantic binary vectors (binary latent variables), perform very well (Hofmann, 1999). Work involving discrete latent variables include the constrained Poisson model (Salakhutdinov & Hinton, 2009), the Replicated Softmax model (Hinton & Salakhutdinov, 2009) and the Over-Replicated Softmax model (Srivastava et al., 2013), as well as similar, auto-regressive neural architectures and deep directed graphical models (Larochelle & Lauly, 2012; Uria et al., 2014; Lauly et al., 2016; Bornschein & Bengio, 2014). In particular, Mnih & Gregor (2014) showed that using NVIL yields better generative models of documents than these previous approaches. The success of these discrete latent variable models — which are able to partition probability mass into separate regions — serve as the main motivation for investigating models with continuous multi-modal latent variables for document modeling. More recently, Miao et al. (2015) have proposed continuous latent variable representations for document modeling, which has achieved state-of-the-art results. This model will be described later.
30
+
31
+ With respect to dialogue modeling, latent variable models were investigated by Bangalore et al. (2008), Crook et al. (2009) as well as others. More recently, Zhai & Williams (2014) have proposed three models combining hidden Markov models and topic models. The success of these discrete latent variable models also motivates our investigation into dialogue models with multi-modal latent variables. Most related to our work is the Variational Hierarchical Recurrent Encoder-Decoder (VHRED) model by Serban et al. (2016b), which is a neural architecture with latent multivariate Gaussian variables. This model will be described later.
32
+
33
+ There has been some work exploring alternative distributions for the latent variables in the variational autoencoder framework, including multi-modal distributions. Rezende & Mohamed (2015) propose an approach called normalizing flows which computes a more complex, potentially multimodal distribution, by projecting standard Gaussian variables through a sequence of non-linear transformations. This approach is similar to the inverse auto-regressive flow proposed by Kingma et al. (2016). Unfortunately, both normalizing flows and auto-regressive flow are only applicable to the approximate posterior distribution; typically these approaches require fixing the prior distribution to a uni-modal multivariate Gaussian. Furthermore, to the best of our knowledge, neither of these approaches have been investigated in the context of larger scale text processing tasks, such as the document modeling and dialogue modeling tasks we evaluate on. A complementary approach is to combine variational inference with MCMC sampling (Salimans et al., 2015; Burda et al., 2015), however this is computationally expensive and therefore difficult to scale up to many real-world tasks. Enriching the latent variable distributions has also been investigated by Maaløe et al. (2016).
34
+
35
+ # 2.1 APPROACHES FOR LEARNING MULTI-MODAL LATENT VARIABLES
36
+
37
+ Mixture of Gaussians Perhaps the most direct and naive approach to learning multi-modal latent variables is to parametrize the latent variable prior and approximate posterior distributions as a mixture of Gaussians. However, the KL divergence between two mixtures of Gaussian distributions cannot be computed in closed form (Durrieu et al., 2012). To train such a model, one would have to either resort to MCMC sampling, which may slow down and hurt the training process due to the high variance it incurs, or resort to approximations of the KL divergence, which may also hurt the training process.1
38
+
39
+ Deep Directed Models An alternative to a mixture of Gaussians parametrization is to construct a deep directed graphical model composed of multiple layers of uni-modal latent variables (e.g. multivariate Gaussians) (Rezende et al., 2014). Such models have the potential to capture highly complex, multi-modal latent variable representations through the marginal distribution of the toplayer latent variables. However, this approaches has two major drawbacks. First, the variance of the gradient estimator grows with the number of layers. This makes it difficult to learn highly multimodal latent representations. Second, it is not clear how many modes such models can represent or how their inductive biases will affect their performance on tasks containing multi-modal latent structure. The piecewise constant latent variables we propose do not suffer from either of these two drawbacks; the piecewise constant variables incur low variance in the gradient estimator, and can, in principle, represent a number of modes exponential in the number of latent variables.
40
+
41
+ Discrete Latent Variables A third approach for learning multi-modal latent representations is to instead use discrete latent variables as discussed above. For example, the learning procedure proposed by Mnih & Gregor (2014) for discrete latent variables can easily be combined with the variational autoencoder framework to learn models with both discrete and continuous latent variables. However, the major drawback of discrete latent variables is the high variance in the gradient estimator. Without further approximations, it might be difficult to scale up models with discrete latent variables for real-world tasks.
42
+
43
+ # 3 THE MULTI-MODAL VARIATIONAL ENCODER-DECODER FRAMEWORK
44
+
45
+ We start by describing the general neural variational learning framework. Then we present our proposed prior model aimed at enhancing the model’s ability to learn multiple modes of data distributions. We focus on modeling discrete output variables in the context of natural language processing applications. However, the framework can easily be adapted to handle continuous output variables, such as images, video and audio.
46
+
47
+ # 3.1 NEURAL VARIATIONAL LEARNING
48
+
49
+ Let $w _ { 1 } , \ldots , w _ { N }$ be a sequence of $N$ words conditioned on a continuous latent variable $z$ . In the general framework, the distribution over the variables follows the directed graphical model:
50
+
51
+ $$
52
+ P _ { \theta } ( w _ { 1 } , \dots , w _ { N } , z ) = \int \prod _ { n = 1 } ^ { N } P _ { \theta } ( w _ { n } | w _ { < n } , z ) P _ { \theta } ( z ) d z ,
53
+ $$
54
+
55
+ where $\theta$ are the model parameters. The model first generates the higher-level, continuous latent variable $z$ , and then, conditioned on this, generates the word sequence. The document modeling
56
+
57
+ task further simplifies the model by assuming the words are independent of each other:
58
+
59
+ $$
60
+ P _ { \theta } ( w _ { 1 } , \dots , w _ { N } , z ) = \int \prod _ { n = 1 } ^ { N } P _ { \theta } ( w _ { n } | z ) P _ { \theta } ( z ) d z .
61
+ $$
62
+
63
+ Following the variational autoencoder (VAE) framework (Kingma & Welling, 2013), the parameters can be learned using the variational lower-bound:
64
+
65
+ $$
66
+ \begin{array} { r } { \begin{array} { r } { \log P _ { \theta } ( w _ { 1 } , \dots , w _ { N } , z ) \geq \operatorname { E } _ { z \sim Q _ { \psi } ( z | w _ { 1 } , \dots , w _ { N } ) } [ \log P _ { \theta } ( w _ { n } | w _ { < n } , z ) ] - \mathrm { K L } \left[ Q _ { \psi } ( z | w _ { 1 } , \dots , w _ { N } ) \right| | P _ { \theta } ( z ) ] , } \end{array} } \end{array}
67
+ $$
68
+
69
+ where $Q _ { \psi } ( z | w _ { 1 } , \dots , w _ { N } )$ is the approximation to the posterior for $z$ , called the encoder, or sometimes the recognition model or inference model, with parameters $\psi$ . The distribution $P _ { \theta } ( z )$ is the prior model for $z$ . The variational autoencoder model further makes use of the re-parametrization trick, which allows one to move the derivative of the lower-bound to inside the expectation. To accomplish this, we need to parametrize $z$ as a transformation from a fixed (parameter-less) random distribution:
70
+
71
+ $$
72
+ z = f _ { \theta } ( \epsilon ) ,
73
+ $$
74
+
75
+ where $\epsilon$ is drawn from a random distribution, e.g. a standard Gaussian distribution (with zero mean and unit standard deviation) or a uniform distribution in the interval $[ 0 , 1 ]$ , and $f$ is some transformation of this variable, also parametrized by $\theta$ .
76
+
77
+ The majority of work on VAEs that uses the re-parametrization trick propose to parametrize $z -$ both the prior and approximate posterior (encoder) — as a multivariate Gaussian variable. However, the multivariate Gaussian is a uni-modal distribution and can therefore only represent one mode in latent space. This means the mapping from latent variable to outputs — i.e. the conditional distribution $P _ { \theta } ( w _ { n } | z )$ — has to be highly non-linear in order to capture additional modes. However, in general, it is difficult to learn such non-linear mappings with existing stochastic optimization methods, such as mini-batch stochastic gradient descent and its variants. Learning such a non-linear mapping is particularly difficult using the variational bound in eq. (3), because it incurs additional variance from sampling the latent variable $z$ . Consequently, such a model is very likely to converge on a solution which does not model multi-modality which then leads to a poor approximation of the output distribution.
78
+
79
+ # 3.2 THE PIECEWISE-CONSTANT PRIOR FOR LATENT VARIABLES
80
+
81
+ In this work, we overcome the uni-modal restriction by parametrizing $z$ using a piecewise constant probability density function (PDF). This parametrization will allow $z$ to represent complex aspects of the data distribution in latent variable space, such as multiple modes and highly non-smooth regions of probability mass. From a manifold learning perspective, this extension translates into expanding the set of manifolds representable by the model parameters to include more non-linear manifolds – in particular, manifolds where there exists separate clusters of probability mass.
82
+
83
+ Let $n \in \mathbb { N }$ be the number of piecewise constant components. We assume $z$ is drawn from the PDF:
84
+
85
+ $$
86
+ P ( z ) = \frac { 1 } { K } \sum _ { i = 1 } ^ { n } 1 { \Big ( } \frac { i - 1 } { n } \underline { { \leq z } } \leq \frac { i } { n } { \Big ) } ^ { a _ { i } } ,
87
+ $$
88
+
89
+ where $1 _ { ( x ) }$ is the indicator function (which is one whenever $x$ is true and otherwise zero), $a _ { i } > 0$ for $i = 1 , \ldots , n$ are the distribution parameters (which will be learned during training), and $K$ is the normalization constant:
90
+
91
+ $$
92
+ K = \sum _ { i = 1 } ^ { n } K _ { i } , \quad { \mathrm { w h e r e ~ } } K _ { 0 } : = 0 , K _ { i } : = { \frac { a _ { i } } { n } } { \mathrm { ~ f o r ~ } } i = 1 , \dots , n .
93
+ $$
94
+
95
+ To train the model using the re-parametrization trick, we need to generate $z = f ( \epsilon )$ where $\epsilon \sim$ Uniform $( 0 , 1 )$ . To do so, we employ inverse transform sampling (Devroye, 1986), which requires finding the inverse of the cumulative distribution function (CDF). We first derive the CDF of eq. (5):
96
+
97
+ $$
98
+ \phi ( z ) = { \frac { 1 } { K } } \sum _ { i = 1 } ^ { n } 1 { } _ { \left( { \frac { i } { n } } \leq z \right) } ^ { K _ { i } + 1 } { \Big ( } { \frac { i - 1 } { n } } \leq z \leq { \frac { i } { n } } { \Big ) } \left( z - { \frac { i - 1 } { n } } \right) a _ { i } .
99
+ $$
100
+
101
+ Next, we derive its inverse:
102
+
103
+ $$
104
+ \phi ^ { - 1 } ( \epsilon ) = \sum _ { i = 1 } ^ { n } 1 _ { \left( { \frac { 1 } { K } } \sum _ { j = 0 } ^ { i - 1 } K _ { j } \leq \epsilon \leq { \frac { 1 } { K } } \sum _ { j = 0 } ^ { i } K _ { j } \right) } \left( { \frac { i - 1 } { n } } + { \frac { K } { a _ { i } } } \left( \epsilon - { \frac { 1 } { K } } \sum _ { j = 0 } ^ { i - 1 } K _ { j } \right) \right)
105
+ $$
106
+
107
+ Armed with the inverse CDF, we can now draw a sample $z$
108
+
109
+ $$
110
+ z = \phi ^ { - 1 } ( \epsilon ) , \quad \mathrm { w h e r e } \epsilon \sim \mathrm { U n i f o r m } ( 0 , 1 ) .
111
+ $$
112
+
113
+ In addition to sampling, we need to compute the Kullback-Leibler (KL) divergence between the prior and approximate posterior distributions of the piecewise constant variables. We assume both the prior and the posterior are piecewise constant distributions. We use prior to denote prior parameters and post to denote posterior parameters (encoder model parameters). The KL divergence between the prior and posterior can be computed using a sum of integrals, where each integral inside the sum corresponds to one constant segment:
114
+
115
+ $$
116
+ \begin{array} { l } { { \displaystyle \mathbb { K L } \left[ \displaystyle Q _ { \psi } ( z | w _ { 1 } , \dots , w _ { N } ) \right] \left\| P _ { \theta } ( z ) \right\} = \int _ { 0 } ^ { 1 } Q _ { \psi } ( z | w _ { 1 } , \dots , w _ { N } ) \log \left( \frac { Q _ { \psi } ( z | w _ { 1 } , \dots , w _ { N } ) } { P _ { \theta } ( z ) } \right) d z } } \\ { { \displaystyle \qquad = \sum _ { i = 1 } ^ { n } \int _ { 0 } ^ { 1 / n } \frac { a _ { i } ^ { \mathrm { p o t } } } { K ^ { \mathrm { p o t } } } \log \left( \frac { a _ { i } ^ { \mathrm { p o t } } / K ^ { \mathrm { p o t } } } { a _ { i } ^ { \mathrm { p o t } } / K ^ { \mathrm { p o t } } } \right) d z } } \\ { ~ } \\ { { \displaystyle \qquad = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { a _ { i } ^ { \mathrm { p o t } } } { K ^ { \mathrm { p o t } } } \log \left( \frac { a _ { i } ^ { \mathrm { p o t } } / K ^ { \mathrm { p o t } } } { a _ { i } ^ { \mathrm { p o t } } / K ^ { \mathrm { p o t } } } \right) } } \\ { { \displaystyle \qquad = \frac { 1 } { n } \frac { 1 } { K ^ { \mathrm { p o t } } } \frac { \sum _ { i = 1 } ^ { n } a _ { i } ^ { \mathrm { p o t } } } { i - 1 } \left( \log ( a _ { i } ^ { \mathrm { p o t } } ) - \log ( a _ { i } ^ { \mathrm { p o t } } ) \right) } } \\ { ~ } \\ { { \displaystyle \qquad + \log ( K ^ { \mathrm { p o t } } ) - \log ( K ^ { \mathrm { p o t } } ) } } \end{array}
117
+ $$
118
+
119
+ In order to train the model, we take partial derivatives of the variational bound in eq. (3) w.r.t. each parameter in $\theta$ and $\psi$ . These expressions involve derivatives of the indicator functions, which have derivatives zero everywhere except for the changing points where the derivative is undefined. However, the probability of sampling $\epsilon$ such that an indicator function is exactly at its changing point is effectively zero. Therefore, we fix their derivatives to zero.2 A similar approach is used for training neural networks with rectified linear units. Figure 1 illustrates how the piecewise constant latent variables can work with Gaussian latent variables in order to model multi-modality.
120
+
121
+ # 4 LATENT VARIABLE PARAMETRIZATIONS
122
+
123
+ The latent variable parametrizations are crucial to modeling the data effectively. In this section, we will develop the parametrizations for both the Gaussian variable and our proposed piecewise latent variable.
124
+
125
+ For all parametrizations, let $c$ be the conditioning information for the prior. In document modeling there is no conditioning information available to the prior, so $c = \emptyset$ . In dialogue modeling $c$ is the vector representation of the dialogue context, namely all previous utterances until the current time step. Let $x$ be the current output sequence (observation), which the model must generate (e.g. $w _ { 1 } , \ldots , w _ { N }$ for document modeling).
126
+
127
+ # 4.1 GAUSSIAN PARAMETRIZATION
128
+
129
+ Let $\mu ^ { \mathrm { p r i o r } }$ and $\sigma ^ { 2 , \mathrm { p r i o r } }$ be the prior mean and variance, and let $\mu ^ { \mathrm { p o s t } }$ and $\sigma ^ { 2 , \mathrm { p o s t } }$ be the posterior mean and variance. For Gaussian latent variables, the prior distribution mean and variances are encoded using linear transformations of a hidden state. In particular, the prior distribution covariance is
130
+
131
+ ![](images/67554ddd11954cd275638c1a7e186936a68fb54053b5485afdf2b2aaa8e6e5d3.jpg)
132
+ Figure 1: The horizontal axis corresponds to $z _ { 1 }$ , which is a univariate Gaussian variable. The vertical axis corresponds to $z _ { 2 }$ , which is a piecewise constant variable. The PDF for each variable is shown along each axis, and their joint distribution is illustrated in grey color.
133
+
134
+ encoded as a diagonal covariance matrix using a softplus function:
135
+
136
+ $$
137
+ \begin{array} { r l } & { \mu ^ { \mathrm { p r i o r } } = H _ { \mu } ^ { \mathrm { p r i o r } } \mathrm { E n c } ( c ) + b _ { \mu } ^ { \mathrm { p r i o r } } , } \\ & { \sigma ^ { \mathrm { 2 , p r i o r } } = \mathrm { d i a g } ( \log ( 1 + \exp ( H _ { \sigma } ^ { \mathrm { p r i o r } } \mathrm { E n c } ( c ) + b _ { \sigma } ^ { \mathrm { p r i o r } } ) ) ) , } \end{array}
138
+ $$
139
+
140
+ where $\operatorname { E n c } ( c )$ is an embedding/encoding of the context $c$ (e.g. given by a bag-of-words encoder or an LSTM encoder applied to $c$ ), which is shared across all latent variable dimensions. The parameters $H _ { \mu } ^ { \mathrm { p r i o r } } , b _ { \mu } ^ { \mathrm { p r i o r } } , H _ { \sigma } ^ { \mathrm { p r i o r } } , b _ { \sigma } ^ { \mathrm { p r i o r } }$ r, H priorσ , are to be learned.
141
+
142
+ For the posterior distribution, our preliminary experiments have shown that it is much better to parametrize the posterior distribution by interpolating between the prior distribution mean and variance and a new estimate of the mean and variance. This interpolation is controlled by a gating mechanism, which makes it easy for the model to learn how to turn on/off latent dimensions:
143
+
144
+ $$
145
+ \begin{array} { r l } & { \mu ^ { \mathrm { p o s t } } = ( 1 - \alpha _ { \mu } ) \mu ^ { \mathrm { p r i o r } } + \alpha _ { \mu } \left( H _ { \mu } ^ { \mathrm { p o s t } } \mathrm { E n c } ( c , x ) + b _ { \mu } ^ { \mathrm { p o s t } } \right) , } \\ & { \sigma ^ { 2 , \mathrm { p o s t } } = ( 1 - \alpha _ { \sigma } ) \sigma ^ { 2 , \mathrm { p r i o r } } + \alpha _ { \sigma } \mathrm { d i a g } ( \log ( 1 + \exp ( H _ { \sigma } ^ { \mathrm { p o s t } } \mathrm { E n c } ( c , x ) + b _ { \sigma } ^ { \mathrm { p o s t } } ) ) ) , } \end{array}
146
+ $$
147
+
148
+ where $\operatorname { E n c } ( c , x )$ is an encoding/embedding of both $c$ and $x$ , and where the parameters are $H _ { \mu } ^ { \mathrm { p o s t } } , b _ { \mu } ^ { \mathrm { p o s t } } , H _ { \sigma } ^ { \mathrm { p o s t } } , b _ { \sigma } ^ { \mathrm { p o s t } } , \alpha _ { \mu } , \alpha _ { \sigma }$ . The interpolation mechanism is controlled by $\alpha _ { \mu }$ and $\alpha _ { \sigma }$ , which are initialized to zero (i.e. initialized such that the posterior is equal to the prior).3
149
+
150
+ # 4.2 PIECEWISE CONSTANT PARAMETRIZATION
151
+
152
+ Similar to the Gaussian variances, we propose to parametrize the piecewise constant prior parameters using an exponential function applied to a linear transformation of the context embedding/encoding:
153
+
154
+ $$
155
+ \begin{array} { r } { a _ { i } ^ { \mathrm { p r i o r } } = \exp ( { H _ { a , i } ^ { \mathrm { p r i o r } } } \mathrm { E n c } ( c ) + b _ { a , i } ^ { \mathrm { p r i o r } } ) , \quad i = 1 , \ldots , n , } \end{array}
156
+ $$
157
+
158
+ where $H _ { a } ^ { \mathrm { p r i o r } }$ and $b _ { a } ^ { \mathrm { p r i o r } }$ are the parameters to be learned.
159
+
160
+ We may also constrain the piecewise constant posterior parameters to be an interpolation between the prior parameters and a new estimated parameter:
161
+
162
+ $$
163
+ a _ { i } ^ { \mathrm { p o s t } } = ( 1 - \alpha _ { a , i } ) a _ { i } ^ { \mathrm { p r i o r } } + \alpha _ { a , i } \exp ( H _ { a , i } ^ { \mathrm { p o s t } } \mathrm { E n c } ( c , x ) + b _ { a , i } ^ { \mathrm { p o s t } } ) , \quad i = 1 , \ldots , n ,
164
+ $$
165
+
166
+ where $H _ { a } ^ { \mathrm { p o s t } } , b _ { a } ^ { \mathrm { p o s t } }$ , $\alpha _ { a }$ are the parameters. However, we found that this interpolation hurt performance and therefore fixed $\alpha _ { a } = { \bf 1 }$ .
167
+
168
+ To take advantage of the properties of both priors, the Gaussian and piecewise constant variables may be combined, as was suggested in Section 3.2. In this work, we primarily experimented with their concatenation to create a hybrid model.
169
+
170
+ # 5 VARIATIONAL TEXT MODELING
171
+
172
+ We now present two probabilistic models, the NVDM and the VHRED, which are extended to incorporate the latent variable parametrization and used for the document modeling and the dialogue modeling experiments described below.
173
+
174
+ # 5.1 NEURAL VARIATIONAL DOCUMENT MODEL (NVDM)
175
+
176
+ The NVDM framework (Mnih & Gregor, 2014; Miao et al., 2015) collapses the recurrent neural encoder into a simpler bag-of-words model (since no symbol order is taken into account), which may be defined as a multi-layer perceptron (MLP) for $\dot { E } n c ( c = \varnothing , x ) = E n c ( x )$ . Let $V$ be the vocabulary. Let $W$ represent a document matrix, where row $w _ { i }$ is the 1-of- $| V |$ binary encoding of the $\overrightarrow { \imath } ^ { \prime }$ th word in the document. $E n c ( W )$ is trained to compress a document vector into a continuous distributed representation upon which the posterior model is built.
177
+
178
+ The NVDM parametrization requires only learning the parameters $b _ { a } ^ { \mathrm { p r i o r } } , W _ { a } ^ { \mathrm { p o s t } } , b _ { a } ^ { \mathrm { p o s t } }$ for the piecewise variables, and learning the parameters $b _ { \mu } ^ { \mathrm { p r i o r } } , b _ { \sigma } ^ { \mathrm { p r i o r } } , W _ { \mu } ^ { \mathrm { p o s t } } , b _ { \mu } ^ { \mathrm { p o s t } } , W _ { \sigma } ^ { \mathrm { p o s t } } , b _ { \sigma } ^ { \mathrm { p o s t } }$ for the Gaussian variables. We initialize the bias parameters to zero, in order for the NVDM to start with a centered Gaussian prior. This prior will be adapted by the parametric encoder as learning progresses, while also learning to turn on/off latent dimensions controlled through the gating mechanism. It is important to note that our particular instantiation of the NVDM is different from that of Mnih & Gregor (2014) and Miao et al. (2015); we jointly learn the prior mean and variance whereas in previous work it has been assumed to be a standard Gaussian. Furthermore, our models learn to interpolate between the generated prior and posterior models to calculate a new posterior.
179
+
180
+ Based on preliminary experiments, we choose the encoder to be a 2-hidden layer perceptron, defined by parameters $\{ E ^ { 0 } , \mathbf { \dot { \boldsymbol { b } } ^ { 0 } } , \dot { E } ^ { 1 } , \boldsymbol { b } ^ { 1 } \}$ . The decoder is defined by parameters $\{ R , c \}$ . For example, in the case of the hybrid VAE we use eq. (15)–(20) to generate the distribution parameters. In this case, to draw a sample from the Gaussian prior, we draw a standard Gaussian variable and then multiply it by the standard deviation and add the mean of the Gaussian prior. To draw a sample from the piecewise prior, we use eq. (8). As such, the complete architecture is:
181
+
182
+ $$
183
+ \begin{array} { r l } & { ~ \pi ( W ) = f ^ { 0 } ( E ^ { 0 } W + b ^ { 0 } ) , } \\ & { ~ E n c ( W ) = f ^ { 1 } ( E ^ { 1 } \pi ( W ) + b ^ { 1 } ) , } \\ & { z _ { G a u s s i a n } = \mu ^ { \mathrm { p o s t } } + \sqrt { \sigma ^ { 2 } , \mathrm { p o s t } } \otimes \epsilon _ { 0 } , } \\ & { z _ { P i e c e w i s e } = \phi ^ { - 1 , p o s t } ( \epsilon _ { 1 } ) , } \\ & { ~ z = \langle z _ { G a u s s i a n } , z _ { P i e c e w i s e } \rangle , } \\ & { D e c ( w , z ) = g ( - w ^ { \mathsf { T } } R z ) , } \end{array}
184
+ $$
185
+
186
+ where $\otimes$ is the Hadamard product, $\langle \circ , \circ \rangle$ is an operator that combines the Gaussian and the Piecewise variables and $D e c ( w , z )$ is the decoder model. 4 As a result of using the re-parametrization trick and choice of prior, we calculate the latent variable $z$ through the two samples, $\epsilon _ { 0 }$ and $\epsilon _ { 1 }$ . $f ( \circ )$ is a non-linear activation function. We choose it to be the softsign function, or $f ( v ) = v / ( 1 + | v | )$ . The decoder model $D e c ( z )$ outputs a probability distribution over words conditioned on $z$ . In this case, we define $g ( \circ )$ as the softmax function (omitting the bias term $c$ for clarity) computed as:
187
+
188
+ $$
189
+ D e c ( w , z ) = P _ { \theta } ( w | z ) = \frac { \exp { ( - w ^ { \mathrm { T } } R z ) } } { \sum _ { w ^ { \prime } } \exp { ( - w ^ { \mathrm { T } } R z ) } } ,
190
+ $$
191
+
192
+ The decoder’s output is used to calculate the first term in the variational lower-bound: $\log { P _ { \theta } ( W | z ) }$ . The prior and posterior distributions are used to compute the KL term in the variational lower-bound. The lower-bound defined becomes:
193
+
194
+ $$
195
+ \mathcal { L } = \mathrm { E } _ { Q _ { \psi } ( z | W ) } \left[ \sum _ { i = 1 } ^ { N } \log P _ { \theta } ( w _ { i } | z ) \right] - \mathrm { K L } \left[ Q _ { \psi } ( z | W ) | | P _ { \theta } ( z ) \right] ,
196
+ $$
197
+
198
+ where the $\mathrm { K L }$ term is the sum of the Gaussian and piecewise KL-divergence measures:
199
+
200
+ $$
201
+ \mathrm { K L } \left[ Q ( z | W ) | | P ( z ) \right] = \mathrm { K L } _ { G a u s s i a n } \left[ Q ( z | W ) | | P ( z ) \right] + \mathrm { K L } _ { P i e c e w i s e } \left[ Q ( z | W ) | | P ( z ) \right] .
202
+ $$
203
+
204
+ The KL-terms may be interpreted as regularizers of the parameter updates for the encoder model (Kingma & Welling, 2013). These terms encourage the posterior distributions to be similar to their corresponding prior distributions, by limiting the amount of information the encoder model transmits regarding the output. For example, it encourages the uni-modal Gaussian posterior to move its mean close to the mean of the Gaussian prior, which makes it difficult for the Gaussian posterior to represent different modes conditioned on the observation. Similarly, this encourages the piecewise constant posterior to be similar to the piecewise constant prior. However, since the piecewise constant posterior is multi-modal, it may be able to shift some of its probability mass towards the prior distribution while keeping other probability mass on one or several modes dependent upon the output observation (e.g. if the prior distribution is a uniform distribution and the true posterior concentrates all its probability mass in several small regions, then the approximate posterior could interpolate between the prior and the true posterior).
205
+
206
+ # 5.2 VARIATIONAL HIERARCHICAL RECURRENT ENCODER-DECODER (VHRED)
207
+
208
+ The VHRED model is an extension of the hierarchical recurrent encoder-decoder model (HRED) for dialogue (Serban et al., 2016b;a). The model decomposes dialogues using a two-level hierarchy: sequences of utterances (e.g. sentences), and sub-sequences of tokens (words). Let ${ \bf w } _ { n }$ be the $n$ ’th utterance in a dialogue with $N$ utterances. Let $w _ { n , m }$ be the $m$ ’th word in the $n$ ’th utterance from vocabulary $V$ , and let $M _ { n }$ be the number of words in the $n$ ’th utterance. In addition to this, VHRED has a latent multivariate continuous variable $\mathbf { z } _ { n }$ for each utterance $n = 1 , \ldots , N$ . The probability distribution of the generative model factorizes as:
209
+
210
+ $$
211
+ \begin{array} { l } { { \displaystyle P _ { \theta } ( \mathbf { w } _ { 1 } , \ldots , \mathbf { w } _ { N } ) = \prod _ { n = 1 } ^ { N } P _ { \theta } ( \mathbf { w } _ { n } | \mathbf { w } _ { < n } , \mathbf { z } _ { n } ) P _ { \theta } ( \mathbf { z } _ { n } | \mathbf { w } _ { < n } ) } , } \\ { ~ } \\ { { \displaystyle \qquad = \prod _ { n = 1 } ^ { N } \prod _ { m = 1 } ^ { M _ { n } } P _ { \theta } ( w _ { n , m } | w _ { n , < m } , \mathbf { w } _ { < n } , \mathbf { z } _ { n } ) P _ { \theta } ( \mathbf { z } _ { n } | \mathbf { w } _ { < n } ) } , } \end{array}
212
+ $$
213
+
214
+ where $\theta$ are the model parameters. VHRED uses three RNN modules: an encoder RNN, a context RNN and a decoder RNN. First, each utterance is encoded into a vector by the encoder RNN:
215
+
216
+ $$
217
+ h _ { n , 0 } ^ { \mathrm { e n c } } = \mathbf { 0 } , \ h _ { n , m } ^ { \mathrm { e n c } } = f _ { \theta } ^ { \mathrm { e n c } } ( h _ { n , m - 1 } ^ { \mathrm { e n c } } , w _ { n , m } ) \forall m = 1 , \ldots , M _ { n } ,
218
+ $$
219
+
220
+ where $f _ { \theta } ^ { \mathrm { e n c } }$ is either a GRU or a bidirectional GRU function. The last hidden state of the encoder RNN is given as input to the context RNN. Then, the context RNN updates its internal hidden state to reflect all the information up until that utterance:
221
+
222
+ $$
223
+ h _ { 0 } ^ { \mathrm { c o n } } = { \bf 0 } , h _ { n } ^ { \mathrm { c o n } } = f _ { \theta } ^ { \mathrm { c o n } } ( h _ { n - 1 } ^ { \mathrm { c o n } } , h _ { n , M _ { n } } ^ { \mathrm { e n c } } ) ,
224
+ $$
225
+
226
+ where $f _ { \theta } ^ { \mathrm { c o n } }$ is a GRU function taking as input two vectors. This state is used to compute the prior distribution over the latent variable $\mathbf { z } _ { n }$ :
227
+
228
+ $$
229
+ P _ { \theta } ( \mathbf { z } _ { n } \mid \mathbf { w } _ { < n } ) = f _ { \theta } ^ { \mathrm { p r i o r } } ( h _ { n - 1 } ^ { c o n } ) ,
230
+ $$
231
+
232
+ where $f ^ { \mathrm { p r i o r } }$ is a PDF parametrized by both $\theta$ and $h _ { n } ^ { c o n }$ . Next, a sample is drawn from this distribution: ${ \bf z } _ { n } \sim P _ { \boldsymbol \theta } ( { \bf z } _ { n } | { \bf w } _ { < n } )$ . The sample and context state are given as input to the decoder RNN:
233
+
234
+ $$
235
+ \begin{array} { r l } & { h _ { n , 0 } ^ { \mathrm { d e c } } = \mathbf { 0 } , \ h _ { n , m } ^ { \mathrm { d e c } } = f _ { \theta } ^ { \mathrm { d e c } } ( h _ { n , m - 1 } ^ { \mathrm { d e c } } , h _ { n - 1 } ^ { \mathrm { c o n } } , \mathbf { z } _ { n } , w _ { n , m } ) } \\ & { \qquad \forall m = 1 , \ldots , M _ { n } , } \end{array}
236
+ $$
237
+
238
+ where $f _ { \theta } ^ { \mathrm { d e c } }$ is the LSTM gating function taking as input four vectors. The output distribution is computed by passing $h _ { n , m } ^ { \mathrm { d e c } }$ through an MLP $f _ { \theta } ^ { \mathrm { m l p } }$ , an affine transformation and a softmax function:
239
+
240
+ $$
241
+ P _ { \theta } ( w _ { n , m + 1 } | w _ { n , \le m } , { \mathbf w } _ { < n } , { \mathbf z } _ { n } ) = \frac { e ^ { ( O w _ { n , m + 1 } ) ^ { \mathrm { T } } f _ { \theta } ^ { \mathrm { m p } } ( h _ { n , m } ^ { \mathrm { d e c } } ) } } { \sum _ { w ^ { \prime } } e ^ { ( O w ^ { \prime } ) ^ { \mathrm { T } } f _ { \theta } ^ { \mathrm { m p } } ( h _ { n , m } ^ { \mathrm { d e c } } ) } } ,
242
+ $$
243
+
244
+ where $O \in \mathbb { R } ^ { | V | \times d }$ is the word embedding matrix for the output distribution with embedding dimensionality $d \in \mathbb { N }$ . The model is trained by maximizing the variational lower-bound, which factorizes into independent terms for each sub-sequence (utterance):
245
+
246
+ $$
247
+ \begin{array} { r } { \log P _ { \theta } ( \mathbf w _ { 1 } , \dots , \mathbf w _ { N } ) \geq \displaystyle \sum _ { n = 1 } ^ { N } - { \mathrm { K L } } \left[ Q _ { \psi } ( \mathbf z _ { n } \mid \mathbf w _ { 1 } , \dots , \mathbf w _ { n } ) \right| \left| P _ { \theta } ( \mathbf z _ { n } \mid \mathbf w _ { < n } ) \right] } \\ { + \mathbb { E } _ { Q _ { \psi } ( \mathbf z _ { n } \mid \mathbf w _ { 1 } , \dots , \mathbf w _ { n } ) } \left[ \log P _ { \theta } ( \mathbf w _ { n } \mid \mathbf z _ { n } , \mathbf w _ { < n } ) \right] , } \end{array}
248
+ $$
249
+
250
+ where distribution $Q _ { \psi }$ is the approximate posterior distribution with parameters $\psi$ , which is computed similar to the prior distribution but further conditioned on the future encoder RNN hidden state:
251
+
252
+ $$
253
+ Q _ { \psi } ( \mathbf { z } _ { n } \mid \mathbf { w } _ { \leq n } ) = f _ { \psi } ^ { \mathrm { p o s t } } ( h _ { n - 1 } ^ { c o n } , h _ { n , M _ { n } } ^ { e n c } ) ,
254
+ $$
255
+
256
+ where $f ^ { \mathrm { p o s t } }$ is a PDF. More details are given by Serban et al. (2016b).
257
+
258
+ The original VHRED model as described by Serban et al. (2016b) used only Gaussian latent variables. We will refer to this model as Gaussian-VHRED (G-VHRED). The VHRED model with both Gaussian and piecewise constant latent variables will be referred to as Hybrid-VHRED (HVHRED). In this case, we combine the Gaussian and piecewise latent variables by concatenating them into one vector.5
259
+
260
+ # 6 EXPERIMENTS
261
+
262
+ In order to validate the ability of our piecewise latent variables to capture complex aspects of data distributions, we conduct experiments with both the NVDM and VHRED models.
263
+
264
+ All models are trained using back-propagation to obtain parameter gradients with respect to the variational lower-bound on the log-likelihood or the exact log-likelihood. We used a standard firstorder gradient-descent optimizer, Adam (Kingma & Ba, 2015), for both models, where only hyperparameter choices varied depending on the task. The specifics of the design of the encoder and decoder differed between the two tasks (as described in Sections 5.1 and 5.2). For all models that used piecewise latent variables, we chose to fix $\alpha _ { a _ { i } } = 1$ , meaning the piecewise prior and posterior models are kept separate (instead of having the posterior be an interpolation between another distribution and the prior), since we found this to perform better6
265
+
266
+ # 6.1 DOCUMENT MODELING
267
+
268
+ For our experiments in document modeling, we make use of the 20 News-Groups dataset. We follow the pre-processing and set-up of Hinton & Salakhutdinov (2009). In addition, we make use of the Reuters corpus (RCV1-V2), using a version that contained a selected 5,000 term vocabulary. 7 Note that the features are a $\log ( 1 + T F )$ transform of the original frequency vectors. To test our document models on text from another language (in this case, Brazilian Portuguese), we make use of the CADE12 dataset (stop-word removed and stemmed) Cardoso-Cachopo (2007), where we further filtered terms that occurred less than 130 times to obtain a vocabulary of 3,736 terms (over 26,991 training and 13,486 test documents). For all datasets, we track the validation bound on a subset of 100 vectors randomly drawn from each training corpus.
269
+
270
+ Table 1: Comparative test perplexities on various document datasets (50 latent variables). Note that document probabilities were calculated using 10 samples to estimate the variational lower bound.
271
+
272
+ <table><tr><td>20-NG</td><td>Sampled</td><td>SGD-Inf</td><td>RCV1</td><td>Sampled</td><td>SGD-Inf</td></tr><tr><td>LDA</td><td>1058</td><td></td><td>G-NVDM</td><td>905</td><td>837</td></tr><tr><td>RSM</td><td>953</td><td></td><td>H-NVDM-3</td><td>865</td><td>807</td></tr><tr><td>docNADE</td><td>896</td><td></td><td>H-NVDM-5</td><td>833</td><td>781</td></tr><tr><td>SBN</td><td>909</td><td></td><td></td><td></td><td></td></tr><tr><td>fDARN</td><td>917</td><td></td><td>CADE</td><td>Sampled</td><td>SGD-Inf</td></tr><tr><td>NVDM</td><td>836</td><td></td><td>G-NVDM</td><td>339</td><td>230</td></tr><tr><td>G-NVDM</td><td>651</td><td>588</td><td>H-NVDM-3</td><td>258</td><td>193</td></tr><tr><td>H-NVDM-3</td><td>607</td><td>546</td><td>H-NVDM-5</td><td>294</td><td>209</td></tr><tr><td>H-NVDM-5</td><td>566</td><td>496</td><td></td><td></td><td></td></tr></table>
273
+
274
+ Table 2: Word query similarity test, where each (20 News-Group) document model’s decoder is given a query and must return the top 10 most relevant words. The first query was “government” while the second was “space”. It appears that the models with piecewise variables tend to associate more general/abstract terms to the query, which may or may not always be what is desired.
275
+
276
+ <table><tr><td>G-NVDM</td><td>H-NVDM-3</td><td>H-NVDM-5</td></tr><tr><td>governments</td><td>citizens</td><td>arms</td></tr><tr><td>citizens</td><td>rights</td><td>rights</td></tr><tr><td>country</td><td>governments</td><td>federal</td></tr><tr><td>threat</td><td>civil</td><td>country</td></tr><tr><td>private</td><td>freedom</td><td>policy</td></tr><tr><td>rights</td><td>legitimate</td><td>administration</td></tr><tr><td>individuals</td><td>constitution</td><td>protect</td></tr><tr><td>military</td><td>private</td><td>private</td></tr><tr><td>freedom</td><td>court</td><td>citizens</td></tr><tr><td>foreign</td><td>states</td><td>military</td></tr></table>
277
+
278
+ <table><tr><td>G-NVDM</td><td>H-NVDM-3</td><td>H-NVDM-5</td></tr><tr><td>environment</td><td>project</td><td>science</td></tr><tr><td>project</td><td>gov</td><td>built</td></tr><tr><td>flight</td><td>major</td><td>high</td></tr><tr><td>lab</td><td>based</td><td>technology</td></tr><tr><td>mission</td><td>earth</td><td>world</td></tr><tr><td>launch</td><td>include</td><td>form</td></tr><tr><td>field</td><td>science</td><td>scale</td></tr><tr><td>working</td><td>nasa</td><td>sun</td></tr><tr><td>build</td><td>systems</td><td>special</td></tr><tr><td>gov</td><td>technical</td><td>area</td></tr></table>
279
+
280
+ For the Gaussian NVDM $G$ -NVDM), we constrain the interpolated posterior variance to lie in the range of [0.01, 10.0]. For the hybrid NVDMs (H-NVDM) 8, we vary the number of components used in the PDF, investigating the effect that 3 and 5 pieces had on the final quality of the model. Parameter updates for all models were estimated using mini-batches of 100 samples drawn randomly without replacement from the training data over 150 epochs. A learning rate of 0.002 was used. Model selection and early stopping (the only additional form of regularization employed for this set of experiments) were conducted using the validation lower-bound, estimated using five stochastic samples per validation example. We rescale large gradients by their norm (Pascanu et al., 2012). Inference networks made use of 50 units in each hidden layer for 20 News-Groups and CADE and 100 for RCV1, while all performed best with 50 latent variables (chosen via preliminary experimentation with smaller models). On the 20 News-Groups, since we were able to use the same set-up (especially vocabulary) as Hinton & Salakhutdinov (2009), we also report the perplexities of a topic model ( $L D A$ , Hinton & Salakhutdinov (2009)), the Replicated Softmax (RSM, Hinton & Salakhutdinov (2009)), the document neural auto-regressive estimator (docNADE, Larochelle & Lauly (2012)), a sigmoid belief network (SBN, Mnih & Gregor (2014)), a deep auto-regressive neural network (fDARN, Mnih & Gregor (2014)), and a neural variational document model with a fixed standard Gaussian prior (NVDM, lowest reported perplexity, Miao et al. (2015)).
281
+
282
+ In Table 1, we report the test document perplexity (under the Sampled column), calculated using the standard formula, $\begin{array} { r } { e x p ( - \frac { 1 } { D } \sum _ { n } \frac { 1 } { L _ { n } } \log \bar { P _ { \theta } } ( x _ { n } ) } \end{array}$ . Note that $\log { P _ { \theta } ( x _ { n } ) }$ , or the log-probability of a particular document, was approximated with an estimate of the variational lower-bound using 10 samples, as was done in Mnih $\&$ Gregor (2014). The second score (or column SGD-Inf ), refers to the model’s test-perplexity when the lower-bound is tightened using iterative inference to search for the optimal latent variable per document. In this paper, our iterative inference procedure consisted of simple stochastic gradient descent (no more than 100 steps), with a learning rate of 0.1 and the same gradient rescaling used in training, using early-stopping (for 20 News-Groups, the lookahead was 10, while on Reuters and CADE the lookahead was 5). The parameters of the model, as well as the well as the generated prior, are fixed, and the gradients of the variational lower bound with respect to generated posterior model parameters (i.e., the mean and variance of the Gaussian variables, and the piecewise components, $a _ { i }$ ) are used to update the posterior model for each document (using a freshly drawn sample each step).
283
+
284
+ First and foremost, we note that the best baseline model (i.e., the NVDM) is more competitive when both the prior and posterior models are learnt together (i.e., the G-NVDM), as opposed to the fixed prior of Miao et al. (2015). However, we observe that integrating our proposed piecewise variables yields even better results in our document modeling experiments, substantially improving over the baselines. More importantly, in some cases, as in the 20 News-Groups and Reuters datasets, increasing the number of pieces from 3 to 5 can further reduce perplexity. Thus, we have achieved a new state-of-the-art perplexity on 20 News-Group task and — to the best of our knowledge – better perplexities on the CADE12 and RCV1 tasks compared to using a state-of-the-art model like the GNVDM. Furthermore, we observe iterative inference yields yet a further boost in performance since the bound estimated is tighter, however, this form of inference is expensive and requires additional meta-parameters (e.g., a step-size, an early-stopping criterion, etc.). We remark a simpler, and more accurate, approach to inference would be to use importance sampling.
285
+
286
+ In Table 2, we examine the top ten highest ranked words given a query term, using the decoder parameter matrix (since the decoder is directly affected by the latent variables in our document models). It appears that the piecewise variables affect what is uncovered by the model with respect to the data, as each model returns different, but relevant results with respect to the query word. In our current examples, it appears that the H-NVDM with 5 pieces returns more general words. For example, in the case of “government”, the baseline seems to value the plural form of the word (which is largely based on morphology) while the hybrid model actually pulls out meaningful terms such as “federal”, “policy”, and “administration”. The case of “space” is interesting–the hybrid with 5 pieces seems to value two senses of the word–one related to “outer space” (e.g., “sun”, “world”, etc.) and another related to the dimensions of depth, height, and width within which things may exist and move (e.g., “area”, “form”, “scale”, etc.).
287
+
288
+ # 6.2 DIALOGUE MODELING
289
+
290
+ We experiment with VHRED for dialogue modeling. This is a difficult problem, extensively studied in the recent literature (Ritter et al., 2011; Lowe et al., 2015; Sordoni et al., 2015; Li et al., 2016; Serban et al., 2016a). Related systems for dialogue response generation have recently gained a significant amount of attention from industry, with high-profile projects such as Google’s SmartReply system (Kannan et al., 2016) and Microsoft’s chatbot Xiaolice (Markoff & Mozur, 2015). Even more recently, Amazon has announced the Alexa Prize Challenge for the research community with the goal of developing a natural and engaging chatbot system (Farber, 2016).
291
+
292
+ We focus on non-goal-driven dialogue modeling and use the Twitter Dialogue Corpus (Ritter et al., 2011) based on public Twitter conversations. The dataset is split into training, validation, and test sets, containing respectively 749,060, 93,633 and 9,399 dialogues each. On average, each dialogue contains about 6 utterances (dialogue turns) and about 94 words. The dataset is the same as used by Serban et al. (2016b), but further pre-processed using byte-pair encoding (Sennrich et al., 2016) using a vocabulary consisting of 5000 sub-words.9 The dialogues are substantially longer than recent large-scale language modeling corpora, such as the 1 Billion Word Language Model Benchmark (Chelba et al., 2014), which usually focus on modeling single sentences.
293
+
294
+ Parameter optimization was conducted with a learning rate of 0.0002 and mini-batches of size 40 or 80.10 We use a variant of truncated back-propagation and apply gradient clipping (Pascanu et al., 2012). Model selection and early stopping — the only additional form of regularization employed for this set of experiments — are conducted using the validation lower-bound, estimated using one stochastic sample per validation example.
295
+
296
+ Table 3: Approximate posterior word encoding on Twitter. The numbers are computed by counting the number of times each word is among the 5 words with the largest sum of squared gradients of the Gaussian KL divergence (G-KL) and piecewise constant KL divergence (P-KL)
297
+
298
+ <table><tr><td rowspan="2">Word Time-related</td><td rowspan="2">G-VHRED G-KL</td><td colspan="2">H-VHRED</td><td rowspan="2">Word Event-related</td><td rowspan="2">G-VHRED</td><td colspan="2">H-VHRED</td></tr><tr><td>G-KL</td><td>P-KL</td><td>G-KL G-KL</td><td>P-KL</td></tr><tr><td>monday</td><td>3</td><td>5</td><td>10</td><td>school</td><td>9</td><td>16</td><td>50</td></tr><tr><td>tuesday</td><td>2</td><td>3</td><td>7</td><td>class</td><td>11</td><td>16</td><td>27</td></tr><tr><td>wednesday</td><td>4</td><td>11</td><td>13</td><td>game</td><td>20</td><td>26</td><td>41</td></tr><tr><td>thursday</td><td>2</td><td>3</td><td>9</td><td>movie</td><td>12</td><td>20</td><td>41</td></tr><tr><td>friday</td><td>9</td><td>18</td><td>26</td><td>club</td><td>13</td><td>22</td><td>28</td></tr><tr><td> saturday</td><td>6</td><td>6</td><td>13</td><td>party</td><td>8</td><td>10</td><td>32</td></tr><tr><td>sunday</td><td>2</td><td>2</td><td>9</td><td>wedding</td><td>7</td><td>13</td><td>23</td></tr><tr><td>weekend</td><td>8</td><td>16</td><td>32</td><td>birthday</td><td>12</td><td>20</td><td>23</td></tr><tr><td>today</td><td>18</td><td>28</td><td>56</td><td>easter</td><td>15</td><td>15</td><td>23</td></tr><tr><td>night</td><td>16</td><td>31</td><td>68</td><td>concert</td><td>7</td><td>16</td><td>20</td></tr><tr><td>tonight</td><td>32</td><td>36</td><td>47</td><td>dance</td><td>11</td><td>12</td><td>21</td></tr><tr><td>Word Sentiment</td><td>G-VHRED</td><td>H-VHRED</td><td></td><td>Word</td><td>G-VHRED</td><td>H-VHRED</td><td></td></tr><tr><td>-related</td><td>G-KL</td><td>G-KL</td><td>P-KL</td><td>Acronyms,Punctuation Marks&amp; Emoticons</td><td>G-KL</td><td>G-KL</td><td>P-KL</td></tr><tr><td>good</td><td>72</td><td>73</td><td>44</td><td>lol</td><td>394</td><td>358</td><td>312</td></tr><tr><td>love</td><td>102</td><td>101</td><td>38</td><td>omg</td><td>52</td><td>45</td><td>19</td></tr><tr><td>awesome</td><td>26</td><td>44</td><td>39</td><td>·</td><td>386</td><td>558</td><td>1009</td></tr><tr><td>cool</td><td>14</td><td>28</td><td>29</td><td>!</td><td>648</td><td>951</td><td>525</td></tr><tr><td>haha</td><td>132</td><td>101</td><td>75</td><td>?</td><td>507</td><td>851</td><td>221</td></tr><tr><td>hahaha</td><td>60</td><td>48</td><td>24</td><td>*</td><td>108</td><td>54</td><td>19</td></tr><tr><td>amazing</td><td>14</td><td>38</td><td>33</td><td>xd</td><td>28</td><td>42</td><td>26</td></tr><tr><td>thank</td><td>137</td><td>153</td><td>29</td><td>B</td><td>56</td><td>42</td><td>24</td></tr></table>
299
+
300
+ Similar to Serban et al. (2016b), we use a bidirectional GRU RNN encoder, where the forward and backward RNNs each have 1000 hidden units. We experiment with context RNN encoders with 500 and 1000 hidden units, and find that that 1000 hidden units reach better performance w.r.t. the variational lower-bound on the validation set. The encoder and context RNNs use layer normalization (Ba et al., 2016). We experiment with decoder RNNs with 1000, 2000 and 4000 hidden units (LSTM cells), and find that 2000 hidden units reach better performance. For the G-VHRED model, we experiment with latent multivariate Gaussian variables with 100 and 300 dimensions, and find that 100 dimensions reach better performance. For the H-VHRED model, we experiment with latent multivariate Gaussian and piecewise constant variables each with 100 and 300 dimensions, and find that 100 dimensions reach better performance. We follow the training procedure of Serban et al. (2016b): we drop words in the decoder with a fixed drop rate of $2 5 \%$ and multiply the KL terms in the variational lower-bound by a scalar, which starts at zero and linearly increases to 1 over the first 60,000 training batches.
301
+
302
+ We also experiment with an LSTM baseline model and a HRED baseline model (Serban et al., 2016a). For the LSTM model, we experiment with number of hidden units (LSTM cells) equal to 1000, 2000 and 4000 and find that 4000 hidden units perform best w.r.t. validation perplextiy. For the HRED model, we use the same encoder and context RNN architectures as the G-VHRED and H-VHRED models described earlier. We set the encoder RNN to have 1000 hidden units. We experiment with a context RNN with 500 and 1000 hidden units, and find that 1000 hidden units reach better performance. For the decoder RNN, we experiment with 1000 and 2000 hidden units (LSTM cells) and find that 2000 hidden units perform better.
303
+
304
+ Approximate Posterior Analysis Our hypothesis is that the piecewise constant latent variables are able to capture multi-modal aspects of the dialogue. Therefore, we evaluate the models by analyzing what information they have learned to represent in the latent variables. For each test dialogue with $n$ utterances, we condition each model on the first $n - 1$ utterances and compute the latent posterior distributions using all $n$ utterances. We then compute the gradients of the KL terms of the multivariate Gaussian and piecewise constant latent variables w.r.t. each word in the dialogue. Since the words vectors are discrete, we compute the sum of the squared gradients w.r.t. each word embedding. The higher the sum of the squared gradients of a word is, the more influence it will have on the posterior approximation (encoder model). For every test dialogue, we count the top 5 words with highest squared gradients separately for the multivariate Gaussian and piecewise constant latent variables.11
305
+
306
+ The results are shown in Table 3. The piecewise constant latent variables clearly capture different aspects of the dialogue compared to the Gaussian latent variables. The piecewise constant variable approximate posterior encodes words related to time (e.g. weekdays and times of day) and events (e.g. parties, concerts, Easter). On the other hand, the Gaussian variable approximate posterior encodes words related to sentiment (e.g. laughter and appreciation) and acronyms, punctuation marks and emoticons (i.e. smilies). We also conduct a similar analysis on the document models evaluated in Sub-section 6.1, the results of which may be found in the Appendix.
307
+
308
+ Response Evaluation Non-goal-driven dialogue models are typically evaluated by asking humans to rate the quality of different responses. We follow the approach by Liu et al. (2016) by conducting an Amazon Mechanical Turk experiment to compare the G-VHRED and H-VHRED models. For each test dialogue, we use TF-IDF to extract 100 candidate responses (Lowe et al., 2015). We then rank the responses according to the G-VHRED model and H-VHRED model using the variational lowerbound.12 We ask three human evaluators to rate model responses for 45 dialogues on a Likert-type scale $1 - 5$ , with 1 representing an inappropriate response and 5 representing a highly appropriate response.13 For each dialogue, we show the human evaluators the top two responses ranked by the G-VHRED and H-VHRED models. We choose to evaluate the re-ranked responses for two reasons. First, it reduces variance in the output because it uses the approximate posterior model, compared to using beam search with samples from the high-entropy prior. Second, it decreases the number of generic responses, which are extremely common among generative models and which human evaluators tend to prefer despite not advancing the dialogue (Li et al., 2016).
309
+
310
+ The results are as follows. The G-VHRED model achieves scores 1.88 and 2.13 for the first and second ranked responses on average, and the H-VHRED model achieves scores 1.93 and 2.04 on average. In other words, H-VHRED performs nominally better on the first ranked response while G-VHRED performs nominally better on the second ranked response. In conclusion, if there exists a difference between the two models, naive human evaluators cannot see it.
311
+
312
+ Although naive human evaluators cannot distinguish between the model responses, based on our previous analysis we know that the two models encode different aspects of dialogue conversations. Therefore, we further investigate the probability of different responses to dialogue contexts related to time and events. Two examples are shown in Figure 2, where the dialogue contexts are “when do you want to meet this weekend?” and “where are you going tomorrow?”. H-VHRED assigns substantially more probability mass to relevant words compared to the G-VHRED as well as an LSTM baseline and HRED baseline. This confirms the ability of the piecewise constant latent variable to generate responses related to time and events.
313
+
314
+ Finally, we also evaluate the diversity of the G-VHRED and H-VHRED model outputs w.r.t. the top ranked FF-IDF candidate responses. We measure the average word entropy (Serban et al., 2016b) as well as number of unique words for each response and unique words across all test responses, but did not find a significant difference between the two models. This indicates that the Gaussian latent variables alone are able to increase response diversity, while the piecewise constant latent variables instead help encode specific aspects of the dialogue such as time and events.
315
+
316
+ ![](images/622012d108e740cb7f598eb4920252e01e3b5bbb0affee750de533a33398b33b.jpg)
317
+ Figure 2: Probabilities for different responses related to time and events: left) probabilities for giving a one-word response with one of the weekdays (monday, tuesday, . . . , sunday) conditioned on the context utterance “when do you want to meet this weekend?”, right) probabilities forgiving a oneword response with one of several event-related nouns (school, class, . . . , wedding) on the context utterance “where are you going tomorrow?”. The probabilities have been normalized in log-space by the number of words in the response including end-of-utterance tokens. For G-VHRED and H-VHRED, the probabilities were estimated using the variational lower-bound over 10 samples.
318
+
319
+ # 7 CONCLUSIONS
320
+
321
+ In this paper, we have proposed the multi-modal variational encoder-decoder framework. In order to capture complex aspects of unknown data distributions, we developed the piecewise constant prior, which can be efficiently and flexibly adjusted to capture distributions with many modes, such as those over topics. In experiments on document modeling and dialogue modeling, we have shown the effectiveness of our framework in building models capable of learning richer structure from data. In particular, we have demonstrated new state-of-the-art results on several document modeling tasks.
322
+
323
+ Future work should focus on exploring other natural language processing tasks, where multimodality plays an important role such as modeling technical help dialogues (Lowe et al., 2015) and online debates (Rosenthal & McKeown, 2015), and where additional information is available, such as in semi-supervised document categorization (Ororbia II et al., 2015a). Furthermore, the piecewise variables proposed in this work could prove useful in uncovering interesting and novel information in lesser-explored corpora.
324
+
325
+ # REFERENCES
326
+
327
+ J. L. Ba, J. R. Kiros, and G. E. Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
328
+ S. Bangalore, G. Di Fabbrizio, and A. Stent. Learning the structure of task-driven human–human dialogs. IEEE Transactions on Audio, Speech, and Language Processing, 16(7):1249–1259, 2008.
329
+ D. M. Blei, A. Y. Ng, and M. I. Jordan. Latent dirichlet allocation. Journal of machine Learning research, 3(Jan):993–1022, 2003.
330
+ J. Bornschein and Y. Bengio. Reweighted wake-sleep. In ICLR 2015, 2014.
331
+ S. R. Bowman, L. Vilnis, O. Vinyals, A. M. Dai, R. Jozefowicz, and S. Bengio. Generating sentences from a continuous space. In Conference on Computational Natural Language Learning, 2015.
332
+ Y. Burda, R. Grosse, and R. Salakhutdinov. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015.
333
+ A. Cardoso-Cachopo. Improving Methods for Single-label Text Categorization. PdD Thesis, Instituto Superior Tecnico, Universidade Tecnica de Lisboa, 2007.
334
+ C. Chelba, T. Mikolov, M. Schuster, Q. Ge, T. Brants, P. Koehn, and T. Robinson. One billion word benchmark for measuring progress in statistical language modeling. In INTERSPEECH, 2014.
335
+ N. Crook, R. Granell, and S. Pulman. Unsupervised classification of dialogue acts using a dirichlet process mixture model. In Proceedings of the SIGDIAL 2009 Conference: The 10th Annual Meeting of the Special Interest Group on Discourse and Dialogue, pp. 341–348. Association for Computational Linguistics, 2009.
336
+ P. Dayan and G. E. Hinton. Varieties of helmholtz machine. Neural Networks, 9(8):1385–1403, 1996.
337
+ L. Devroye. Sample-based non-uniform random variate generation. In Proceedings of the 18th conference on Winter simulation, pp. 260–265. ACM, 1986.
338
+ J. L. Durrieu, J. P. Thiran, and F. Kelly. Lower and upper bounds for approximation of the kullbackleibler divergence between gaussian mixture models. In 2012 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4833–4836. Ieee, 2012.
339
+ M. Farber. Amazon’s ’Alexa Prize’ Will Give College Students Up To $\$ 2.5 M$ To Create A Socialbot. Fortune, 2016.
340
+ K. Gregor, I. Danihelka, A. Graves, and D. Wierstra. DRAW: A recurrent neural network for image generation. In International Conference on Learning Representations (ICLR), 2015.
341
+ G. E. Hinton and R. Salakhutdinov. Replicated softmax: an undirected topic model. In Y. Bengio, D. Schuurmans, J. D. Lafferty, C. K. I. Williams, and A. Culotta (eds.), Advances in Neural Information Processing Systems 22, pp. 1607–1614. Curran Associates, Inc., 2009.
342
+ G. E. Hinton and R. S. Zemel. Autoencoders, minimum description length and helmholtz free energy. In J. D. Cowan, G. Tesauro, and J. Alspector (eds.), Advances in Neural Information Processing Systems 6, pp. 3–10. Morgan-Kaufmann, 1994.
343
+ G. E. Hinton, P. Dayan, B. J. Frey, and R. M. Neal. The" wake-sleep" algorithm for unsupervised neural networks. Science, 268(5214):1158, 1995.
344
+ T. Hofmann. Probabilistic latent semantic indexing. In Proceedings of the 22nd annual international ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 50–57. ACM, 1999.
345
+ M. I. Jordan, Z. Ghahramani, T. S. Jaakkola, and L. K. Saul. An introduction to variational methods for graphical models. Machine Learning, 37(2):183–233, 1999.
346
+ A. Kannan, K. Kurach, et al. Smart Reply: Automated Response Suggestion for Email. In KDD, 2016.
347
+ D. Kingma and J. Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR, 2015.
348
+ D. P. Kingma and M. Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
349
+ D. P. Kingma, T. Salimans, and M. Welling. Improving variational inference with inverse autoregressive flow. arXiv preprint arXiv:1606.04934, 2016.
350
+ H. Larochelle and S. Lauly. A neural autoregressive topic model. In Advances in Neural Information Processing Systems, pp. 2708–2716, 2012.
351
+ Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. arXiv preprint arXiv:1512.09300, 2015.
352
+ S. Lauly, Y. Zheng, A. Allauzen, and H. Larochelle. Document neural autoregressive distribution estimation. arXiv preprint arXiv:1603.05962, 2016.
353
+ J. Li, M. Galley, C. Brockett, J. Gao, and B. Dolan. A diversity-promoting objective function for neural conversation models. In The North American Chapter of the Association for Computational Linguistics (NAACL), 2016.
354
+
355
+ C.-W. Liu, R. Lowe, I. V. Serban, M. Noseworthy, L. Charlin, and J. Pineau. How NOT to evaluate your dialogue system: An empirical study of unsupervised evaluation metrics for dialogue response generation. arXiv:1603.08023, 2016.
356
+
357
+ Ryan Lowe, Nissan Pow, Iulian Serban, and Joelle Pineau. The Ubuntu Dialogue Corpus: A Large Dataset for Research in Unstructured Multi-Turn Dialogue Systems. In Proceedings of the SIGDIAL 2015 Conference, 2015. In press.
358
+
359
+ L. Maaløe, C. K. Sønderby, S. K. Sønderby, and O. Winther. Auxiliary deep generative models. arXiv preprint arXiv:1602.05473, 2016.
360
+
361
+ J. Markoff and P. Mozur. For Sympathetic Ear, More Chinese Turn to Smartphone Program. New York Times, 2015.
362
+
363
+ Yishu Miao, Lei Yu, and Phil Blunsom. Neural variational inference for text processing. arXiv preprint arXiv:1511.06038, 2015.
364
+
365
+ A. Mnih and K. Gregor. Neural variational inference and learning in belief networks. arXiv preprint arXiv:1402.0030, 2014.
366
+
367
+ R. M. Neal. Connectionist learning of belief networks. Artificial intelligence, 56(1):71–113, 1992.
368
+
369
+ A. G. Ororbia II, C. L. Giles, and D. Reitter. Learning a deep hybrid model for semi-supervised text classification. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (EMNLP), Lisbon, Portugal, 2015a., 2015a.
370
+
371
+ A. G. Ororbia II, C. L. Giles, and D. Reitter. Online semi-supervised learning with deep hybrid boltzmann machines and denoising autoencoders. arXiv preprint arXiv:1511.06964, 2015b.
372
+
373
+ R. Pascanu, T. Mikolov, and Y. Bengio. On the difficulty of training recurrent neural networks. ICML, 28, 2012.
374
+
375
+ D. J. Rezende and S. Mohamed. Variational inference with normalizing flows. arXiv preprint arXiv:1505.05770, 2015.
376
+
377
+ D. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning (ICML), 2014.
378
+
379
+ A. Ritter, C. Cherry, and W. B. Dolan. Data-driven response generation in social media. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pp. 583–593. Association for Computational Linguistics (ACL), 2011.
380
+
381
+ S. Rosenthal and K. McKeown. I couldn’t agree more: The role of conversational structure in agreement and disagreement detection in online discussions. In 16th Annual Meeting of the Special Interest Group on Discourse and Dialogue, pp. 168, 2015.
382
+
383
+ R. Salakhutdinov and G. E. Hinton. Semantic hashing. International Journal of Approximate Reasoning, 50(7):969–978, 2009.
384
+
385
+ R. Salakhutdinov and H. Larochelle. Efficient learning of deep boltzmann machines. In International Conference on Artificial Intelligence and Statistics (AISTATs), pp. 693–700, 2010.
386
+
387
+ T. Salimans, D. P Kingma, M. Welling, et al. Markov chain monte carlo and variational inference: Bridging the gap. In International Conference on Machine Learning (ICML), pp. 1218–1226, 2015.
388
+
389
+ R. Sennrich, B. Haddow, and A. Birch. Neural machine translation of rare words with subword units. In Association for Computational Linguistics (ACL), 2016.
390
+
391
+ I. V. Serban, A. Sordoni, Y. Bengio, A. Courville, and J. Pineau. Building end-to-end dialogue systems using generative hierarchical neural network models. In Thirtieth AAAI Conference (AAAI), pp. 3776–3784, 2016a.
392
+
393
+ I. V. Serban, A. Sordoni, R. Lowe, L. Charlin, J. Pineau, A. Courville, and Y. Bengio. A hierarchical latent variable encoder-decoder model for generating dialogues. arXiv preprint arXiv:1605.06069, 2016b.
394
+ A. Sordoni, M. Galley, M. Auli, C. Brockett, Y. Ji, M. Mitchell, J. Nie, J. Gao, and B. Dolan. A neural network approach to context-sensitive generation of conversational responses. In Conference of the North American Chapter of the Association for Computational Linguistics (NAACL-HLT 2015), 2015. In press.
395
+ N. Srivastava, R. R Salakhutdinov, and G. E. Hinton. Modeling documents with deep boltzmann machines. arXiv preprint arXiv:1309.6865, 2013.
396
+ B. Uria, I. Murray, and H. Larochelle. A deep and tractable density estimator. In International Conference on Machine Learning (ICML), pp. 467–475, 2014.
397
+ K. Zhai and J. D. Williams. Discovering latent structure in task-oriented dialogues. In Association for Computational Linguistics (ACL), pp. 36–46, 2014.
398
+
399
+ # APPENDIX A: ANALYSIS OF DOCUMENT MODEL PIECEWISE VARIABLES
400
+
401
+ We present an additional analysis of the learned 20 News-Groups document models in order to explore what each set of latent variables might be capturing. To calculate the gradient of the KL terms needed to formulate word scores, we follow the approach described in Sub-section 6.2, however, conditioning only on the (training) document bag-of-words to compute the latent posterior to then calculate the gradient of the KL-terms with respect to each word in the document.
402
+
403
+ In Table 4, we observe results similar to those of Sub-section 6.2–the piecewise variables capture different aspects of the document data. It is worth noting, in this experiment, that the Gaussian variables alone were originally were sensitive to some of these words. However, in the hybrid model, nearly all of the temporal words that the Gaussian variables were once more sensitive to now more strongly affect the piecewise variables, which themselves also capture all of the words that were originally missed. This might indicate a shift in responsibility in which latent variables the document model decide are more suitable to capture certain aspects of the data. This effect appears to be even stronger in the case of certain nationality-based adjectives (e.g., “american”, “israeli”, etc.). While the G-NVDM could model multi-modality in the data to some degree, this work would be primarily done in the model’s decoder. In the H-NVDM, the piecewise variables provide an explicit mechanism for capturing modes in the unknown target distribution, so it makes sense that the model would learn to use the piecewise variables instead, thus freeing up the Gaussian variables to capture other aspects of the data, as we found was the case with names (e.g., “jesus”, “kent”, etc.).
404
+
405
+ Table 4: Approximate posterior word encodings on 20 News-Groups. For P-KL, we also bold every case where the piecewise variables showed greater sensitivity to the word than the Gaussian variables within the same hybrid model.
406
+
407
+ <table><tr><td>Word Time-related</td><td>G-NVDM G-KL</td><td>H-NVDM-5 G-KL</td><td>P-KL</td><td>Word Names</td><td>G-NVDM G-KL</td><td>H-NVDM-5 G-KL</td><td>P-KL</td></tr><tr><td>months</td><td>23</td><td>33</td><td>40</td><td>henry</td><td>33</td><td>47</td><td>39</td></tr><tr><td>day</td><td>28</td><td>32</td><td>35</td><td>tim</td><td>32</td><td>27</td><td>11</td></tr><tr><td>time</td><td>55</td><td>22</td><td>40</td><td>mary</td><td>26</td><td>51</td><td>30</td></tr><tr><td>century</td><td>28</td><td>13</td><td>19</td><td></td><td>40</td><td>72</td><td>30</td></tr><tr><td>past</td><td>30</td><td>18</td><td>28</td><td>james jesus</td><td>28</td><td>87</td><td>39</td></tr><tr><td>days</td><td>37</td><td>14</td><td>19</td><td>george</td><td>26</td><td>56</td><td>29</td></tr><tr><td>ahead</td><td>33</td><td>20</td><td>33</td><td>keith</td><td>65</td><td>94</td><td></td></tr><tr><td>years</td><td>44</td><td>16</td><td>38</td><td>kent</td><td>51</td><td>56</td><td>61</td></tr><tr><td>today</td><td>46</td><td>27</td><td>71</td><td>chris</td><td>38</td><td></td><td>15</td></tr><tr><td>back</td><td>31</td><td>30</td><td>47</td><td>thomas</td><td>19</td><td>55</td><td>28</td></tr><tr><td>future</td><td>20</td><td>15</td><td>20</td><td>hitler</td><td></td><td>35</td><td>19</td></tr><tr><td>order</td><td>42</td><td>14</td><td>26</td><td></td><td>10</td><td>14</td><td>9</td></tr><tr><td>minute</td><td>15</td><td>34</td><td>40</td><td>paul</td><td>25</td><td>52</td><td>18</td></tr><tr><td>began</td><td>16</td><td>5</td><td>13</td><td>mike</td><td>38</td><td>76</td><td>40</td></tr><tr><td>night</td><td>49</td><td>12</td><td>18</td><td>bush</td><td>21</td><td>20</td><td>14</td></tr><tr><td>hour</td><td>18</td><td>17</td><td>16</td><td></td><td></td><td></td><td></td></tr><tr><td>early</td><td>42</td><td>42</td><td>69</td><td>Adjectives</td><td>G-KL</td><td>G-KL</td><td>P-KL</td></tr><tr><td>yesterday</td><td>25 60</td><td>26</td><td>36</td><td>american</td><td>50</td><td>12</td><td>40</td></tr><tr><td>year</td><td></td><td>17</td><td>21</td><td>german</td><td>25</td><td>21</td><td>22</td></tr><tr><td>week</td><td>28</td><td>54</td><td>58</td><td>european</td><td>20</td><td>17</td><td>27</td></tr><tr><td>hours</td><td>20</td><td>26</td><td>31</td><td>muslim</td><td>19</td><td>7</td><td>23</td></tr><tr><td>minutes</td><td>40</td><td>34</td><td>38</td><td>french</td><td>11</td><td>17</td><td>17</td></tr><tr><td>months</td><td>23</td><td>33</td><td>40</td><td>canadian</td><td>18</td><td>10</td><td>16</td></tr><tr><td>history</td><td>32</td><td>18</td><td>28</td><td>japanese</td><td>16</td><td>9</td><td>24</td></tr><tr><td>late</td><td>41</td><td>45</td><td>31</td><td>jewish</td><td>56</td><td>37</td><td>54</td></tr><tr><td>moment</td><td>23</td><td>17</td><td>16</td><td>english</td><td>19</td><td>16</td><td>26</td></tr><tr><td>season</td><td>45 29</td><td>29</td><td>37</td><td>islamic</td><td>14</td><td>18</td><td>28</td></tr><tr><td>summer</td><td>30</td><td>28</td><td>31 38</td><td>israeli</td><td>24</td><td>14</td><td>18</td></tr><tr><td>start</td><td>21</td><td>14</td><td>34</td><td>british</td><td>35</td><td>15</td><td>17</td></tr><tr><td>continue happened</td><td>22</td><td>32 27</td><td>35</td><td>russian</td><td>14</td><td>19</td><td>20</td></tr></table>
md/train/BJfvknCqFQ/BJfvknCqFQ.md ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A ROTATION AND A TRANSLATION SUFFICE: FOOLING CNNS WITH SIMPLE TRANSFORMATIONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We show that simple spatial transformations, namely translations and rotations alone, suffice to fool neural networks on a significant fraction of their inputs in multiple image classification tasks. Our results are in sharp contrast to previous work in adversarial robustness that relied on more complicated optimization approaches unlikely to appear outside a truly adversarial context. Moreover, the misclassifying rotations and translations are easy to find and require only a few black-box queries to the target model. Overall, our findings emphasize the need to design robust classifiers even for natural input transformations in benign settings.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Neural networks are now widely embraced as dominant solutions in computer vision (Krizhevsky et al., 2012; He et al., 2016), speech recognition (Graves et al., 2013), and natural language processing (Collobert & Weston, 2008). While their accuracy scores often match (and sometimes go beyond) human-level performance on key benchmarks (He et al., 2015; Taigman et al., 2014), we still do not understand how robust neural networks are. A prominent issue in this context is the existence of so-called adversarial examples, i.e., inputs that are almost indistinguishable from natural data to a human but cause state-of-the-art classifiers to make incorrect predictions with high confidence (Szegedy et al., 2013; Goodfellow et al., 2014). This raises concerns about the use of neural networks in contexts where reliability, dependability, and security are important desiderata.
12
+
13
+ There is a long line of work on methods for constructing adversarial perturbations in various settings (Szegedy et al., 2013; Goodfellow et al., 2014; Kurakin et al., 2016a;b; Sharif et al., 2016; Moosavi-Dezfooli et al., 2016; Carlini & Wagner, 2016; Papernot et al., 2017; Madry et al., 2017; Athalye et al., 2017). However, these methods are quite sophisticated and the resulting perturbations tend to be fairly contrived since they often rely on fine-tuned control over a large number of input pixels or audio samples. So one may suspect that adversarial examples constitute a problem only in the presence of a truly malicious attacker and are unlikely to arise in more benign environments. In particular, the focus on intricate worst-case attacks so far raises a natural question:
14
+
15
+ Are neural networks robust to simple, naturally-occurring transformations of their input?
16
+
17
+ We address this question by studying two basic image transformations: translations and rotations. While these transformations appear natural to a human, we show that small rotations and translations alone (i.e., without any additional fine-tuned perturbation) can cause a significant drop in the model’s performance. This holds even when the model has been trained using appropriate data augmentation and no visual information is lost due to these transformations (e.g. due to cropping, see Figure 1).
18
+
19
+ # 1.1 OUR METHODOLOGY AND RESULTS
20
+
21
+ We start with standard image classifiers for the MNIST (LeCun et al., 1998), CIFAR10 (Krizhevsky & Hinton, 2009), and ImageNet (Russakovsky et al., 2015) datasets. The classifiers achieve close to state-of-the-art performance on the respective benchmarks. Nevertheless, we demonstrate that small transformations can cause a significant drop in classification accuracy for these models. Depending on dataset and model, this drop ranges from $34 \%$ to as high as $90 \%$ for the worst combination of rotation angle and translation shift. Even for a small random transformation, the accuracy can drop by up to $30 \%$ . These results demonstrate that robustness to rotations and translations should also be a concern in standard classification problems outside an adversarial security context.
22
+
23
+ ![](images/ea20825e83c337f09b98fee548cdb575b880d5b0d9764434ef6dcaa1ce2b19a0.jpg)
24
+ Figure 1: Examples of adversarial transformations and their predictions in the standard, ”black canvas”, and reflection padding setting.
25
+
26
+ Moreover, we show that direct access to the model (or a surrogate) is not necessary to find such misclassifying transformations. Choosing the worst out of 10 random transformations suffices to reduce the accuracy of these models by $26 \%$ on MNIST, $72 \%$ on CIFAR10, and $28 \%$ on ImageNet (top 1 accuracy). Hence our results also give a strong baseline for fooling classifiers with a small number of non-adaptive queries.
27
+
28
+ Finally, we examine possible ways to alleviate these vulnerabilities. A natural first step is to augment the training procedure with rotations and translations. While this does largely mitigate the problem on MNIST, the models trained on CIFAR10 and ImageNet are still far from robust. We thus propose two natural methods for further increasing the robustness of these models. These methods are based on robust optimization and aggregation of random input transformations. They offer significant improvements in classification accuracy but also come with considerable computational overhead. Even then, they are still not sufficient to completely mitigate the vulnerability. This suggests that obtaining models robust to spatial transformations of their inputs remains a challenge.
29
+
30
+ Finally, we examine the interplay between rotations / translations and the widely used $\ell _ { \infty }$ -based adversarial examples. We observe that robustness to these two classes of input perturbations is largely orthogonal to each other. In particular, pixel-based robustness does not imply spatial robustness, while combining spatial and $\ell _ { \infty }$ -bounded transformations seems to have a cumulative effect in reducing classification accuracy. This emphasizes the need to broaden the notions of image similarity in the adversarial examples literature beyond the common $\ell _ { p }$ -balls.
31
+
32
+ # 1.2 SUMMARY OF CONTRIBUTIONS
33
+
34
+ We perform extensive experiments that provide a fine-grained understanding of rotation / translation robustness on a wide spectrum of datasets and training regimes. In summary, we show that:
35
+
36
+ • A simple attack based solely on rotations and translations is effective against state-of-theart neural networks. This holds even when the model has been trained with appropriate data augmentation and no image information is lost during the spatial transformation.
37
+ • Rotation / translation attacks are easy to execute, requiring only a few black-box queries.
38
+ • It is possible to increase a model’s robustness to rotations and translations at the cost of increased training and / or inference time. However, these methods are still not sufficient to fully recover the accuracy on unmodified images. Robustness to $\ell _ { \infty }$ -bounded perturbations does not significantly affect spatial robustness. Instead, these two notions appear orthogonal to each other.
39
+ • First-order methods are significantly less effective for finding adversarial transformations than an exhaustive search over a fine grid of transformations. This is in stark contrast to $\ell _ { p }$ -bounded perturbrbations where first-order methods have been very successful (Carlini & Wagner, 2016; Madry et al., 2017). Hence rigorous evaluation of model robustness in this spatial setting requires techniques that are different from $\ell _ { p }$ -bounded adversarial examples.
40
+
41
+ # 2 ADVERSARIAL ROTATIONS AND TRANSLATIONS
42
+
43
+ Recall that in the context of image classification, an adversarial example for a given input image $x$ and a classifier $C$ is an image $x ^ { \bar { \prime } }$ that satisfies two properties: (i) on the one hand, the adversarial example $x ^ { \prime }$ causes the classifier $C$ to output a different label on $x ^ { \prime }$ than on $x$ , i.e., we have $C ( x ) \neq$ $C ( { \boldsymbol { x } } ^ { \prime } )$ . (ii) On the other hand, the adversarial example $x ^ { \prime }$ is “visually similar” to $x$ .
44
+
45
+ Clearly, the notion of visual similarity is not precisely defined here. In fact, providing a precise and rigorous definition is extraordinarily difficult as it would require formally capturing the notion of human perception. Consequently, previous work largely settled on the assumption that $x ^ { \prime }$ is a valid adversarial example for $x$ if and only if $\| x - x ^ { \prime } \| _ { p } \ \leq \varepsilon$ for some $p \in [ 0 , \infty ]$ and $\varepsilon$ small enough. This convention is based on the fact that two images are indeed visually similar when they are close enough in some $\ell _ { p }$ norm. However, the converse is not necessarily true. A small rotation or translation of an image usually appears visually similar to a human, yet can lead to a large change when measured in an $\ell _ { p }$ norm. We aim to expand the range of similarity measures considered in the adversarial examples literature by investigating robustness to small rotations and translations.
46
+
47
+ Attack methods. Our first goal is to develop sufficiently strong methods for generating adversarial rotations and translations. In the context of pixel-wise $\ell _ { p }$ perturbations, the most successful approach for constructing adversarial examples so far has been to employ optimization methods on a suitable loss function (Szegedy et al., 2013; Goodfellow et al., 2014; Carlini & Wagner, 2016). Following this approach, we parametrize our attack method with a set of tunable parameters and then optimize over these parameters. We perform this optimization in three distinct ways:
48
+
49
+ • First-Order Method (FO): Starting from a random choice of parameters, we iteratively take steps in the direction of the gradient of the loss function. This is the direction that locally maximizes the loss of the classifier (as a surrogate for misclassification probability). Note that unlike the $\ell _ { p }$ -norm case, we are not optimizing in the pixel space but in the latent space of rotation and translation parameters. Grid Search: We discretize the parameter space and exhaustively examine every possible parametrization of the attack to find one that causes the classifier to give a wrong prediction (if such a parametrization exists). Since our parameter space is low-dimensional enough, this method is computationally feasible (in contrast to a grid search for $\ell _ { p }$ -based adversaries). Worst-of- $k$ : We randomly sample $k$ different choices of attack parameters and choose the one on which the model performs worst. As we increase $k$ , this attack interpolates between a random choice and grid search.
50
+
51
+ While a first-order attack requires full knowledge of the model to compute the gradient of the loss with respect to the input, the other two attacks do not. They only require the outputs corresponding to chosen inputs, which can be done witho only query access to the target model.
52
+
53
+ Next, we need to define the exact range of attacks we want to optimize over. For the case of rotation and translation attacks, we wish to find parameters $( \delta u , \delta v , \theta )$ such that rotating the original image by $\theta$ degrees around the center and then translating it by $( \delta u , \delta v )$ pixels causes the classifier to make a wrong prediction. Formally, the pixel at position $( u , v )$ is moved to the following position (assuming the point $( 0 , 0 )$ is the center of the image):
54
+
55
+ $$
56
+ \left[ { \begin{array} { c } { u ^ { \prime } } \\ { v ^ { \prime } } \end{array} } \right] = \left[ { \begin{array} { c c } { \cos \theta } & { - \sin \theta } \\ { \sin \theta } & { \cos \theta } \end{array} } \right] \cdot \left[ { \begin{array} { c } { u } \\ { v } \end{array} } \right] + \left[ { \begin{array} { c } { \delta u } \\ { \delta v } \end{array} } \right] .
57
+ $$
58
+
59
+ We implement this transformation in a differentiable manner using the spatial transformer blocks of (Jaderberg et al., 2015). In order to handle pixels that are mapped to non-integer coordinates, the transformer units include a differentiable bilinear interpolation routine. Since our loss function is differentiable with respect to the input and the transformation is in turn differentiable with respect to its parameters, we can obtain gradients of the model’s loss function w.r.t. the perturbation parameters. This enables us to apply a first-order optimization method to our problem.
60
+
61
+ By defining the spatial transformation for some $x$ as $T ( x ; \delta u , \delta v , \theta )$ , we construct an adversarial perturbation for $x$ by solving the problem
62
+
63
+ $$
64
+ \operatorname * { m a x } _ { \delta u , \delta v , \theta } \mathcal { L } ( x ^ { \prime } , y ) , \quad \mathrm { f o r } x ^ { \prime } = T ( x ; \delta u , \delta v , \theta ) \ ,
65
+ $$
66
+
67
+ where $\mathcal { L }$ is the loss function of the neural network1, and $y$ is the correct label for $x$ . Since this is a non-concave maximization problem, there are no guarantees for the global optimality of a general first order method.
68
+
69
+ # 3 IMPROVING INVARIANCE TO SPATIAL TRANSFORMATIONS
70
+
71
+ As we will see in Section 4, augmenting the training set with random rotations and translations does improve the robustness of the model against such random transformations. However, data augmentation does not significantly improve the robustness against worst-case attacks and sometimes leads to a drop in accuracy on unperturbed images. To address these issues, we explore two simple baselines that turn out to be surprisingly effective.
72
+
73
+ Robust Optimization. Instead of performing standard empirical risk minimization to train the classification model, we utilize ideas from robust optimization. Robust optimization has a rich history (Ben-Tal et al., 2009) and has recently been applied successfully in the context of defending neural networks against adversarial examples (Madry et al., 2017; Sinha et al., 2017; Raghunathan et al., 2018; Kolter & Wong, 2017). The main barrier to applying robust optimization for spatial transformations is the lack of an efficient procedure to compute the worst-case perturbation of a given example. Performing a grid search (as described in Section 2) is prohibitive as this would increase the training time by a factor close to the grid size, which can easily be a factor 100 or 1,000. Moreover, the non-convexity of the loss landscape prevents potentially more efficient first-order methods from discovering (approximately) worst-case transformations (see Section 4 for details).
74
+
75
+ Given that we cannot fully optimize over the space of translations and rotations, we instead use a coarse approximation provided by the worst-of-10 adversary (as described in Section 2). So each time we use an example during training, we first sample 10 transformations of the example uniformly at random from the space of allowed transformations. We then evaluate the model on each of these transformations and train on the one perturbation with the highest loss. This corresponds to approximately minimizing a min-max formulation of robust accuracy similar to (Madry et al., 2017). Training against such an adversary increases the overall time by a factor of roughly six.2
76
+
77
+ Aggregating Random Transformations. As Section 4 shows, the accuracy against a random transformation is significantly higher than the accuracy against the worst transformation in the allowed attack space. This motivates the following inference procedure: compute a (tyipcally small) number of random transformations of the input image and output the label that occurs most common in the resulting set of predictions. We constrain these random transformations to be within $5 \%$ of the input image size in each translation direction and up to $1 5 ^ { \circ }$ of rotation. 3 The training procedure and model can remain unchanged while the inference time is increased by a small factor (equal to the number of transformations we evaluate on).
78
+
79
+ Combining Both Methods. The two methods outlined above are orthogonal and in some sense complementary. We can therefore combine robust training (using a worst-of- $\mathbf { \nabla } \cdot \mathbf { k }$ adversary) and majority inference to further increase the robustness of our models.
80
+
81
+ # 4 EXPERIMENTS
82
+
83
+ We evaluate standard image classifiers for the MNIST (LeCun et al., 1998), CIFAR10 (Krizhevsky & Hinton, 2009) and ImageNet (Russakovsky et al., 2015) datasets. In order to determine the extent to which misclassification is caused by insufficient data augmentation during training, we examine various data augmentation methods. We begin with a description of our experimental setup.
84
+
85
+ Model Architecture. For MNIST, we use a convolutional neural network derived from the TensorFlow Tutorial (tft). In order to obtain a fully convolutional version of the network, we replace the fully-connected layer by two convolutional layers with 128 and 256 filters each, followed by a global average pooling. For CIFAR10, we consider a standard ResNet (He et al., 2016) model with 4 groups of residual layers with filter sizes [16, 16, 32, 64] and 5 residual units each. We use standard and $\ell _ { \infty }$ -adversarially trained models similar to those studied by Madry et al. (2017).4,5 For ImageNet, we use a ResNet-50 (He et al., 2016) architecture implemented in the tensorpack repository (Wu et al., 2016). We did not modify the model architectures or training procedures.
86
+
87
+ Attack Space. In order to maintain the visual similarity of images to the natural ones we restrict the space of allowed perturbations to be relatively small. We consider rotations of at most $3 0 ^ { \circ }$ and translations of at most (roughly) $10 \%$ percent of the image size in each direction. This corresponds to 3 pixels for MNIST (image size $2 8 \times 2 8$ ) and CIFAR10 (image size $3 2 \times 3 2$ ), and 24 pixels for ImageNet (image size $2 9 9 \times 2 9 9$ ). For grid search attacks, we consider 5 values per translation direction and 31 values for rotations, equally spaced. For first-order attacks, we use 200 steps of projected gradient descent of step size 0.01 times the parameter range. When rotating and translating the images, we fill the empty space with zeros (black pixels).
88
+
89
+ Data Augmentation. We consider five variants of training for our models.
90
+
91
+ • Standard training: The standard training procedure for the respective model architecture.
92
+ • $\ell _ { \infty }$ -bounded adversarial training: The classifier is trained on $\ell _ { \infty }$ -bounded adversarial examples that are generated with projected gradient descent.
93
+ • No random cropping: Standard training for CIFAR-10 and ImageNet includes data augmentation via random crops. We investigate the effect of this data augmentation scheme by also training a model without random crops. Random rotations and translations: At each training step, we perform a uniformly random perturbation from the attack space on each training example.
94
+ • Random rotations and translations from larger intervals: As before, we perform uniformly random perturbations, but now from a superset of the attack space $( 4 0 ^ { \circ } , \pm 1 3 \%$ pixels).
95
+
96
+ # 4.1 EVALUATING MODEL ROBUSTNESS
97
+
98
+ We evaluate all models against random and grid search adversaries with rotations and translations considered both separately and together. We report the results in Table 1. We visualize a random subset of successful attacks in Figures 3, 4, and 5 of Appendix A.
99
+
100
+ Despite the high accuracy of standard models on unperturbed examples and their reasonable performance on random perturbations, a grid search can significantly lower the classifiers’ accuracy on the test set. For the standard models, accuracy drops from $9 9 \%$ to $26 \%$ on MNIST, $93 \%$ to $3 \%$ on CIFAR10, and $76 \%$ to $31 \%$ on ImageNet (Top 1 accuracy).
101
+
102
+ The addition of random rotations and translations during training greatly improves both the random and adversarial accuracy of the classifier for MNIST and CIFAR10, but less so for ImageNet. For the first two datasets, data augmentation increases the accuracy against a grid adversary by $60 \%$ to $70 \%$ , while the same data augmentation technique adds less than $3 \%$ accuracy on ImageNet.
103
+
104
+ In Appendix A, we perform a fine-grained investigation of our findings:
105
+
106
+ • In Figure 8 we examine how many examples can be fooled by (i) rotations only, (ii) translations only, (iii) neither transformation, or (iv) both. We visualize the set of fooling angles for a random sample of the rotations-only grid in Figure 9. We observe that the set of fooling angles is not contiguous. • To investigate how many transformations are adversarial per image, we analyze the percentage of misclassified grid points for each example in Figure 10. While the majority of images has only a small number of adversarial transformations, a significant fraction of images is fooled by $20 \%$ or more of the transformations.
107
+
108
+ Table 1: Accuracy of different classifiers against rotation and translation adversaries on MNIST, CIFAR10, and ImageNet. The allowed transformations are translations by (roughly) $10 \%$ of the image size and $\pm 3 0 ^ { \circ }$ rotations. The attack parameters are chosen through random sampling or grid search with rotations and translations considered both together (“Rand.”, “Grid”) and separately (“Rand. T.” and “Grid T.” for transformations, “Rand R.” and “Grid R.” for rotations). We consider networks that are trained with (i) the respective standard setup, (ii) no data augmentation (if data augmentation is present in standard setup), (iii) with an $\ell _ { \infty }$ adversary, (iv) with data augmentation corresponding to the attack space $( \pm \mathrm { { 3 p x } , \pm 3 0 ^ { \circ } ) }$ and an enlarged space $( \pm 4 \mathrm { p x } , \pm 4 0 ^ { \circ } )$ , and (v) with worst-of-10 training for both types of augmentations.
109
+
110
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=4>Nat. Rand. Grid</td><td rowspan=1 colspan=1>Rand. T. Grid T.</td><td rowspan=1 colspan=1>Rand. R. Grid R.</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Standard</td><td rowspan=1 colspan=4>99.31% 94.23% 26.02%</td><td rowspan=1 colspan=1>98.61% 89.80%</td><td rowspan=1 colspan=1>95.68% 70.98%</td></tr><tr><td rowspan=5 colspan=1>LSINN</td><td rowspan=1 colspan=1>loo-Adv</td><td rowspan=1 colspan=4>98.65% 88.02% 1.20%</td><td rowspan=1 colspan=1>93.72% 34.13%</td><td rowspan=1 colspan=1>95.27% 72.03%</td></tr><tr><td rowspan=4 colspan=1>Aug. 30Aug. 40W-10 (30)W-10 (40)</td><td rowspan=1 colspan=4>99.53% 99.35% 95.79%</td><td rowspan=1 colspan=1>99.47% 98.66%</td><td rowspan=1 colspan=1>99.34% 98.23%</td></tr><tr><td rowspan=2 colspan=4>99.34% 99.31% 96.95%99.48% 99.37% 97.32%</td><td rowspan=1 colspan=1>99.39% 98.65%</td><td rowspan=2 colspan=1>99.40% 98.49%99.39% 98.62%</td></tr><tr><td rowspan=1 colspan=1>99.50% 99.01%</td><td rowspan=1 colspan=1>99.39% 98.62%</td></tr><tr><td rowspan=1 colspan=3>99.42%</td><td rowspan=1 colspan=2>99.39% 97.88%</td><td rowspan=1 colspan=1>99.45% 98.89%</td><td rowspan=1 colspan=1>99.36% 98.85%</td></tr><tr><td rowspan=7 colspan=1>CITIII</td><td rowspan=7 colspan=1>StandardNo Croploo-AdvAug. 30Aug. 40W-10 (30)W-10 (40)</td><td rowspan=1 colspan=2>92.62%</td><td rowspan=1 colspan=2>60.93% 2.80%</td><td rowspan=1 colspan=1>88.54% 66.17%</td><td rowspan=1 colspan=1>75.36% 24.71%</td></tr><tr><td rowspan=1 colspan=2>90.34%</td><td rowspan=1 colspan=1>01</td><td rowspan=1 colspan=2>54.64% 1.86%</td><td rowspan=1 colspan=1>81.95% 46.07%</td><td rowspan=1 colspan=1>69.23% 18.34%</td></tr><tr><td rowspan=5 colspan=4>80.21% 58.33% 6.02%90.02% 90.92% 58.90%88.83% 91.18% 61.69%91.34% 92.35% 69.17%91.00% 92.11% 71.15%</td><td rowspan=1 colspan=1>78.15% 59.02%</td><td rowspan=1 colspan=1>62.85% 20.98%</td></tr><tr><td rowspan=1 colspan=1>91.76% 79.01%</td><td rowspan=1 colspan=1>91.14% 76.33%</td></tr><tr><td rowspan=1 colspan=1>91.53% 77.42%</td><td rowspan=1 colspan=1>91.10% 76.80%</td></tr><tr><td rowspan=1 colspan=1>92.43% 83.01%</td><td rowspan=2 colspan=1>92.33% 81.82%92.53% 82.25%</td></tr><tr><td rowspan=1 colspan=1>92.28% 82.15%</td></tr><tr><td rowspan=6 colspan=1>1negee</td><td rowspan=6 colspan=1>StandardNo CropAug. 30Aug. 40W-10 (30)W-10 (40)</td><td rowspan=4 colspan=4>75.96% 63.39% 31.42%70.81% 59.09% 16.52%65.96% 68.60% 32.90%66.19% 67.58% 33.86%</td><td rowspan=1 colspan=1>73.24% 60.42%</td><td rowspan=1 colspan=1>67.90% 44.98%</td></tr><tr><td rowspan=1 colspan=1>66.75% 45.17%</td><td rowspan=1 colspan=1>62.78% 34.17%</td></tr><tr><td rowspan=4 colspan=4>65.96% 68.60% 32.90%66.19% 67.58% 33.86%76.14% 73.19% 52.76%74.64% 71.36% 50.23%</td><td rowspan=1 colspan=1>70.27% 45.72%</td><td rowspan=1 colspan=1>69.28% 47.25%</td></tr><tr><td rowspan=1 colspan=1>69.50% 44.60%</td><td rowspan=1 colspan=1>68.88% 48.72%</td></tr><tr><td rowspan=1 colspan=1>74.42% 61.18%</td><td rowspan=2 colspan=1>73.74% 61.06%71.95% 59.23%</td></tr><tr><td rowspan=1 colspan=1>72.86% 59.34%</td></tr></table>
111
+
112
+ Padding Experiments. A natural question is whether the reduced accuracy of the models is due to the cropping applied during the transformation. We verify that this is not the case by applying zero and reflection padding to the image datasets. We note that the zero padding creates a “black canvas” version of the dataset, ensuring that no information from the original image is lost after a transformation. We show a random set of adversarial examples in this setting in Figure 6 and a full evaluation in Table 4. We also provide more details regarding reflection padding in Section B and provide an evaluation in Table 6. All of these are in Appendix A.
113
+
114
+ # 4.2 COMPARING ATTACK METHODS
115
+
116
+ In Table 2 we compare different attack methods on various classifiers and datasets. We observe that worst-of-10 is a powerful adversary despite its limited interaction with the target classifier. The firstorder adversary performs significantly worse. While it is still better than a random transformation , it fails to approximate the ground-truth accuracy of the models and performs significantly worse than the grid adversary and even the worst-of-10 adversary.
117
+
118
+ Understanding the Failure of First-Order Methods. The fact that first-order methods fail to reliably find adversarial rotations and translations is in sharp contrast to previous work on $\ell _ { p }$ -robustness (Carlini & Wagner, 2016; Madry et al., 2017). For $\ell _ { p }$ -bounded perturbations parametrized directly in pixel space, prior work found the optimization landscape to be well-behaved which allowed first-order methods to consistently find maxima with high loss. In the case of spatial perturbations, we observe that the non-concavity of the problem is a significant barrier for first-order methods. We investigate this issue by visualizing the loss landscape. For a few random examples from the three datasets, we plot the cross-entropy loss of the examples as a function of translation and rotation. Figure 2 shows one example for each dataset and additional examples are visualized in Figure 11 of the appendix. The plots show that the loss landscape is indeed non-concave and contains many local maxima of low value. The low-dimensional problem structure seems to make non-concavity a crucial obstacle. Even for MNIST, where we observe fewer local maxima, the large flat regions prevent first-order methods from finding transformations of high loss.
119
+
120
+ Table 2: Comparison of attack methods across datasets and models. Worst-of-10 is very effective and significantly reduces the model accuracy despite the limited interaction. The first-order (FO) adversary performs poorly, despite the large number of steps allowed. We compare standard training to Augmentation $( \pm \mathrm { { 3 p x } , \pm 3 0 ^ { \circ } ) }$ . For the full table, see Figure 3 of Appendix A.
121
+
122
+ <table><tr><td rowspan="2"></td><td colspan="2">MNIST</td><td colspan="2">CIFAR-10</td><td colspan="2">ImageNet</td></tr><tr><td>Standard</td><td>Aug.</td><td>Standard</td><td>Aug.</td><td>Standard</td><td>Aug.</td></tr><tr><td>Natural</td><td>99.31%</td><td>99.53%</td><td>92.62%</td><td>90.02%</td><td>75.96%</td><td>65.96%</td></tr><tr><td>Worst-of-10</td><td>73.32%</td><td>98.33%</td><td>20.13%</td><td>79.92%</td><td>47.83%</td><td>50.62%</td></tr><tr><td>First-Order</td><td>79.84%</td><td>98.78%</td><td>62.69%</td><td>85.92%</td><td>63.12%</td><td>66.05%</td></tr><tr><td>Grid</td><td>26.02%</td><td>95.79%</td><td>2.80%</td><td>58.92%</td><td>31.42%</td><td>32.90%</td></tr></table>
123
+
124
+ ![](images/037aebd33bb873a22c486788575345d70cc4fdbdf871cfe483c5e7705c723eb1.jpg)
125
+ Figure 2: Loss landscape of a random example for each dataset when performing left-right translations and rotations. Translations and rotations are restricted to $10 \%$ of the image pixels and $3 0 ^ { \circ }$ , respectively. We observe that the landscape is significantly non-concave, rendering first-order methods to generate adversarial example ineffective. Figure 11 in the appendix shows additional examples.
126
+
127
+ Relation to Black-Box Attacks. Given its limited interaction with the model, the worst-of-10 adversary achieves a significant reduction in classification accuracy. It performs only 10 random, non-adaptive queries to the model and is still able to find adversarial examples for a large fraction of the inputs (see Table 2). The low query complexity is an important baseline for black-box attacks on neural networks, which recently gained significant interest (Papernot et al., 2017; Chen et al., 2017; Bhagoji et al., 2017; Ilyas et al., 2017). Black-box attacks rely only function evaluations of the target classifier, without additional information such as gradients. The main challenge is to construct an adversarial example from a small number of queries. Our results show that it is possible to find adversarial rotations and translations for a significant fraction of inputs with very few queries.
128
+
129
+ Combining Spatial and $\ell _ { \infty }$ -Bounded Perturbations Table 1 shows that models trained to be robust to $\ell _ { \infty }$ perturbations do not achieve higher robustness to spatial perturbations. This provides evidence that the two families of perturbation are orthogonal to each other. We further investigate this possibility by considering a combined adversary that utilizes $\ell _ { \infty }$ bounded perturbations on top of rotations and translations. The results are shown in Figure 12. We indeed observe that these combined attacks reduce classification accuracy in an (approximately) additive manner.
130
+
131
+ # 4.3 EVALUATING OUR DEFENSE METHODS.
132
+
133
+ As we see in Table 1, training with a worst-of-10 adversary significantly increases the spatial robustness of the model, also compared to data augmentation with random transformations. We conjecture that using more reliable methods to compute the worst-case transformations will further improve these results. Unfortunately, increasing the number of random transformations per training example quickly becomes computationally expensive. And as pointed out above, current first-order methods also appear to be insufficient for finding worst-case transformations efficiently.
134
+
135
+ Our results for majority-based inference are presented in Table 5 of Appendix A. By combining these two defense, we improve the worst-case performance of the models from $26 \%$ to $98 \%$ on MNIST, from $3 \%$ to $82 \%$ on CIFAR10, and from $31 \%$ to $56 \%$ on ImageNet (Top 1).
136
+
137
+ # 5 RELATED WORK
138
+
139
+ The fact that small rotations and translation can fool neural networks on MNIST and CIFAR10 was first observed in (Fawzi & Frossard, 2015). They compute the minimum transformation required to fool the model and use it as a measure for a quantitative comparison of different architectures and training procedures. The main difference to our work is that we focus on the optimization aspect of the problem . We show that a few random queries usually suffice for a successful attack, while firstorder methods are ineffective. Moreover, we go beyond standard data augmentation and evaluate the effectiveness of natural baseline defenses.
140
+
141
+ The concurrent work of Kanbak et al. (2017) proposes a different first-order method to evaluate the robustness of classifiers based on geodesic distances on a manifold. This metric is harder to interpret than our parametrized attack space. Moreover, given our findings on the non-concavity of the optimization landscape, it is unclear how close their method is to the ground truth (exhaustive enumeration). While they perform a limited study of defenses (adversarial fine-tuning) using their method, it appears to be less effective than our baseline worst-of-10 training. We attribute this difference to the inherent obstacles first-order methods face in this optimization landscape.
142
+
143
+ Recently, Xiao et al. (2018) and Tramer & Boneh (2017) observed independently that it is possible to \` use various spatial transformations to construct adversarial examples for naturally and adversarially trained models. The main difference from our work is that we show even very simple transformations (translations and rotations) are sufficient to break a variety of classifiers, while the transformations employed in (Xiao et al., 2018) and (Tramer & Boneh, 2017) are more involved. The transformation \` in (Xiao et al., 2018) is based on performing a displacement of individual pixels in the original image constrained to be globally smooth and then optimized for misclassification probability. Tramer & \` Boneh (2017) consider an $\ell _ { \infty }$ -bounded pixel-wise perturbation of a version of the original image that has been slightly rotated and in which a few random pixels have been flipped. Both of these methods require direct access to the attacked model (or a surrogate) to compute (or at least estimate) the gradient of the loss function with respect to the model’s input. In contrast, our attacks can be implemented using only a small number of random, non-adaptive transformations of the input.
144
+
145
+ # 6 CONCLUSIONS
146
+
147
+ We examined the robustness of state-of-the-art image classifiers to translations and rotations. We observed that even a small number of randomly chosen perturbations of the input are sufficient to considerably degrade the classifier’s performance.
148
+
149
+ The fact that common neural networks are vulnerable to simple and naturally occurring spatial transformations (and that these transformations can be found easily from just a few random tries) indicates that adversarial robustness should be a concern not only in a fully worst-case security setting. We conjecture that additional techniques need to be incorporated in the architecture and training procedures of modern classifiers to achieve worst-case spatial robustness. Also, our results underline the need to consider broader notions of similarity than only pixel-wise distances when studying adversarial misclassification attacks. In particular, we view combining the pixel-wise distances with rotations and translations as a next step towards the “right” notion of similarity in the context of images.
150
+
151
+ # REFERENCES
152
+
153
+ TensorFlow tutorial: Deep MNIST for experts. URL https://www.tensorflow.org/versions/ r0.12/tutorials/mnist/pros/.
154
+
155
+ Anish Athalye, Logan Engstrom, Andrew Ilyas, and Kevin Kwok. Synthesizing robust adversarial examples. arXiv preprint arXiv:1707.07397, 2017.
156
+
157
+ A. Ben-Tal, L. El Ghaoui, and A.S. Nemirovski. Robust Optimization. Princeton University Press, 2009.
158
+
159
+ Arjun Nitin Bhagoji, Warren He, Bo Li, and Dawn Song. Exploring the space of black-box attacks on deep neural networks. arXiv preprint arXiv:1712.09491, 2017.
160
+
161
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. arXiv preprint arXiv:1608.04644, 2016.
162
+
163
+ Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, pp. 15–26. ACM, 2017.
164
+
165
+ Ronan Collobert and Jason Weston. A unified architecture for natural language processing: Deep neural networks with multitask learning. In Proceedings of the 25th international conference on Machine learning, pp. 160–167. ACM, 2008.
166
+
167
+ Alhussein Fawzi and Pascal Frossard. Manitest: Are classifiers really invariant? In British Machine Vision Conference (BMVC), 2015.
168
+
169
+ Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
170
+
171
+ Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In Acoustics, speech and signal processing (icassp), 2013 ieee international conference on, pp. 6645–6649. IEEE, 2013.
172
+
173
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing humanlevel performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026–1034, 2015.
174
+
175
+ 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.
176
+
177
+ Andrew Ilyas, Logan Engstrom, Anish Athalye, and Jessy Lin. Query-efficient black-box adversarial examples. arXiv preprint arXiv:1712.07113, 2017.
178
+
179
+ Max Jaderberg, Karen Simonyan, Andrew Zisserman, et al. Spatial transformer networks. In Advances in Neural Information Processing Systems, pp. 2017–2025, 2015.
180
+
181
+ Can Kanbak, Seyed-Mohsen Moosavi-Dezfooli, and Pascal Frossard. Geometric robustness of deep networks: analysis and improvement. arXiv preprint arXiv:1711.09115, 2017.
182
+
183
+ J Zico Kolter and Eric Wong. Provable defenses against adversarial examples via the convex outer adversarial polytope. arXiv preprint arXiv:1711.00851, 2017.
184
+
185
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
186
+
187
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
188
+
189
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016a.
190
+
191
+ Alexey Kurakin, Ian J. Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016b.
192
+
193
+ 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.
194
+
195
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
196
+
197
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: A simple and accurate method to fool deep neural networks. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 2574–2582, 2016.
198
+
199
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, pp. 506–519. ACM, 2017.
200
+
201
+ Aditi Raghunathan, Jacob Steinhardt, and Percy Liang. Certified defenses against adversarial examples. International Conference on Learning Representations, 2018. URL https://openreview.net/forum? id=Bys4ob-Rb.
202
+
203
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y.
204
+
205
+ Mahmood Sharif, Sruti Bhagavatula, Lujo Bauer, and Michael K. Reiter. Accessorize to a crime: Real and stealthy attacks on state-of-the-art face recognition. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, Vienna, Austria, October 24-28, 2016, pp. 1528–1540, 2016.
206
+
207
+ Aman Sinha, Hongseok Namkoong, and John Duchi. Certifiable distributional robustness with principled adversarial training. arXiv preprint arXiv:1710.10571, 2017.
208
+
209
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
210
+
211
+ Yaniv Taigman, Ming Yang, Marc’Aurelio Ranzato, and Lior Wolf. Deepface: Closing the gap to human-level performance in face verification. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1701–1708, 2014.
212
+
213
+ Florian Tramer and Dan Boneh. Personal communication, 2017. \`
214
+
215
+ Yuxin Wu et al. Tensorpack. https://github.com/tensorpack/, 2016.
216
+
217
+ Chaowei Xiao, Jun-Yan Zhu, Bo Li, Warren He, Mingyan Liu, and Dawn Song. Spatially transformed adversarial examples. International Conference on Learning Representations, 2018. URL https: //openreview.net/forum?id $\equiv$ HyydRMZC-.
218
+
219
+ # A OMITTED TABLES AND FIGURES
220
+
221
+ ![](images/6be8b1e90011565dbfe18086124e632ae6c4f7015bb8b51d90e17ae7749163ea.jpg)
222
+ Figure 3: MNIST. Successful adversarial examples for the models studied in Section 4. Rotations are restricted to be within $3 0 ^ { \circ }$ of the original image and translations up to 3 pixels per direction (image size $2 8 \times 2 8$ ). Each example is visualized along with its predicted label in the original and perturbed versions.
223
+
224
+ ![](images/26b7cdf24cc48d671ac5febb8af59b365b797de29104fd693f5d7858c1d01466.jpg)
225
+ Figure 4: CIFAR10. Successful adversarial examples for the models studied in Section 4. Rotations are restricted to be within $3 0 ^ { \circ }$ of the original and translations up to 3 pixels per directions (image size $3 2 \times 3 2 ,$ ). Each example is visualized along with its predicted label in the original and perturbed version.
226
+
227
+ ![](images/355d6ece4af015878f75c7904074cb3ce8fc4acf1a2682a83017eb3cdd94580a.jpg)
228
+ Figure 5: ImageNet. Successful adversarial examples for the models studied in Section 4. Rotations are restricted to be within $3 0 ^ { \circ }$ of the original and translations up to 24 pixels per directions (image size $2 9 9 \times 2 9 9$ ). Each example is visualized along with its predicted label in the original and perturbed version.
229
+
230
+ ![](images/9adc97254f9a49fc289bf63a114c93c63d72ba5fe677cc63dbad9dc88db6a269.jpg)
231
+ Figure 6: Sample adversarial transformations for the ”black-canvas” setting for the standard models on CIFAR10 and ImageNet.
232
+
233
+ ![](images/34f61e1cb5c8fcd102da1367f3949ca26b3ba5ce8a043f83a1151970aa4d7030.jpg)
234
+ Figure 7: Sample adversarial transformations for the reflection padding setting for the standard models on CIFAR10.
235
+
236
+ ![](images/af22e88fb367464ae08d512ced58677326738b42ff7c1d32c031f9152e88a8f2.jpg)
237
+ Figure 8: Fine-grained dataset analysis. For each model, we visualize what percent of the test set can be fooled via various methods. We compute how many examples can be fooled with either translations or rotations (”any”), how many can be fooled only by one of these, and how many require a combination to be fooled (”both”).
238
+
239
+ ![](images/36b377a5f8e6a35b475cb5fcb813f0fc17f6ad24d95ced1b9f5569a67d62fb9e.jpg)
240
+ Figure 9: Visualizing which angles fool the classifier for 50 random examples. For each dataset and model, we visualize one example per row. Red corresponds to misclassification of the images. We observe that the angles fooling the models form a highly non-convex set.
241
+
242
+ ![](images/d63c0b01d615e7cd366824c1817405e3b76745a1255c2ab4b6273fbdf12922c4.jpg)
243
+ Figure 10: Cumulative Density Function plots. For each fraction of grid points $p$ , we plot the percentage of correctly classified test set examples that are fooled by at least $p$ of the grid points. For instance, we can see from the first plot, MNIST Translations and Rotations, that approximately $10 \%$ of the correctly classified natural examples are misclassified under $1 / 5$ of the grid points transformations.
244
+
245
+ Table 3: Comparison of attack methods across datasets and models.
246
+
247
+ <table><tr><td></td><td>Model</td><td>Natural</td><td>Worst-of-10</td><td>FO</td><td>Grid</td></tr><tr><td>LSINW</td><td>Standard lo-Adversarially Trained Aug.30 (±3px,±30°) Aug. 40 (±4±,±40°)</td><td>99.31% 98.65% 99.53% 99.34%</td><td>73.32% 51.18% 98.33% 98.49%</td><td>79.84% 81.23% 98.78% 98.74%</td><td>26.02% 1.20% 95.79% 96.95%</td></tr><tr><td>CITIIIT</td><td>Standard No Crop loo-Adversarially Trained Aug.30 (±3px,±30°) Aug. 40 (±4px,±40°)</td><td>92.62% 90.34% 80.21% 90.02% 88.83%</td><td>20.13% 15.04% 19.38% 79.92% 80.47%</td><td>62.69% 52.27% 33.24% 85.92% 85.48%</td><td>2.80% 1.86% 6.02% 58.92% 61.69%</td></tr><tr><td>1eenee</td><td>Standard No Crop Aug.30 (±24px,±30°) Aug.40 (±32px,±40°)</td><td>75.96% 70.81% 65.96% 66.19%</td><td>47.83% 35.52% 50.62% 51.11%</td><td>63.12% 55.93% 66.05% 66.14%</td><td>31.42% 16.52% 32.90% 33.86%</td></tr></table>
248
+
249
+ Table 4: Evaluation of a subset of Table 1 in the “black-canvas” setting (images are zero-padded to avoid cropping due to rotations and translations). The models are trained on padded images.
250
+
251
+ <table><tr><td></td><td></td><td>Natural</td><td>Random</td><td>Worst-of-10</td><td>Grid</td><td>Trans. Grid</td><td>Rot. Grid</td></tr><tr><td rowspan="4">CITIII</td><td>Standard</td><td>91.81%</td><td>70.23%</td><td>25.51%</td><td>6.55%</td><td>83.38%</td><td>12.44%</td></tr><tr><td>No Crop</td><td>89.70%</td><td>52.86%</td><td>14.14%</td><td>1.17%</td><td>47.94%</td><td>9.46%</td></tr><tr><td>Aug.30 (±3px,±30°)</td><td>91.45%</td><td>90.82%</td><td>80.53%</td><td>63.64%</td><td>82.28%</td><td>76.32%</td></tr><tr><td>Aug.40 (±4px,±40°)</td><td>91.24%</td><td>91.00%</td><td>81.81%</td><td>66.64%</td><td>81.75%</td><td>78.57%</td></tr><tr><td rowspan="4">1aeege</td><td>Standard</td><td>73.60%</td><td>46.59%</td><td>29.51%</td><td>15.38%</td><td>28.03%</td><td>23.81%</td></tr><tr><td>No Crop</td><td>66.28%</td><td>38.70%</td><td>14.17%</td><td>3.43%</td><td>8.87%</td><td>10.97%</td></tr><tr><td>Aug.30 (±24px,±30°)</td><td>64.60%</td><td>67.75%</td><td>47.32%</td><td>28.51%</td><td>45.33%</td><td>39.33%</td></tr><tr><td>Aug.40 (±32px,±40°)</td><td>49.20%</td><td>57.69%</td><td>38.36%</td><td>22.10%</td><td>32.84%</td><td>32.95%</td></tr></table>
252
+
253
+ ![](images/61eeaa79b4ebcc0e672828f115ea91e7b4c7ab09d22c040a193ca6de379d6445.jpg)
254
+ Figure 11: Loss landscape of 4 random examples for each dataset when performing left-right translations and rotations. Translations and rotations are restricted to $10 \%$ of the image pixels and $3 0 ^ { \circ }$ respectively. We observe that the landscape is significantly non-concave, making rendering FO methods for adversarial example generation powerless.
255
+
256
+ ![](images/603dbd3b56ec7b704aaf472369fd8da9b002abacfcff3173c1d2f263c55c6e19.jpg)
257
+ Figure 12: Accuracy of different classifiers against $\ell _ { \infty }$ -bounded adversaries with various values of $\varepsilon$ and spatial transformations. For each value of $\varepsilon$ , we perform PGD to find the most adversarial $\ell _ { \infty }$ - bounded perturbation. Additionally, we combine PGD with random rotations and translations and with a grid search over rotations and translations in order to find the transformation that combines with PGD in the most adversarial way.
258
+
259
+ # B MIRROR PADDING
260
+
261
+ In the experiments of Section 4, we filled the remaining pixels of rotated and translated images with black (also known as zero or constant padding). This is the standard approach used when performing random cropping for data augmentation purposes. We briefly examined the effect of mirror padding, that is replacing empty pixels by reflecting the image around the border6. The results are shown in Table 6. We observed that training with one padding method and evaluating using the other resulted in a significant drop in accuracy. Training using one of these methods randomly for each example resulted in a model which roughly matched the best-case of the two individual cases.
262
+
263
+ Table 5: Majority Defense. Accuracy of different models on the natural evaluation set and against a combined rotation and translation adversary using aggregation of multiple random transformations.
264
+
265
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Natural Acc.Stand. Vote</td><td rowspan=1 colspan=1>Grid Acc.Stand. Vote</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Standard</td><td rowspan=1 colspan=1>99.31% 98.71%</td><td rowspan=2 colspan=1>26.02% 18.80%95.79%95.32%96.95% 97.65%97.32% 96.95%97.88% 98.47%</td></tr><tr><td rowspan=1 colspan=1>JSINN</td><td rowspan=1 colspan=1>Aug 30.Aug 40.W-10 (30)W-10 (40)</td><td rowspan=1 colspan=1>99.53%99.41%99.34%99.25%99.48% 99.40%99.42% 99.41%</td></tr><tr><td rowspan=1 colspan=1>CITIIIO</td><td rowspan=1 colspan=1>StandardAug 30.Aug 40.W-10 (30)W-10 (40)</td><td rowspan=1 colspan=1>92.62% 80.37%90.02% 92.70%88.83% 92.50%91.34% 93.38%91.00% 93.40%</td><td rowspan=1 colspan=1>2.82% 7.85%58.90% 69.65%61.69% 76.54%69.17% 77.33%71.15% 81.52%</td></tr><tr><td rowspan=1 colspan=1>1eeeeer</td><td rowspan=1 colspan=1>StandardAug 30.Aug 40.W-10 (30)W-10 (40)</td><td rowspan=1 colspan=1>75.96% 73.19%65.96% 72.44%66.19% 71.46%76.14%74.92%74.64%73.38%</td><td rowspan=1 colspan=1>31.42% 40.21%32.90% 44.46%33.86% 46.98%52.76%56.45%50.23%56.23%</td></tr></table>
266
+
267
+ Table 6: CIFAR10: The effect of using reflection or zero padding when training a model. The experimental setup matches that of Section 4. Zero padding refers to filling the empty pixels caused by translations and rotations with black. Mirror padding corresponds to using a reflection of the images. ”Both” refers to training using both methods and alternating randomly between them for each training example.
268
+
269
+ <table><tr><td></td><td>Natural</td><td>Random (Zero)</td><td>Random (Mirror)</td><td>Grid Search (Zero)</td><td>Grid Search (Mirror)</td></tr><tr><td>Standard Nat</td><td>92.62%</td><td>60.76%</td><td>66.42%</td><td>8.08%</td><td>5.37%</td></tr><tr><td>Standard Adv</td><td>80.21%</td><td>59.79%</td><td>67.12%</td><td>7.20%</td><td>12.89%</td></tr><tr><td>Aug. A, Zero</td><td>90.25%</td><td>91.09%</td><td>87.67%</td><td>59.87%</td><td>40.55%</td></tr><tr><td>Aug. B, Zero</td><td>89.55%</td><td>91.40%</td><td>87.94%</td><td>62.42%</td><td>42.37%</td></tr><tr><td>Aug. A, Mirror</td><td>92.25%</td><td>88.43%</td><td>91.05%</td><td>41.46%</td><td>53.95%</td></tr><tr><td>Aug. B, Mirror</td><td>92.03%</td><td>88.58%</td><td>91.34%</td><td>45.44%</td><td>57.97%</td></tr><tr><td>Aug. A, Both</td><td>91.80%</td><td>90.98%</td><td>91.28%</td><td>56.95%</td><td>52.60%</td></tr><tr><td>Aug. B, Both</td><td>91.57%</td><td>91.87%</td><td>91.11%</td><td>60.46%</td><td>56.13%</td></tr></table>
md/train/ByeL1R4FvS/ByeL1R4FvS.md ADDED
@@ -0,0 +1,409 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UNSUPERVISED DATA AUGMENTATION FOR CONSISTENCY TRAINING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Semi-supervised learning lately has shown much promise in improving deep learning models when labeled data is scarce. Common among recent approaches is the use of consistency training on a large amount of unlabeled data to constrain model predictions to be invariant to input noise. In this work, we present a new perspective on how to effectively noise unlabeled examples and argue that the quality of noising, specifically those produced by advanced data augmentation methods, plays a crucial role in semi-supervised learning. By substituting simple noising operations with advanced data augmentation methods, our method brings substantial improvements across six language and three vision tasks under the same consistency training framework. On the IMDb text classification dataset, with only 20 labeled examples, our method achieves an error rate of 4.20, outperforming the state-of-the-art model trained on 25,000 labeled examples. On a standard semi-supervised learning benchmark, CIFAR-10, our method outperforms all previous approaches and achieves an error rate of $2 . 7 \%$ with only 4,000 examples, nearly matching the performance of models trained on 50,000 labeled examples. Our method also combines well with transfer learning, e.g., when finetuning from BERT, and yields improvements in high-data regime, such as ImageNet, whether when there is only $10 \%$ labeled data or when a full labeled set with 1.3M extra unlabeled examples is used. 1
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ A fundamental weakness of deep learning is that it typically requires a lot of labeled data to work well. Semi-supervised learning (SSL) (Chapelle et al., 2009) is one of the most promising methods of leveraging unlabeled data to address this weakness. The recent works in SSL are diverse but those that are based on consistency training (Bachman et al., 2014; Rasmus et al., 2015; Laine & Aila, 2016; Tarvainen & Valpola, 2017) have shown to work well on many benchmarks.
12
+
13
+ In a nutshell, consistency training methods simply regularize model predictions to be invariant to small noise applied to either input examples (Miyato et al., 2018; Sajjadi et al., 2016; Clark et al., 2018) or hidden states (Bachman et al., 2014; Laine & Aila, 2016). This framework makes sense intuitively because a good model should be robust to any small change in an input example or hidden states. Under this framework, different methods in this category differ mostly in how and where the noise injection is applied. Typical noise injection methods are additive Gaussian noise, dropout noise or adversarial noise.
14
+
15
+ In this work, we investigate the role of noise injection in consistency training and observe that advanced data augmentation methods, specifically those work best in supervised learning (Simard et al., 1998; Krizhevsky et al., 2012; Cubuk et al., 2018; Yu et al., 2018), also perform well in semisupervised learning. There is indeed a strong correlation between the performance of data augmentation operations in supervised learning and their performance in consistency training. We, hence, propose to substitute the traditional noise injection methods with high quality data augmentation methods in order to improve consistency training. To emphasize the use of better data augmentation in consistency training, we name our method Unsupervised Data Augmentation or UDA.
16
+
17
+ We evaluate UDA on a wide variety of language and vision tasks. On six text classification tasks, our method achieves significant improvements over state-of-the-art models. Notably, on IMDb, UDA with 20 labeled examples outperforms the state-of-the-art model trained on $1 2 5 0 \mathrm { x }$ more labeled data. We also evaluate UDA on standard semi-supervised learning benchmarks for vision such as CIFAR-10 and SVHN. UDA outperforms all existing semi-supervised learning methods by significant margins. On CIFAR-10 with 4,000 labeled examples, UDA achieves an error rate of 5.29, nearly matching the performance of the fully supervised model that uses 50,000 labeled examples. Furthermore, with a better architecture, PyramidNet+ShakeDrop, UDA achieves a new state-ofthe-art error rate of 2.7. On SVHN, UDA achieves an error rate of 2.55 with only 1,000 labeled examples. Finally, we also find UDA to be beneficial when there is a large amount of supervised data. For instance, on ImageNet, UDA leads to improvements of top-1 accuracy from 58.84 to 68.78 with $1 0 \%$ of the labeled set and from 78.43 to 79.05 when we use the full labeled set and an external dataset with 1.3M unlabeled examples.
18
+
19
+ Our key contributions and findings can be summarized as follows:
20
+
21
+ • First, we show that state-of-the-art data augmentations found in supervised learning can also serve as a superior source of perturbation under the consistency enforcing semi-supervised framework. See results in Table 1 and Table 2.
22
+ • Second, we show that UDA can match and even outperform purely supervised learning that uses orders of magnitude more labeled data. State-of-the-art results for both vision and language tasks are reported in Table 3 and 4. The effectiveness of UDA across different training data sizes are highlighted in Figure 4 and 5.
23
+ • Finally, we show that UDA combines well with transfer learning, e.g., when fine-tuning from BERT (see Table 4), and is effective at high-data regime, e.g. on ImageNet (see Table 5).
24
+
25
+ # 2 UNSUPERVISED DATA AUGMENTATION (UDA)
26
+
27
+ In this section, we first formulate our task and then present the key method and insights behind UDA. Throughout this paper, we focus on classification problems and will use $x$ to denote the input and $y ^ { * }$ to denote its ground-truth prediction target. We are interested in learning a model $p _ { \theta } ( y \mid x )$ to predict $y ^ { * }$ based on the input $x$ , where $\theta$ denotes the model parameters. Finally, we will use $L$ and $U$ to denote the sets of labeled and unlabeled examples respectively.
28
+
29
+ # 2.1 BACKGROUND: SUPERVISED DATA AUGMENTATION
30
+
31
+ Data augmentation aims at creating novel and realistic-looking training data by applying a transformation to an example, without changing its label. Formally, let $q ( \bar { x } \mid x )$ be the augmentation transformation from which one can draw augmented examples $\hat { x }$ based on an original example $x$ . For an augmentation transformation to be valid, it is required that any example ${ \hat { x } } \sim q ( { \hat { x } } \mid x )$ drawn from the distribution shares the same ground-truth label as $x$ . Given a valid augmentation transformation, we can simply minimize the negative log-likelihood on augmented examples.
32
+
33
+ Supervised data augmentation can be equivalently seen as constructing an augmented labeled set from the original supervised set and then training the model on the augmented set. Therefore, the augmented set needs to provide additional inductive biases to be more effective. How to design the augmentation transformation has, thus, become critical.
34
+
35
+ In recent years, there have been significant advancements on the design of data augmentations for NLP (Yu et al., 2018), vision (Krizhevsky et al., 2012; Cubuk et al., 2018) and speech (Hannun et al., 2014; Park et al., 2019) in supervised settings. Despite the promising results, data augmentation is mostly regarded as the “cherry on the cake” which provides a steady but limited performance boost because these augmentations has so far only been applied to a set of labeled examples which is usually of a small size. Motivated by this limitation, via the consistency training framework, we extend the advancement in supervised data augmentation to semi-supervised learning where abundant unlabeled data is available.
36
+
37
+ ![](images/87dbf12e693e4fa1ebe2e7d799c65864b5d966ed735b831120d0fb1e1c6877ca.jpg)
38
+ Figure 1: Training objective for UDA, where M is a model that predicts a distribution of $y$ given $x$ .
39
+
40
+ # 2.2 UNSUPERVISED DATA AUGMENTATION
41
+
42
+ As discussed in the introduction, a recent line of work in semi-supervised learning has been utilizing unlabeled examples to enforce smoothness of the model. The general form of these works can be summarized as follows:
43
+
44
+ • Given an input $x$ , compute the output distribution $p _ { \theta } ( y \mid x )$ given $x$ and a noised version $p _ { \theta } ( y ~ |$ $x , \epsilon )$ by injecting a small noise $\epsilon$ . The noise can be applied to $x$ or hidden states. • Minimize a divergence metric between the two distributions $\mathcal { D } \left( p _ { \theta } ( y \mid x ) \parallel p _ { \theta } ( y \mid x , \epsilon ) \right)$ .
45
+
46
+ This procedure enforces the model to be insensitive to the noise $\epsilon$ and hence smoother with respect to changes in the input (or hidden) space. From another perspective, minimizing the consistency loss gradually propagates label information from labeled examples to unlabeled ones.
47
+
48
+ In this work, we are interested in a particular setting where the noise is injected to the input $x$ , i.e., $\hat { x } = q ( x , \epsilon )$ , as considered by prior works (Sajjadi et al., 2016; Laine & Aila, 2016; Miyato et al., 2018). But different from existing work, we focus on the unattended question of how the form or “quality” of the noising operation $q$ can influence the performance of this consistency training framework. Specifically, to enforce consistency, prior methods generally employ simple noise injection methods such as adding Gaussian noise, simple input augmentations to noise unlabeled examples. In contrast, we hypothesize that stronger data augmentations in supervised learning can also lead to superior performance when used to noise unlabeled examples in the semi-supervised consistency training framework, since it has been shown that more advanced data augmentations that are more diverse and natural can lead to significant performance gain in the supervised setting.
49
+
50
+ Following this idea, we propose to use a rich set of state-of-the-art data augmentations verified in various supervised settings to inject noise and optimize the same consistency training objective on unlabeled examples. When jointly trained with labeled examples, we utilize a weighting factor $\lambda$ to balance the supervised cross entropy and the unsupervised consistency training loss, which is illustrated in Figure 1. Formally, the full objective can be written as follows:
51
+
52
+ $$
53
+ \operatorname* { m i n } _ { \theta } \mathcal { I } ( \theta ) = \mathbb { E } _ { x , y ^ { * } \in L } \left[ - \log p _ { \theta } ( y ^ { * } \mid x ) \right] + \lambda \mathbb { E } _ { x \in U } \mathbb { E } _ { \hat { x } \sim q ( \hat { x } | x ) } \left[ \mathcal { D } _ { \mathrm { K L } } \left( p _ { \tilde { \theta } } ( y \mid x ) \ \lVert \ p _ { \theta } ( y \mid \hat { x } ) ) \right) \right] .
54
+ $$
55
+
56
+ where $q ( { \hat { x } } \mid x )$ is a data augmentation transformation and $\tilde { \theta }$ is a fixed copy of the current parameters $\theta$ indicating that the gradient is not propagated through $\tilde { \theta }$ , as suggested by Miyato et al. (2018). We also follow VAT (Miyato et al., 2018) to use the KL divergence. We set $\lambda$ to 1 for most of our experiments and use different batch sizes for the supervised data and the unsupervised data. In the vision domain, simple augmentations including cropping and flipping are applied to labeled examples. To minimize the discrepancy between supervised training and prediction on unlabeled examples, we apply the same simple augmentations to unlabeled examples for computing $p _ { \tilde { \theta } } ( y \mid x )$ .
57
+
58
+ Discussion. Before detailing the augmentation operations used in this work, we first provide some intuitions on how more advanced data augmentations can provide extra advantages over simple ones used in earlier works from three aspects:
59
+
60
+ • Valid noise: Advanced data augmentation methods that achieve great performance in supervised learning usually generate realistic augmented examples that share the same ground-truth labels with the original example. Thus, it is safe to encourage the consistency between predictions on the original unlabeled example and the augmented unlabeled examples.
61
+
62
+ • Diverse noise: Advanced data augmentation can generate a diverse set of examples since it can make large modifications to the input example without changing its label, while simple Gaussian noise only make local changes. Encouraging consistency on a diverse set of augmented examples can significantly improve the sample efficiency.
63
+
64
+ • Targeted inductive biases: Different tasks require different inductive biases. Data augmentation operations that work well in supervised training essentially provides the missing or most wanted inductive biases in an original labeled set.
65
+
66
+ # 2.3 AUGMENTATION STRATEGIES FOR DIFFERENT TASKS
67
+
68
+ We now detail the augmentation methods, tailored for different tasks, that we use in this work.
69
+
70
+ RandAugment for Image Classification. We make use of a data augmentation method called RandAugment, which is inspired by AutoAugment (Cubuk et al., 2018). AutoAugment uses a search method to combine all image processing transformations in the Python Image Library (PIL) to find a good augmentation strategy. In RandAugment, we do not use search, but instead uniformly sample from the same set of augmentation transformations in PIL. In other words, RandAugment is simpler and requires no labeled data as there is no need to search for optimal policies.
71
+
72
+ Back-translation for Text Classification. When used as an augmentation method, backtranslation (Sennrich et al., 2015; Edunov et al., 2018) refers to the procedure of translating an existing example $x$ in language $A$ into another language $B$ and then translating it back into $A$ to obtain an augmented example $\hat { x }$ . As observed by Yu et al. (2018), back-translation can generate diverse paraphrases while preserving the semantics of the original sentences, leading to significant performance improvements in question answering. In our case, we use back-translation to paraphrase the training data of our text classification tasks.2
73
+
74
+ We find that the diversity of the paraphrases is more important than the quality or the validity. Hence, we employ random sampling with a tunable temperature instead of beam search for the generation. As shown in Figure 2, the paraphrases generated by back-translation sentence are diverse and have similar semantic meanings. More specifically, we use WMT’14 English-French translation models (in both directions) to perform back-translation on each sentence. To facilitate future research, we have open-sourced our back-translation system together with the translation checkpoints.
75
+
76
+ ![](images/4cdd12835430eea86a7d9a619a2a3a2afe8958713c4ab32bb4b8dff477e76dc8.jpg)
77
+ Figure 2: Augmented examples using back-translation and RandAugment.
78
+
79
+ Word replacing with TF-IDF for Text Classification. While back-translation is good at maintaining the global semantics of a sentence, there is little control over which words will be retained. This requirement is important for topic classification tasks, such as DBPedia, in which some keywords are more informative than other words in determining the topic. We, therefore, propose an augmentation method that replaces uninformative words with low TF-IDF scores while keeping those with high TF-IDF values. We refer readers to Appendix C for a detailed description.
80
+
81
+ # 2.4 TRAINING SIGNAL ANNEALING FOR LOW-DATA REGIME
82
+
83
+ In semi-supervised learning, we often encounter a situation where there is a huge gap between the amount of unlabeled data and that of labeled data. Hence, the model often quickly overfits the limited amount of labeled data while still underfitting the unlabeled data. To tackle this difficulty, we introduce a new training technique, called Training Signal Annealing (TSA), which gradually releases the “training signals” of the labeled examples as training progresses. Intuitively, we only utilize a labeled example if the model’s confidence on that example is lower than a predefined threshold which increases according to a schedule. Specifically, at training step $t$ , if the model’s predicted probability for the correct category $p _ { \theta } ( y ^ { \ast } \mid x )$ is higher than a threshold $\eta _ { t }$ , we remove that example from the loss function. Suppose $K$ is the number of categories, by gradually increase $\eta _ { t }$ from $\textstyle { \frac { 1 } { K } } $ to 1, the threshold $\eta _ { t }$ serves as a ceiling to prevent over-training on easy labeled examples.
84
+
85
+ We consider three increasing schedules of $\eta _ { t }$ with different application scenarios. Let $T$ be the total number of training steps, the three schedules are shown in Figure 3. Intuitively, when the model is prone to overfit, e.g., when the problem is relatively easy or the number of labeled examples is very limited, the exp-schedule is most suitable as the supervised signal is mostly released at the end of training. In contrast, when the model is less likely to overfit (e.g., when we have abundant labeled examples or when the model employs effective regularization), the log-schedule can serve well.
86
+
87
+ ![](images/113c6c44647a30d9d7e78b133896c1a245e30dd854fa25c70b7fed58bcd93e81.jpg)
88
+ Figure 3: Three schedules of TSA. We set $\begin{array} { r } { \eta _ { t } = \alpha _ { t } * \left( 1 - \frac { 1 } { K } \right) + \frac { 1 } { K } } \end{array}$ . $\alpha _ { t }$ is set to $\textstyle 1 - \exp \bigl ( - \frac { t } { T } * 5 \bigr )$ $\textstyle { \frac { t } { T } }$ and $\textstyle \exp \bigl ( \bigl ( \frac { t } { T } - 1 \bigr ) * 5 \bigr )$ for the log, linear and exp schedules.
89
+
90
+ # 3 EXPERIMENTS
91
+
92
+ In this section, we evaluate UDA on a variety of language and vision tasks. For language, we rely on six text classification benchmark datasets, including IMDb, Yelp-2, Yelp-5, Amazon-2 and Amazon5 sentiment classification and DBPedia topic classification (Maas et al., 2011; Zhang et al., 2015). For vision, we employ two smaller datasets CIFAR-10 (Krizhevsky & Hinton, 2009), SVHN (Netzer et al., 2011), which are often used to compare semi-supervised algorithms, as well as ImageNet (Deng et al., 2009) of a larger scale to test the scalability of UDA. For details of the labeled and unlabeled data and experiment details, we refer readers to Appendix E.
93
+
94
+ # 3.1 CORRELATION BETWEEN SUPERVISED AND SEMI-SUPERVISED PERFORMANCES
95
+
96
+ As the first step, we try to verify the fundamental idea of UDA, i.e., there is a positive correlation of data augmentation’s effectiveness in supervised learning and semi-supervised learning. Based on Yelp-5 (a language task) and CIFAR-10 (a vision task), we compare the performance of different data augmentation methods in either fully supervised or semi-supervised settings. For Yelp-5, apart from back-translation, we include a simpler method Switchout (Wang et al., 2018) which replaces a token with a random token uniformly sampled from the vocabulary. For CIFAR-10, we compare RandAugment with two simpler methods: (1) cropping & flipping augmentation and (2) Cutout.
97
+
98
+ Based on this setting, Table 1 and Table 2 exhibit a strong correlation of an augmentation’s effectiveness between supervised and semi-supervised settings. This validates our idea of stronger data augmentations found in supervised learning can always lead to more gains when applied to the semi-supervised learning settings.
99
+
100
+ <table><tr><td>Augmentation (# Sup examples)</td><td>Sup (50k)</td><td>Semi-Sup (4k)</td></tr><tr><td>Crop&amp;flip</td><td>5.36</td><td>16.17</td></tr><tr><td>Cutout</td><td>4.42</td><td>6.42</td></tr><tr><td>RandAugment</td><td>4.23</td><td>5.29</td></tr></table>
101
+
102
+ Table 1: Error rates on CIFAR-10.
103
+
104
+ Table 2: Error rate on Yelp-5.
105
+
106
+ <table><tr><td>Augmentation (# Sup examples)</td><td>Sup (650k)</td><td>Semi-sup (2.5k)</td></tr><tr><td>X</td><td>38.36</td><td>50.80</td></tr><tr><td>Switchout</td><td>37.24</td><td>43.38</td></tr><tr><td>Back-translation</td><td>36.71</td><td>41.35</td></tr></table>
107
+
108
+ # 3.2 ALGORITHM COMPARISON ON VISION SEMI-SUPERVISED LEARNING BENCHMARKS
109
+
110
+ With the correlation established above, the next question we ask is how well UDA performs compared to existing semi-supervised learning algorithms. To answer the question, we focus on the most commonly used semi-supervised learning benchmarks CIFAR-10 and SVHN.
111
+
112
+ Vary the size of labeled data. Firstly, we follow the settings in (Oliver et al., 2018) and employ Wide-ResNet-28-2 (Zagoruyko & Komodakis, 2016; He et al., 2016) as the backbone model and evaluate UDA with varied supervised data sizes. Specifically, we compare UDA with two highly competitive baselines: (1) Virtual adversarial training (VAT) (Miyato et al., 2018), an algorithm that generates adversarial Gaussian noise on input, and (2) MixMatch (Berthelot et al., 2019), a parallel work that combines previous advancements in semi-supervised learning. The comparison is shown in Figure 4 with two key observations.3
113
+
114
+ • First, UDA consistently outperforms the two baselines with a clear margin given different sizes of labeled data.
115
+ • Moreover, the performance difference between UDA and VAT shows the superiority of data augmentation based noise. The difference of UDA and VAT is essentially the noise process. While the noise produced by VAT often contain high-frequency artifacts that do not exist in real images, data augmentation mostly generates diverse and realistic images.
116
+
117
+ ![](images/f8f181f11a4ad184e5b17ad7505a41bb3ae73b6be1c54c39cfd10ad05474ac35.jpg)
118
+ Figure 4: Comparison with two semi-supervised learning methods on CIFAR-10 and SVHN with varied number of labeled examples.
119
+
120
+ Comparisons with published results Next, we directly compare UDA with previously published results under different model architectures. Following previous work, 4k and 1k labeled examples are used for CIFAR-10 and SVHN respectively. As shown in Table 3, given the same architecture, UDA outperforms all published results by significant margins. This shows the huge potential of state-of-the-art data augmentations under the consistency training framework in the vision domain.
121
+
122
+ Table 3: Comparison between methods using different models where PyramidNet is used with ShakeDrop regularization. Fully supervised Wide-ResNet-28-2 and PyramidNet+ShakeDrop have an error rate of 5.4 and 2.7 when trained on 50,000 examples without RandAugment. On CIFAR10, with only 4,000 labeled examples, UDA matches the performance of the two fully supervised models. On SVHN, UDA also matches the performance of our fully supervised model trained on 73,257 examples without RandAugment, which has an error rate of 2.84.
123
+
124
+ <table><tr><td>Method</td><td>Model</td><td>#Param</td><td>CIFAR-10 (4k)</td><td>SVHN (1k)</td></tr><tr><td>II-Model (Laine &amp; Aila,2016)</td><td>Conv-Large</td><td>3.1M</td><td>12.36 ± 0.31</td><td>4.82 ± 0.17</td></tr><tr><td>Mean Teacher (Tarvainen &amp; Valpola,2017)</td><td>Conv-Large</td><td>3.1M</td><td>12.31 ± 0.28</td><td>3.95 ± 0.19</td></tr><tr><td>VAT+ EntMin (Miyato et al., 2018)</td><td>Conv-Large</td><td>3.1M</td><td>10.55 ± 0.05</td><td>3.86 ± 0.11</td></tr><tr><td>SNTG (Luo et al., 2018)</td><td>Conv-Large</td><td>3.1M</td><td>10.93 ± 0.14</td><td>3.86 ± 0.27</td></tr><tr><td>VAdD (Park et al., 2018)</td><td>Conv-Large</td><td>3.1M</td><td>11.32 ± 0.11</td><td>4.16 ± 0.08</td></tr><tr><td>Fast-SWA (Athiwaratkun et al., 2018)</td><td>Conv-Large</td><td>3.1M</td><td>9.05</td><td></td></tr><tr><td>ICT (Verma et al., 2019)</td><td>Conv-Large</td><td>3.1M</td><td>7.29 ± 0.02</td><td>3.89 ±0.04</td></tr><tr><td>Pseudo-Label (Lee,2013)</td><td>WRN-28-2</td><td>1.5M</td><td>16.21 ± 0.11</td><td>7.62 ± 0.29</td></tr><tr><td>LGA + VAT (Jackson &amp; Schulman, 2019)</td><td>WRN-28-2</td><td>1.5M</td><td>12.06 ± 0.19</td><td>6.58 ± 0.36</td></tr><tr><td>mixmixup (Hataya &amp; Nakayama, 2019)</td><td>WRN-28-2</td><td>1.5M</td><td>10</td><td>=</td></tr><tr><td>ICT (Verma et al., 2019)</td><td>WRN-28-2</td><td>1.5M</td><td>7.66 ± 0.17</td><td>3.53 ± 0.07</td></tr><tr><td>MixMatch (Berthelot et al.,2019)</td><td>WRN-28-2</td><td>1.5M</td><td>6.24 ± 0.06</td><td>2.89 ± 0.06</td></tr><tr><td>Mean Teacher (Tarvainen&amp; Valpola,2017)</td><td>Shake-Shake</td><td>26M</td><td>6.28 ± 0.15</td><td>-</td></tr><tr><td>Fast-SWA (Athiwaratkun et al., 2018)</td><td>Shake-Shake</td><td>26M</td><td>5.0</td><td></td></tr><tr><td>MixMatch (Berthelot et al.,2019)</td><td>WRN</td><td>26M</td><td>4.95 ± 0.08</td><td>=</td></tr><tr><td>UDA (RandAugment)</td><td>WRN-28-2</td><td>1.5M</td><td>5.29 ± 0.25</td><td>2.55 ± 0.09</td></tr><tr><td>UDA (RandAugment)</td><td>Shake-Shake</td><td>26M</td><td>3.7</td><td></td></tr><tr><td>UDA (RandAugment)</td><td>PyramidNet</td><td>26M</td><td>2.7</td><td></td></tr></table>
125
+
126
+ # 3.3 EVALUATION ON TEXT CLASSIFICATION DATASETS
127
+
128
+ Next, we further evaluate UDA in the language domain. Moreover, in order to test whether UDA can be combined with the success of unsupervised representation learning, such as BERT (Devlin et al., 2018), we further consider four initialization schemes: (a) random Transformer; (b) BERTBASE; (c) BERTLARGE; (d) BERTFINETUNE: BERTLARGE fine-tuned on in-domain unlabeled data4. Under each of these four initialization schemes, we compare the performances with and without UDA.
129
+
130
+ The results are presented in Table 4 where we would like to emphasize three observations:
131
+
132
+ • First, even with very few labeled examples, UDA can offer decent or even competitive performances compared to the SOTA model trained with full supervised data. Particularly, on binary sentiment analysis tasks, with only 20 supervised examples, UDA outperforms the previous SOTA trained with full supervised data on IMDb and is competitive on Yelp-2 and Amazon-2. • Second, UDA is complementary to transfer learning / representation learning. As we can see, when initialized with BERT and further finetuned on in-domain data, UDA can still significantly reduce the error rate from 6.50 to 4.20 on IMDb. • Finally, we also note that for five-category sentiment classification tasks, there still exists a clear gap between UDA with 500 labeled examples per class and BERT trained on the entire supervised set. Intuitively, five-category sentiment classifications are much more difficult than their binary counterparts. This suggests a room for further improvement in the future.
133
+
134
+ Results with different labeled set sizes. We also show in Figure 5 that UDA leads to consistent improvements across all labeled data sizes on IMDb and Yelp-2.
135
+
136
+ <table><tr><td colspan="8">Fully supervised baseline</td></tr><tr><td>Datasets (# Sup examples)</td><td>IMDb (25k)</td><td>Yelp-2 (560k)</td><td>Yelp-5 (650k)</td><td>Amazon-2 (3.6m)</td><td>Amazon-5 (3m)</td><td>DBpedia (560k)</td></tr><tr><td>Pre-BERT SOTA BERTLARGE</td><td>4.32 4.51</td><td>2.16 1.89</td><td>29.98 29.32</td><td>3.32 2.63</td><td>34.81 34.17</td><td>0.70 0.64</td></tr><tr><td colspan="7">Semi-supervised setting</td></tr><tr><td>Initialization UDA</td><td>IMDb (20)</td><td>Yelp-2 (20)</td><td>Yelp-5 (2.5k)</td><td>Amazon-2 (20)</td><td>Amazon-5 (2.5k)</td><td>DBpedia (140)</td></tr><tr><td>X Random</td><td>43.27 25.23</td><td>40.25 8.33</td><td>50.80 41.35</td><td>45.39 16.16</td><td>55.70 44.19</td><td>41.14 7.24</td></tr><tr><td>X BERTBASE</td><td>18.40 5.45</td><td>13.60 2.61</td><td>41.00 33.80</td><td>26.75 3.96</td><td>44.09 38.40</td><td>2.58 1.33</td></tr><tr><td>X BERTLARGE</td><td>11.72 4.78</td><td>10.55 2.50</td><td>38.90 33.54</td><td>15.54 3.93</td><td>42.30 37.80</td><td>1.68 1.09</td></tr><tr><td>BERTFINETUNE</td><td>X 6.50 4.20</td><td>2.94 2.05</td><td>32.39 32.08</td><td>12.17 3.50</td><td>37.32 37.12</td><td>- -</td></tr></table>
137
+
138
+ Table 4: Error rates on text classification datasets. In the fully supervised settings, the pre-BERT SOTAs include ULMFiT (Howard & Ruder, 2018) for Yelp-2 and Yelp-5, DPCNN (Johnson & Zhang, 2017) for Amazon-2 and Amazon-5, Mixed VAT (Sachan et al., 2018) for IMDb and DBPedia. All of our experiments use a sequence length of 512.
139
+
140
+ ![](images/731ae10a632f4f3d0e6c2394811c6a9f4a6ed503003af707fcf41fde324f664e.jpg)
141
+ Figure 5: Accuracy on IMDb and Yelp-2 with different number of labeled examples. In the largedata regime, with the full training set of IMDb, UDA also provides robust gains.
142
+
143
+ # 3.4 SCALABILITY TEST ON THE IMAGENET DATASET
144
+
145
+ Then, to evaluate whether UDA can scale to problems with a large scale and a higher difficulty, we now turn to the ImageNet dataset with ResNet-50 being the underlying architecture. Specifically, we consider two experiment settings with different natures:
146
+
147
+ • We use $10 \%$ of the supervised data of ImageNet while using all other data as unlabeled data. As a result, the unlabeled exmaples are entirely in-domain. • In the second setting, we keep all images in ImageNet as supervised data. Then, we use the domain-relevance data filtering method (See Appendix B for details) to filter out 1.3M images from an anonymous dataset. Hence, the unlabeled set is not necessarily in-domain.
148
+
149
+ The results are summarized in Table 5. In both $10 \%$ and the full data settings, UDA consistently brings significant gains compared to the supervised baseline. This shows UDA is not only able to scale but also able to utilize out-of-domain unlabeled examples to improve model performance. In parallel to our work, S4L (Zhai et al., 2019b) and CPC (Henaff et al., 2019) also show significant ´ improvements on ImageNet.
150
+
151
+ Table 5: Top- $^ { . 1 / }$ top-5 accuracy on ImageNet with $10 \%$ and $100 \%$ of the labeled set. We use image size 224 and 331 for the $10 \%$ and $100 \%$ experiments respectively.
152
+
153
+ <table><tr><td>Methods</td><td>SSL</td><td>10%</td><td>100%</td></tr><tr><td>ResNet-50</td><td>×</td><td>55.09 /77.26</td><td>77.28 /93.73</td></tr><tr><td> w. RandAugment</td><td></td><td>58.84 / 80.56</td><td>78.43 /94.37</td></tr><tr><td>UDA (RandAugment)|√</td><td></td><td>68.78 / 88.80</td><td>79.05 / 94.49</td></tr></table>
154
+
155
+ # 3.5 ABLATION STUDIES FOR TSA
156
+
157
+ Lastly, we study the effect of TSA on two tasks with different amounts of unlabeled data: (a) Yelp-5 where we have only $2 . 5 \mathrm { k }$ labeled examples and $6 \mathrm { m }$ unlabeled examples. (b) CIFAR-10 where we have 4k labeled examples and $5 0 \mathrm { k }$ unlabeled examples. For Yelp-5, we use a randomly initialized transformer in this study to rule out factors of having a pre-trained representation.
158
+
159
+ As shown in Table 6, on Yelp-5, where there is a lot more unlabeled data than labeled data, TSA reduces the error rate from 50.81 to 41.35 when compared to the baseline without TSA. More specifically, the best performance is achieved when we choose to postpone releasing the supervised training signal to the end of the training, i.e, exp-schedule leads to the best performance. On the other hand, linear-schedule is the sweet spot on CIFAR-10 in terms of the speed of releasing supervised training signals, where the amount of unlabeled data is comparable to that of supervised data.
160
+
161
+ Table 6: Ablation study for Training Signal Annealing (TSA) on Yelp-5 and CIFAR-10. The shown numbers are error rates.
162
+
163
+ <table><tr><td>TSA schedule</td><td>Yelp-5</td><td>CIFAR-10</td></tr><tr><td>X</td><td>50.81</td><td>5.67</td></tr><tr><td>log-schedule</td><td>49.06</td><td>5.67</td></tr><tr><td>linear-schedule</td><td>45.41</td><td>5.29</td></tr><tr><td>exp-schedule</td><td>41.35</td><td>7.81</td></tr></table>
164
+
165
+ # 4 RELATED WORK
166
+
167
+ Existing works in consistency training does make use of data augmentation (Laine & Aila, 2016; Sajjadi et al., 2016); however, they only apply weak augmentation methods such as random translations and cropping. In parallel to our work, ICT (Verma et al., 2019) and MixMatch (Berthelot et al., 2019) also show improvements for semi-supervised learning. These methods employ mixup (Zhang et al., 2017) on top of simple augmentations such as flipping and cropping; instead, UDA emphasizes on the use of state-of-the-art data augmentations, leading to significantly better results on CIFAR-10 and SVHN. In addition, UDA is also applicable to language domain and can also scale well to more challenging vision datasets, such as ImageNet.
168
+
169
+ Other works in the consistency training family mostly differ in how the noise is defined: Pseudoensemble (Bachman et al., 2014) directly applies Gaussian noise and Dropout noise; VAT (Miyato et al., 2018; 2016) defines the noise by approximating the direction of change in the input space that the model is most sensitive to; Cross-view training (Clark et al., 2018) masks out part of the input data. Apart from enforcing consistency on the input examples and the hidden representations, another line of research enforces consistency on the model parameter space. Works in this category include Mean Teacher (Tarvainen & Valpola, 2017), fast-Stochastic Weight Averaging (Athiwaratkun et al., 2018) and Smooth Neighbors on Teacher Graphs (Luo et al., 2018). For a complete version of related work, see Appendix D.
170
+
171
+ # 5 CONCLUSION
172
+
173
+ In this paper, we show that data augmentation and semi-supervised learning are well connected: better data augmentation can lead to significantly better semi-supervised learning. Our method,
174
+
175
+ UDA, employs state-of-the-art data augmentation found in supervised learning to generate diverse and realistic noise and enforces the model to be consistent with respect to these noise. For text, UDA combines well with representation learning, e.g., BERT, and is very effective in low-data regime where state-of-the-art performance is achieved on IMDb with only 20 examples. For vision, UDA outperforms prior works by a clear margin and nearly matches the performance of the fully supervised models trained on the full labeled sets which are one order of magnitude larger. Lastly, UDA can effectively leverage out-of-domain unlabeled data and achieve improved performances on ImageNet where we have a large amount of supervised data. We hope that UDA will encourage future research to transfer advanced supervised augmentation to semi-supervised setting for different tasks.
176
+
177
+ # REFERENCES
178
+
179
+ Ben Athiwaratkun, Marc Finzi, Pavel Izmailov, and Andrew Gordon Wilson. There are many consistent explanations of unlabeled data: Why you should average. 2018.
180
+ Philip Bachman, Ouais Alsharif, and Doina Precup. Learning with pseudo-ensembles. In Advances in Neural Information Processing Systems, pp. 3365–3373, 2014.
181
+ David Berthelot, Nicholas Carlini, Ian Goodfellow, Nicolas Papernot, Avital Oliver, and Colin Raffel. Mixmatch: A holistic approach to semi-supervised learning. arXiv preprint arXiv:1905.02249, 2019.
182
+ Yair Carmon, Aditi Raghunathan, Ludwig Schmidt, Percy Liang, and John C Duchi. Unlabeled data improves adversarial robustness. arXiv preprint arXiv:1905.13736, 2019.
183
+ 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.
184
+ Kevin Clark, Minh-Thang Luong, Christopher D Manning, and Quoc V Le. Semi-supervised sequence modeling with cross-view training. arXiv preprint arXiv:1809.08370, 2018.
185
+ Ronan Collobert and Jason Weston. A unified architecture for natural language processing: Deep neural networks with multitask learning. In Proceedings of the 25th international conference on Machine learning, pp. 160–167. ACM, 2008.
186
+ Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation policies from data. arXiv preprint arXiv:1805.09501, 2018.
187
+ Andrew M Dai and Quoc V Le. Semi-supervised sequence learning. In Advances in neural information processing systems, pp. 3079–3087, 2015.
188
+ Zihang Dai, Zhilin Yang, Fan Yang, William W Cohen, and Ruslan R Salakhutdinov. Good semisupervised learning that requires a bad gan. In Advances in Neural Information Processing Systems, pp. 6510–6520, 2017.
189
+ 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.
190
+ 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.
191
+ Sergey Edunov, Myle Ott, Michael Auli, and David Grangier. Understanding back-translation at scale. arXiv preprint arXiv:1808.09381, 2018.
192
+ Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In Advances in neural information processing systems, pp. 529–536, 2005.
193
+ Awni Hannun, Carl Case, Jared Casper, Bryan Catanzaro, Greg Diamos, Erich Elsen, Ryan Prenger, Sanjeev Satheesh, Shubho Sengupta, Adam Coates, et al. Deep speech: Scaling up end-to-end speech recognition. arXiv preprint arXiv:1412.5567, 2014.
194
+
195
+ Ryuichiro Hataya and Hideki Nakayama. Unifying semi-supervised and robust learning by mixup. ICLR The 2nd Learning from Limited Labeled Data (LLD) Workshop, 2019.
196
+
197
+ 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.
198
+
199
+ Xuanli He, Gholamreza Haffari, and Mohammad Norouzi. Sequence to sequence mixture model for diverse machine translation. arXiv preprint arXiv:1810.07391, 2018.
200
+
201
+ Olivier J Henaff, Ali Razavi, Carl Doersch, SM Eslami, and Aaron van den Oord. Data-efficient ´ image recognition with contrastive predictive coding. arXiv preprint arXiv:1905.09272, 2019.
202
+
203
+ Alex Hernandez-Garc ´ ´ıa and Peter Konig. Data augmentation instead of explicit regularization. ¨ arXiv preprint arXiv:1806.03852, 2018.
204
+
205
+ Jeremy Howard and Sebastian Ruder. Universal language model fine-tuning for text classification. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 328–339, 2018.
206
+
207
+ Weihua Hu, Takeru Miyato, Seiya Tokui, Eiichi Matsumoto, and Masashi Sugiyama. Learning discrete representations via information maximizing self-augmented training. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1558–1567. JMLR. org, 2017.
208
+
209
+ Jacob Jackson and John Schulman. Semi-supervised learning by label gradient alignment. arXiv preprint arXiv:1902.02336, 2019.
210
+
211
+ Rie Johnson and Tong Zhang. Deep pyramid convolutional neural networks for text categorization. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 562–570, 2017.
212
+
213
+ Durk P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Advances in neural information processing systems, pp. 3581–3589, 2014.
214
+
215
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
216
+
217
+ Wouter Kool, Herke van Hoof, and Max Welling. Stochastic beams and where to find them: The gumbel-top-k trick for sampling sequences without replacement. arXiv preprint arXiv:1903.06059, 2019.
218
+
219
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
220
+
221
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
222
+
223
+ Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. arXiv preprint arXiv:1610.02242, 2016.
224
+
225
+ 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, volume 3, pp. 2, 2013.
226
+
227
+ Davis Liang, Zhiheng Huang, and Zachary C Lipton. Learning noise-invariant representations for robust speech recognition. In 2018 IEEE Spoken Language Technology Workshop (SLT), pp. 56–63. IEEE, 2018.
228
+
229
+ Yucen Luo, Jun Zhu, Mengxi Li, Yong Ren, and Bo Zhang. Smooth neighbors on teacher graphs for semi-supervised learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8896–8905, 2018.
230
+
231
+ Lars Maaløe, Casper Kaae Sønderby, Søren Kaae Sønderby, and Ole Winther. Auxiliary deep generative models. arXiv preprint arXiv:1602.05473, 2016.
232
+
233
+ Andrew L Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew Y Ng, and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th annual meeting of the association for computational linguistics: Human language technologies-volume 1, pp. 142–150. Association for Computational Linguistics, 2011.
234
+
235
+ Julian McAuley, Christopher Targett, Qinfeng Shi, and Anton Van Den Hengel. Image-based recommendations on styles and substitutes. In Proceedings of the 38th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 43–52. ACM, 2015.
236
+
237
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111–3119, 2013.
238
+
239
+ Takeru Miyato, Andrew M Dai, and Ian Goodfellow. Adversarial training methods for semisupervised text classification. arXiv preprint arXiv:1605.07725, 2016.
240
+
241
+ Takeru Miyato, Shin-ichi Maeda, Shin Ishii, and Masanori Koyama. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 2018.
242
+
243
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011.
244
+
245
+ Avital Oliver, Augustus Odena, Colin A Raffel, Ekin Dogus Cubuk, and Ian Goodfellow. Realistic evaluation of deep semi-supervised learning algorithms. In Advances in Neural Information Processing Systems, pp. 3235–3246, 2018.
246
+
247
+ Daniel S Park, William Chan, Yu Zhang, Chung-Cheng Chiu, Barret Zoph, Ekin D Cubuk, and Quoc V Le. Specaugment: A simple data augmentation method for automatic speech recognition. arXiv preprint arXiv:1904.08779, 2019.
248
+
249
+ Sungrae Park, JunKeon Park, Su-Jin Shin, and Il-Chul Moon. Adversarial dropout for supervised and semi-supervised learning. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
250
+
251
+ 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.
252
+
253
+ Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. arXiv preprint arXiv:1802.05365, 2018.
254
+
255
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. URL https://s3-us-west-2. amazonaws. com/openaiassets/research-covers/languageunsupervised/language understanding paper. pdf, 2018.
256
+
257
+ Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semisupervised learning with ladder networks. In Advances in neural information processing systems, pp. 3546–3554, 2015.
258
+
259
+ Devendra Singh Sachan, Manzil Zaheer, and Ruslan Salakhutdinov. Revisiting lstm networks for semi-supervised text classification via mixed objective function. 2018.
260
+
261
+ Mehdi Sajjadi, Mehran Javanmardi, and Tolga Tasdizen. Regularization with stochastic transformations and perturbations for deep semi-supervised learning. In Advances in Neural Information Processing Systems, pp. 1163–1171, 2016.
262
+
263
+ Julian Salazar, Davis Liang, Zhiheng Huang, and Zachary C Lipton. Invariant representation learning for robust deep networks. In Workshop on Integration of Deep Learning Theories, NeurIPS, 2018.
264
+
265
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in neural information processing systems, pp. 2234–2242, 2016.
266
+
267
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Improving neural machine translation models with monolingual data. arXiv preprint arXiv:1511.06709, 2015.
268
+
269
+ Tianxiao Shen, Myle Ott, Michael Auli, and Marc’Aurelio Ranzato. Mixture models for diverse machine translation: Tricks of the trade. arXiv preprint arXiv:1902.07816, 2019.
270
+
271
+ Patrice Y Simard, Yann A LeCun, John S Denker, and Bernard Victorri. Transformation invariance in pattern recognition—tangent distance and tangent propagation. In Neural networks: tricks of the trade, pp. 239–274. Springer, 1998.
272
+
273
+ Robert Stanforth, Alhussein Fawzi, Pushmeet Kohli, et al. Are labels required for improving adversarial robustness? arXiv preprint arXiv:1905.13725, 2019.
274
+
275
+ Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In Advances in neural information processing systems, pp. 1195–1204, 2017.
276
+
277
+ Trieu H Trinh, Minh-Thang Luong, and Quoc V Le. Selfie: Self-supervised pretraining for image embedding. arXiv preprint arXiv:1906.02940, 2019.
278
+
279
+ Vikas Verma, Alex Lamb, Juho Kannala, Yoshua Bengio, and David Lopez-Paz. Interpolation consistency training for semi-supervised learning. arXiv preprint arXiv:1903.03825, 2019.
280
+
281
+ Xinyi Wang, Hieu Pham, Zihang Dai, and Graham Neubig. Switchout: an efficient data augmentation algorithm for neural machine translation. arXiv preprint arXiv:1808.07512, 2018.
282
+
283
+ Jason Weston, Fred´ eric Ratle, Hossein Mobahi, and Ronan Collobert. Deep learning via semi- ´ supervised embedding. In Neural Networks: Tricks of the Trade, pp. 639–655. Springer, 2012.
284
+
285
+ Zhilin Yang, William W Cohen, and Ruslan Salakhutdinov. Revisiting semi-supervised learning with graph embeddings. arXiv preprint arXiv:1603.08861, 2016.
286
+
287
+ Zhilin Yang, Junjie Hu, Ruslan Salakhutdinov, and William W Cohen. Semi-supervised qa with generative domain-adaptive nets. arXiv preprint arXiv:1702.02206, 2017.
288
+
289
+ 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, pp. 6210–6219, 2019.
290
+
291
+ Adams Wei Yu, David Dohan, Minh-Thang Luong, Rui Zhao, Kai Chen, Mohammad Norouzi, and Quoc V Le. Qanet: Combining local convolution with global self-attention for reading comprehension. arXiv preprint arXiv:1804.09541, 2018.
292
+
293
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
294
+
295
+ Runtian Zhai, Tianle Cai, Di He, Chen Dan, Kun He, John Hopcroft, and Liwei Wang. Adversarially robust generalization just requires more unlabeled data. arXiv preprint arXiv:1906.00555, 2019a.
296
+
297
+ Xiaohua Zhai, Avital Oliver, Alexander Kolesnikov, and Lucas Beyer. $\mathrm { S ^ { 4 } l }$ : Self-supervised semisupervised learning. arXiv preprint arXiv:1905.03670, 2019b.
298
+
299
+ Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
300
+
301
+ Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In Advances in neural information processing systems, pp. 649–657, 2015.
302
+
303
+ Xiaojin Zhu, Zoubin Ghahramani, and John D Lafferty. Semi-supervised learning using gaussian fields and harmonic functions. In Proceedings of the 20th International conference on Machine learning (ICML-03), pp. 912–919, 2003.
304
+
305
+ # A MORE EXPERIMENTS
306
+
307
+ A.1 ABLATIONS STUDIES ON RANDAUGMENT
308
+
309
+ We hypothesize that the success of RandAugment should be credited to the diversity of the augmentation transformations, since RandAugment works very well for multiple different datasets while does not require a search algorithm to find out the most effective policies. To verify this hypothesis, we test UDA’s performance when we restrict the number of possible transformations used in RandAugment. As shown in Figure 6, the performance gradually improves as we use more augmentation transformations.
310
+
311
+ ![](images/376a93ef160eb5d0c57caf29b3b056eb5656528130872dbb9e9309f4bd847d3a.jpg)
312
+ Figure 6: Error rate of UDA on CIFAR-10 with different numbers of possible transformations in RandAugment. UDA achieves lower error rate when we increase the number of possible transformations, which demonstrates the importance of a rich set of augmentation transformations.
313
+
314
+ # A.2 RESULTS ON CIFAR-10 AND SVHN WITH VARIED LABEL SET SIZES
315
+
316
+ CIFAR-10 In Table 7, we show results for compared methods of Figure 4a and results of PseudoLabel (Lee, 2013), Π-Model (Laine & Aila, 2016), Mean Teacher (Tarvainen & Valpola, 2017). Fully supervised learning using 50,000 examples achieves an error rate of 5.36 and 4.23 with or without RandAugment. The performance of the baseline models are reported by MixMatch (Berthelot et al., 2019).
317
+
318
+ To make sure that the performance reported by MixMatch and our results are comparable, we reimplement MixMatch in our codebase and find that the results in the original paper is comparable but slightly higher than our reimplementation, which results in a more competitive comparison for UDA. For example, our reimplementation of MixMatch achieves an error rate of $7 . 0 0 \pm 0 . 5 9$ and $7 . 3 9 \pm 0 . 1 1$ with 4,000 and 2,000 examples. MixMatch uses a different model implementation and employs exponential moving average (EMA) on the model parameters, while we do not use EMA for our implementations.
319
+
320
+ Table 7: Error rate $( \% )$ for CIFAR-10.
321
+
322
+ <table><tr><td>Methods /# Sup</td><td>250</td><td>500</td><td>1,000</td><td>2,000</td><td>4,000</td></tr><tr><td>Pseudo-Label</td><td>49.98 ± 1.17</td><td>40.55 ± 1.70</td><td>30.91 ± 1.73</td><td>21.96 ± 0.42</td><td>16.21 ± 0.11</td></tr><tr><td>II-Model</td><td>53.02 ± 2.05</td><td>41.82 ± 1.52</td><td>31.53 ± 0.98</td><td>23.07 ± 0.66</td><td>17.41 ± 0.37</td></tr><tr><td>Mean Teacher</td><td>47.32 ± 4.71</td><td>42.01 ± 5.86</td><td>17.32 ± 4.00</td><td>12.17 ± 0.22</td><td>10.36 ± 0.25</td></tr><tr><td>VAT</td><td>36.03 ± 2.82</td><td>26.11 ± 1.52</td><td>18.68 ± 0.40</td><td>14.40 ± 0.15</td><td>11.05 ± 0.31</td></tr><tr><td>MixMatch</td><td>11.08 ± 0.87</td><td>9.65 ± 0.94</td><td>7.75 ± 0.32</td><td>7.03 ± 0.15</td><td>6.24 ± 0.06</td></tr><tr><td>UDA (RandAugment)</td><td>8.76 ± 0.90</td><td>6.68 ± 0.24</td><td>5.87 ± 0.13</td><td>5.51 ± 0.21</td><td>5.29 ± 0.25</td></tr></table>
323
+
324
+ SVHN In Table 8, we similarly show results for compared methods of Figure 4b and results of methods mentioned above. Fully supervised learning using 73,257 examples achieves an error rate of 2.84 and 2.28 with or without RandAugment. The performance of the baseline models are reported by MixMatch (Berthelot et al., 2019). Our reimplementation of MixMatch also resulted in comparable but higher error rates than the reported ones.
325
+
326
+ <table><tr><td>Methods /# Sup</td><td>250</td><td>500</td><td>1,000</td><td>2,000</td><td>4,000</td></tr><tr><td>Pseudo-Label</td><td>21.16 ± 0.88</td><td>14.35 ± 0.37</td><td>10.19 ± 0.41</td><td>7.54 ± 0.27</td><td>5.71 ± 0.07</td></tr><tr><td>II-Model</td><td>17.65 ± 0.27</td><td>11.44 ± 0.39</td><td>8.60 ± 0.18</td><td>6.94 ± 0.27</td><td>5.57 ± 0.14</td></tr><tr><td>Mean Teacher</td><td>6.45 ± 2.43</td><td>3.82 ± 0.17</td><td>3.75 ± 0.10</td><td>3.51 ± 0.09</td><td>3.39 ± 0.11</td></tr><tr><td>VAT</td><td>8.41 ± 1.01</td><td>7.44 ± 0.79</td><td>5.98 ± 0.21</td><td>4.85 ± 0.23</td><td>4.20 ± 0.15</td></tr><tr><td>MixMatch</td><td>3.78 ± 0.26</td><td>3.64 ± 0.46</td><td>3.27 ± 0.31</td><td>3.04 ± 0.13</td><td>2.89 ± 0.06</td></tr><tr><td>UDA (RandAugment)</td><td>2.76 ± 0.17</td><td>2.70 ± 0.09</td><td>2.55 ± 0.09</td><td>2.57 ± 0.09</td><td>2.47 ± 0.15</td></tr></table>
327
+
328
+ Table 8: Error rate $( \% )$ for SVHN.
329
+
330
+ # B ADDITIONAL TRAINING TECHNIQUES
331
+
332
+ While UDA generally works well, there are several practical issues in consistency training that may dampen the performance gain if not carefully dealt with. This section presents additional techniques targeting at some commonly encountered problems.
333
+
334
+ Sharpening Predictions. Entropy minimization (Grandvalet & Bengio, 2005) has been shown to be effective in semi-supervised learning methods such as VAT (Miyato et al., 2018). To apply entropy minimization in our method, we simply add a loss term to the objective to regularize the predicted distributions on unlabeled examples to have a low entropy. Alternatively, when the number of labeled examples are extremely small, we find it helpful to mask out examples that the current model is not confident about and use a low Softmax temperature when computing the target distribution on unlabeled examples. Specifically, in each minibatch, the consistency loss term is computed only on examples whose highest probability among classification categories is greater than a threshold.
335
+
336
+ Domain-relevance Data Filtering. Ideally, we would like to make use of out-of-domain unlabeled data since it is usually much easier to collect, but the class distributions of out-of-domain data are mismatched with those of in-domain data, which can result in performance loss if directly used (Oliver et al., 2018). To obtain data relevant to the domain for the task at hand, we adopt a common technique for detecting out-of-domain data. We use our baseline model trained on the in-domain data to infer the labels of data in a large out-of-domain dataset and pick out examples that the model is most confident about. Specifically, for each category, we sort all examples based on the classified probabilities of being in that category and select the examples with the highest probabilities.
337
+
338
+ # C EXTENDED AUGMENTATION STRATEGIES FOR DIFFERENT TASKS
339
+
340
+ Discussion on Trade-off Between Diversity and Validity for Data Augmentation. Despite that state-of-the-art data augmentation methods can generate diverse and valid augmented examples as discussed in section 2.2, there is a trade-off between diversity and validity since diversity is achieved by changing a part of the original example, naturally leading to the risk of altering the ground-truth label. We find it beneficial to tune the trade-off between diversity and validity for data augmentation methods. For text classification, we tune the temperature of random sampling. On the one hand, when we use a temperature of 0, decoding by random sampling degenerates into greedy decoding and generates perfectly valid but identical paraphrases. On the other hand, when we use a temperature of 1, random sampling generates very diverse but barely readable paraphrases. We find that setting the Softmax temperature to 0.7, 0.8 or 0.9 leads to the best performances.
341
+
342
+ RandAugment Details. In our implementation of RandAugment, each sub-policy is composed of two operations, where each operation is represented by the transformation name, probability, and magnitude that is specific to that operation. For example, a sub-policy can be [(Sharpness, 0.6, 2), (Posterize, 0.3, 9)].
343
+
344
+ For each operation, we randomly sample a transformation from 15 possible transformations, a magnitude in [1, 10) and fix the probability to 0.5. Specifically, we sample from the following 15 transformations: Invert, Cutout, Sharpness, AutoContrast, Posterize, ShearX, TranslateX, TranslateY, ShearY, Rotate, Equalize, Contrast, Color, Solarize, Brightness. We find this setting to work well in our first try and did not tune the magnitude range and the probability. Tuning these hyperparameters might result in further gains in accuracy.
345
+
346
+ TF-IDF based word replacing Details. We describe the TF-IDF based word replacing data augmentation method in this section. Ideally, we would like the augmentation method to generate both diverse and valid examples. Hence, the augmentation is designed to retain keywords and replace uninformative words with other uninformative words. We use BERT’s word tokenizer since BERT first tokenizes sentences into a sequence of words and then tokenize words into subwords although the model uses subwords as input.
347
+
348
+ Specifically, Suppose $\mathrm { I D F } ( w )$ is the IDF score for word $w$ computed on the whole corpus, and $\mathrm { T F } ( w )$ is the TF score for word $w$ in a sentence. We compute the TF-IDF score as $\mathrm { T F I D \bar { F } } ( w ) =$ $\mathrm { T F } ( w ) \mathrm { I D F } ( w )$ . Suppose the maximum TF-IDF score in a sentence $x$ is $C = \mathrm { m a x } _ { i } \mathrm { T F I D F } ( x _ { i } )$ . To make the probability of having a word replaced to negatively correlate with its TF-IDF score, we set the probability to $\mathrm { \dot { m i n } } ( p ( C - \mathrm { T F I D F } ( \bar { x _ { i } } ) ) / Z , 1 )$ , where $p$ is a hyperparameter that controls the magnitude of the augmentation and $\begin{array} { r } { Z = \sum _ { i } ( C - \mathrm { T F I D F } ( x _ { i } ) ) / | x | } \end{array}$ is the average score. $p$ is set to 0.7 for experiments on DBPedia.
349
+
350
+ When a word is replaced, we sample another word from the whole vocabulary for the replacement. Intuitively, the sampled words should not be keywords to prevent changing the ground-truth labels of the sentence. To measure if a word is keyword, we compute a score of each word on the whole corpus. Specifically, we compute the score as $S ( w ) = \mathrm { f r e q } ( w ) \mathrm { I D F } ( w )$ where $\operatorname { f r e q } ( w )$ is the frequency of word $w$ on the whole corpus. We set the probability of sampling word $w$ as $( \operatorname* { m a x } _ { w ^ { \prime } } \bar { S ( w ^ { \prime } ) } - \bar { S ( w ) } ) / Z ^ { \prime }$ where $\begin{array} { r } { Z ^ { \prime } = \sum _ { w } \operatorname* { i n a x } _ { w ^ { \prime } } S ( w ^ { \prime } ) - \bar { S ( w ) } } \end{array}$ is a normalization term.
351
+
352
+ # D EXTENDED RELATED WORK
353
+
354
+ Semi-supervised Learning. Due to the long history of semi-supervised learning (SSL), we refer readers to (Chapelle et al., 2009) for a general review. More recently, many efforts have been made to renovate classic ideas into deep neural instantiations. For example, graph-based label propagation (Zhu et al., 2003) has been extended to neural methods via graph embeddings (Weston et al., 2012; Yang et al., 2016) and later graph convolutions (Kipf & Welling, 2016). Similarly, with the variational auto-encoding framework and reinforce algorithm, classic graphical models based SSL methods with target variable being latent can also take advantage of deep architectures (Kingma et al., 2014; Maaløe et al., 2016; Yang et al., 2017). Besides the direct extensions, it was found that training neural classifiers to classify out-of-domain examples into an additional class (Salimans et al., 2016) works very well in practice. Later, Dai et al. (2017) shows that this can be seen as an instantiation of low-density separation.
355
+
356
+ Apart from enforcing consistency on the noised input examples and the hidden representations, another line of research enforces consistency under different model parameters, which is complementary to our method. For example, Mean Teacher (Tarvainen & Valpola, 2017) maintains a teacher model with parameters being the ensemble of a student model’s parameters and enforces the consistency between the predictions of the two models. Recently, Athiwaratkun et al. (2018) propose fast-SWA that improves Mean Teacher by encouraging the model to explore a diverse set of plausible parameters. In addition to parameter-level consistency, SNTG (Luo et al., 2018) also enforces input-level consistency by constructing a similarity graph between unlabeled examples.
357
+
358
+ Data Augmentation. Also related to our work is the field of data augmentation research. Besides the conventional approaches and two data augmentation methods mentioned in Section 2.1, a recent approach MixUp (Zhang et al., 2017) goes beyond data augmentation from a single data point and performs interpolation of data pairs to achieve augmentation. Recently, Hernandez-Garc ´ ´ıa & Konig (2018) have shown that data augmentation can be regarded as a kind of explicit regularization ¨ methods similar to Dropout.
359
+
360
+ Diverse Back Translation. Diverse paraphrases generated by back-translation has been a key component in the significant performance improvements in our text classification experiments. We use random sampling instead of beam search for decoding similar to the work by Edunov et al. (2018). There are also recent works on generating diverse translations (He et al., 2018; Shen et al., 2019; Kool et al., 2019) that might lead to further improvements when used as data augmentations.
361
+
362
+ Unsupervised Representation Learning. Apart from semi-supervised learning, unsupervised representation learning offers another way to utilize unsupervised data. Collobert & Weston (2008) demonstrated that word embeddings learned by language modeling can improve the performance significantly on semantic role labeling. Later, the pre-training of word embeddings was simplified and substantially scaled in Word2Vec (Mikolov et al., 2013) and Glove (Pennington et al., 2014). More recently, Dai & Le (2015); Peters et al. (2018); Radford et al. (2018); Howard & Ruder (2018); Devlin et al. (2018) have shown that pre-training using language modeling and denoising auto-encoding leads to significant improvements on many tasks in the language domain. There is also a growing interest in self-supervised learning for vision (Zhai et al., 2019b; Henaff et al., 2019; ´ Trinh et al., 2019).
363
+
364
+ Consistency Training in Other Domains. Similar ideas of consistency training has also been applied in other domains. For example, recently, enforcing adversarial consistency on unsupervised data has also been shown to be helpful in adversarial robustness (Stanforth et al., 2019; Zhai et al., 2019a; Carmon et al., 2019). Enforcing consistency w.r.t data augmentation has also been shown to work well for representation learning (Hu et al., 2017; Ye et al., 2019). Invariant representation learning (Liang et al., 2018; Salazar et al., 2018) applies the consistency loss not only to the predicted distributions but also to representations and has been shown significant improvements on speech recognition.
365
+
366
+ # E EXPERIMENT DETAILS
367
+
368
+ In this section, we provide experiment details for the performed experiments.
369
+
370
+ # E.1 TEXT CLASSIFICATIONS
371
+
372
+ Datasets. In our semi-supervised setting, we randomly sampled labeled examples from the full supervised set5 and use the same number of examples for each category. For unlabeled data, we use the whole training set for DBPedia, the concatenation of the training set and the unlabeled set for IMDb and external data for Yelp-2, Yelp-5, Amazon-2 and Amazon-5 (McAuley et al., 2015)6. Note that for Yelp and Amazon based datasets, the label distribution of the unlabeled set might not match with that of labeled datasets since there are different number of examples in different categories. Nevertheless, we find it works well to use all the unlabeled data.
373
+
374
+ Preprocessing. We find the sequence length to be an important factor in achieving good performance. For all text classification datasets, we truncate the input to 512 subwords since BERT is pretrained with a maximum sequence length of 512. Further, when the length of an example is greater than 512, we keep the last 512 subwords instead of the first 512 subwords as keeping the latter part of the sentence lead to better performances on IMDb.
375
+
376
+ Fine-tuning BERT on in-domain unsupervised data. We fine-tune the BERT model on in-domain unsupervised data using the code released by BERT. We try learning rate of 2e-5, 5e-5 and 1e-4, batch size of 32, 64 and 128 and number of training steps of $3 0 \mathrm { k }$ , $1 0 0 \mathrm { k }$ and $3 0 0 \mathrm { k }$ . We pick the fine-tuned models by the BERT loss on a held-out set instead of the performance on a downstream task.
377
+
378
+ Random initialized Transformer. For the experiments with randomly initialized Transformer, we adopt hyperparameters for BERT base except that we only use 6 hidden layers and 8 attention heads. We also increase the dropout rate on the attention and the hidden states to 0.2, When we train UDA with randomly initialized architectures, we train UDA for $5 0 0 \mathrm { k }$ or 1M steps on Amazon-5 and Yelp5 where we have abundant unlabeled data.
379
+
380
+ BERT hyperparameters. Following the common BERT fine-tuning procedure, we keep a dropout rate of 0.1, and try learning rate of 1e-5, 2e-5 and 5e-5 and batch size of 32 and 128. We also tune the number of steps ranging from 30 to $1 0 0 \mathrm { k }$ for various data sizes.
381
+
382
+ UDA hyperparameters. We set the weight on the unsupervised objective $\lambda$ to 1 in all of our experiments. We use a batch size of 32 for the supervised objective since 32 is the smallest batch size on v3-32 Cloud TPU Pod. We use a batch size of 224 for the unsupervised objective when the Transformer is initialized with BERT so that the model can be trained on more unlabeled data. We find that generating one augmented example for each unlabeled example is enough for BERTFINETUNE.
383
+
384
+ All experiments in this part are performed on a v3-32 Cloud TPU Pod.
385
+
386
+ # E.2 SEMI-SUPERVISED LEARNING BENCHMARKS CIFAR-10 AND SVHN
387
+
388
+ Hyperparameters for Wide-ResNet-28-2. For hyperparameter tuning, for simplicity, we performed a random sampling search over hyperparameters and choose the best one based on validation sets ( $20 \%$ of the training sets with different sizes). We use the averaged results of multiple experiments to reduce the performance variance measured on the small validation sets. Specifically, we tried the following ranges:
389
+
390
+ • training steps: 50k, 100k;
391
+ • learning rate: 0.03, 0.05, 0.1;
392
+ • TSA schedules: log-schedule, linear-schedule, exp-schedule, not using TSA; entropy minimization loss weight: 0, 0.1, 0.3; consistency loss weight: 1, 3, 6; unlabeled data batch size: 960, 1280;
393
+ • weight decay rate: 5e-4, 7e-4, 1e-3;
394
+ • softmax temperature: 1, 0.9;
395
+ • confidence threshold: 0, 0.8.
396
+
397
+ where the values in bold black text are our default hyperparameters. We found that given a reasonably large labeled set, our method is robust to hyper-parameters. Therefore, we use the same hyper-parameters in these cases. Specifically, we use the above default hyperparameters for CIFAR10 with 4,000, 2,000, 1,000 and 500 examples. For SVHN with 4,000, 2,000, 1,000, 500, 250 examples, we additionally set the learning rate to 0.05 and unlabeled batch size to 1280. For the case of 250 examples on CIFAR-10, we use a different set of hyper-parameters: training steps: 50k; TSA schedule: log-schedule; consistency loss coefficient: 6; weight decay: 7e-4; unlabeled data batch size: 1280; softmax temperature: 0.9; consistency threshold: 0.8.
398
+
399
+ Other hyperparameters not mentioned above are the same to the the original paper of WideResNet (Zagoruyko & Komodakis, 2016). In order to reduce training time, we generate augmented examples before training and dump them to disk. For CIFAR-10, we generate 100 augmented examples for each unlabeled example. Note that generating augmented examples in an online fashion is always better or as good as using dumped augmented examples since the model can see different augmented examples in different epochs, leading to more diverse samples. We report the average performance and the standard deviation for 10 runs.
400
+
401
+ Hyperparameters for Shake-Shake and PyramidNet. For the experiments with Shake-Shake, we train UDA for 300k steps and use a batch size of 128 for the supervised objective and use a batch size of 512 for the unsuperivsed objective. For the experiments with PyramidNet+ShakeDrop, we train UDA for $7 0 0 \mathrm { k }$ steps and use a batch size of 64 for the supervised objective and a batch size of 128 for the unsupervised objective. For both models, we use a learning rate of 0.03 and use a cosine learning decay with one annealing cycle following AutoAugment.
402
+
403
+ All experiments in this part are performed on a v3-32 Cloud TPU v3 Pod.
404
+
405
+ # E.3 IMAGENET
406
+
407
+ $10 \%$ Labeled Set Setting. Unless otherwise stated, we follow the standard hyperparameters used in an open-source implementation of ResNet.7 For the $10 \%$ labeled set setting, we use a batch size of 512 for the supervised objective and a batch size of 15,360 for the unsupervised objective. We use a base learning rate of 0.3 that is decayed by 10 for four times and set the weight on the unsupervised objective $\lambda$ to 20. We mask out unlabeled examples whose highest probabilities across categories are less than 0.5 and set the Softmax temperature to 0.4. The model is trained for 40k steps. Experiments in this part are performed on a v3-64 Cloud TPU v3 Pod.
408
+
409
+ Full Labeled Set Setting. For experiments on the full ImageNet, we use a batch size of 8,192 for the supervised objective and a batch size of 16,384 for the unsupervised objective. The weight on the unsupervised objective $\lambda$ is set to 1. We use entropy minimization to sharpen the prediction. We use a base learning rate of 1.6 and decay it by 10 for four times. Experiments in this part are performed on a v3-128 Cloud TPU v3 Pod.
md/train/HJKkY35le/HJKkY35le.md ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MODE REGULARIZED GENERATIVE ADVERSARIAL NETWORKS
2
+
3
+ †Tong Che∗, ‡Yanran Li∗, †,§Athul Paul Jacob, †Yoshua Bengio, ‡Wenjie Li
4
+ †Montreal Institute for Learning Algorithms, Universite de Montr ´ eal, Montr ´ eal, QC H3T 1J4, Canada ´
5
+ ‡Department of Computing, The Hong Kong Polytechnic University, Hong Kong
6
+ §David R. Cheriton School of Computer Science, University Of Waterloo, Waterloo, ON N2L 3G1, Canada
7
+ {tong.che,ap.jacob,yoshua.bengio}@umontreal.ca
8
+ {csyli,cswjli}@comp.polyu.edu.hk
9
+
10
+ # ABSTRACT
11
+
12
+ Although Generative Adversarial Networks achieve state-of-the-art results on a variety of generative tasks, they are regarded as highly unstable and prone to miss modes. We argue that these bad behaviors of GANs are due to the very particular functional shape of the trained discriminators in high dimensional spaces, which can easily make training stuck or push probability mass in the wrong direction, towards that of higher concentration than that of the data generating distribution. We introduce several ways of regularizing the objective, which can dramatically stabilize the training of GAN models. We also show that our regularizers can help the fair distribution of probability mass across the modes of the data generating distribution, during the early phases of training and thus providing a unified solution to the missing modes problem.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Generative adversarial networks (GAN) (Goodfellow et al., 2014) have demonstrated their potential on various tasks, such as image generation, image super-resolution, 3D object generation, and video prediction (Radford et al., 2015; Ledig et al., 2016; Sønderby et al., 2016; Nguyen et al., 2016; Wu et al., 2016; Mathieu et al., 2015). The objective is to train a parametrized function (the generator) which maps noise samples (e.g., uniform or Gaussian) to samples whose distribution is close to that of the data generating distribution. The basic scheme of the GAN training procedure is to train a discriminator which assigns higher probabilities to real data samples and lower probabilities to generated data samples, while simultaneously trying to move the generated samples towards the real data manifold using the gradient information provided by the discriminator. In a typical setting, the generator and the discriminator are represented by deep neural networks.
17
+
18
+ Despite their success, GANs are generally considered as very hard to train due to training instability and sensitivity to hyper-parameters. On the other hand, a common failure pattern observed while training GANs is the collapsing of large volumes of probability mass onto a few modes. Namely, although the generators produce meaningful samples, these samples are often from just a few modes (small regions of high probability under the data distribution). Behind this phenomenon is the missing modes problem, which is widely conceived as a major problem for training GANs: many modes of the data generating distribution are not at all represented in the generated samples, yielding a much lower entropy distribution, with less variety than the data generating distribution.
19
+
20
+ This issue has been the subject of several recent papers proposing several tricks and new architectures to stabilize GAN’s training and encourage its samples’ diversity. However, we argue that a general cause behind these problems is the lack of control on the discriminator during GAN training. We would like to encourage the manifold of the samples produced by the generator to move towards that of real data, using the discriminator as a metric. However, even if we train the discriminator to distinguish between these two manifolds, we have no control over the shape of the discriminator function in between these manifolds. In fact, the shape of the discriminator function in the data space can be very non-linear with bad plateaus and wrong maxima and this can therefore hurt the training of GANs (Figure 1).
21
+
22
+ ![](images/369f34d05cb3594aa3e375375091c128e3752c2e993fd9075254cddcb9f00c0b.jpg)
23
+ Figure 1: Samples with very high discrimination values $\mathrm { ( D = } 1 . 0$ ) in DCGAN model trained on CelebA dataset.
24
+
25
+ To remedy this problem, we propose a novel regularizer for the GAN training target. The basic idea is simple yet powerful: in addition to the gradient information provided by the discriminator, we want the generator to take advantage of other similarity metrics with much more predictable behavior, such as the $L _ { 2 }$ norm. Differentiating these similarity metrics will provide us with more stable gradients to train our generator. Combining this idea with an approach meant to penalize the missing modes, we propose a family of additional regularizers for the GAN objective. We then design a set of metrics to evaluate the generated samples in terms of both the diversity of modes and the distribution fairness of the probability mass. These metrics are shown to be more robust in judging complex generative models, including those which are well-trained and collapsed ones.
26
+
27
+ Regularizers usually bring a trade-off between model variance and bias. Our results have shown that, when correctly applied, our regularizers can dramatically reduce model variance, stabilize the training, and fix the missing mode problem all at once, with positive or at the least no negative effects on the generated samples. We also discuss a variant of the regularized GAN algorithm, which can even improve sample quality as compared to the DCGAN baseline.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ The GAN approach was initially proposed by Goodfellow et al. (2014) where both the generator and the discriminator are defined by deep neural networks.
32
+
33
+ In Goodfellow et al. (2014), the GAN is able to generate interesting local structure but globally incoherent images on various datasets. Mirza & Osindero (2014) enlarges GAN’s representation capacity by introducing an extra vector to allow the generator to produce samples conditioned on other beneficial information. Motivated from this, several conditional variants of GAN has been applied to a wide range of tasks, including image prediction from a normal map Wang & Gupta (2016), image synthesis from text Reed et al. (2016) and edge map Isola et al. (2016), real-time image manipulation Zhu et al. (2016), temporal image generation Zhou & Berg (2016); Saito & Matsumoto (2016); Vondrick et al. (2016), texture synthesis, style transfer, and video stylization Li & Wand (2016).
34
+
35
+ Researchers also aim at stretching GAN’s limit to generate higher-resolution, photo-realistic images. Denton et al. (2015) initially apply a Laplacian pyramid framework on GAN to generate images of high resolution. At each level of their LAPGAN, both the generator and the discriminator are convolutional networks. As an alternative to LAPGAN, Radford et al. (2015) successfully designs a class of deep convolutional generative adversarial networks which has led to significant improvements on unsupervised image representation learning. Another line of work aimed at improving GANs are through feature learning, including features from the latent space and image space. The motivation is that features from different spaces are complementary for generating perceptual and natural-looking images. With this perspective, some researchers use distances between learned features as losses for training objectives for generative models. Larsen et al. (2015) combine a variational autoencoder objective with a GAN and utilize the learned features from the discriminator in the GANs for better image similarity metrics. It is shown that the learned distance from the discriminator is of great help for the sample visual fidelity. Recent literature have also shown impressive results on image super-resolution to infer photo-realistic natural images for $4 \mathbf { x }$ upscaling factors Ledig et al. (2016); Sønderby et al. (2016); Nguyen et al. (2016).
36
+
37
+ Despite these promising successes, GANs are notably hard to train. Although Radford et al. (2015) provide a class of empirical architectural choices that are critical to stabilize GAN’s training, it would be even better to train GANs more robustly and systematically. Salimans et al. (2016) propose feature matching technique to stabilize GAN’s training. The generator is required to match the statistics of intermediate features of the discriminator. Similar idea is adopted by Zhao et al. (2016).
38
+
39
+ In addition to feature distances, Dosovitskiy & Brox (2016) found that the counterpart loss in image space further improves GAN’s training stability. Furthermore, some researchers make use of information in both spaces in a unified learning procedure (Dumoulin et al., 2016; Donahue et al., 2016). In Dumoulin et al. (2016), one trains not just a generator but also an encoder, and the discriminator is trained to distinguish between two joint distributions over image and latent spaces produced either by the application of the encoder on the training data or by the application of the generator (decoder) to the latent prior. This is in contrast with the regular GAN training, in which the discriminator only attempts to separate the distributions in the image space. Parallelly, Metz et al. (2016) stabilize GANs by unrolling the optimization of discriminator, which can be considered as an orthogonal work with ours.
40
+
41
+ Our work is related to VAEGAN (Larsen et al., 2015) in terms of training an autoencoder or VAE jointly with the GAN model. However, the variational autoencoder (VAE) in VAEGAN is used to generate samples whereas our autoencoder based losses serves as a regularizer to penalize missing modes and thus improving GAN’s training stability and sample qualities. We demonstrate detailed differences from various aspects in Appendix D.
42
+
43
+ # 3 MODE REGULARIZERS FOR GANS
44
+
45
+ The GAN training procedure can be viewed as a non-cooperative two player game, in which the discriminator $D$ tries to distinguish real and generated examples, while the generator $G$ tries to fool the discriminator by pushing the generated samples towards the direction of higher discrimination values. Training the discriminator $D$ can be viewed as training an evaluation metric on the sample space. Then the generator $G$ has to take advantage of the local gradient $\nabla \log D ( G )$ provided by the discriminator to improve itself, namely to move towards the data manifold.
46
+
47
+ We now take a closer look at the root cause of the instabilities while training GANs. The discriminator is trained on both generated and real examples. As pointed out by Goodfellow et al. (2014); Denton et al. (2015); Radford et al. (2015), when the data manifold and the generation manifold are disjoint (which is true in almost all practical situations), it is equivalent to training a characteristic function to be very close to 1 on the data manifold, and 0 on the generation manifold. In order to pass good gradient information to the generator, it is important that the trained discriminator produces stable and smooth gradients. However, since the discriminator objective does not directly depend on the behavior of the discriminator in other parts of the space, training can easily fail if the shape of the discriminator function is not as expected. As an example,Denton et al. (2015) noted a common failure pattern for training GANs which is the vanishing gradient problem, in which the discriminator $D$ perfectly classifies real and fake examples, such that around the fake examples, $D$ is nearly zero. In such cases, the generator will receive no gradient to improve itself.1
48
+
49
+ Another important problem while training GANs is mode missing. In theory, if the generated data and the real data come from the same low dimensional manifold, the discriminator can help the generator distribute its probability mass, because the missing modes will not have near-0 probability under the generator and so the samples in these areas can be appropriately concentrated towards regions where $D$ is closer to 1. However, in practice since the two manifolds are disjoint, $D$ tends to be near 1 on all the real data samples, so large modes usually have a much higher chance of attracting the gradient of discriminator. For a typical GAN model, since all modes have similar $D$ values, there is no reason why the generator cannot collapse to just a few major modes. In other words, since the discriminator’s output is nearly 0 and 1 on fake and real data respectively, the generator is not penalized for missing modes.
50
+
51
+ # 3.1 GEOMETRIC METRICS REGULARIZER
52
+
53
+ Compared with the objective for the GAN generator, the optimization targets for supervised learning are more stable from an optimization point of view. The difference is clear: the optimization target for the GAN generator is a learned discriminator. While in supervised models, the optimization targets are distance functions with nice geometric properties. The latter usually provides much easier training gradients than the former, especially at the early stages of training.
54
+
55
+ Inspired by this observation, we propose to incorporate a supervised training signal as a regularizer on top of the discriminator target. Assume the generator $G ( z ) : Z \to X$ generates samples by sampling first from a fixed prior distribution in space $Z$ followed by a deterministic trainable transformation $G$ into the sample space $X$ . Together with $G$ , we also jointly train an encoder $E ( x ) : X Z$ . Assume $d$ is some similarity metric in the data space, we add $\mathbb { E } _ { { x } \sim { p } _ { d } } [ d ( { x } , G \circ E ( { x } ) ) ]$ as a regularizer, where $p _ { d }$ is the data generating distribution. The encoder itself is trained by minimizing the same reconstruction error.
56
+
57
+ In practice, there are many options for the distance measure $d$ . For instance, the pixel-wise $L ^ { 2 }$ distance, or the distance of learned features by the discriminator (Dumoulin et al., 2016) or by other networks, such as a VGG classifier. (Ledig et al., 2016)
58
+
59
+ The geometric intuition for this regularizer is straight-forward. We are trying to move the generated manifold to the real data manifold using gradient descent. In addition to the gradient provided by the discriminator, we can also try to match the two manifolds by other geometric distances, say, $L ^ { s }$ metric. The idea of adding an encoder is equivalent to first training a point to point mapping $G ( E ( x ) )$ between the two manifolds and then trying to minimize the expected distance between the points on these two manifolds.
60
+
61
+ # 3.2 MODE REGULARIZER
62
+
63
+ In addition to the metric regularizer, we propose a mode regularizer to further penalize missing modes. In traditional GANs, the optimization target for the generator is the empirical sum $\begin{array} { r } { \sum _ { i } { \nabla _ { \theta } \log { D ( G _ { \theta } ( z _ { i } ) ) } } } \end{array}$ . The missing mode problem is caused by the conjunction of two facts: (1) the areas near missing modes are rarely visited by the generator, by definition, thus providing very few examples to improve the generator around those areas, and (2) both missing modes and nonmissing modes tend to correspond to a high value of $D$ , because the generator is not perfect so that the discriminator can take strong decisions locally and obtain a high value of $D$ even near non-missing modes.
64
+
65
+ As an example, consider the situation in Figure 2. For most $z$ , the gradient of the generator $\nabla _ { \theta } \log D ( G _ { \theta } ( z ) )$ pushes the generator towards the major mode $M _ { 1 }$ . Only when $G ( z )$ is very close to the mode $M _ { 2 }$ can the generator get gradients to push itself towards the minor mode $M _ { 2 }$ . However, it is possible that such $z$ is of low or zero probability in the prior distribution $p _ { 0 }$ .
66
+
67
+ ![](images/7385e91fa5a2d1dc34cba4cf1f79b9eaf272d966fa73d5daac595e2758dd374d.jpg)
68
+ Figure 2: Illustration of missing modes problem.
69
+
70
+ Given this observation, consider a regularized GAN model with the metric regularizer. Assume $M _ { 0 }$ is a minor mode of the data generating distribution. For $x \ \in \ M _ { 0 }$ , we know that if $G \circ E$ is a good autoencoder, $G ( E ( x ) )$ will be located very close to mode $M _ { 0 }$ . Since there are sufficient training examples of mode $M _ { 0 }$ in the training data, we add the mode regularizer $\mathbb { E } _ { { x } \sim p _ { d } } [ \log { \bar { D } } ( G \circ E ( x ) ) ]$ to our optimization target for the generator, to encourage $G ( E ( x ) )$
71
+
72
+ to move towards a nearby mode of the data generating distribution. In this way, we can achieve fair probability mass distribution across different modes.
73
+
74
+ In short, our regularized optimization target for the generator and the encoder becomes:
75
+
76
+ $$
77
+ \begin{array} { r } { T _ { G } = - \mathbb { E } _ { z } [ \log D ( G ( z ) ) ] + \mathbb { E } _ { x \sim p _ { d } } [ \lambda _ { 1 } d ( x , G \circ E ( x ) ) + \lambda _ { 2 } \log D ( G \circ E ( x ) ) ] } \\ { T _ { E } = \mathbb { E } _ { x \sim p _ { d } } [ \lambda _ { 1 } d ( x , G \circ E ( x ) ) + \lambda _ { 2 } \log D ( G \circ E ( x ) ) ] } \end{array}
78
+ $$
79
+
80
+ # 3.3 MANIFOLD-DIFFUSION TRAINING FOR REGULARIZED GANS
81
+
82
+ On some large scale datasets, CelebA for example, the regularizers we have discussed do improve the diversity of generated samples, but the quality of samples may not be as good without carefully tuning the hyperparameters. Here we propose a new algorithm for training metric-regularized GANs, which is very stable and much easier to tune for producing good samples.
83
+
84
+ The proposed algorithm divides the training procedure of GANs into two steps: a manifold step and a diffusion step. In the manifold step, we try to match the generation manifold and the real data manifold with the help of an encoder and the geometric metric loss. In the diffusion step, we try to distribute the probability mass on the generation manifold fairly according to the real data distribution.
85
+
86
+ An example of manifold-diffusion training of GAN (MDGAN for short) is as follows: we train a discriminator $D _ { 1 }$ which separates between the samples $x$ and $G \circ E ( x )$ , for $x$ from the data, and we optimize $G$ with respect to the regularized GAN loss $\mathbb { E } [ \log D _ { 1 } ( G \circ E ( x ) ) + \lambda d ( x , G \circ E ( x ) ) ]$ in order to match the two manifolds. In the diffusion step we train a discriminator $D _ { 2 }$ between distributions $G ( z )$ and $G \circ E ( x )$ , and we train $G$ to maximize $\log { D _ { 2 } ( G ( z ) ) }$ . Since these two distributions are now nearly on the same low dimensional manifold, the discriminator $D _ { 2 }$ provides much smoother and more stable gradients. The detailed training procedure is given in Appendix A. See Figure 6 for the quality of generated samples.
87
+
88
+ # 3.4 EVALUATION METRICS FOR MODE MISSING
89
+
90
+ In order to estimate both the missing modes and the sample qualities in our experiments, we used several different metrics for different experiments instead of human annotators.
91
+
92
+ The inception score (Salimans et al., 2016) was considered as a good assessment for sample quality from a labelled dataset:
93
+
94
+ $$
95
+ \exp { ( \mathbb { E } _ { x } K L ( p ( y | \mathbf { x } ) | | p ^ { * } ( y ) ) ) }
96
+ $$
97
+
98
+ Where $\mathbf { x }$ denotes one sample, $p ( y | x )$ is the softmax output of a trained classifier of the labels, and $p ^ { * } ( y )$ is the overall label distribution of generated samples. The intuition behind this score is that a strong classifier usually has a high confidence for good samples. However, the inception score is sometimes not a good metric for our purpose. Assume a generative model that collapse to a very bad image. Although the model is very bad, it can have a perfect inception score, because $p ( y | x )$ can have a high entropy and $p ^ { * } ( y )$ can have a low entropy. So instead, for labelled datasets, we propose another assessment for both visual quality and variety of samples, the MODE score:
99
+
100
+ $$
101
+ \exp \left( \mathbb { E } _ { x } K L ( p ( y | \mathbf { x } ) | | p ( y ) ) - K L ( p ^ { * } ( y ) | | p ( y ) ) \right)
102
+ $$
103
+
104
+ where $p ( y )$ is the distribution of labels in the training data. According to our human evaluation experiences, the MODE score successfully measures two important aspects of generative models, i.e., variety and visual quality, in one metric.
105
+
106
+ However, in datasets without labels (LSUN) or where the labels are not sufficient to characterize every data mode (CelebA), the above metric does not work well. We instead train a third party discriminator between the real data and the generated data from the model. It is similar to the GAN discriminator but is not used to train the generator. We can view the output of the discriminator as an estimator for the quantity (See (Goodfellow et al., 2014) for proof):
107
+
108
+ $$
109
+ D ^ { * } ( s ) \approx \frac { p _ { g } ( s ) } { p _ { g } ( s ) + p _ { d } ( s ) }
110
+ $$
111
+
112
+ Where $p _ { g }$ is the probability density of the generator and $p _ { d }$ is the density of the data distribution. To prevent $D ^ { * }$ from learning a perfect 0-1 separation of $p _ { g }$ and $p _ { d }$ , we inject a zero-mean Gaussian noise to the inputs when training $D ^ { * }$ . After training, we test $D ^ { * }$ on the test set $T$ of the real dataset. If for any test sample $t \in T$ , the discrimination value $D ( t )$ is close to 1, we can conclude that the mode corresponding to $t$ is missing. In this way, although we cannot measure exactly the number of modes that are missing, we have a good estimator of the total probability mass of all the missing modes.
113
+
114
+ # 4 EXPERIMENTS
115
+
116
+ # 4.1 MNIST
117
+
118
+ We perform two classes of experiments on MNIST. For the MNIST dataset, we can assume that the data generating distribution can be approximated with ten dominant modes, if we define the term “mode” here as a connected component of the data manifold.
119
+
120
+ # 4.1.1 GRID SEARCH FOR MNIST GAN MODELS
121
+
122
+ Table 1: Grid Search for Hyperparameters.
123
+
124
+ <table><tr><td>nLayerG</td><td>[2,3,4]</td></tr><tr><td>nLayerD</td><td>[2,3,4]</td></tr><tr><td>sizeG sizeD</td><td>[400,800,1600,3200]</td></tr><tr><td></td><td>[256, 512, 1024]</td></tr><tr><td>dropoutD</td><td>[True,False]</td></tr><tr><td>optimG</td><td>[SGD,Adam]</td></tr><tr><td>optimD</td><td>[SGD,Adam]</td></tr><tr><td>lr</td><td>[1e-2,1e-3,1e-4]</td></tr></table>
125
+
126
+ In order to systemically explore the effect of our proposed regularizers on GAN models in terms of improving stability and sample quality, we use a large scale grid search of different GAN hyper-parameters on the MNIST dataset. The grid search is based on a pair of randomly selected loss weights: $\lambda _ { 1 } = 0 . 2$ and $\lambda _ { 2 } ~ = ~ 0 . 4$ . We use the same hyper-parameter settings for both GAN and Regularized GAN, and list the search ranges in Table 1. Our grid search is similar to those proposed in Zhao et al. (2016). Please refer to it for detailed explanations regarding these hyper-parameters.
127
+
128
+ For evaluation, we first train a 4-layer CNN classifier on the MNIST digits, and then apply it to compute the MODE scores for the generated samples from all these models. The resulting distribution of MODE score is shown in Figure 3. Clearly, our proposed regularizer significantly improves the MODE scores and thus demonstrates its benefits on stabilizing GANs and improving sample qualities.
129
+
130
+ ![](images/23691178a9332efa7d0b890615c2cf021c092595979c93013beab8b2b47d1ea1.jpg)
131
+ Figure 3: The distributions of MODE scores for GAN and regularized GAN.
132
+
133
+ To illustrate the effect of regularizers with different coefficients, we randomly pick an architecture and train it with different $\lambda _ { 1 } = \lambda _ { 2 }$ . The results are shown in Figure 4.
134
+
135
+ ![](images/ba0462a6a90a59f8d012d3b775739a6a034addf655922b4e85364f2d3f1a8aa3.jpg)
136
+ Figure 4: (Left 1-5) Different hyperparameters for MNIST generation. The values of the $\lambda _ { 1 }$ and $\lambda _ { 2 }$ in our Regularized GAN are listed below the corresponding samples. (Right 6-7) Best samples through grid search for GAN and Regularized GAN.
137
+
138
+ # 4.1.2 COMPOSITIONAL MNIST DATA WITH 1000 MODES
139
+
140
+ In order to quantitatively study the effect of our regularizers on the missing modes, we concatenate three MNIST digits to a number in [0,999] in a single 64x64 image, and then train DCGAN as a baseline model on the 1000 modes dataset. The digits on the image are sampled with different probabilities, in order to test the model’s capability to preserve small modes in generation. We again use a pre-trained classifier for MNIST instead of a human to evaluate the models.
141
+
142
+ Table 2: Results for Compositional MNIST with 1000 modes. The proposed regularization (RegDCGAN) allows to substantially reduce the number of missed modes as well as the KL divergence that measures the plausibility of the generated samples (like in the Inception score).
143
+
144
+ <table><tr><td rowspan="2"></td><td colspan="2">Set 1</td><td colspan="2">Set 2</td><td colspan="2">Set3</td><td colspan="2">Set4</td></tr><tr><td>#Miss</td><td>KL</td><td>#Miss</td><td>KL</td><td>#Miss</td><td>KL</td><td>#Miss</td><td>KL</td></tr><tr><td>DCGAN</td><td>204.7</td><td>77.9</td><td>204.3</td><td>60.2</td><td>103.4</td><td>75.9</td><td>89.3</td><td>77.8</td></tr><tr><td>Reg-DCGAN</td><td>32.1</td><td>62.3</td><td>71.5</td><td>58.9</td><td>42.7</td><td>68.4</td><td>31.6</td><td>67.8</td></tr></table>
145
+
146
+ The performances on the compositional experiment are measured by two metrics. #Miss represents the classifier-reported number of missing modes, which is the size of the set of numbers that the model never generates. KL stands for the KL divergence between the classifier-reported distribution of generated numbers and the distribution of numbers in the training data (as for the Inception score). The results are shown in Table 2. With the help of our proposed regularizer, both the number of missing modes and KL divergence drop dramatically among all the sets of the compositional MNIST dataset, which again proves the effectiveness of our regularizer for preventing the missing modes problem.
147
+
148
+ # 4.2 CELEBA
149
+
150
+ To test the effectiveness of our proposal on harder problems, we implement an encoder for the DCGAN algorithm and train our model with different hyper-parameters together with the DCGAN baseline on the CelebA dataset. We provide the detailed architecture of our regularized DCGAN in Appendix B.
151
+
152
+ # 4.2.1 MISSING MODES ESTIMATION ON CELEBA
153
+
154
+ We also employ a third party discriminator trained with injected noise as a metric for missing mode estimation. To implement this, we add noise in the input layer in the discriminator network. For each GAN model to be estimated, we independently train this noisy discriminator, as mode estimator, with the same architecture and hyper-parameters on the generated data and the training data. We then apply the mode estimator to the test data. The images which have high mode estimator outputs can be viewed as on the missing modes.
155
+
156
+ Table 3: Number of images on the missing modes on CelebA estimated by a third-party discriminator. The numbers in the brackets indicate the dimension of prior $z$ . $\sigma$ denotes the standard deviation of the added Gaussian noise applied at the input of the discriminator to regularize it. MDGAN achieves a very high reduction in the number of missing modes, in comparison to other methods .
157
+
158
+ <table><tr><td>0</td><td>DCGAN (100)</td><td>DCGAN (200)</td><td>Reg-GAN (100)</td><td>Reg-GAN (200)</td><td>MDGAN (200)</td></tr><tr><td>3.5</td><td>5463</td><td>17089</td><td>754</td><td>3644</td><td>74</td></tr><tr><td>4.0</td><td>590</td><td>15832</td><td>42</td><td>391</td><td>13</td></tr></table>
159
+
160
+ The comparison result is shown in Table 3. Both our proposed Regularized-GAN and MDGAN outperform baseline DCGAN models on all settings. Especially, MDGAN suppresses other models, showing its superiority on modes preserving. We also find that, although sharing the same architecture, the DCGAN with 200-dimensional noise performs quite worse than that with 100-dimensional noise as input. On the contrary, our regularized GAN performs more consistently.
161
+
162
+ To get a better understanding of the models’ performance, we want to figure out when and where these models miss the modes. Visualizing the test images associated with missed modes is instructive. In Figure 5, the left three images are missed by all models. It is rare to see in the training data the cap in the second image and the type of background in the third, which thus can be viewed as small modes under this situation. These three images should be considered as the hardest test data for GAN to learn. Nonetheless, our best model, MDGAN still capture certain small modes. The seven images on the right in Figure 5 are only missed by DCGAN. The sideface, paleface, black, and the berets are special attributes among these images, but our proposed MDGAN performs well on all of them.
163
+
164
+ ![](images/dd60ba26724f057d75e53e8f9051cfa7ab0d2f40c846afeeccfbb3ecd6ec1b15.jpg)
165
+ Figure 5: Test set images that are on missing mode. Left: Both MDGAN and DCGAN missing. Right: Only DCGAN missing.
166
+
167
+ # 4.2.2 QUALITATIVE EVALUATION OF GENERATED SAMPLES
168
+
169
+ After quantitative evaluation, we manually examine the generated samples by our regularized GAN to see whether the proposed regularizer has side-effects on sample quality. We compare our model with ALI (Dumoulin et al., 2016), VAEGAN (Larsen et al., 2015), and DCGAN (Radford et al., 2015) in terms of sample visual quality and mode diversity. Samples generated from these models are shown in Figure $6 ^ { 2 ^ { \circ } }$ .
170
+
171
+ ![](images/601224511ba5ab1ca605c826bf8588ec4a9779fd983509775ed6e2be4b574de3.jpg)
172
+ Figure 6: Samples generated from different generative models. For each compared model, we directly take ten decent samples reported in their corresponding papers and code repositories. Note how MDGAN samples are both globally more coherent and locally have sharp textures.
173
+
174
+ Both MDGAN and Regularized-GAN generate clear and natural-looking face images. Although ALI’s samples are plausible, they are sightly deformed in comparison with those from MDGAN. The samples from VAEGAN and DCGAN seem globally less coherent and locally less sharp.
175
+
176
+ As to sample quality, it is worth noting that the samples from MDGAN enjoy fewer distortions. With all four other models, the majority of generated samples suffer from some sort of distortion. However, for the samples generated by MDGAN, the level of distortion is lower compared with the other four compared models. We attribute it to the help of the autoencoder as the regularizer to alter the generation manifolds. In this way, the generator is able to learn fine-grained details such as face edges. As a result, MDGAN is able to reduce distortions.
177
+
178
+ ![](images/7ccfe9752c1edde7bf368397e5fc0a44880f5ada2037abd62a3f910d669af1b5.jpg)
179
+ Figure 7: Sideface samples generated by Regularized-GAN and MDGAN.
180
+
181
+ In terms of missing modes problem, we instructed five individuals to conduct human evaluation on the generated samples. They achieve consensus that MDGAN wins in terms of mode diversities. Two people pointed out that MDGAN generates a larger amount of samples with side faces than other models. We select several of these side face samples in Figure 7. Clearly, our samples maintain acceptable visual fidelity meanwhile share diverse modes. Combined with the above quantitative results, it is convincing that our regularizers bring benefits for both training stability and mode variety without the loss of sample quality.
182
+
183
+ # 5 CONCLUSIONS
184
+
185
+ Although GANs achieve state-of-the-art results on a large variety of unsupervised learning tasks, training them is considered highly unstable, very difficult and sensitive to hyper-parameters, all the while, missing modes from the data distribution or even collapsing large amounts of probability mass on some modes. Successful GAN training usually requires large amounts of human and computing efforts to fine tune the hyper-parameters, in order to stabilize training and avoid collapsing. Researchers usually rely on their own experience and published tricks and hyper-parameters instead of systematic methods for training GANs.
186
+
187
+ We provide systematic ways to measure and avoid the missing modes problem and stabilize training with the proposed autoencoder-based regularizers. The key idea is that some geometric metrics can provide more stable gradients than trained discriminators, and when combined with the encoder, they can be used as regularizers for training. These regularizers can also penalize missing modes and encourage a fair distribution of probability mass on the generation manifold.
188
+
189
+ # ACKNOWLEDGEMENTS
190
+
191
+ We thank Naiyan Wang, Jianbo Ye, Yuchen Ding, Saboya Yang for their GPU support. We also want to thank Huiling Zhen for helpful discussions, Junbo Zhao for providing the details of grid search experiments on the EBGAN model, as well as Anders Boesen Lindbo Larsen for kindly helping us on running VAEGAN experiments. We appreciate for the valuable suggestions and comments from the anonymous reviewers. The work described in this paper was partially supported by NSERC, Calcul Quebec, Compute Canada, the Canada Research Chairs, CIFAR, National Natural Science Foundation of China (61672445 and 61272291), Research Grants Council of Hong Kong (PolyU 152094/14E), and The Hong Kong Polytechnic University (G-YBP6).
192
+
193
+ # REFERENCES
194
+
195
+ Emily L Denton, Soumith Chintala, Rob Fergus, et al. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in neural information processing systems, pp. 1486–1494, 2015.
196
+ Jeff Donahue, Philipp Krahenb ¨ uhl, and Trevor Darrell. Adversarial feature learning. ¨ arXiv preprint arXiv:1605.09782, 2016.
197
+ Alexey Dosovitskiy and Thomas Brox. Generating images with perceptual similarity metrics based on deep networks. arXiv preprint arXiv:1602.02644, 2016.
198
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016.
199
+
200
+ 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.
201
+
202
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. arxiv, 2016.
203
+
204
+ Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. arXiv preprint arXiv:1512.09300, 2015.
205
+
206
+ Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Aitken, Alykhan Tejani, Jo- ´ hannes Totz, Zehan Wang, and Wenzhe Shi. Photo-realistic single image super-resolution using a generative adversarial network. arXiv preprint arXiv:1609.04802, 2016.
207
+
208
+ Chuan Li and Michael Wand. Precomputed real-time texture synthesis with markovian generative adversarial networks. arXiv preprint arXiv:1604.04382, 2016.
209
+
210
+ Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. arXiv preprint arXiv:1511.05440, 2015.
211
+
212
+ Luke Metz, Ben Poole, David Pfau, and Jascha Sohl-Dickstein. Unrolled generative adversarial networks. arXiv preprint arXiv:1611.02163, 2016.
213
+
214
+ Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
215
+
216
+ Anh Nguyen, Jason Yosinski, Yoshua Bengio, Alexey Dosovitskiy, and Jeff Clune. Plug & play generative networks: Conditional iterative generation of images in latent space. arXiv preprint arXiv:1612.00005, 2016.
217
+
218
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
219
+
220
+ Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. arXiv preprint arXiv:1605.05396, 2016.
221
+
222
+ Masaki Saito and Eiichi Matsumoto. Temporal generative adversarial nets. arXiv preprint arXiv:1611.06624, 2016.
223
+
224
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. arXiv preprint arXiv:1606.03498, 2016.
225
+
226
+ Casper Kaae Sønderby, Jose Caballero, Lucas Theis, Wenzhe Shi, and Ferenc Huszar. Amortised ´ map inference for image super-resolution. arXiv preprint arXiv:1610.04490, 2016.
227
+
228
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In Advances In Neural Information Processing Systems, pp. 613–621, 2016.
229
+
230
+ Xiaolong Wang and Abhinav Gupta. Generative image modeling using style and structure adversarial networks. In ECCV, 2016.
231
+
232
+ Jiajun Wu, Chengkai Zhang, Tianfan Xue, William T Freeman, and Joshua B Tenenbaum. Learning a probabilistic latent space of object shapes via 3d generative-adversarial modeling. In Neural Information Processing Systems (NIPS), 2016.
233
+
234
+ Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126, 2016.
235
+
236
+ Yipin Zhou and Tamara L Berg. Learning temporal transformations from time-lapse videos. In European Conference on Computer Vision, pp. 262–277. Springer, 2016.
237
+
238
+ Jun-Yan Zhu, Philipp Krahenb ¨ uhl, Eli Shechtman, and Alexei A. Efros. Generative visual manipula- ¨ tion on the natural image manifold. In Proceedings of European Conference on Computer Vision (ECCV), 2016.
239
+
240
+ # A APPENDIX: PSEUDO CODE FOR MDGAN
241
+
242
+ In this Appendix, we give the detailed training procedure of an MDGAN example we discuss in Section 3.3.
243
+
244
+ # Manifold Step:
245
+
246
+ 1. Sample $\left\{ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \cdots \mathbf { x } _ { m } \right\}$ from data generating distribution $p _ { d a t a } ( x )$
247
+
248
+ 2. Update discriminator $D _ { 1 }$ using SGD with gradient ascent:
249
+
250
+ $$
251
+ \nabla _ { \theta _ { d } ^ { 1 } } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } [ \log D _ { 1 } ( \mathbf { x } _ { i } ) + \log ( 1 - D _ { 1 } ( G ( E ( \mathbf { x } _ { i } ) ) ) ) ]
252
+ $$
253
+
254
+ 3. Update generator $G$ using SGD with gradient ascent:
255
+
256
+ $$
257
+ \nabla _ { \theta _ { g } } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } [ \lambda \log D _ { 1 } ( G ( E ( \mathbf { x } _ { i } ) ) ) - | | \mathbf { x } _ { i } - G ( E ( \mathbf { x } _ { i } ) ) | | ^ { 2 } ]
258
+ $$
259
+
260
+ # Diffusion Step:
261
+
262
+ 4. Sample $\left\{ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \cdots \mathbf { x } _ { m } \right\}$ from data generating distribution $p _ { d a t a } ( x )$ .
263
+ 5. Sample $\{ \mathbf { z } _ { 1 } , \mathbf { z } _ { 2 } , \cdots \mathbf { z } _ { m } \}$ from prior distribution $p _ { \sigma } ( z )$ .
264
+ 6. Update discriminator $D _ { 2 }$ using SGD with gradient ascent:
265
+
266
+ $$
267
+ \nabla _ { \theta _ { d } ^ { 2 } } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } [ \log D _ { 2 } ( G ( E ( \mathbf { x } _ { i } ) ) ) + \log ( 1 - D _ { 2 } ( \mathbf { z } _ { i } ) ) ]
268
+ $$
269
+
270
+ 7. Update generator $G$ using SGD with gradient ascent:
271
+
272
+ $$
273
+ \nabla _ { \boldsymbol { \theta } _ { g } } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } [ \log D _ { 2 } ( G ( \mathbf { z } _ { i } ) ) ]
274
+ $$
275
+
276
+ # B APPENDIX: ARCHITECTURE FOR EXPERIMENTS
277
+
278
+ We use similar architectures for Compositional MNIST and CelebA experiments. The architecture is based on that found in DCGAN Radford et al. (2015). Apart from the discriminator and generator which are the same as DCGAN, we add an encoder which is the ”inverse” of the generator, by reversing the order of layers and replacing the de-convolutional layers with convolutional layers.
279
+
280
+ One has to pay particular attention to batch normalization layers. In DCGAN, there are batch normalization layers both in the generator and the discriminator. However, two classes of data go through the batch normalization layers in the generator. One come from sampled noise $z$ , the other one come from the encoder. In our implementation, we separate the batch statistics for these two classes of data in the generator, while keeping the parameters of BN layer to be shared. In this way, the batch statistics of these two kinds of batches cannot interfere with each other.
281
+
282
+ # C APPENDIX: ADDITIONAL SYNTHESIZED EXPERIMENTS
283
+
284
+ To demonstrate the effectiveness of mode-regularized GANs proposed in this paper, we train a very simple GAN architecture on synthesized 2D dataset, following Metz et al. (2016).
285
+
286
+ The data is sampled from a mixture of 6 Gaussians, with standard derivation of 0.1. The means of the Gaussians are placed around a circle with radius 5. The generator network has two ReLU hidden layers with 128 neurons. It generates 2D output samples from 3D uniform noise from [0,1]. The discriminator consists of only one fully connected layer of ReLU neurons, mapping the 2D input to a real 1D number. Both networks are optimized with the Adam optimizer with the learning rate of 1e-4.
287
+
288
+ In the regularized version, we choose $\lambda _ { 1 } = \lambda _ { 2 } = 0 . 0 0 5$ . The comparison between the generator distribution from standard GAN and our proposed regularized GAN are shown in Figure 9.
289
+
290
+ ![](images/2acc16f21eb9e8b9d0333914b869f7d2c9aea0b818b3a87da7a5c415e117f9f3.jpg)
291
+ Figure 9: Comparison results on a toy 2D mixture of Gaussians dataset. The columns on the left shows heatmaps of the generator distributions as the number of training epochs increases, whereas the rightmost column presents the target, the original data distribution. The top row shows standard GAN result. The generator has a hard time oscillating among the modes of the data distribution, and is only able to “recover” a single data mode at once. In contrast, the bottom row shows results of our regularized GAN. Its generator quickly captures the underlying multiple modes and fits the target distribution.
292
+
293
+ # D APPENDIX: COMPARISON WITH VAEGAN
294
+
295
+ In this appendix section, we demonstrate the effectiveness and uniqueness of mode-regularized GANs proposed in this paper as compared to Larsen et al. (2015) in terms of its theoretical difference, sample quality and number of missing modes.
296
+
297
+ With regard to the theoretical difference, the optimization of VAEGAN relies on the probabilistic variational bound, namely $p ( x ) \geq \mathbb { E } _ { q ( z | x ) } [ \log p ( x | z ) ] - { \mathrm { K L } } ( q ( z | x ) | | p ( z ) )$ . This variational bound together with a GAN loss is optimized with several assumptions imposed in VAEGAN:
298
+
299
+ 1. In general, VAE is based on the assumption that the true posterior $p ( z | x )$ can be well approximated by factorized Gaussian distribution $q$ .
300
+ 2. As to VAEGAN, It is also assumed that the maximum likelihood objectives does not conflict with GAN objective in terms of probabilistic framework.
301
+
302
+ The first assumption does not necessarily hold for GANs. We have found that in some trained models of DCGANs, the real posterior $p ( z | x )$ is even not guaranteed to have only one mode, not to mention it is anything close to factorized Gaussian. We believe that this difference in probabilistic framework is an essential obstacle when one tries to use the objective of VAEGAN as a regularizer. However, in our algorithm, where we use a plain auto-encoder instead of VAE as the objective. Plain auto-encooders works better than VAE for our purposes because as long as the model $G ( z )$ is able to generate training samples, there always exists a function $E ^ { \ast } ( x )$ such that $G ( E ( x ) ) = x$ . Our encoder can therefore be viewed as being trained to approximate this real encoder $E ^ { * }$ . There are no conflicts between a good GAN generator and our regularization objective. Hence, our objectives can be used as regularizers for encoding the prior knowledge that good models should be able to generate the training samples. This is why our work is essentially different from VAEGAN. In our experiments, we also believe that this is the reason why VAEGAN generates worse samples than a carefully tuned regularized GANs.
303
+
304
+ In terms of sample quality and missing modes, we run the official code of VAEGAN 3 with their default setting. We train VAEGAN for 30 epochs 4 and our models for only 20 epochs. For fairness, their model was run 3 times and the trained model with the best sample visual quality was taken for the comparison.
305
+
306
+ The generated samples are shown in Figure 10. The most obvious difference between our samples and VAEGAN’s samples is the face distortion, which is consistent with our experimental results in Section 4.2.2. We conjecture that the distortions of VAEGAN’s samples are due to the conflicts between the two objectives, as we present above. In other words, the way we introduce auto-encoders as regularizers for GAN models is different from VAEGAN’s. The difference is that the second assumption mentioned above is not required in our approaches. In our framework, the auto-encoders helps alter the generation manifolds, leading to fewer distortions in fine-grained details in our generated samples.
307
+
308
+ ![](images/e0082f3127f2aab9defa52d7d88f547f2ca4aa33600ecc6c7008814eebed363b.jpg)
309
+ Figure 10: Samples generated by our models and VAEGAN. The third line are samples generated by our self-trained VAEGAN model, with default settings. The last line are generated samples reported in the original VAEGAN paper. We depict both of them here for a fair comparison.
310
+
311
+ In terms of the missing modes problem, we use the same method described in Section 4.2.1 for computing the number of images with missing modes. The results are shown below.
312
+
313
+ Table 4: Number of images on the missing modes on CelebA estimated by a third-party discriminator. The numbers in the brackets indicate the dimension of prior $z$ . $\sigma$ denotes the standard deviation of the added Gaussian noise applied at the input of the discriminator to regularize it. MDGAN achieves a very high reduction in the number of missing modes, in comparison to VAEGAN.
314
+
315
+ <table><tr><td>0</td><td>VAEGAN (100)</td><td>Reg-GAN (100)</td><td>Reg-GAN (200)</td><td>MDGAN (200)</td></tr><tr><td>3.5</td><td>9720</td><td>754</td><td>3644</td><td>74</td></tr><tr><td>4.0</td><td>5862</td><td>42</td><td>391</td><td>13</td></tr></table>
316
+
317
+ We see that using our proposed regularizers results in a huge drop in the number of missing modes. We conjecture that the reason why VAEGAN performs very bad in our metric for missing modes is because the samples generated are of low quality, so the discriminator classifies the samples as “not on mode”. Namely, the data generated is too far away from many real data modes. Essentially if a model generates very bad samples, we can say that the model misses all or most modes.
318
+
319
+ To conduct more fair evaluation between VAEGAN and our methods, we also perform a blind human evaluation. Again we instructed five individuals to conduct this evaluation of sample variability. Without telling them which is generated by VAEGAN and which is generated by our methods, four people agree that our method wins in terms of sample diversity. One person thinks the samples are equally diverse.
320
+
321
+ In conclusion, we demonstrate that our proposed mode-regularized GANs, i.e., Reg-GAN and MDGAN, are different from VAEGAN theoretically as discussed above. Such differences empirically result in better sample quality and mode preserving ability, which are our main contributions.
md/train/HkwoSDPgg/HkwoSDPgg.md ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SEMI-SUPERVISED KNOWLEDGE TRANSFERFOR DEEP LEARNING FROM PRIVATE TRAINING DATA
2
+
3
+ Nicolas Papernot∗ Pennsylvania State University ngp5056@cse.psu.edu
4
+
5
+ Mart´ın Abadi
6
+ Google Brain
7
+ abadi@google.com
8
+
9
+ Ulfar Erlingsson ´ Google ulfar@google.com
10
+
11
+ Ian Goodfellow
12
+ Google Brain†
13
+ goodfellow@google.com
14
+ Kunal Talwar
15
+ Google Brain
16
+ kunal@google.com
17
+
18
+ # ABSTRACT
19
+
20
+ Some machine learning applications involve training data that is sensitive, such as the medical histories of patients in a clinical trial. A model may inadvertently and implicitly store some of its training data; careful analysis of the model may therefore reveal sensitive information.
21
+
22
+ To address this problem, we demonstrate a generally applicable approach to providing strong privacy guarantees for training data: Private Aggregation of Teacher Ensembles (PATE). The approach combines, in a black-box fashion, multiple models trained with disjoint datasets, such as records from different subsets of users. Because they rely directly on sensitive data, these models are not published, but instead used as “teachers” for a “student” model. The student learns to predict an output chosen by noisy voting among all of the teachers, and cannot directly access an individual teacher or the underlying data or parameters. The student’s privacy properties can be understood both intuitively (since no single teacher and thus no single dataset dictates the student’s training) and formally, in terms of differential privacy. These properties hold even if an adversary can not only query the student but also inspect its internal workings.
23
+
24
+ Compared with previous work, the approach imposes only weak assumptions on how teachers are trained: it applies to any model, including non-convex models like DNNs. We achieve state-of-the-art privacy/utility trade-offs on MNIST and SVHN thanks to an improved privacy analysis and semi-supervised learning.
25
+
26
+ # 1 INTRODUCTION
27
+
28
+ Some machine learning applications with great benefits are enabled only through the analysis of sensitive data, such as users’ personal contacts, private photographs or correspondence, or even medical records or genetic sequences (Alipanahi et al., 2015; Kannan et al., 2016; Kononenko, 2001; Sweeney, 1997). Ideally, in those cases, the learning algorithms would protect the privacy of users’ training data, e.g., by guaranteeing that the output model generalizes away from the specifics of any individual user. Unfortunately, established machine learning algorithms make no such guarantee; indeed, though state-of-the-art algorithms generalize well to the test set, they continue to overfit on specific training examples in the sense that some of these examples are implicitly memorized.
29
+
30
+ Recent attacks exploiting this implicit memorization in machine learning have demonstrated that private, sensitive training data can be recovered from models. Such attacks can proceed directly, by analyzing internal model parameters, but also indirectly, by repeatedly querying opaque models to gather data for the attack’s analysis. For example, Fredrikson et al. (2015) used hill-climbing on the output probabilities of a computer-vision classifier to reveal individual faces from the training data.
31
+
32
+ Because of those demonstrations—and because privacy guarantees must apply to worst-case outliers, not only the average—any strategy for protecting the privacy of training data should prudently assume that attackers have unfettered access to internal model parameters.
33
+
34
+ To protect the privacy of training data, this paper improves upon a specific, structured application of the techniques of knowledge aggregation and transfer (Breiman, 1994), previously explored by Nissim et al. (2007), Pathak et al. (2010), and particularly Hamm et al. (2016). In this strategy, first, an ensemble (Dietterich, 2000) of teacher models is trained on disjoint subsets of the sensitive data. Then, using auxiliary, unlabeled non-sensitive data, a student model is trained on the aggregate output of the ensemble, such that the student learns to accurately mimic the ensemble. Intuitively, this strategy ensures that the student does not depend on the details of any single sensitive training data point (e.g., of any single user), and, thereby, the privacy of the training data is protected even if attackers can observe the student’s internal model parameters.
35
+
36
+ This paper shows how this strategy’s privacy guarantees can be strengthened by restricting student training to a limited number of teacher votes, and by revealing only the topmost vote after carefully adding random noise. We call this strengthened strategy PATE, for Private Aggregation of Teacher Ensembles. Furthermore, we introduce an improved privacy analysis that makes the strategy generally applicable to machine learning algorithms with high utility and meaningful privacy guarantees—in particular, when combined with semi-supervised learning.
37
+
38
+ To establish strong privacy guarantees, it is important to limit the student’s access to its teachers, so that the student’s exposure to teachers’ knowledge can be meaningfully quantified and bounded. Fortunately, there are many techniques for speeding up knowledge transfer that can reduce the rate of student/teacher consultation during learning. We describe several techniques in this paper, the most effective of which makes use of generative adversarial networks (GANs) (Goodfellow et al., 2014) applied to semi-supervised learning, using the implementation proposed by Salimans et al. (2016). For clarity, we use the term PATE-G when our approach is combined with generative, semisupervised methods. Like all semi-supervised learning methods, PATE-G assumes the student has access to additional, unlabeled data, which, in this context, must be public or non-sensitive. This assumption should not greatly restrict our method’s applicability: even when learning on sensitive data, a non-overlapping, unlabeled set of data often exists, from which semi-supervised methods can extract distribution priors. For instance, public datasets exist for text and images, and for medical data.
39
+
40
+ It seems intuitive, or even obvious, that a student machine learning model will provide good privacy when trained without access to sensitive training data, apart from a few, noisy votes from a teacher quorum. However, intuition is not sufficient because privacy properties can be surprisingly hard to reason about; for example, even a single data item can greatly impact machine learning models trained on a large corpus (Chaudhuri et al., 2011). Therefore, to limit the effect of any single sensitive data item on the student’s learning, precisely and formally, we apply the well-established, rigorous standard of differential privacy (Dwork & Roth, 2014). Like all differentially private algorithms, our learning strategy carefully adds noise, so that the privacy impact of each data item can be analyzed and bounded. In particular, we dynamically analyze the sensitivity of the teachers’ noisy votes; for this purpose, we use the state-of-the-art moments accountant technique from Abadi et al. (2016), which tightens the privacy bound when the topmost vote has a large quorum. As a result, for MNIST and similar benchmark learning tasks, our methods allow students to provide excellent utility, while our analysis provides meaningful worst-case guarantees. In particular, we can bound the metric for privacy loss (the differential-privacy $\varepsilon$ ) to a range similar to that of existing, real-world privacyprotection mechanisms, such as Google’s RAPPOR (Erlingsson et al., 2014).
41
+
42
+ Finally, it is an important advantage that our learning strategy and our privacy analysis do not depend on the details of the machine learning techniques used to train either the teachers or their student. Therefore, the techniques in this paper apply equally well for deep learning methods, or any such learning methods with large numbers of parameters, as they do for shallow, simple techniques. In comparison, Hamm et al. (2016) guarantee privacy only conditionally, for a restricted class of student classifiers—in effect, limiting applicability to logistic regression with convex loss. Also, unlike the methods of Abadi et al. (2016), which represent the state-of-the-art in differentiallyprivate deep learning, our techniques make no assumptions about details such as batch selection, the loss function, or the choice of the optimization algorithm. Even so, as we show in experiments on
43
+
44
+ ![](images/d7717c03d9df57663d58cc01cb8ea2daa4d640b2149e5038c16b69b12d684e45.jpg)
45
+ Figure 1: Overview of the approach: (1) an ensemble of teachers is trained on disjoint subsets of the sensitive data, (2) a student model is trained on public data labeled using the ensemble.
46
+
47
+ MNIST and SVHN, our techniques provide a privacy/utility tradeoff that equals or improves upon bespoke learning methods such as those of Abadi et al. (2016).
48
+
49
+ Section 5 further discusses the related work. Building on this related work, our contributions are as follows:
50
+
51
+ • We demonstrate a general machine learning strategy, the PATE approach, that provides differential privacy for training data in a “black-box” manner, i.e., independent of the learning algorithm, as demonstrated by Section 4 and Appendix C.
52
+ We improve upon the strategy outlined in Hamm et al. (2016) for learning machine models that protect training data privacy. In particular, our student only accesses the teachers’ top vote and the model does not need to be trained with a restricted class of convex losses.
53
+ • We explore four different approaches for reducing the student’s dependence on its teachers, and show how the application of GANs to semi-supervised learning of Salimans et al. (2016) can greatly reduce the privacy loss by radically reducing the need for supervision.
54
+ • We present a new application of the moments accountant technique from Abadi et al. (2016) for improving the differential-privacy analysis of knowledge transfer, which allows the training of students with meaningful privacy bounds. We evaluate our framework on MNIST and SVHN, allowing for a comparison of our results with previous differentially private machine learning methods. Our classifiers achieve an $( \varepsilon , \delta )$ differential-privacy bound of $( 2 . 0 4 , 1 0 ^ { - 5 } )$ for MNIST and $( 8 . 1 9 , 1 0 ^ { - 6 } ) $ for SVHN, respectively with accuracy of $9 8 . 0 0 \%$ and $9 0 . 6 6 \%$ . In comparison, for MNIST, Abadi et al. (2016) obtain a looser $( 8 , 1 0 ^ { - 5 } )$ privacy bound and $9 7 \%$ accuracy. For SVHN, Shokri & Shmatikov (2015) report approx. $9 2 \%$ accuracy with $\varepsilon > 2$ per each of 300,000 model parameters, naively making the total $\varepsilon > 6 0 0 , 0 0 0$ , which guarantees no meaningful privacy. Finally, we show that the PATE approach can be successfully applied to other model structures and to datasets with different characteristics. In particular, in Appendix C PATE protects the privacy of medical data used to train a model based on random forests.
55
+
56
+ Our results are encouraging, and highlight the benefits of combining a learning strategy based on semi-supervised knowledge transfer with a precise, data-dependent privacy analysis. However, the most appealing aspect of this work is probably that its guarantees can be compelling to both an expert and a non-expert audience. In combination, our techniques simultaneously provide both an intuitive and a rigorous guarantee of training data privacy, without sacrificing the utility of the targeted model. This gives hope that users will increasingly be able to confidently and safely benefit from machine learning models built from their sensitive data.
57
+
58
+ # 2 PRIVATE LEARNING WITH ENSEMBLES OF TEACHERS
59
+
60
+ In this section, we introduce the specifics of the PATE approach, which is illustrated in Figure 1. We describe how the data is partitioned to train an ensemble of teachers, and how the predictions made by this ensemble are noisily aggregated. In addition, we discuss how GANs can be used in training the student, and distinguish PATE-G variants that improve our approach using generative, semi-supervised methods.
61
+
62
+ # 2.1 TRAINING THE ENSEMBLE OF TEACHERS
63
+
64
+ Data partitioning and teachers: Instead of training a single model to solve the task associated with dataset $( X , Y )$ , where $X$ denotes the set of inputs, and $Y$ the set of labels, we partition the data in $n$ disjoint sets $( X _ { n } , Y _ { n } )$ and train a model separately on each set. As evaluated in Section 4.1, assuming that $n$ is not too large with respect to the dataset size and task complexity, we obtain $n$ classifiers $f _ { i }$ called teachers. We then deploy them as an ensemble making predictions on unseen inputs $x$ by querying each teacher for a prediction $f _ { i } ( x )$ and aggregating these into a single prediction.
65
+
66
+ Aggregation: The privacy guarantees of this teacher ensemble stems from its aggregation. Let $m$ be the number of classes in our task. The label count for a given class $j \in [ m ]$ and an input $\vec { x }$ is the number of teachers that assigned class $j$ to input $\vec { x }$ : $n _ { j } ( \vec { x } ) = | \{ i : i \in [ \bar { n } ] , \bar { f } _ { i } ( \vec { x } ) = j \} |$ . If we simply apply plurality—use the label with the largest count—the ensemble’s decision may depend on a single teacher’s vote. Indeed, when two labels have a vote count differing by at most one, there is a tie: the aggregated output changes if one teacher makes a different prediction. We add random noise to the vote counts $n _ { j }$ to introduce ambiguity:
67
+
68
+ $$
69
+ f ( x ) = \arg \operatorname* { m a x } _ { j } \left\{ n _ { j } ( \vec { x } ) + L a p \left( \frac { 1 } { \gamma } \right) \right\}
70
+ $$
71
+
72
+ In this equation, $\gamma$ is a privacy parameter and $L a p ( b )$ the Laplacian distribution with location 0 and scale $b$ . The parameter $\gamma$ influences the privacy guarantee we can prove. Intuitively, a large $\gamma$ leads to a strong privacy guarantee, but can degrade the accuracy of the labels, as the noisy maximum $f$ above can differ from the true plurality.
73
+
74
+ While we could use an $f$ such as above to make predictions, the noise required would increase as we make more predictions, making the model useless after a bounded number of queries. Furthermore, privacy guarantees do not hold when an adversary has access to the model parameters. Indeed, as each teacher $f _ { i }$ was trained without taking into account privacy, it is conceivable that they have sufficient capacity to retain details of the training data. To address these limitations, we train another model, the student, using a fixed number of labels predicted by the teacher ensemble.
75
+
76
+ # 2.2 SEMI-SUPERVISED TRANSFER OF THE KNOWLEDGE FROM AN ENSEMBLE TO A STUDENT
77
+
78
+ We train a student on nonsensitive and unlabeled data, some of which we label using the aggregation mechanism. This student model is the one deployed, in lieu of the teacher ensemble, so as to fix the privacy loss to a value that does not grow with the number of user queries made to the student model. Indeed, the privacy loss is now determined by the number of queries made to the teacher ensemble during student training and does not increase as end-users query the deployed student model. Thus, the privacy of users who contributed to the original training dataset is preserved even if the student’s architecture and parameters are public or reverse-engineered by an adversary.
79
+
80
+ We considered several techniques to trade-off the student model’s quality with the number of labels it needs to access: distillation, active learning, semi-supervised learning (see Appendix B). Here, we only describe the most successful one, used in PATE-G: semi-supervised learning with GANs.
81
+
82
+ Training the student with GANs: The GAN framework involves two machine learning models, a generator and a discriminator. They are trained in a competing fashion, in what can be viewed as a two-player game (Goodfellow et al., 2014). The generator produces samples from the data distribution by transforming vectors sampled from a Gaussian distribution. The discriminator is trained to distinguish samples artificially produced by the generator from samples part of the real data distribution. Models are trained via simultaneous gradient descent steps on both players’ costs. In practice, these dynamics are often difficult to control when the strategy set is non-convex (e.g., a DNN). In their application of GANs to semi-supervised learning, Salimans et al. (2016) made the following modifications. The discriminator is extended from a binary classifier (data vs. generator sample) to a multi-class classifier (one of $k$ classes of data samples, plus a class for generated samples). This classifier is then trained to classify labeled real samples in the correct class, unlabeled real samples in any of the $k$ classes, and the generated samples in the additional class.
83
+
84
+ Although no formal results currently explain why yet, the technique was empirically demonstrated to greatly improve semi-supervised learning of classifiers on several datasets, especially when the classifier is trained with feature matching loss (Salimans et al., 2016).
85
+
86
+ Training the student in a semi-supervised fashion makes better use of the entire data available to the student, while still only labeling a subset of it. Unlabeled inputs are used in unsupervised learning to estimate a good prior for the distribution. Labeled inputs are then used for supervised learning.
87
+
88
+ # 3 PRIVACY ANALYSIS OF THE APPROACH
89
+
90
+ We now analyze the differential privacy guarantees of our PATE approach. Namely, we keep track of the privacy budget throughout the student’s training using the moments accountant (Abadi et al., 2016). When teachers reach a strong quorum, this allows us to bound privacy costs more strictly.
91
+
92
+ # 3.1 DIFFERENTIAL PRIVACY PRELIMINARIES AND A SIMPLE ANALYSIS OF PATE
93
+
94
+ Differential privacy (Dwork et al., 2006b; Dwork, 2011) has established itself as a strong standard. It provides privacy guarantees for algorithms analyzing databases, which in our case is a machine learning training algorithm processing a training dataset. Differential privacy is defined using pairs of adjacent databases: in the present work, these are datasets that only differ by one training example. Recall the following variant of differential privacy introduced in Dwork et al. (2006a).
95
+
96
+ Definition 1. A randomized mechanism $\mathcal { M }$ with domain $\mathcal { D }$ and range $\mathcal { R }$ satisfies $( \varepsilon , \delta )$ -differential privacy if for any two adjacent inputs $d , d ^ { \prime } \in \mathcal { D }$ and for any subset of outputs $S \subseteq \mathcal { R }$ it holds that:
97
+
98
+ $$
99
+ \operatorname* { P r } [ \mathcal { M } ( d ) \in S ] \leq e ^ { \varepsilon } \operatorname* { P r } [ \mathcal { M } ( d ^ { \prime } ) \in S ] + \delta .
100
+ $$
101
+
102
+ It will be useful to define the privacy loss and the privacy loss random variable. They capture the differences in the probability distribution resulting from running $\mathcal { M }$ on $d$ and $d ^ { \prime }$ .
103
+
104
+ Definition 2. Let $\mathcal { M } \colon \mathcal { D } \mathcal { R }$ be a randomized mechanism and $d , d ^ { \prime }$ a pair of adjacent databases. Let aux denote an auxiliary input. For an outcome $o \in \mathcal { R }$ , the privacy loss at o is defined as:
105
+
106
+ $$
107
+ c ( o ; \mathcal { M } , a u x , d , d ^ { \prime } ) \overset { \Delta } { = } \log \frac { \operatorname* { P r } [ \mathcal { M } ( a u x , d ) = o ] } { \operatorname* { P r } [ \mathcal { M } ( a u x , d ^ { \prime } ) = o ] } .
108
+ $$
109
+
110
+ The privacy loss random variable $C ( \mathcal { M } , a u x , d , d ^ { \prime } )$ is defined as $c ( \mathcal { M } ( d ) ; \mathcal { M } , a u x , d , d ^ { \prime } )$ , i.e. the random variable defined by evaluating the privacy loss at an outcome sampled from $\mathcal M ( d )$ .
111
+
112
+ A natural way to bound our approach’s privacy loss is to first bound the privacy cost of each label queried by the student, and then use the strong composition theorem (Dwork et al., 2010) to derive the total cost of training the student. For neighboring databases $d , d ^ { \prime }$ , each teacher gets the same training data partition (that is, the same for the teacher with $d$ and with $d ^ { \prime }$ , not the same across teachers), with the exception of one teacher whose corresponding training data partition differs. Therefore, the label counts $n _ { j } ( \vec { x } )$ for any example $\vec { x }$ , on $d$ and $d ^ { \prime }$ differ by at most 1 in at most two locations. In the next subsection, we show that this yields loose guarantees.
113
+
114
+ # 3.2 THE MOMENTS ACCOUNTANT: A BUILDING BLOCK FOR BETTER ANALYSIS
115
+
116
+ To better keep track of the privacy cost, we use recent advances in privacy cost accounting. The moments accountant was introduced by Abadi et al. (2016), building on previous work (Bun & Steinke, 2016; Dwork & Rothblum, 2016; Mironov, 2016).
117
+
118
+ Definition 3. Let $\mathcal { M } \colon \mathcal { D } \mathcal { R }$ be a randomized mechanism and $d , d ^ { \prime }$ a pair of adjacent databases. Let aux denote an auxiliary input. The moments accountant is defined as:
119
+
120
+ $$
121
+ \alpha _ { \mathcal { M } } ( \lambda ) \overset { \Delta } { = } \operatorname* { m a x } _ { a u x , d , d ^ { \prime } } \alpha _ { \mathcal { M } } ( \lambda ; a u x , d , d ^ { \prime } )
122
+ $$
123
+
124
+ where ${ \alpha } _ { \mathcal { M } } ( \lambda ; a u x , d , d ^ { \prime } ) \overset { \Delta } { = } \log \mathbb { E } [ \exp ( \lambda C ( \mathcal { M } , a u x , d , d ^ { \prime } ) ) ]$ is the moment generating function of the privacy loss random variable.
125
+
126
+ The following properties of the moments accountant are proved in Abadi et al. (2016).
127
+
128
+ Theorem 1. 1. [Composability] Suppose that a mechanism $\mathcal { M }$ consists of a sequence of adaptive mechanisms $\mathcal { M } _ { 1 } , \ldots , \mathcal { M } _ { k }$ where $\begin{array} { r } { \mathcal { M } _ { i } \colon \prod _ { j = 1 } ^ { i - 1 } \mathcal { R } _ { j } \times \mathcal { D } \to \mathcal { R } _ { i } } \end{array}$ . Then, for any output sequence $o _ { 1 } , \ldots , o _ { k - 1 }$ and any $\lambda$
129
+
130
+ $$
131
+ \alpha _ { \mathcal { M } } ( \lambda ; d , d ^ { \prime } ) = \sum _ { i = 1 } ^ { k } \alpha _ { \mathcal { M } _ { i } } ( \lambda ; o _ { 1 } , \ldots , o _ { i - 1 } , d , d ^ { \prime } ) ,
132
+ $$
133
+
134
+ where $\alpha _ { \mathcal { M } }$ is conditioned on $\mathcal { M } _ { i }$ ’s output being $o _ { i }$ for $i < k$ .
135
+
136
+ 2. [Tail bound] For any $\varepsilon > 0$ , the mechanism $\mathcal { M }$ is $( \varepsilon , \delta )$ -differentially private for
137
+
138
+ $$
139
+ \delta = \operatorname* { m i n } _ { \lambda } \exp ( \alpha _ { \mathcal { M } } ( \lambda ) - \lambda \varepsilon ) .
140
+ $$
141
+
142
+ We write down two important properties of the aggregation mechanism from Section 2. The first property is proved in Dwork & Roth (2014), and the second follows from Bun & Steinke (2016).
143
+
144
+ Theorem 2. Suppose that on neighboring databases $d , d ^ { \prime }$ , the label counts $n _ { j }$ differ by at most $^ { l }$ in each coordinate. Let $\mathcal { M }$ be the mechanism that reports $\arg \operatorname* { m a x } _ { j } \left\{ n _ { j } + L a p ( \textstyle { \frac { 1 } { \gamma } } ) \right\}$ . Then $\mathcal { M }$ satisfies $( 2 \gamma , 0 )$ -differential privacy. Moreover, for any $l$ , aux, $d$ and $d ^ { \prime }$ ,
145
+
146
+ $$
147
+ \alpha ( l ; a u x , d , d ^ { \prime } ) \le 2 \gamma ^ { 2 } l ( l + 1 )
148
+ $$
149
+
150
+ At each step, we use the aggregation mechanism with noise $L a p ( \textstyle { \frac { 1 } { \gamma } } )$ which is $( 2 \gamma , 0 )$ -DP. Thus over $T$ steps, we get $( 4 T \gamma ^ { 2 } + 2 \gamma \sqrt { 2 T \ln \frac { 1 } { \delta } } , \delta )$ -differential privacy. This can be rather large: plugging in values that correspond to our SVHN result, $\gamma = 0 . 0 5 , T = 1 0 0 0 , \delta = 1 \mathrm { e } { - 6 }$ gives us $\varepsilon \approx 2 6$ or alternatively plugging in values that correspond to our MNIST result, $\gamma = 0 . 0 5 , T = 1 0 0 , \delta = 1 \mathrm { e } { - 5 }$ gives us $\varepsilon \approx 5 . 8 0$ .
151
+
152
+ # 3.3 A PRECISE, DATA-DEPENDENT PRIVACY ANALYSIS OF PATE
153
+
154
+ Our data-dependent privacy analysis takes advantage of the fact that when the quorum among the teachers is very strong, the majority outcome has overwhelming likelihood, in which case the privacy cost is small whenever this outcome occurs. The moments accountant allows us analyze the composition of such mechanisms in a unified framework.
155
+
156
+ The following theorem, proved in Appendix A, provides a data-dependent bound on the moments of any differentially private mechanism where some specific outcome is very likely.
157
+
158
+ ThLet . Letand $\mathcal { M }$ $( 2 \gamma , 0 )$ -differentially private and hen for any aux and any n $q \geq \operatorname* { P r } [ \mathcal { M } ( d ) \neq o ^ { * } ]$ for some outcome atisfies $o ^ { * }$ $l , \gamma \geq 0$ $\begin{array} { r } { q < \frac { e ^ { 2 \gamma } - 1 } { e ^ { 4 \gamma } - 1 } } \end{array}$ $d ^ { \prime }$ $\mathcal { M }$
159
+
160
+ $$
161
+ \alpha ( l ; a u x , d , d ^ { \prime } ) \le \log ( ( 1 - q ) \Big ( \frac { 1 - q } { 1 - e ^ { 2 \gamma } q } \Big ) ^ { l } + q \exp ( 2 \gamma l ) ) .
162
+ $$
163
+
164
+ To upper bound $q$ for our aggregation mechanism, we use the following simple lemma, also proved in Appendix A.
165
+
166
+ Lemma 4. Let n be the label score vector for a database $d$ with $n _ { j ^ { * } } \geq n _ { j }$ for all $j$ . Then
167
+
168
+ $$
169
+ \operatorname* { P r } [ \mathcal { M } ( d ) \neq j ^ { * } ] \le \sum _ { j \neq j ^ { * } } \frac { 2 + \gamma ( n _ { j ^ { * } } - n _ { j } ) } { 4 \exp ( \gamma ( n _ { j ^ { * } } - n _ { j } ) ) }
170
+ $$
171
+
172
+ This allows us to upper bound $q$ for a specific score vector $\mathbf { n }$ , and hence bound specific moments. We take the smaller of the bounds we get from Theorems 2 and 3. We compute these moments for a few values of $\lambda$ (integers up to 8). Theorem 1 allows us to add these bounds over successive steps, and derive an $( \varepsilon , \delta )$ guarantee from the final $\alpha$ . Interested readers are referred to the script that we used to empirically compute these bounds, which is released along with our code: https://github. com/tensorflow/models/tree/master/differential_privacy/multiple_teachers
173
+
174
+ Since the privacy moments are themselves now data dependent, the final $\varepsilon$ is itself data-dependent and should not be revealed. To get around this, we bound the smooth sensitivity (Nissim et al., 2007) of the moments and add noise proportional to it to the moments themselves. This gives us a differentially private estimate of the privacy cost. Our evaluation in Section 4 ignores this overhead and reports the un-noised values of $\varepsilon$ . Indeed, in our experiments on MNIST and SVHN, the scale of the noise one needs to add to the released $\varepsilon$ is smaller than 0.5 and 1.0 respectively.
175
+
176
+ How does the number of teachers affect the privacy cost? Recall that the student uses a noisy label computed in (1) which has a parameter $\gamma$ . To ensure that the noisy label is likely to be the correct one, the noise scale $\frac { 1 } { \gamma }$ should be small compared to the the additive gap between the two largest vales of $n _ { j }$ . While the exact dependence of $\gamma$ on the privacy cost in Theorem 3 is subtle, as a general principle, a smaller $\gamma$ leads to a smaller privacy cost. Thus, a larger gap translates to a smaller privacy cost. Since the gap itself increases with the number of teachers, having more teachers would lower the privacy cost. This is true up to a pofraction of the training data. For large enough t. With , each te $n$ teachers, each teacher only trains on a hers will have too little training data to $\textstyle { \frac { 1 } { n } }$ $n$
177
+ accurate.
178
+
179
+ To conclude, we note that our analysis is rather conservative in that it pessimistically assumes that, even if just one example in the training set for one teacher changes, the classifier produced by that teacher may change arbitrarily. One advantage of our approach, which enables its wide applicability, is that our analysis does not require any assumptions about the workings of the teachers. Nevertheless, we expect that stronger privacy guarantees may perhaps be established in specific settings—when assumptions can be made on the learning algorithm used to train the teachers.
180
+
181
+ # 4 EVALUATION
182
+
183
+ In our evaluation of PATE and its generative variant PATE-G, we first train a teacher ensemble for each dataset. The trade-off between the accuracy and privacy of labels predicted by the ensemble is greatly dependent on the number of teachers in the ensemble: being able to train a large set of teachers is essential to support the injection of noise yielding strong privacy guarantees while having a limited impact on accuracy. Second, we minimize the privacy budget spent on learning the student by training it with as few queries to the ensemble as possible.
184
+
185
+ Our experiments use MNIST and the extended SVHN datasets. Our MNIST model stacks two convolutional layers with max-pooling and one fully connected layer with ReLUs. When trained on the entire dataset, the non-private model has a $9 9 . 1 8 \%$ test accuracy. For SVHN, we add two hidden layers.1 The non-private model achieves a $9 2 . 8 \%$ test accuracy, which is shy of the state-of-the-art. However, we are primarily interested in comparing the private student’s accuracy with the one of a non-private model trained on the entire dataset, for different privacy guarantees. The source code for reproducing the results in this section is available on GitHub.2
186
+
187
+ # 4.1 TRAINING AN ENSEMBLE OF TEACHERS PRODUCING PRIVATE LABELS
188
+
189
+ As mentioned above, compensating the noise introduced by the Laplacian mechanism presented in Equation 1 requires large ensembles. We evaluate the extent to which the two datasets considered can be partitioned with a reasonable impact on the performance of individual teachers. Specifically, we show that for MNIST and SVHN, we are able to train ensembles of 250 teachers. Their aggregated predictions are accurate despite the injection of large amounts of random noise to ensure privacy. The aggregation mechanism output has an accuracy of $9 3 . 1 8 \%$ for MNIST and $8 7 . 7 9 \%$ for SVHN, when evaluated on their respective test sets, while each query has a low privacy budget of $\varepsilon = 0 . 0 5$ .
190
+
191
+ Prediction accuracy: All other things being equal, the number $n$ of teachers is limited by a tradeoff between the classification task’s complexity and the available data. We train $n$ teachers by partitioning the training data $n$ -way. Larger values of $n$ lead to larger absolute gaps, hence potentially allowing for a larger noise level and stronger privacy guarantees. At the same time, a larger $n$ implies a smaller training dataset for each teacher, potentially reducing the teacher accuracy. We empirically find appropriate values of $n$ for the MNIST and SVHN datasets by measuring the test set accuracy of each teacher trained on one of the $n$ partitions of the training data. We find that even for $n = 2 5 0$ , the average test accuracy of individual teachers is $8 3 . 8 6 \%$ for MNIST and $8 3 . 1 8 \%$ for SVHN. The larger size of SVHN compensates its increased task complexity.
192
+
193
+ ![](images/3d0f2414761710708a40157a3a73fa2cbadf0de052c528d51a20b9d0479cf0ce.jpg)
194
+ Figure 2: How much noise can be injected to a query? Accuracy of the noisy aggregation for three MNIST and SVHN teacher ensembles and varying $\gamma$ value per query. The noise introduced to achieve a given $\gamma$ scales inversely proportionally to the value of $\gamma$ : small values of $\gamma$ on the left of the axis correspond to large noise amplitudes and large $\gamma$ values on the right to small noise.
195
+
196
+ ![](images/a66ae0d26ae3c231407e574c5df899a89e0dda53ec25eee418372deea7ce68b9.jpg)
197
+ Figure 3: How certain is the aggregation of teacher predictions? Gap between the number of votes assigned to the most and second most frequent labels normalized by the number of teachers in an ensemble. Larger gaps indicate that the ensemble is confident in assigning the labels, and will be robust to more noise injection. Gaps were computed by averaging over the test data.
198
+
199
+ Prediction confidence: As outlined in Section 3, the privacy of predictions made by an ensemble of teachers intuitively requires that a quorum of teachers generalizing well agree on identical labels. This observation is reflected by our data-dependent privacy analysis, which provides stricter privacy bounds when the quorum is strong. We study the disparity of labels assigned by teachers. In other words, we count the number of votes for each possible label, and measure the difference in votes between the most popular label and the second most popular label, i.e., the gap. If the gap is small, introducing noise during aggregation might change the label assigned from the first to the second. Figure 3 shows the gap normalized by the total number of teachers $n$ . As $n$ increases, the gap remains larger than $6 0 \%$ of the teachers, allowing for aggregation mechanisms to output the correct label in the presence of noise.
200
+
201
+ Noisy aggregation: For MNIST and SVHN, we consider three ensembles of teachers with varying number of teachers $n \in \{ 1 0 , 1 0 0 , 2 5 0 \}$ . For each of them, we perturb the vote counts with Laplacian noise of inversed scale $\gamma$ ranging between 0.01 and 1. This choice is justified below in Section 4.2. We report in Figure 2 the accuracy of test set labels inferred by the noisy aggregation mechanism for these values of $\varepsilon$ . Notice that the number of teachers needs to be large to compensate for the impact of noise injection on the accuracy.
202
+
203
+ # 4.2 SEMI-SUPERVISED TRAINING OF THE STUDENT WITH PRIVACY
204
+
205
+ The noisy aggregation mechanism labels the student’s unlabeled training set in a privacy-preserving fashion. To reduce the privacy budget spent on student training, we are interested in making as few label queries to the teachers as possible. We therefore use the semi-supervised training approach described previously. Our MNIST and SVHN students with $( \varepsilon , \delta )$ differential privacy of $( 2 . 0 4 , 1 0 ^ { - 5 } )$ ) and (8.19, $1 0 ^ { - 6 } )$ achieve accuracies of $9 8 . 0 0 \%$ and $9 0 . 6 6 \%$ . These results improve the differential privacy state-of-the-art for these datasets. Abadi et al. (2016) previously obtained $9 7 \%$ accuracy with a $( 8 , 1 0 ^ { - 5 } )$ bound on MNIST, starting from an inferior baseline model without privacy. Shokri & Shmatikov (2015) reported about $9 2 \%$ accuracy on SVHN with $\varepsilon > 2$ per model parameter and a model with over 300,000 parameters. Naively, this corresponds to a total $\varepsilon > 6 0 0 , 0 0 0$ .
206
+
207
+ Figure 4: Utility and privacy of the semi-supervised students: each row is a variant of the student model trained with generative adversarial networks in a semi-supervised way, with a different number of label queries made to the teachers through the noisy aggregation mechanism. The last column reports the accuracy of the student and the second and third column the bound $\varepsilon$ and failure probability $\delta$ of the $( \varepsilon , \delta )$ differential privacy guarantee.
208
+
209
+ <table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>E</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>Queries</td><td rowspan=1 colspan=1>Non-Private Baseline</td><td rowspan=1 colspan=1> Student Accuracy</td></tr><tr><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>2.04</td><td rowspan=1 colspan=1>10-5</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>99.18%</td><td rowspan=1 colspan=1>98.00%</td></tr><tr><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>8.03</td><td rowspan=1 colspan=1>10-5</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1>99.18%</td><td rowspan=1 colspan=1>98.10%</td></tr><tr><td rowspan=1 colspan=1>SVHN</td><td rowspan=1 colspan=1>5.04</td><td rowspan=1 colspan=1>10-6</td><td rowspan=1 colspan=1>500</td><td rowspan=1 colspan=1>92.80%</td><td rowspan=1 colspan=1>82.72%</td></tr><tr><td rowspan=1 colspan=1>SVHN</td><td rowspan=1 colspan=1>8.19</td><td rowspan=1 colspan=1>10-6</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1>92.80%</td><td rowspan=1 colspan=1>90.66%</td></tr></table>
210
+
211
+ We apply semi-supervised learning with GANs to our problem using the following setup for each dataset. In the case of MNIST, the student has access to 9,000 samples, among which a subset of either 100, 500, or 1,000 samples are labeled using the noisy aggregation mechanism discussed in Section 2.1. Its performance is evaluated on the 1,000 remaining samples of the test set. Note that this may increase the variance of our test set accuracy measurements, when compared to those computed over the entire test data. For the MNIST dataset, we randomly shuffle the test set to ensure that the different classes are balanced when selecting the (small) subset labeled to train the student. For SVHN, the student has access to 10,000 training inputs, among which it labels 500 or 1,000 samples using the noisy aggregation mechanism. Its performance is evaluated on the remaining 16,032 samples. For both datasets, the ensemble is made up of 250 teachers. We use Laplacian scale of 20 to guarantee an individual query privacy bound of $\varepsilon = 0 . 0 5$ . These parameter choices are motivated by the results from Section 4.1.
212
+
213
+ In Figure 4, we report the values of the $( \varepsilon , \delta )$ differential privacy guarantees provided and the corresponding student accuracy, as well as the number of queries made by each student. The MNIST student is able to learn a $9 8 \%$ accurate model, which is shy of $1 \%$ when compared to the accuracy of a model learned with the entire training set, with only 100 label queries. This results in a strict differentially private bound of $\varepsilon = 2 . 0 4$ for a failure probability fixed at $1 0 ^ { - 5 }$ . The SVHN student achieves $9 0 . 6 6 \%$ accuracy, which is also comparable to the $9 2 . 8 0 \%$ accuracy of one teacher learned with the entire training set. The corresponding privacy bound is $\varepsilon = 8 . 1 9$ , which is higher than for the MNIST dataset, likely because of the larger number of queries made to the aggregation mechanism.
214
+
215
+ We observe that our private student outperforms the aggregation’s output in terms of accuracy, with or without the injection of Laplacian noise. While this shows the power of semi-supervised learning, the student may not learn as well on different kinds of data (e.g., medical data), where categories are not explicitly designed by humans to be salient in the input space. Encouragingly, as Appendix C illustrates, the PATE approach can be successfully applied to at least some examples of such data.
216
+
217
+ # 5 DISCUSSION AND RELATED WORK
218
+
219
+ Several privacy definitions are found in the literature. For instance, $k$ -anonymity requires information about an individual to be indistinguishable from at least $k - 1$ other individuals in the dataset (L. Sweeney, 2002). However, its lack of randomization gives rise to caveats (Dwork & Roth, 2014), and attackers can infer properties of the dataset (Aggarwal, 2005). An alternative definition, differential privacy, established itself as a rigorous standard for providing privacy guarantees (Dwork et al., 2006b). In contrast to $k$ -anonymity, differential privacy is a property of the randomized algorithm and not the dataset itself.
220
+
221
+ A variety of approaches and mechanisms can guarantee differential privacy. Erlingsson et al. (2014) showed that randomized response, introduced by Warner (1965), can protect crowd-sourced data collected from software users to compute statistics about user behaviors. Attempts to provide differential privacy for machine learning models led to a series of efforts on shallow machine learning models, including work by Bassily et al. (2014); Chaudhuri & Monteleoni (2009); Pathak et al. (2011); Song et al. (2013), and Wainwright et al. (2012).
222
+
223
+ A privacy-preserving distributed SGD algorithm was introduced by Shokri & Shmatikov (2015). It applies to non-convex models. However, its privacy bounds are given per-parameter, and the large number of parameters prevents the technique from providing a meaningful privacy guarantee. Abadi et al. (2016) provided stricter bounds on the privacy loss induced by a noisy SGD by introducing the moments accountant. In comparison with these efforts, our work increases the accuracy of a private MNIST model from $9 7 \%$ to ${ \bar { 9 } } 8 \%$ while improving the privacy bound $\varepsilon$ from 8 to 1.9. Furthermore, the PATE approach is independent of the learning algorithm, unlike this previous work. Support for a wide range of architecture and training algorithms allows us to obtain good privacy bounds on an accurate and private SVHN model. However, this comes at the cost of assuming that nonprivate unlabeled data is available, an assumption that is not shared by (Abadi et al., 2016; Shokri & Shmatikov, 2015).
224
+
225
+ Pathak et al. (2010) first discussed secure multi-party aggregation of locally trained classifiers for a global classifier hosted by a trusted third-party. Hamm et al. (2016) proposed the use of knowledge transfer between a collection of models trained on individual devices into a single model guaranteeing differential privacy. Their work studied linear student models with convex and continuously differentiable losses, bounded and $c$ -Lipschitz derivatives, and bounded features. The PATE approach of this paper is not constrained to such applications, but is more generally applicable.
226
+
227
+ Previous work also studied semi-supervised knowledge transfer from private models. For instance, Jagannathan et al. (2013) learned privacy-preserving random forests. A key difference is that their approach is tailored to decision trees. PATE works well for the specific case of decision trees, as demonstrated in Appendix C, and is also applicable to other machine learning algorithms, including more complex ones. Another key difference is that Jagannathan et al. (2013) modified the classic model of a decision tree to include the Laplacian mechanism. Thus, the privacy guarantee does not come from the disjoint sets of training data analyzed by different decision trees in the random forest, but rather from the modified architecture. In contrast, partitioning is essential to the privacy guarantees of the PATE approach.
228
+
229
+ # 6 CONCLUSIONS
230
+
231
+ To protect the privacy of sensitive training data, this paper has advanced a learning strategy and a corresponding privacy analysis. The PATE approach is based on knowledge aggregation and transfer from “teacher” models, trained on disjoint data, to a “student” model whose attributes may be made public. In combination, the paper’s techniques demonstrably achieve excellent utility on the MNIST and SVHN benchmark tasks, while simultaneously providing a formal, state-of-the-art bound on users’ privacy loss. While our results are not without limits—e.g., they require disjoint training data for a large number of teachers (whose number is likely to increase for tasks with many output classes)—they are encouraging, and highlight the advantages of combining semi-supervised learning with precise, data-dependent privacy analysis, which will hopefully trigger further work. In particular, such future work may further investigate whether or not our semi-supervised approach will also reduce teacher queries for tasks other than MNIST and SVHN, for example when the discrete output categories are not as distinctly defined by the salient input space features.
232
+
233
+ A key advantage is that this paper’s techniques establish a precise guarantee of training data privacy in a manner that is both intuitive and rigorous. Therefore, they can be appealing, and easily explained, to both an expert and non-expert audience. However, perhaps equally compelling are the techniques’ wide applicability. Both our learning approach and our analysis methods are “blackbox,” i.e., independent of the learning algorithm for either teachers or students, and therefore apply, in general, to non-convex, deep learning, and other learning methods. Also, because our techniques do not constrain the selection or partitioning of training data, they apply when training data is naturally and non-randomly partitioned—e.g., because of privacy, regulatory, or competitive concerns— or when each teacher is trained in isolation, with a different method. We look forward to such further applications, for example on RNNs and other sequence-based models.
234
+
235
+ # ACKNOWLEDGMENTS
236
+
237
+ Nicolas Papernot is supported by a Google PhD Fellowship in Security. The authors would like to thank Ilya Mironov and Li Zhang for insightful discussions about early drafts of this document.
238
+
239
+ # REFERENCES
240
+
241
+ Martin Abadi, Andy Chu, Ian Goodfellow, H. Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security. ACM, 2016.
242
+
243
+ Charu C Aggarwal. On k-anonymity and the curse of dimensionality. In Proceedings of the 31st International Conference on Very Large Data Bases, pp. 901–909. VLDB Endowment, 2005.
244
+
245
+ Babak Alipanahi, Andrew Delong, Matthew T Weirauch, and Brendan J Frey. Predicting the sequence specificities of DNA-and RNA-binding proteins by deep learning. Nature biotechnology, 2015.
246
+
247
+ Dana Angluin. Queries and concept learning. Machine learning, 2(4):319–342, 1988.
248
+
249
+ Raef Bassily, Adam Smith, and Abhradeep Thakurta. Differentially private empirical risk minimization: efficient algorithms and tight error bounds. arXiv preprint arXiv:1405.7085, 2014.
250
+
251
+ Eric B Baum. Neural net algorithms that learn in polynomial time from examples and queries. IEEE Transactions on Neural Networks, 2(1):5–19, 1991.
252
+
253
+ Leo Breiman. Bagging predictors. Machine Learning, 24(2):123–140, 1994.
254
+
255
+ Jane Bromley, James W Bentz, Leon Bottou, Isabelle Guyon, Yann LeCun, Cliff Moore, Eduard ´ Sackinger, and Roopak Shah. Signature verification using a “Siamese” time delay neural network.¨ International Journal of Pattern Recognition and Artificial Intelligence, 7(04):669–688, 1993.
256
+
257
+ Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In Proceedings of the 12th ACM International Conference on Knowledge Discovery and Data mining, pp. 535–541. ACM, 2006.
258
+
259
+ Mark Bun and Thomas Steinke. Concentrated differential privacy: simplifications, extensions, and lower bounds. In Proceedings of TCC, 2016.
260
+
261
+ Kamalika Chaudhuri and Claire Monteleoni. Privacy-preserving logistic regression. In Advances in Neural Information Processing Systems, pp. 289–296, 2009.
262
+
263
+ Kamalika Chaudhuri, Claire Monteleoni, and Anand D Sarwate. Differentially private empirical risk minimization. Journal of Machine Learning Research, 12(Mar):1069–1109, 2011.
264
+
265
+ Thomas G Dietterich. Ensemble methods in machine learning. In International workshop on multiple classifier systems, pp. 1–15. Springer, 2000.
266
+
267
+ Cynthia Dwork. A firm foundation for private data analysis. Communications of the ACM, 54(1): 86–95, 2011.
268
+
269
+ Cynthia Dwork and Aaron Roth. The algorithmic foundations of differential privacy. Foundations and Trends in Theoretical Computer Science, 9(3-4):211–407, 2014.
270
+
271
+ Cynthia Dwork and Guy N Rothblum. Concentrated differential privacy. arXiv preprint arXiv:1603.01887, 2016.
272
+
273
+ Cynthia Dwork, Krishnaram Kenthapadi, Frank McSherry, Ilya Mironov, and Moni Naor. Our data, ourselves: privacy via distributed noise generation. In Advances in Cryptology-EUROCRYPT 2006, pp. 486–503. Springer, 2006a.
274
+
275
+ Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam Smith. Calibrating noise to sensitivity in private data analysis. In Theory of Cryptography, pp. 265–284. Springer, 2006b.
276
+
277
+ Cynthia Dwork, Guy N Rothblum, and Salil Vadhan. Boosting and differential privacy. In Proceedings of the 51st IEEE Symposium on Foundations of Computer Science, pp. 51–60. IEEE, 2010.
278
+
279
+ Ulfar Erlingsson, Vasyl Pihur, and Aleksandra Korolova. RAPPOR: Randomized aggregatable ´ privacy-preserving ordinal response. In Proceedings of the 2014 ACM SIGSAC Conference on Computer and Communications Security, pp. 1054–1067. ACM, 2014.
280
+
281
+ Matt Fredrikson, Somesh Jha, and Thomas Ristenpart. Model inversion attacks that exploit confidence information and basic countermeasures. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security, pp. 1322–1333. ACM, 2015.
282
+
283
+ 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.
284
+
285
+ Jihun Hamm, Paul Cao, and Mikhail Belkin. Learning privately from multiparty data. arXiv preprint arXiv:1602.03552, 2016.
286
+
287
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
288
+
289
+ Geetha Jagannathan, Claire Monteleoni, and Krishnan Pillaipakkamnatt. A semi-supervised learning approach to differential privacy. In 2013 IEEE 13th International Conference on Data Mining Workshops, pp. 841–848. IEEE, 2013.
290
+
291
+ Anjuli Kannan, Karol Kurach, Sujith Ravi, Tobias Kaufmann, Andrew Tomkins, Balint Miklos, Greg Corrado, et al. Smart reply: Automated response suggestion for email. In Proceedings of the ACM SIGKDD Conference on Knowledge Discovery and Data mining, volume 36, pp. 495–503, 2016.
292
+
293
+ Gregory Koch. Siamese neural networks for one-shot image recognition. PhD thesis, University of Toronto, 2015.
294
+
295
+ Igor Kononenko. Machine learning for medical diagnosis: history, state of the art and perspective. Artificial Intelligence in medicine, 23(1):89–109, 2001.
296
+
297
+ L. Sweeney. k-anonymity: A model for protecting privacy. volume 10, pp. 557–570. World Scientific, 2002.
298
+
299
+ Ilya Mironov. Renyi differential privacy. manuscript, 2016.
300
+
301
+ Kobbi Nissim, Sofya Raskhodnikova, and Adam Smith. Smooth sensitivity and sampling in private data analysis. In Proceedings of the 39th annual ACM Symposium on Theory of Computing, pp. 75–84. ACM, 2007.
302
+
303
+ Manas Pathak, Shantanu Rane, and Bhiksha Raj. Multiparty differential privacy via aggregation of locally trained classifiers. In Advances in Neural Information Processing Systems, pp. 1876–1884, 2010.
304
+
305
+ Manas Pathak, Shantanu Rane, Wei Sun, and Bhiksha Raj. Privacy preserving probabilistic inference with hidden markov models. In 2011 IEEE International Conference on Acoustics, Speech and Signal Processing, pp. 5868–5871. IEEE, 2011.
306
+
307
+ Jason Poulos and Rafael Valle. Missing data imputation for supervised learning. arXiv preprint arXiv:1610.09075, 2016.
308
+
309
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. arXiv preprint arXiv:1606.03498, 2016.
310
+
311
+ Reza Shokri and Vitaly Shmatikov. Privacy-preserving deep learning. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security. ACM, 2015.
312
+
313
+ Shuang Song, Kamalika Chaudhuri, and Anand D Sarwate. Stochastic gradient descent with differentially private updates. In Global Conference on Signal and Information Processing, pp. 245–248. IEEE, 2013.
314
+
315
+ Latanya Sweeney. Weaving technology and policy together to maintain confidentiality. The Journal of Law, Medicine & Ethics, 25(2-3):98–110, 1997.
316
+
317
+ Martin J Wainwright, Michael I Jordan, and John C Duchi. Privacy aware learning. In Advances in Neural Information Processing Systems, pp. 1430–1438, 2012.
318
+
319
+ Stanley L Warner. Randomized response: A survey technique for eliminating evasive answer bias. Journal of the American Statistical Association, 60(309):63–69, 1965.
320
+
321
+ # A MISSING DETAILS ON THE ANALYSIS
322
+
323
+ We provide missing proofs from Section 3.
324
+
325
+ ThLet . Letand $\mathcal { M }$ $( 2 \gamma , 0 )$ -differentially private and hen for any aux and any n $q \geq \operatorname* { P r } [ \mathcal { M } ( d ) \neq o ^ { * } ]$ for some outcome atisfies $o ^ { * }$ . $l , \gamma \geq 0$ $q < \frac { e ^ { 2 \gamma } - 1 } { e ^ { 4 \gamma } - 1 }$ $d ^ { \prime }$ $\mathcal { M }$
326
+
327
+ $$
328
+ \alpha ( l ; a u x , d , d ^ { \prime } ) \le \log ( ( 1 - q ) \Big ( \frac { 1 - q } { 1 - e ^ { 2 \gamma } q } \Big ) ^ { l } + q \exp ( 2 \gamma l ) ) .
329
+ $$
330
+
331
+ Proof. Since M is 2γ-differentially private, for every outcome o, P r[M(d)=o]P r[M(d0)=o] $\frac { P r [ M ( d ) = o ] } { P r [ M ( d ^ { \prime } ) = o ] } \ \leq \ \exp ( 2 \gamma )$ . Let $q ^ { \prime } = P r [ M ( d ) \neq o ^ { * } ]$ . Then $P r [ M ( d ^ { \prime } ) \neq o ^ { * } ] \leq \exp ( 2 \gamma ) q ^ { \prime }$ . Thus
332
+
333
+ $$
334
+ \begin{array} { r l } { { \operatorname { N p } ( \alpha ( l ; \mathbf { a u x } , d , d ^ { \prime } ) ) = \sum _ { o } \operatorname* { P r } [ M ( d ) = o ] \Big ( \frac { \operatorname* { P r } [ M ( d ) = o ] } { \operatorname* { P r } [ M ( d ^ { \prime } ) = o ] } \Big ) ^ { l } } } \\ & { = \operatorname* { P r } [ M ( d ) = o ^ { * } ] \Big ( \frac { \operatorname* { P r } [ M ( d ) = o ^ { * } ] } { \operatorname* { P r } [ M ( d ^ { \prime } ) = o ^ { * } ] } \Big ) ^ { l } + \sum _ { o \neq o ^ { * } } \operatorname* { P r } [ M ( d ) = o ] \Big ( \frac { \operatorname* { P r } [ M ( d ) = o ] } { \operatorname* { P r } [ M ( d ^ { \prime } ) = o ] } \Big ) } \\ & { \leq ( 1 - q ^ { \prime } ) \Big ( \frac { 1 - q ^ { \prime } } { 1 - e ^ { 2 \gamma } q ^ { \prime } } \Big ) ^ { l } + \sum _ { o \neq o ^ { * } } \operatorname* { P r } [ M ( d ) = o ] ( e ^ { 2 \gamma } ) ^ { l } } \\ & { \leq ( 1 - q ^ { \prime } ) \big ( \frac { 1 - q ^ { \prime } } { 1 - e ^ { 2 \gamma } q ^ { \prime } } \big ) ^ { l } + q ^ { \prime } e ^ { 2 \gamma l } . } \end{array}
335
+ $$
336
+
337
+ Now consider the function
338
+
339
+ $$
340
+ f ( z ) = ( 1 - z ) \Bigl ( \frac { 1 - z } { 1 - e ^ { 2 \gamma } z } \Bigr ) ^ { l } + z e ^ { 2 \gamma l } .
341
+ $$
342
+
343
+ We next argue that this function is non-decreasing in $( 0 , { \frac { e ^ { 2 \gamma } - 1 } { e ^ { 4 \gamma } - 1 } } )$ under the conditions of the lemma. Towards this goal, define
344
+
345
+ $$
346
+ g ( z , w ) = ( 1 - z ) \Big ( \frac { 1 - w } { 1 - e ^ { 2 \gamma } w } \Big ) ^ { l } + z e ^ { 2 \gamma l } ,
347
+ $$
348
+
349
+ and observe that $f ( z ) = g ( z , z )$ . We can easily verify by differentiation that $g ( z , w )$ is increasing individually in $z$ and in $w$ in the range of interest. This implies that $f ( q ^ { \prime } ) \leq f ( q )$ completing the proof. □
350
+
351
+ Lemma 4. Let n be the label score vector for a database $d$ with $n _ { j ^ { * } } \geq n _ { j }$ for all $j$ . Then
352
+
353
+ $$
354
+ \operatorname* { P r } [ \mathcal { M } ( d ) \neq j ^ { * } ] \leq \sum _ { j \neq j ^ { * } } \frac { 2 + \gamma ( n _ { j ^ { * } } - n _ { j } ) } { 4 \exp ( \gamma ( n _ { j ^ { * } } - n _ { j } ) ) }
355
+ $$
356
+
357
+ Proof. The probability that $\begin{array} { r } { n _ { j ^ { * } } + L a p ( \frac { 1 } { \gamma } ) < n _ { j } + L a p ( \frac { 1 } { \gamma } ) } \end{array}$ is equal to the probability that the sum of two independent $L a p ( 1 )$ random variables exceeds $\gamma ( n _ { j ^ { * } } - n _ { j } )$ . The sum of two independent $L a p ( 1 )$ variables has the same distribution as the difference of two $G a m m a ( 2 , 1 )$ random variables. Recalling that the $G a m m a ( 2 , 1 )$ distribution has pdf $x e ^ { - x }$ , we can compute the pdf of the difference via convolution as
358
+
359
+ $$
360
+ \int _ { y = 0 } ^ { \infty } ( y + | x | ) e ^ { - y - | x | } y e ^ { - y } d y = { \frac { 1 } { e ^ { | x | } } } \int _ { y = 0 } ^ { \infty } ( y ^ { 2 } + y | x | ) e ^ { - 2 y } d y = { \frac { 1 + | x | } { 4 e ^ { | x | } } } .
361
+ $$
362
+
363
+ The probability mass in the tail can then be computed by integration as $\frac { 2 + \gamma ( n _ { j ^ { * } } - n _ { j } ) } { 4 \exp ( \gamma ( n _ { j ^ { * } } - n _ { j } ) }$ . Taking a union bound over the various candidate $j$ ’s gives the claimed bound. □
364
+
365
+ # B APPENDIX: TRAINING THE STUDENT WITH MINIMAL TEACHER QUERIES
366
+
367
+ In this appendix, we describe approaches that were considered to reduce the number of queries made to the teacher ensemble by the student during its training. As pointed out in Sections 3 and 4, this effort is motivated by the direct impact of querying on the total privacy cost associated with student training. The first approach is based on distillation, a technique used for knowledge transfer and model compression (Hinton et al., 2015). The three other techniques considered were proposed in the context of active learning, with the intent of identifying training examples most useful for learning. In Sections 2 and 4, we described semi-supervised learning, which yielded the best results. The student models in this appendix differ from those in Sections 2 and 4, which were trained using GANs. In contrast, all students in this appendix were learned in a fully supervised fashion from a subset of public, labeled examples. Thus, the learning goal was to identify the subset of labels yielding the best learning performance.
368
+
369
+ # B.1 TRAINING STUDENTS USING DISTILLATION
370
+
371
+ Distillation is a knowledge transfer technique introduced as a means of compressing large models into smaller ones, while retaining their accuracy (Bucilua et al., 2006; Hinton et al., 2015). This is for instance useful to train models in data centers before deploying compressed variants in phones. The transfer is accomplished by training the smaller model on data that is labeled with probability vectors produced by the first model, which encode the knowledge extracted from training data. Distillation is parameterized by a temperature parameter $T$ , which controls the smoothness of probabilities output by the larger model: when produced at small temperatures, the vectors are discrete, whereas at high temperature, all classes are assigned non-negligible values. Distillation is a natural candidate to compress the knowledge acquired by the ensemble of teachers, acting as the large model, into a student, which is much smaller with $n$ times less trainable parameters compared to the $n$ teachers.
372
+
373
+ To evaluate the applicability of distillation, we consider the ensemble of $n = 5 0$ teachers for SVHN. In this experiment, we do not add noise to the vote counts when aggregating the teacher predictions. We compare the accuracy of three student models: the first is a baseline trained with labels obtained by plurality, the second and third are trained with distillation at $T \in \{ 1 , 5 \}$ . We use the first 10,000 samples from the test set as unlabeled data. Figure 5 reports the accuracy of the student model on the last 16,032 samples from the test set, which were not accessible to the model during training. It is plotted with respect to the number of samples used to train the student (and hence the number of queries made to the teacher ensemble). Although applying distillation yields classifiers that perform more accurately, the increase in accuracy is too limited to justify the increased privacy cost of revealing the entire probability vector output by the ensemble instead of simply the class assigned the largest number of votes. Thus, we turn to an investigation of active learning.
374
+
375
+ # B.2 ACTIVE LEARNING OF THE STUDENT
376
+
377
+ Active learning is a class of techniques that aims to identify and prioritize points in the student’s training set that have a high potential to contribute to learning (Angluin, 1988; Baum, 1991). If the label of an input in the student’s training set can be predicted confidently from what we have learned so far by querying the teachers, it is intuitive that querying it is not worth the privacy budget spent. In our experiments, we made several attempts before converging to a simpler final formulation.
378
+
379
+ Siamese networks: Our first attempt was to train a pair of siamese networks, introduced by Bromley et al. (1993) in the context of one-shot learning and later improved by Koch (2015). The siamese networks take two images as input and return 1 if the images are equal and 0 otherwise. They are two identical networks trained with shared parameters to force them to produce similar representations of the inputs, which are then compared using a distance metric to determine if the images are identical or not. Once the siamese models are trained, we feed them a pair of images where the first is unlabeled and the second labeled. If the unlabeled image is confidently matched with a known labeled image, we can infer the class of the unknown image from the labeled image. In our experiments, the siamese networks were able to say whether two images are identical or not, but did not generalize well: two images of the same class did not receive sufficiently confident matches. We also tried a variant of this approach where we trained the siamese networks to output 1 when the two images are of the same class and 0 otherwise, but the learning task proved too complicated to be an effective means for reducing the number of queries made to teachers.
380
+
381
+ ![](images/301e2803665289652cc9c4a671ef12c8391e1f4aac0f59022196ecd50bdf0862.jpg)
382
+ Figure 5: Influence of distillation on the accuracy of the SVHN student trained with respect to the initial number of training samples available to the student. The student is learning from $n = 5 0$ teachers, whose predictions are aggregated without noise: in case where only the label is returned, we use plurality, and in case a probability vector is returned, we sum the probability vectors output by each teacher before normalizing the resulting vector.
383
+
384
+ Collection of binary experts: Our second attempt was to train a collection of binary experts, one per class. An expert for class $j$ is trained to output 1 if the sample is in class $j$ and 0 otherwise. We first trained the binary experts by making an initial batch of queries to the teachers. Using the experts, we then selected available unlabeled student training points that had a candidate label score below 0.9 and at least 4 other experts assigning a score above 0.1. This gave us about 500 unconfident points for 1700 initial label queries. After labeling these unconfident points using the ensemble of teachers, we trained the student. Using binary experts improved the student’s accuracy when compared to the student trained on arbitrary data with the same number of teacher queries. The absolute increases in accuracy were however too limited—between $1 . 5 \%$ and $2 . 5 \%$ .
385
+
386
+ Identifying unconfident points using the student: This last attempt was the simplest yet the most effective. Instead of using binary experts to identify student training points that should be labeled by the teachers, we used the student itself. We asked the student to make predictions on each unlabeled training point available. We then sorted these samples by increasing values of the maximum probability assigned to a class for each sample. We queried the teachers to label these unconfident inputs first and trained the student again on this larger labeled training set. This improved the accuracy of the student when compared to the student trained on arbitrary data. For the same number of teacher queries, the absolute increases in accuracy of the student trained on unconfident inputs first when compared to the student trained on arbitrary data were in the order of $4 \% - 1 0 \%$ .
387
+
388
+ # C APPENDIX: ADDITIONAL EXPERIMENTS ON THE UCI ADULT AND DIABETES DATASETS
389
+
390
+ In order to further demonstrate the general applicability of our approach, we performed experiments on two additional datasets. While our experiments on MNIST and SVHN in Section 4 used convolutional neural networks and GANs, here we use random forests to train our teacher and student models for both of the datasets. Our new results on these datasets show that, despite the differing data types and architectures, we are able to provide meaningful privacy guarantees.
391
+
392
+ UCI Adult dataset: The UCI Adult dataset is made up of census data, and the task is to predict when individuals make over $\$ 50\mathrm { k }$ per year. Each input consists of 13 features (which include the age, workplace, education, occupation—see the UCI website for a full list3). The only pre-processing we apply to these features is to map all categorical features to numerical values by assigning an integer value to each possible category. The model is a random forest provided by the scikit-learn Python package. When training both our teachers and student, we keep all the default parameter values, except for the number of estimators, which we set to 100. The data is split between a training set of 32,562 examples, and a test set of 16,282 inputs.
393
+
394
+ UCI Diabetes dataset: The UCI Diabetes dataset includes de-identified records of diabetic patients and corresponding hospital outcomes, which we use to predict whether diabetic patients were readmitted less than 30 days after their hospital release. To the best of our knowledge, no particular classification task is considered to be a standard benchmark for this dataset. Even so, it is valuable to consider whether our approach is applicable to the likely classification tasks, such as readmission, since this dataset is collected in a medical environment—a setting where privacy concerns arise frequently. We select a subset of 18 input features from the 55 available in the dataset (to avoid features with missing values) and form a dataset balanced between the two output classes (see the UCI website for more details4). In class 0, we include all patients that were readmitted in a 30-day window, while class 1 includes all patients that were readmitted after 30 days or never readmitted at all. Our balanced dataset contains 34,104 training samples and 12,702 evaluation samples. We use a random forest model identical to the one described above in the presentation of the Adult dataset.
395
+
396
+ Experimental results: We apply our approach described in Section 2. For both datasets, we train ensembles of $n = 2 5 0$ random forests on partitions of the training data. We then use the noisy aggregation mechanism, where vote counts are perturbed with Laplacian noise of scale 0.05 to privately label the first 500 test set inputs. We train the student random forest on these 500 test set inputs and evaluate it on the last 11,282 test set inputs for the Adult dataset, and 6,352 test set inputs for the Diabetes dataset. These numbers deliberately leave out some of the test set, which allowed us to observe how the student performance-privacy trade-off was impacted by varying the number of private labels, as well as the Laplacian scale used when computing these labels.
397
+
398
+ For the Adult dataset, we find that our student model achieves an $8 3 \%$ accuracy for an $( \varepsilon , \delta ) =$ $( 2 . 6 6 , 1 0 ^ { - 5 } )$ differential privacy bound. Our non-private model on the dataset achieves $8 5 \%$ accuracy, which is comparable to the state-of-the-art accuracy of $8 6 \%$ on this dataset (Poulos & Valle, 2016). For the Diabetes dataset, we find that our privacy-preserving student model achieves a $9 3 . 9 4 \%$ accuracy for a $( \varepsilon , \delta ) = ( 1 . 4 4 , 1 0 ^ { - 5 } )$ differential privacy bound. Our non-private model on the dataset achieves $9 3 . 8 1 \%$ accuracy.
md/train/HylUPnVKvH/HylUPnVKvH.md ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MIX & MATCH: TRAINING CONVNETS WITH MIXED IMAGE SIZES FOR IMPROVED ACCURACY, SPEED AND SCALE RESILIENCY
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Convolutional neural networks (CNNs) are commonly trained using a fixed spatial image size predetermined for a given model. Although trained on images of a specific size, it is well established that CNNs can be used to evaluate a wide range of image sizes at test time, by adjusting the size of intermediate feature maps.
8
+
9
+ In this work, we describe and evaluate a novel mixed-size training regime that mixes several image sizes at training time. We demonstrate that models trained using our method are more resilient to image size changes and generalize well even on small images. This allows faster inference by using smaller images at test time. For instance, we receive a $7 6 . 4 3 \%$ top-1 accuracy using ResNet50 with an image size of 160, which matches the accuracy of the baseline model with $2 \times$ fewer computations. Furthermore, for a given image size used at test time, we show this method can be exploited either to accelerate training or the final test accuracy. For example, we are able to reach a $7 9 . 2 7 \%$ accuracy with a model evaluated at a 288 spatial size for a relative improvement of $1 4 \%$ over the baseline. Our PyTorch implementation and pre-trained models are publicly available1
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Convolutional neural networks are successfully used to solve various tasks across multiple domains such as visual (Krizhevsky et al., 2012; Ren et al., 2015), audio (van den Oord et al., 2016), language (Gehring et al., 2017) and speech (Abdel-Hamid et al., 2014). While scale-invariance is considered important for visual representations (Lowe, 1999), convolutional networks are not scale invariant with respect to the spatial resolution of the image input, as a change in image dimension may lead to a non-linear change of their output. Even though CNNs are able to achieve state-of-the
14
+
15
+ ![](images/1b579338f11246697fb783b19c8d0953fb640ad92da56184477f7a81c9df594d.jpg)
16
+ Figure 1: Test accuracy per image size, models trained on specific sizes (ResNet50, ImageNet).
17
+
18
+ art results in many tasks and domains, their sensitivity to the image size is an inherent deficiency that limits practical use cases and requires evaluation inputs to match training image size. For example, Touvron et al. (2019) demonstrated that networks trained on specific image size, perform poorly on other image sizes at evaluation, as shown in Figure 1.
19
+
20
+ Several works attempted to achieve scale invariance by modifying the network structure (Xu et al., 2014; Takahashi et al., 2017). However, the most common method is to artificially enlarge the dataset using a set of label-preserving transformations also known as ”data augmentation” (Krizhevsky et al., 2012; Howard, 2013). Several of these transformations scale and crop objects appearing within the data, thus increasing the network’s robustness to inputs of different scale.
21
+
22
+ Although not explicitly trained to handle varying image sizes, CNNs are commonly evaluated on multiple scales post training, such as in the case of detection (Lin et al., 2017; Redmon & Farhadi,
23
+
24
+ 2018) and segmentation (He et al., 2017) tasks. In these tasks, a network that was pretrained with fixed image size for classification is used as the backbone of a larger model that is expected to adapt to a wide variety of image sizes.
25
+
26
+ In this work, we will introduce a novel training regime, “MixSize” for convolutional networks that uses stochastic image and batch sizes. The main contributions of the MixSize regime are:
27
+
28
+ • Reducing image size sensitivity. We show that the MixSize training regime can improve model performance on a wide range of sizes used at evaluation.
29
+ • Faster inference. As our mixed-size models can be evaluated at smaller image sizes, we show up to $2 \times$ reduction in computations required at inference to reach the same accuracy as the baseline model.
30
+ • Faster training vs. high accuracy. We show that reducing the average image size at training leads to a trade-off between the time required to train the model and its final accuracy.
31
+
32
+ # 2 RELATED WORK
33
+
34
+ # 2.1 USING MULTIPLE IMAGE SIZES
35
+
36
+ Deep convolutional networks are traditionally trained using fixed-size inputs, with spatial dimensions $H \times W$ and a batch size $B$ . The network architecture is configured such that the spatial dimensions are reduced through strided pooling or convolutions, with the last classification layer applied on a $1 \times 1$ spatial dimension. Modern convolutional networks usually conclude with a final ”global” average pooling (Lin et al., 2013; Szegedy et al., 2015), that reduces any remaining spatial dimensions with a simple averaging operation. Modifying the spatial size of an input to a convolutional layer by a factor $\gamma$ , will yield an output with size scaled by the same factor $\gamma$ . This modification does not require any change to the number of parameters of the given convolutional layer, nor its underlying operation. Small changes in the expected size can occur, however, due to padding or strides performed by the layer. It was observed by practitioners and previous works that a network trained on a specific input dimension can still be used at inference using a modified image size to some extent (Simonyan & Zisserman, 2014). Moreover, evaluating with an image size that is larger than used for training can improve accuracy up to a threshold, after which it quickly deteriorates (Touvron et al., 2019).
37
+
38
+ Recently, Tan & Le (2019) showed a computational-vs-accuracy trade-off in scaling image size used to train and evaluate with a convolutional network. This finding is consistent with past findings, which demonstrated that training with a larger image size can result in a larger classification error (Szegedy et al., 2016; Huang et al., 2018). In addition, previous works explored the notion of “progressive resizing” (Karras et al., 2017; Howard, 2018) — increasing image size as training progresses to improve model performance and time to convergence. More recently, Touvron et al. (2019) demonstrated that CNNs can be trained using a fixed small image size and fine-tuned posttraining to a larger size, with which evaluation will be performed. This procedure reduced the traintest discrepancy caused by the change in image size and allowed faster training time and improved accuracy — at the cost of additional fine-tuning procedure and additional computations at inference time.
39
+
40
+ In this work we will further explore the notion of using multiple image sizes at training, so the CNN performance will be resilient to test time changes in the image size.
41
+
42
+ # 2.2 LARGE BATCH TRAINING OF DEEP NETWORKS
43
+
44
+ Deep neural network training can be distributed across many computational units and devices. The most common distribution method is by ”data-parallelism”—computing an average estimate of the gradients using multiple, separably computed data samples. As training NN models is done using batch-SGD method and its variants, scaling this process across more computational devices while maintaining similar utilization for each device inflates the global batch size.
45
+
46
+ Large batch training is known to affect the generalization capabilities of the networks and to require modification of the regime used for its optimization. While several works claimed that large-batch training leads to an inherent ”generalization gap” (Keskar et al., 2016), more recent works demonstrated that this gap is largely caused from an insufficient number of optimization steps performed and can be partly mitigated by hyper-parameter tuning (Hoffer et al., 2017; Shallue et al., 2018). In order to cope with the changes in the training dynamics of the network, several modifications to the optimization procedure have been proposed such as a linear (Goyal et al., 2017) or a square-root (Hoffer et al., 2017) scaling of the learning rate with respect to the batch size growth. Other modifications include per-layer gradient scaling schemes (You et al., 2017) and optimizer modifications (Ginsburg et al., 2019). Several works also explored using incremented batch-sizes (Smith et al., 2018) in order to decrease the number of training iterations required to reach the desired accuracy.
47
+
48
+ Recent work by Hoffer et al. (2019) introduced the notion of ”Batch Augmentation” (BA)— increasing the batch size by augmenting several instances of each sample within the same batch. BA aids generalization across a wide variety of models and tasks, with the expense of an increased computational effort per step. A similar method called “Repeated Augmentation” (RA) was proposed by Berman et al. (2019). It was also demonstrated that BA may allow to decrease the number of training steps needed to achieve a similar accuracy and also mitigate I/O throughput bottlenecks (Choi et al., 2019). As previous works investigated mostly homogeneous training settings (e.g., using a fixed batch size), an open question still exists on the utility of rapidly varying batch-sizes. We will explore this notion and suggest a new optimizer modification that enables training with multiple varying batch-sizes with limited hyper-parameter tuning.
49
+
50
+ # 3 MIXSIZE: TRAINING WITH MULTIPLE IMAGE SCALES
51
+
52
+ The traditional practice of training convolutional networks using fixed-size images holds several shortcomings. First, CNNs are commonly evaluated using a different size than that used for training (Lin et al., 2017; Redmon & Farhadi, 2018; He et al., 2017) and it was observed that classification accuracy may degrade above or below a certain size threshold (Touvron et al. (2019) and Figure 1). To remedy these issues, we suggest a stochastic training regime, where image sizes can change in each optimization step.
53
+
54
+ Motivation. In order to motivate our method, we first evaluate the impact of the image size on the training progress of a CNN — by examining gradient statistics during training2. Specifically, in Table 1 we measured the correlation of the gradients across image sizes. We see that gradients computed across different scales of the same image have a strong correlation compared to those obtained across different images. This correlation is especially apparent during the first stages of training and decreases as the model converges. This suggests that the small image gradients can be used as an approximation of the full image gradients, with a smaller computational footprint. Therefore, using large images along the entire training process may be sub-optimal in terms of computational resource utilization. More specifically, as the gradients of images of different size are highly correlated at the initial steps of training, it may prove beneficial to sacrifice spatial size in favor of batch size that can be increased. To do so, we suggest the following.
55
+
56
+ The MixSize training regime. We suggest ”MixSize”, a stochastic training regime, where input sizes can vary in each optimization step. In this regime, we modify the spatial dimensions $H , W$ (height and width) of the input image size3, as well as the batch size. The batch size is changed either by the number of samples used, denoted $B$ , or the number of batch-augmentations for each sample (Hoffer et al., 2019), denoted $D$ (”duplicates”). To simplify our notation and use-cases, we will follow the common practice of training on square images and use $S = H = W$ . Formally, in the MixSize regime, these sizes can be described as random variables sharing a single discrete distribution
57
+
58
+ $$
59
+ ( \hat { S } , \hat { B } , \hat { D } ) = \left\{ ( S , B , D ) _ { i } ~ w . p . ~ p _ { i } \right\} ,
60
+ $$
61
+
62
+ where $\forall i : p _ { i } \geq 0$ and $\textstyle \sum _ { i } p _ { i } = 1$ .
63
+
64
+ Table 1: ResNet-44 gradient correlation on CIFAR10. We measure the Spearman correlation coefficient $\rho$ between different spatial size of random images $\rho \left( x ^ { ( s _ { 1 } ) } , x ^ { ( s _ { 2 } ) } \right)$ , as well as non-identical random images of the same size $\rho \left( x ^ { ( s _ { 1 } ) } , y ^ { ( s _ { 1 } ) } \right)$ . We also compute the variance $V ( x )$ for the gradients of each spatial size.
65
+
66
+ <table><tr><td rowspan="2">Measure</td><td colspan="3">Network State</td></tr><tr><td>Initial</td><td>Partially Trained</td><td>Fully Trained</td></tr><tr><td>Epoch Test Accuracy</td><td>1 55.12%</td><td>50 87.56%</td><td>100 92.62%</td></tr><tr><td>p(x(32),x(24))</td><td>0.2</td><td>0.08</td><td>0.03</td></tr><tr><td>(x(32),y(32)) p</td><td>0.086</td><td>0.02</td><td>-0.004</td></tr><tr><td>V (x(32))</td><td>1.03e-6</td><td>1.44e-6</td><td>6.24e-7</td></tr><tr><td>V ((x(24))</td><td>1.95e-6</td><td>6.34e-6</td><td>2.26e-5</td></tr></table>
67
+
68
+ As the computational cost of each training step is approximately proportional to $S ^ { 2 } { \cdot } B { \cdot } D$ , we choose these sizes to reflect an approximately fixed budget for any choice $i$ such that $S _ { i } ^ { 2 } B _ { i } D _ { i } \approx C o n s t$ Thus the computational and memory requirements for each step are constant.
69
+
70
+ Benefits and Trade-offs. We will demonstrate that using such a MixSize regime can have a positive impact on the resiliency of trained networks to the image size used at evaluation. That is, mixed-size networks will be shown to have better accuracy across a wide range of sizes. This entails a considerable saving in computations needed for inference, especially when using smaller models. Furthermore, given a fixed budget of computational and time resources (per step), we can now modify our regime along spatial and batch axes. We will explore two trade-offs:
71
+
72
+ • Decrease number of iterations per epoch – by enlarging $B$ at the expense of $S$ • Improve generalization per epoch – by enlarging $D$ at the expense of $S$ .
73
+
74
+ # 4 IMPROVED TRAINING PRACTICES FOR MIXSIZE
75
+
76
+ MixSize regimes continuously change the statistics of the model’s inputs, by modifying the image size as well as batch-size. This behavior may require hyper-parameter tuning and may also affect size-dependent layers such as batch normalization (Ioffe & Szegedy, 2015). To easily adapt training regimes to the use of MixSize as well as improve their final performance, we continue to describe two methods we found useful: Gradient Smoothing and Batch-norm calibration.
77
+
78
+ # 4.1 GRADIENT SMOOTHING
79
+
80
+ Training with varying batch and spatial sizes inadvertently leads to a change in the variance of the accumulated gradients. For example, in Table 1, the gradient variance is larger when computed over a small image size (unsurprisingly). This further suggests that the optimization regime should be adapted to smaller spatial sizes, in a manner similar to learning-rate adaptations that are used for large-batch training. This property was explored in previous works concerning large-batch regimes, in which a learning rate modification was suggested to compensate for the variance reduction for larger batch-sizes. Unfortunately, the nature of this modification can vary from task to task or across models (Shallue et al., 2018), with solutions such as a square-root scaling (Hoffer et al., 2017), linear scaling (Goyal et al., 2017) or a fixed norm ratio (You et al., 2017). Here we suggest changing both the spatial size as well as the batch size, which is also expected to modify the variance of gradients within each step and further complicates the choice of optimal scaling.
81
+
82
+ Previous works suggested methods to control the gradient norm by gradient normalization (Hazan et al., 2015) and gradient clipping (Pascanu et al., 2013). These methods explicitly disable or limit the gradient’s norm used for each optimization step, but also limit naturally occurring variations in gradient statistics. We suggest an alternative solution to previous approaches, which we refer to as ”Gradient smoothing”. Gradient smoothing mitigates the variability of gradient statistics when image sizes are constantly changing across training.
83
+
84
+ We introduce an exponentially moving weighted average of the gradients’ norm $\bar { g } _ { t }$ (scalar) which is updated according to
85
+
86
+ $$
87
+ \bar { g } _ { t } = \alpha \bar { g } _ { t - 1 } + ( 1 - \alpha ) g _ { t }
88
+ $$
89
+
90
+ where
91
+
92
+ $$
93
+ g _ { t } = \bigg | \bigg | \frac { \partial E } { \partial w _ { t } } \bigg | \bigg | _ { 2 } \mathrm { a n d } \bar { g } _ { 0 } = g _ { 0 } .
94
+ $$
95
+
96
+ We normalize the gradients used for each step by the smoothing coefficient, such that each consecutive step is performed with gradients of similar norm. For example, for the vanilla SGD step, we use a weight update rule of the form
97
+
98
+ $$
99
+ w _ { t + 1 } = w _ { t } - \eta \frac { \bar { g } _ { t } } { g _ { t } } \frac { \partial E } { \partial w _ { t } } .
100
+ $$
101
+
102
+ This running estimate of gradient norm is similar to the optimizer suggested by Ginsburg et al. (2019), which keeps a per-layer estimate of gradient moments. Gradient smoothing, however, is designed to adapt globally (across all layers) to the batch and spatial size modification and can be used regardless of the optimization method used.
103
+
104
+ We found gradient smoothing to be mostly beneficial in regimes where multiple varying batch sizes are used. Figure 5a in the Appendix demonstrates how gradient smoothing reduces the gap between gradient norms of different sizes. Measuring test error on the same model shows a slight advantage for gradient-smoothing (Appendix Figure 5b).
105
+
106
+ # 4.2 BATCH-NORM CALIBRATION FOR VARYING IMAGE SIZES
107
+
108
+ As demonstrated by Touvron et al. (2019), using a different image size at evaluation may incur a discrepancy between training and evaluation protocols, caused by using different data pre-processing. Touvron et al. (2019) suggested a post-training procedure, where a network trained on a specific fixed-size is fine-tuned on another size, later used for evaluation. Their solution required 10s of training epochs, amounting to 1000s of full forward and back-propagation computations, along with parameter updates for batch-norm and classifier layers. In contrast, we surmise that for networks trained with mixed-regimes, discrepancy issues mainly arise from the use of the batch-norm layers (Ioffe & Szegedy, 2015) and can be solved by targeting them specifically.
109
+
110
+ Batch-norm layers introduce a discrepancy between training and test evaluations (Ioffe, 2017), as at inference a running estimate of the mean and variance (of training data) are used instead of the actual mean and variance values. This difference is emphasized further in the use of varying image size, as changing the spatial size of an input map can significantly modify the measured variance of that map. While a fine-tuning process per image size can eliminate this discrepancy (Touvron et al., 2019), we offer a simpler alternative. For each evaluated size, we calibrate the mean and variance estimates used for that size by computing an average value over a small number of training examples. This calibration requires only a few (100s) feed-forward operations with no back-propagation or parameter update and takes only a few seconds on a single GPU.
111
+
112
+ Interestingly, we highlight the fact that although this process has little or no effect on models trained using a fixed-size input, it does improve our mixed-size models considerably on a wide range of image sizes.
113
+
114
+ # 5 EXPERIMENTS
115
+
116
+ # 5.1 MIXSIZE WITH A FIXED IMAGE SIZE AT TEST-TIME: THE SPEED-ACCURACY TRADE-OFF
117
+
118
+ CIFAR10/100. First, we examine our method using the common visual datasets CIFAR10/100 (Krizhevsky, 2009) that consist of $3 2 \times 3 2$ color images. We use the ResNet-44 model suggested by (He et al., 2016), Wide Resnet WRN-28-10 (Zagoruyko, 2016) and AmoebaNet (Real et al., 2019) with their original regime and batch size of 64. While for ResNet-44 we use the original augmentation protocol, we apply cutout (DeVries & Taylor, 2017) and auto-augment policies (Cubuk et al., 2018) on WRN-28-10 and AmoebaNet for both datasets (see Appendix A.1 for details).
119
+
120
+ ![](images/b136ba7cf484e737618f6844d373518d17c7d6b2033803cccf0222271dd940bc.jpg)
121
+ Figure 2: Training (dotted) and test accuracy vs optimization step (ResNet44, CIFAR10). We compare vanilla training with two computationally equivalent stochastic regimes: increased duplicates $\bar { ( } D ^ { + } )$ and increased batch $( B ^ { + } )$ . $\bar { B ^ { + } }$ regime achieves better test accuracy at a reduced number of iterations, while $D ^ { + }$ improves accuracy further at a similar computational cost.
122
+
123
+ As CIFAR datasets are limited in size, we consider the following balanced stochastic regime chosen:
124
+
125
+ $$
126
+ S = \left\{ \begin{array} { l l l } { 4 0 , } & { \mathrm { w . p . } } & { p = 0 . 2 } \\ { 3 2 , } & { \mathrm { w . p . } } & { p = 0 . 3 } \\ { 2 4 , } & { \mathrm { w . p . } } & { p = 0 . 3 } \\ { 1 6 , } & { \mathrm { w . p . } } & { p = 0 . 2 } \end{array} \right.
127
+ $$
128
+
129
+ The regime was designed to be centered around the mean value of 28. As the original image size used for training is $3 2 \times 3 2$ , we are now able to increase either the batch size or number of duplicates for each training step by a factor of 322S2 such that $S ^ { 2 } \cdot B \cdot D$ is approximately constant. We denote our modified mixed-size regimes as $B ^ { + }$ for an increased effective batch-size and $D ^ { + }$ for an increased number of BA duplicates of the same ratio. We used our sampling strategy to train and compare our regime to the baseline results. We use the original hyper-parameters without modification. For the $B ^ { + }$ regime, use our gradient smoothing method, as described in Section 4.1. For each result, we measure our final test accuracy on the original $3 2 \times 3 2$ image size. We also perform batch-norm calibration as described in Section 4.2. From Table 2, we see that our MixSize regimes on CIFAR datasets yield two possible improvements:
130
+
131
+ • Reduced number of training steps to achieve a similar test accuracy using $B ^ { + }$ regime.
132
+ • Better test accuracy when using $D ^ { + }$ regime.
133
+
134
+ Training progress on the CIFAR10 using ResNet44 is depicted in Figure 2. Interestingly, although designed only to reduce training time, we can see that our $B ^ { + }$ regime also improves accuracy in some cases. This improvement can be attributed to a regularization effect induced by changing image sizes during training, also manifested by an increase in training error throughout its progress.
135
+
136
+ ImageNet. We also perform large scale experiments using the ImageNet dataset (Deng et al., 2009) to confirm our findings. We used the ResNet-50 (He et al., 2016) model, with the training regime suggested by Goyal et al. (2017) that consists of base learning rate of 0.1, decreased by a factor of 10 on epochs 30, 60, 80, stopping at epoch 90. We used the base batch size of 256 over 4 devices and $L _ { 2 }$ regularization over weights of convolutional layers. We used the standard data augmentation and did not incorporate any additional regularization or augmentation techniques.
137
+
138
+ Table 2: Test accuracy (Top-1) results for CIFAR and ImageNet. Each row represents models trained using the same computational and memory budget per step. Steps and accuracy are reported at the completion of a fixed epoch budget (e.g., 90 epochs for ResNet on ImageNet, 200 for ResNet on CIFAR). Accuracy is reported for model’s original size (32 for CIFAR, 224 for ImageNet).
139
+
140
+ <table><tr><td rowspan="2">Network</td><td rowspan="2">Dataset</td><td colspan="3">Steps</td><td colspan="3">Accuracy</td></tr><tr><td>Baseline</td><td>B+</td><td>D+</td><td>Baseline</td><td>B+</td><td>D+</td></tr><tr><td>ResNet-44</td><td>CIFAR10</td><td>156K</td><td>109K</td><td>156K</td><td>92.84%</td><td>94.30%</td><td>94.46%</td></tr><tr><td>WRN-28-10</td><td>CIFAR10</td><td>156K</td><td>109K</td><td>156K</td><td>96.60%</td><td>97.28%</td><td>97.68%</td></tr><tr><td>AmoebaNet</td><td>CIFAR10</td><td>469K</td><td>328K</td><td>469K</td><td>98.16%</td><td>98.14%</td><td>98.32%</td></tr><tr><td>ResNet-44</td><td>CIFAR100</td><td>156K</td><td>109K</td><td>156K</td><td>70.36%</td><td>72.19%</td><td>73.10%</td></tr><tr><td>WRN-28-10</td><td>CIFAR100</td><td>156K</td><td>109K</td><td>156K</td><td>79.85%</td><td>83.08%</td><td>83.52%</td></tr><tr><td>ResNet-50</td><td>ImageNet</td><td>450K</td><td>169K</td><td>450K</td><td>76.40%</td><td>76.61%</td><td>78.04%</td></tr><tr><td>EfficientNet-B0</td><td>ImageNet</td><td>1000K</td><td>376K</td><td>1000K</td><td>76.32%</td><td>76.29%</td><td>76.53%</td></tr></table>
141
+
142
+ Additionally, we also used the EfficientNet-B0 model suggested by Tan & Le (2019). We used the same data augmentation and regularization as the original paper, but opted for a shorter training regime with a momentum-SGD optimizer that consisted of a cosine-annealed learning rate (Loshchilov & Hutter, 2016) over 200 epochs starting from an initial base 0.1 value.
143
+
144
+ For the ImageNet dataset, we use the following stochastic regime found by cross-validation on several alternatives (see Appendix D):
145
+
146
+ $$
147
+ S ^ { ( 1 4 4 ) } : S = { \left\{ \begin{array} { l l } { 2 5 6 , } & { { \mathrm { w . p } } p = 0 . 1 } \\ { 2 2 4 , } & { { \mathrm { w . p } } p = 0 . 1 } \\ { 1 2 8 , } & { { \mathrm { w . p } } p = 0 . 6 } \\ { 9 6 , } & { { \mathrm { w . p } } p = 0 . 2 } \end{array} \right. }
148
+ $$
149
+
150
+ While the original training regime consisted of images of size $2 2 4 \times 2 2 4$ , our proposed regime makes for an average image size of $\bar { S } \times \bar { S } = 1 4 4 \times 1 4 \bar { 4 }$ . This regime was designed so that the reduced spatial size can be used to increase the corresponding batch size or the number of BA duplicates, as described in Section 3. We are first interested in accelerating the time needed for convergence of the tested models using our $B ^ { + }$ scheme. We enlarge the batch size used for each spatial size by a factor of 2242 such that $S ^ { 2 } \cdot B$ is kept approximately fixed. As the average batch size is larger than $B _ { o }$ , which was used with the original optimization hyper-parameters, we scale the learning rate linearly as suggested by Goyal et al. (2017) by a factor of $\bar { \frac { B } { B _ { o } } }$ . We note that for the proposed regimes we did not require any learning rate warm-up, due to the use of gradient smoothing.
151
+
152
+ As can be seen in Figure 3, regime $B ^ { + }$ enables training with approximately $2 . 7 \times$ less training steps, while reaching a better-than-baseline accuracy of $7 6 . 6 1 \%$ . As sizes were chosen to reflect in approximately equal computational cost per iteration, $B ^ { + }$ regime offers a similar improvement in total wall-clock time.
153
+
154
+ Next, we perform a similar experiment with a $D ^ { + }$ regime, where the number of BA duplicates is similarly increased with respect to $D _ { o }$ instead of the batch size. This scaling results with an average duplicates of $\bar { D } = 3$ .
155
+
156
+ ![](images/1a84b5090d53fd568c012d510a34e8d7fc621440369594acf75a993e3fa628b9.jpg)
157
+ Figure 3: Training (dotted) and test accuracy on ImageNet using the Baseline, $B ^ { + }$ and $D ^ { \bar { + } }$ regimes $2 2 4 \times 2 2 4$ evaluation size). All regimes required similar computational resources per step. $B ^ { + }$ regime required $\approx 2 . 7 \times$ less steps per epoch.
158
+
159
+ As the computational cost for each step remains approximately constant, as well as the number of required steps per epochs, training a model under this regime requires an equal wall-clock
160
+
161
+ time. However, the increased batch-augmentation improves the final test accuracy to $7 8 . 0 4 \%$ , approximately $7 \%$ relative improvement over the $7 6 . 4 \%$ baseline.
162
+
163
+ # 5.2 INCREASING MODEL RESILIENCY TO TEST-TIME CHANGES IN IMAGE SIZE
164
+
165
+ Next, we examine how MixSize affects the resulting model resiliency to changes in the image size during test-time. We evaluated the models by varying the test-time image sizes around the original 224 spatial size: $S = 2 2 4 + 3 2 \cdot m , m \in \{ - \bar { 6 } , . . . , 6 \}$ . The common evaluation procedure for ImageNet models first scales the image to a 256 smallest dimension and crops a center $2 2 4 \times 2 2 4$ image. We adapt this regime for other image sizes by scaling the smallest dimension to $\lfloor { \frac { 8 } { 7 } } S \rfloor$ (since $\frac { 8 } { 7 } \cdot 2 2 4 = 2 5 6 )$ and then cropping the center $S \times S$ patch. Models trained with a mixed regime were calibrated to a specific evaluation size by measuring batch-norm statistics for 200 batches of training samples. We note that for original fixed-size regimes this calibration procedure resulted with degraded results and so we report accuracy without calibration for these models. We did not use any fine-tuning procedure post training for any of the models.
166
+
167
+ As can be seen in Figure 4a, the baseline model trained using a fixed size, reaches $7 6 . 4 \%$ top-1 accuracy at the same 224 spatial size it was trained on. As observed previously, the model continues to slightly improve beyond that size, to a maximum of $7 6 . 8 \%$ accuracy. However, it is apparent that the model’s performance quickly degrades when evaluating with sizes smaller than 224.
168
+
169
+ We compare these results with a $D ^ { + }$ regime, trained with an average size of $\bar { S } = 1 4 4$ . As described earlier, this model requires the same time and computational resources as the baseline model. However, due to the decreased average size, we were able to leverage more than 1 duplicates per batch on average, which improved the model’s top-1 accuracy to $7 7 . 1 4 \%$ at size 224. Furthermore, we find that the model performs much more favorably at image sizes smaller than 224, scoring an improved (over baseline) accuracy of $7 6 . 4 3 \%$ at only $1 6 0 \times 1 6 0$ spatial size. We analyzed an alternative regime $S ^ { ( 2 0 8 ) }$ , where the average spatial size is larger at $2 0 8 \times 2 0 8$ (for more details see Appendix D). The model trained with the $S ^ { ( 2 0 8 ) }$ regime offers a similar improvement in accuracy, only across a larger spatial size, as it observed an average size of $2 0 8 \times 2 0 8$ during training. Figure 4a demonstrates that while all three models (Fixed with $S = 2 2 4$ , $S ^ { ( 1 4 4 ) }$ and $S ^ { ( 2 0 8 ) }$ ) were trained with the same compute and memory budget, mixed-size regimes offer superior accuracy over a wide range of evaluation sizes. Specifically, mixed-regime at $S = 2 0 8$ dominates the baseline fixed-size regime at all sizes, while our mixed regime at $S = 1 4 4$ achieves best results at sizes smaller than 224.
170
+
171
+ ![](images/db2b2b989b584c1ba941925f5f6a2fddc0143307bbbf6bef492dca374db7de46.jpg)
172
+ Figure 4: Left: Test accuracy on validation set per image size, all models trained using the same computational and memory resources (regime $D ^ { + }$ ). Right: Test accuracy per billion flop (at evaluation).
173
+
174
+ We also compared the classification performance across evaluated image sizes, using networks trained on a variety of fixed sizes and our mixed regimes. As a baseline, we use results obtained by Touvron et al. (2019) (trained with repeated augmentations, without fine-tuning) and compare them with mixed-regime models trained with an equal computational budget, by setting the base number of BA duplicates to $D = 2$ . As can be seen in Figure 4b, mixed-regime trained models offer a wider range of resolutions with close-to-baseline accuracy (within a $2 \%$ change) and perform better than their fixed-size counterparts at all sizes. As the number of floating-point operations (flops) grows linearly with the number of pixels, using a mixed regime significantly improves accuracy per compute at evaluation. We further note that our $S ^ { ( 2 2 4 ) }$ model reaches a top accuracy of $7 9 . 2 7 \%$ at a $2 8 8 \times 2 8 8$ evaluation size.
175
+
176
+ # 6 SUMMARY
177
+
178
+ In this work, we introduced and examined a performance trade-off between computational load and classification accuracy governed by the input’s spatial size. We suggested stochastic image size regimes, which randomly change the spatial dimension as well as the batch size and the number of augmentation (duplicates) in the batch. Stochastic regime benefits are threefold: (1) reduced number of training iterations; or (2) improved model accuracy (generalization) and (3) improved model robustness to changing the image size. We believe this approach may have a profound impact on the practice of training convolutional networks. Given a computational and time budget, stochastic size regimes may enable to train networks faster, with better results, as well as to target specific image sizes that will be used at test time. As the average size chosen to train is reflected in the optimal operating point for evaluation resolution, mixed regimes can be used to create networks with better performance across multiple designated use cases.
179
+
180
+ # REFERENCES
181
+
182
+ Ossama Abdel-Hamid, Abdel-rahman Mohamed, Hui Jiang, Li Deng, Gerald Penn, and Dong Yu. Convolutional neural networks for speech recognition. IEEE/ACM Transactions on audio, speech, and language processing, 22(10):1533–1545, 2014.
183
+
184
+ Maxim Berman, Herve J ´ egou, Andrea Vedaldi, Iasonas Kokkinos, and Matthijs Douze. Multigrain: ´ a unified image embedding for classes and instances. arXiv preprint arXiv:1902.05509, 2019.
185
+
186
+ Dami Choi, Alexandre Passos, Christopher J Shallue, and George E Dahl. Faster neural network training with data echoing. arXiv preprint arXiv:1907.05550, 2019.
187
+
188
+ Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation policies from data. arXiv preprint arXiv:1805.09501, 2018.
189
+
190
+ J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009.
191
+
192
+ Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
193
+
194
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1243–1252. JMLR. org, 2017.
195
+
196
+ Boris Ginsburg, Patrice Castonguay, Oleksii Hrinchuk, Oleksii Kuchaiev, Vitaly Lavrukhin, Ryan Leary, Jason Li, Huyen Nguyen, and Jonathan M Cohen. Stochastic gradient methods with layerwise adaptive moments for training of deep networks. arXiv preprint arXiv:1905.11286, 2019.
197
+
198
+ Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, An-´ drew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
199
+
200
+ Elad Hazan, Kfir Levy, and Shai Shalev-Shwartz. Beyond convexity: Stochastic quasi-convex optimization. In Advances in Neural Information Processing Systems, pp. 1594–1602, 2015.
201
+
202
+ 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.
203
+
204
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017.
205
+
206
+ Elad Hoffer, Itay Hubara, and Daniel Soudry. Train longer, generalize better: closing the generalization gap in large batch training of neural networks. In Advances in Neural Information Processing Systems, pp. 1731–1741, 2017.
207
+
208
+ Elad Hoffer, Tal Ben-Nun, Itay Hubara, Niv Giladi, Torsten Hoefler, and Daniel Soudry. Augment your batch: better training with larger batches. arXiv preprint arXiv:1901.09335, 2019.
209
+
210
+ Andrew G Howard. Some improvements on deep convolutional neural network based image classification. arXiv preprint arXiv:1312.5402, 2013.
211
+
212
+ Jeremy Howard. Fastai - progressive resizing. https://www.fast.ai/2018/04/30/ dawnbench-fastai/, 2018.
213
+
214
+ 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. arXiv preprint arXiv:1811.06965, 2018.
215
+
216
+ Sergey Ioffe. Batch renormalization: Towards reducing minibatch dependence in batch-normalized models. In Advances in neural information processing systems, pp. 1945–1953, 2017.
217
+
218
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448–456, 2015.
219
+
220
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017.
221
+
222
+ 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. 2016.
223
+
224
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
225
+
226
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
227
+
228
+ Min Lin, Qiang Chen, and Shuicheng Yan. Network in network. arXiv preprint arXiv:1312.4400, 2013.
229
+
230
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense ´ object detection. In Proceedings of the IEEE international conference on computer vision, pp. 2980–2988, 2017.
231
+
232
+ Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016.
233
+
234
+ David G. Lowe. Object recognition from local scale-invariant features. In Proceedings of the Seventh IEEE International Conference on Computer Vision, volume 2, pp. 1150–1157 vol.2, 1999.
235
+
236
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International conference on machine learning, pp. 1310–1318, 2013.
237
+
238
+ Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V Le. Regularized evolution for image classifier architecture search. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 4780–4789, 2019.
239
+
240
+ Joseph Redmon and Ali Farhadi. Yolov3: An incremental improvement. arXiv, 2018.
241
+
242
+ 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.
243
+
244
+ Christopher J Shallue, Jaehoon Lee, Joe Antognini, Jascha Sohl-Dickstein, Roy Frostig, and George E Dahl. Measuring the effects of data parallelism on neural network training. arXiv preprint arXiv:1811.03600, 2018.
245
+
246
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
247
+
248
+ Samuel L Smith, Pieter-Jan Kindermans, Chris Ying, and Quoc V Le. Don’t decay the learning rate, increase the batch size. 2018.
249
+
250
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1–9, 2015.
251
+
252
+ 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.
253
+
254
+ Ryo Takahashi, Takashi Matsubara, and Kuniaki Uehara. Scale-invariant recognition by weightshared cnns in parallel. In Asian Conference on Machine Learning, pp. 295–310, 2017.
255
+
256
+ Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pp. 6105–6114, 2019.
257
+
258
+ Hugo Touvron, Andrea Vedaldi, Matthijs Douze, and Herve J ´ egou. Fixing the train-test resolution ´ discrepancy. CoRR, abs/1906.06423, 2019. URL http://arxiv.org/abs/1906.06423.
259
+
260
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alexander ¨ Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. 2016.
261
+
262
+ Yichong Xu, Tianjun Xiao, Jiaxing Zhang, Kuiyuan Yang, and Zheng Zhang. Scale-invariant convolutional neural networks. arXiv preprint arXiv:1411.6369, 2014.
263
+
264
+ Yang You, Igor Gitman, and Boris Ginsburg. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017.
265
+
266
+ Komodakis Zagoruyko. Wide residual networks. In BMVC, 2016.
267
+
268
+ # Appendix
269
+
270
+ A EXPERIMENTAL SETTINGS
271
+
272
+ A.1 CIFAR
273
+
274
+ We used the common data augmentation technique as described by He et al. (2016). In this method, the input image is padded with 4 zero-valued pixels at each side, top and bottom. A random $3 2 \times 3 2$ part of the padded image is then cropped and with a 0.5 probability flipped horizontally. In order to adapt to varying input scales, we add an additional augmentation step, that resizes the images using bilinear interpolation to $S \times S$ , depending on a sampled size for each step. We note that this keeps the exact original augmentation procedure for $S = 3 2$ .
275
+
276
+ # B IMPACT OF GRADIENT SMOOTHING
277
+
278
+ (a) Gradient norm values with and without Gradsmoothing. Solid lines are gradients for $S ~ = ~ 3 2$ while dotted lines are for $S = 1 6$ .
279
+
280
+ ![](images/3b5a4bec38369a3a9f08bcde93793589da2f3699c013203d4024b4b0aa2b6387.jpg)
281
+ (b) Training and test error with and with out gradient smoothing. Solid lines are test errors while dotted lines are for training.
282
+
283
+ ![](images/b880a0f1614ff8f14f091c95c236b578af67e6f91fb93f032cd8ddadba161c4b.jpg)
284
+
285
+ Figure 5: Impact of gradient smoothing on CIFAR10, ResNet-44. The training regime includes two image sizes: $3 2 \times 3 2$ and $1 6 \times 1 6$ (average size is $S = 2 4$ ). Using a $B ^ { + }$ regime creates two batch sizes: 256 and 2, 048 respectively. Gradient smoothing helps to reduce gap between gradient norms at difference batch sizes and improves final accuracy.
286
+
287
+ # C VARYING IMAGE-SIZE TRAINING REGIMES
288
+
289
+ We wish to consider training regimes with varying image sizes, such that the average image size is smaller than the desired evaluation size. For example, for the height dimension $H$ , we wish to obtain an average size of $\begin{array} { r } { \bar { H } = \sum _ { i } p _ { i } H _ { i } } \end{array}$ such that $\bar { H } < \mathbf { \bar { \Gamma } } H _ { o }$ . We consider three alternatives for image size variations:
290
+
291
+ • Increase image size from small to large, where each image size is used for number of epochs $E _ { i } = p _ { i } E _ { \mathrm { t o t a l } }$ , where $E _ { \mathrm { t o t a l } }$ is the total number training epochs required. • Using a random image size for each epoch, keeping the epoch number for each size at $E _ { i }$ • Sampling image size per training step at probability $p _ { i }$
292
+
293
+ As can be seen in Figure 6, we found that random sampling regimes performed better than scaling image size from small to large (Howard, 2018; Touvron et al., 2019). While sampling both at epoch and step time frames performed similarly, replacing sizes on each step seemed to converge faster and to have less noise in measured test accuracy. We note that these behaviours may partly stem from the use of batch-normalization (Ioffe & Szegedy, 2015) which is sensitive to the image size used at evaluation or insufficient hyper-parameter tuning for each specific size (e.g., spiking error at the end of the small-to-large regime). Considering these findings, we continue to perform our experiments using the third regime – sampling image size per training step.
294
+
295
+ ![](images/d9d9dea62f1564c1593f40644bbbaff8dfb4165f7fd1b7a845f4ec6fddccade1.jpg)
296
+ Figure 6: Test accuracy vs step for 3 size sampling regimes: (1) From small to large (2) Sample each Epoch (3) Sample each step. All methods reached a similar accuracy, but sampling each epoch was less noisy and did not require hyper-parameter tuning.
297
+
298
+ # D ALTERNATIVE SIZE DISTRIBUTION REGIMES
299
+
300
+ We used alternative size regimes balanced around 224, named $S ^ { ( 2 0 8 ) }$ and $S ^ { ( 2 2 4 ) }$ . They can be described by the following distributions:
301
+
302
+ $$
303
+ S ^ { ( 2 0 8 ) } : ~ S = \left\{ \begin{array} { l l } { 3 2 0 , } & { \mathrm { w . p } ~ p = 0 . 1 } \\ { 2 8 8 , } & { \mathrm { w . p } ~ p = 0 . 1 } \\ { 2 5 6 , } & { \mathrm { w . p } ~ p = 0 . 1 } \\ { 2 2 4 , } & { \mathrm { w . p } ~ p = 0 . 2 } \\ { 1 9 2 , } & { \mathrm { w . p } ~ p = 0 . 2 } \\ { 1 6 0 , } & { \mathrm { w . p } ~ p = 0 . 1 } \\ { 1 2 8 , } & { \mathrm { w . p } ~ p = 0 . 1 } \\ { 9 6 , } & { \mathrm { w . p } ~ p = 0 . 1 } \end{array} \right.
304
+ $$
md/train/Pg13X3rETW/Pg13X3rETW.md ADDED
@@ -0,0 +1,420 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Group-Aware Threshold Adaptation for Fair Classification
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 The fairness in machine learning is getting increasing attention, as its applications
11
+ 2 in different fields continue to expand and diversify. To mitigate the discriminated
12
+ 3 model behaviors between different demographic groups, we introduce a novel post
13
+ 4 processing method to optimize over multiple fairness constraints through group
14
+ 5 aware threshold adaptation. We propose to learn adaptive classification thresholds
15
+ 6 for each demographic group by optimizing the confusion matrix estimated from
16
+ 7 the probability distribution of a classification model output. As we only need
17
+ 8 an estimated probability distribution of model output instead of the classification
18
+ 9 model structure, our post-processing model can be applied to a wide range of
19
+ 10 classification models and improve fairness in a model-agnostic manner to ensure
20
+ 11 privacy. This even allows us to post-process existing fairness methods to further
21
+ 12 improve the trade-off between accuracy and fairness. Moreover, our model is
22
+ 13 efficient with low computational cost by alternating optimization and flexible with
23
+ 14 the optimization over multiple fairness constraints. We provide Pareto frontier to
24
+ 15 characterize fairness-accuracy trade-off. Also, we provide a theoretical analysis
25
+ 16 of the optimal thresholds obtained from our model in terms of both accuracy
26
+ 17 and fairness in classification. Experimental results demonstrate that our method
27
+ 18 outperforms state-of-the-art methods and obtains the result that is closest to the
28
+ 19 theoretical accuracy-fairness trade-off boundary.
29
+
30
+ # 20 1 Introduction
31
+
32
+ 21 Machine learning is broadening its impact in various fields including autonomous driving, credit
33
+ 22 analysis, and job application screening. As a consequence, the role and importance of fairness in
34
+ 23 machine learning are emerging. However, recent models have been found to behave differently
35
+ 24 between demographic groups in favorable predictions. For example, it has been discovered that
36
+ 25 COMPAS, the criminal risk assessment software currently used to help pretrial release decisions,
37
+ 26 has biases between different races [4]. Specifically, blacks got higher risk scores predicted from the
38
+ 27 model than whites with similar profiles. Therefore, discrimination truly exists and resolving it in
39
+ 28 machine learning is very important and urgent because its direct and potential impact is growing
40
+ 29 tremendously.
41
+ 30 However, obtaining fairness is not a trivial problem, because the data set itself will be biased when it
42
+ 31 is accumulated artificially. Simply removing or manipulating sensitive features (such as race, gender)
43
+ 32 from the data does not solve the bias, because there is indirect discrimination [19] or disparate
44
+ 33 treatment [1] due to the feature redundancy and relevance, which means sensitive information can be
45
+ 34 inferred from other features.
46
+ 35 In order to alleviate discrimination from different perspectives, various quantitative measurements
47
+ 36 of group equity [7, 11, 2, 13] have been proposed. It has been proven that the pursuit of fairness is
48
+ 37 subject to a trade-off between fairness and accuracy [14, 10], i.e., if we want to improve fairness, we
49
+ 38 need to sacrifice accuracy.
50
+ 39 Moreover, Pleiss et al. [20] studied the trade-offs between fairness notions that cannot be satisfied
51
+ 40 at the same time. Therefore, recent works usually target at a certain fairness notion in different
52
+ 41 approaches such as pre-processing [6], in-processing [24], and post-processing [7] methods. However,
53
+ 42 these approaches suffer from the lack of flexibility, since it is difficult to adapt a fair model that
54
+ 43 is trained w.r.t. one certain fairness criterion so as to optimize over other fairness measures. If
55
+ 44 the fairness constraints change under some circumstances, traditional fairness models need to be
56
+ 45 re-trained from scratch, which is computationally demanding and sometimes inapplicable due to
57
+ 46 model settings. To overcome the limitations above, we propose a novel post-processing method to
58
+ 47 improve fairness in a model-agnostic manner. Our GSTAR (Group Specific Threshold Adaptation
59
+ 48 for faiR classification) model learns adaptive classification thresholds for each demographic group
60
+ 49 in classification task for improving the trade-off between fairness and accuracy. Given an existing
61
+ 50 classification model, GSTAR approximates the probability distribution of the model output via
62
+ 51 maximum likelihood estimation and utilizes confusion matrix to quantify accuracy and fairness w.r.t.
63
+ 52 the group-aware classification thresholds. This allows us to: 1) prevent from burdening additional
64
+ 53 complexity or deteriorate the stability of the training process of the classifier; 2) integrate different
65
+ 54 fairness notions into one unified objective function; 3) easily adapt one pre-trained model to other
66
+ 55 fairness constraints. We summarize our contributions of this paper as follows:
67
+
68
+ 1. We propose a novel post-processing method, GSTAR, which can learn group-aware thresholds to optimize the trade-off between fairness and accuracy in classification. We derive rigorous theoretical analysis on the trade-off in our model, and empirically show that GSTAR outperforms state-of-the-art methods.
69
+ 2. With GSTAR, we can simultaneously optimize over multiple fairness constraints with a low computational cost. GSTAR does not require multiple iterations over data, instead, it takes at most one pass of data in training for fast computation.
70
+ 3. GSTAR can be adapted to a wide range of classification models in a model-agnostic manner and can adapt an existing classification model from one fairness criterion to another without re-training the classifier.
71
+ 4. We derive Pareto frontiers of our model for the fairness-accuracy trade-offs that contextualize the quality of fair classification.
72
+
73
+ # 68 2 Related Works
74
+
75
+ 69 In order to achieve group fairness, which quantifies the discrimination among different sensitive
76
+ 70 groups, a diverse notion of fairness has been introduced. Equalized odds [7] enforce equality of true
77
+ 71 positive rates and false positive rates between different demographic groups. Pleiss et al. [20] relaxed
78
+ 72 equalized odds to satisfy the calibration. Demographic parity or disparate impact [1] suggests that a
79
+ 73 model is unbiased if the model prediction is independent of the protected attribute.
80
+ 74 Among different fairness methods, post-processing techniques propose to improve fairness by mod
81
+ 75 ifying the output of a black-box classifier. Hardt et al. [7] propose to ensure equalized odds by
82
+ 76 constraining the model output. Kamiran et al. [9] propose to give a favorable outcome to unprivileged
83
+ 77 and an unfavorable outcome to the privileged group when the confidence of the prediction is beyond a
84
+ 78 certain range. However, such static confidence window keeps the same regardless of the demographic
85
+ 79 group and is determined by grid search, so it is less efficient.
86
+ 80 Threshold adjustment (a.k.a. thresholding) was introduced to improve the performance of static
87
+ 81 thresholds. In the literature, Menon et al. [18] prove that instance-dependent thresholding of the
88
+ 82 predictive probability function is the optimal classifier in cost-sensitive fairness measures. Also,
89
+ 83 when considering immediate utility, Corbett-Davies et al. [3] show that optimal algorithm is achieved
90
+ 84 from group-specific threshold which is determined by group statistics. However, to the best of our
91
+ 85 knowledge, the threshold adjustment approach has not been deeply studied that neither encompasses
92
+ 86 broad group fairness metrics nor describes an explicit method to achieve the threshold.
93
+ 87 Trade-off between fairness and accuracy exists when we impose fairness constraint to a model. Recent
94
+ 88 studies [2, 25] prove that models targeting at such fairness notions conform to an information theoretic
95
+ 89 lower bound on the joint error across different sensitive groups. Therefore, our work presents a
96
+ 90 practical upper bound of the best achievable accuracy given the fairness constraints.
97
+ 91 Moreover, trade-offs between different fairness notions also exist if one has to consider multiple
98
+ 92 fairness criteria. Some of them are theoretically proven to be incompatible [6, 18, 14]. To express
99
+ 93 and formulate fairness, recent work [10] utilize confusion matrix and propose least-square accuracy
100
+ 94 fairness optimization problem on multiple fairness notions, and categorize the trade-offs between the
101
+ 95 fairness notions.
102
+ 96 Here, our work is the most related to the post-processing methods [7, 10]. Hardt et al. [7] propose
103
+ 97 a post-processing method that utilizes the mixing rate to meet the equalized odds. Ours is similar
104
+ 98 to Hardt et al. [7] in the manner that achieving group-wise threshold from the feasible region that
105
+ 99 is geometrically generated by the intersection between the receiver operating characteristic (ROC)
106
+ 100 curves conditioned on sensitive feature. Ours differ from [7] by generalizing the concept beyond
107
+ 101 equalized odds to other multiple fairness constraints into consideration. FACT [10] utilizes a single
108
+ 102 point (static) from the classifier to be post-processed as a reference which does not fully utilize the
109
+ 103 classifier for the post-processing. In contrast, by approximating the distribution of the continuous
110
+ 104 predicted logits, our GSTAR model enables a larger feasible region than [10] with a better fairness
111
+ 105 accuracy trade-off. We validate the improvement in trade-off via both theoretical and empical results.
112
+ 106 It is notable that these related methods [7, 10] can be considered as a special case of GSTAR.
113
+
114
+ # 7 3 GSTAR for Fair Classification
115
+
116
+ # 3.1 Motivation
117
+
118
+ Consider a binary classification problem with a binary sensitive feature, such that the sensitive feature $A \in \{ 0 , 1 \}$ and label $Y \in \{ 0 , 1 \}$ . In general, for a given data $X$ , a binary classification model outputs an unnormalized logit $h ( { \bar { X } } ) \in \mathbb { R }$ with the class label probability $p ( \dot { X } ) = \sigma ( h ( X ) ) \in [ 0 , 1 ]$ , where $\sigma$ is an activation function (sigmoid function in logistic regression and neural network). It is not necessary to calculate $p$ in a classification model, e.g. support vector machines directly use the positiveness/negativeness of logit $h ( X )$ to determine classification outcome. For traditional models, we use a cut-off threshold $\theta _ { h } = 0$ for $h ( X )$ (i.e., $\theta _ { p } = \sigma ( 0 ) = 0 . 5$ for $p ( X ) \}$ ) in classification, such that the predicted label is determined by $\hat { Y } = \mathbb { I } \{ h ( X ) \geq \theta _ { h } \}$ . In the following context, unless otherwise mentioned, we use $\theta$ to refer to the threshold $\theta _ { h }$ on logit $h$ since it is applicable to a wider range of classification models, and the corresponding threshold on label probability $\theta _ { p }$ can be easily inferred from the threshold on logit $h$ . Traditional models use the same cut-off threshold $\theta$ for different demographic groups. However, since the distribution of logits $h$ in different demographic groups can be different, using the same threshold $\theta$ brings biased classification.
119
+
120
+ 122 In Figure 1, we show a real-world example of image classification on CelebA dataset with
121
+ 123 ResNet50 [8] to show that the default setting of classification thresholds affects both accuracy
122
+ 124 and fairness in classification. The goal of this classification example is to predict the image of a
123
+ 125 person is whether attractive or not, and consider sensitive attribute as gender. This can be generalized
124
+ 126 to different sensitive attributes such as age or race [22, 16]. We can observe an obvious difference in
125
+ 127 the distribution of logit $h$ between two gender groups. In this case, if we use a unified classification
126
+ 128 threshold $\theta _ { 1 } = \theta _ { 0 } = 0$ , it naturally brings a difference in the true positive rate and true negative
127
+ 129 rate between two gender groups, thus renders bias in classification. Instead, we observe that the
128
+ 130 optimal group-specific threshold obtained from GSTAR $( \theta _ { 1 } ^ { * } > \theta _ { 1 }$ , and ${ \theta } _ { 0 } ^ { * } < { \theta } _ { 0 }$ ) can adapt to such
129
+ 131 discrepancy in distribution between two demographic groups to improve both fairness and accuracy.
130
+
131
+ # 3.2 Group-Aware Classification Thresholds
132
+
133
+ 133 Given an existing classification model and a sensitive attribute $a$ , we can denote true positive rate
134
+ 134 $( \mathrm { T P } _ { a } )$ , false positive rate $( \mathrm { F P } _ { a } )$ , true negative rate $( \mathrm { T N } _ { a } )$ , and false negative rate $( \mathrm { F N } _ { a } )$ in the confusion
135
+ 135 matrix. Most fairness notions can be represented with entries in the confusion matrix. For instance,
136
+ 136 Equal Opportunity (EOp) [7] requires $T P _ { 0 } = T P _ { 1 }$ , and Demographic Parity (DP) [1] requires
137
+
138
+ $$
139
+ \frac { T P _ { 1 } n _ { 1 1 } + F P _ { 1 } n _ { 0 1 } } { N _ { 1 } } = \frac { T P _ { 0 } n _ { 1 0 } + F P _ { 0 } n _ { 0 0 } } { N _ { 0 } } ,
140
+ $$
141
+
142
+ where 137 $n _ { y a }$ denotes the number of samples in the subset $\{ Y = y , A = a \}$ , $\begin{array} { r } { N _ { a } = \sum _ { y } n _ { y a } } \end{array}$ denotes the number of samples in 138 $\{ Y = y \}$ , and $\begin{array} { r } { N = \sum _ { y , a } n _ { y a } } \end{array}$ is the total number of samples.
143
+
144
+ ![](images/ae284a0093cee4b3affbd0d3bfb2f4a1f83a69b2bef20505d07b95f159ade15d.jpg)
145
+ Figure 1: Histograms of logit $h$ distribution from logistic regression on CelebA data, where logit $h$ is used to determine the predicted label $\hat { Y } = \mathbb { I } \{ h ( X ) \geq \theta \}$ , and $\theta$ is the classification threshold. The top plot is for positive samples $Y = 1$ , attractive), and the bottom plot for negative samples $( Y = 0$ , unattractive). In each plot, yellow/green bars represent the distribution of logit $h$ in different sensitive groups, and blue/red curves are estimated probability density functions of logit $h$ in different sensitive groups. $\theta _ { 0 } = \theta _ { 1 } = 0$ (black dashed line) are the default classification thresholds, that are identical for $A = 0$ and $A = 1$ groups. The default thresholds result in biased prediction towards the unprivileged group $A = 0$ due to the different logit $h$ distributions in different sensitive groups. $\theta _ { 0 } ^ { * }$ (red dashed line), $\theta _ { 1 } ^ { * }$ (blue dashed line) are group-aware thresholds from GSTAR for each sensitive group.
146
+
147
+ 139 Consider the group-aware classification threshold $\pmb { \theta } = ( \theta _ { 1 } , \theta _ { 0 } ) ^ { \top }$ , where $\theta _ { a }$ is the classification
148
+ 140 threshold for sensitive group $A = a$ . We can formulate the entries in the confusion matrix w.r.t. $\pmb { \theta }$ as
149
+ 141 below:
150
+
151
+ $$
152
+ \begin{array} { r l } { \mathrm { T P } _ { a } ( \theta _ { a } ) \approx 1 - \displaystyle \int _ { - \infty } ^ { \theta _ { a } } f _ { 1 a } ( x ) d x , } & { \qquad \mathrm { F N } _ { a } ( \theta _ { a } ) \approx \displaystyle \int _ { - \infty } ^ { \theta _ { a } } f _ { 1 a } ( x ) d x , } \\ { \mathrm { F P } _ { a } ( \theta _ { a } ) \approx 1 - \displaystyle \int _ { - \infty } ^ { \theta _ { a } } f _ { 0 a } ( x ) d x , } & { \qquad \mathrm { T N } _ { a } ( \theta _ { a } ) \approx \displaystyle \int _ { - \infty } ^ { \theta _ { a } } f _ { 0 a } ( x ) d x , } \end{array}
153
+ $$
154
+
155
+ 142 where $f _ { y a } ( x )$ is an estimated parametric probability density function of the distribution of output
156
+ 143 logit $h$ in the subset $\{ Y = y , { \bar { A } } = a \}$ . Here, we consider gamma, Student’s t, and normal distribution
157
+ 144 as the candidates for the estimated distribution, and select the one that has the maximum likelihood
158
+ 145 with the output distribution. Without loss of generality, this can be generalized with other parametric
159
+ 146 probability density function based on the needs or prior knowledge.
160
+ 147 Then, we formulate the fairness-constrained classification problem with the objective of minimizing
161
+ 148 classification error into a least-squared optimization problem. We denote our objective function
162
+ 149 as $\mathcal { L } ( \pmb { \theta } )$ which consists of the performance loss $\mathcal { L } _ { p e r } ( \pmb { \theta } )$ and fairness loss $\mathcal { L } _ { f a i r } ( \pmb { \theta } )$ . $\mathcal { L } _ { p e r } ( \pmb { \theta } )$ and
163
+ 150 $\mathcal { L } _ { f a i r } ( \pmb { \theta } )$ measures the error in performance and fairness respectively that are represented with the
164
+ 151 entries of the confusion matrix. In other words, our goal is to minimize the objective function $\mathcal { L } ( \pmb { \theta } )$
165
+ 152 as below:
166
+
167
+ $$
168
+ \begin{array} { r } { \mathcal { L } ( \pmb { \theta } ) = \mathcal { L } _ { p e r } ( \pmb { \theta } ) + \lambda \mathcal { L } _ { f a i r } ( \pmb { \theta } ) , } \end{array}
169
+ $$
170
+
171
+ 53 where $\lambda$ is a hyperparameter that determines how much fairness is enforced in the optimization.
172
+
173
+ 154 The performance error $\mathcal { L } _ { p e r } ( \pmb { \theta } )$ can be written as
174
+
175
+ $$
176
+ \mathcal { L } _ { p e r } ( \pmb { \theta } ) = \Big ( \frac { n _ { 0 1 } } { N } \mathrm { F P } _ { 1 } ( \theta _ { 1 } ) + \frac { n _ { 1 1 } } { N } \mathrm { F N } _ { 1 } ( \theta _ { 1 } ) + \frac { n _ { 0 0 } } { N } \mathrm { F P } _ { 0 } ( \theta _ { 0 } ) + \frac { n _ { 1 0 } } { N } \mathrm { F N } _ { 0 } ( \theta _ { 0 } ) \Big ) ^ { 2 } .
177
+ $$
178
+
179
+ 155 As for $\mathcal { L } _ { f a i r } ( \pmb { \theta } )$ , it can be formulated to any fairness metrics that are expressible with confusion matrix.
180
+ 156 For instance, when we impose EOp $\mathbf { \Delta T P _ { 1 } = T P _ { 0 } }$ ) and predictive equality (PE) $\mathbf { \mathrm { F P _ { 1 } } } = \mathbf { \mathrm { F P _ { 0 } } }$ ) [2], we
181
+ 157 can get the corresponding $\mathcal { L } _ { f a i r } ( \pmb { \theta } )$ by summing over the least squared form of each constraint. Also,
182
+ 158 satisfying EOp and PP is equivalent to satisfying Equalized Odds (EOd) [7], This can be formulated
183
+ 159 in our $\mathscr { L } _ { f a i r }$ as
184
+
185
+ $$
186
+ \begin{array} { r l } & { \mathcal { L } _ { f a i r } ^ { E O d } ( \pmb { \theta } ) = \mathcal { L } _ { f a i r } ^ { E O p } ( \pmb { \theta } ) + \mathcal { L } _ { f a i r } ^ { P P } ( \pmb { \theta } ) } \\ & { \quad \quad \quad = \left( T P _ { 1 } ( \theta _ { 1 } ) - T P _ { 0 } ( \theta _ { 0 } ) \right) ^ { 2 } + \left( F P _ { 1 } ( \theta _ { 1 } ) - F P _ { 0 } ( \theta _ { 0 } ) \right) ^ { 2 } . } \end{array}
187
+ $$
188
+
189
+ Note that a lower 160 $\mathcal { L } _ { f a i r }$ value indicates a fairer threshold. When $\mathcal { L } _ { f a i r } ^ { E O D } ( \pmb { \theta } ) = 0$ , we can interpret as 161 the satisfies the perfect EOd fairness.
190
+
191
+ 162 Similar to (4), we can enforce multiple fairness constraints by summing over the least squared of
192
+ 163 each metric with different weight constant $\lambda$ to each fairness constraints if needed.
193
+ 164 Also, it is notable that compared to the recent paper [10] that enforces fairness through confusion
194
+ 165 tensor, our formulation of fairness in $\mathcal { L } _ { f a i r } ( \pmb { \theta } )$ represents a direct notion of fairness metrics and
195
+ 166 improves the measures that allows us to achieve better performance and Pareto frontiers that is shown
196
+ 167 in Section 4.2 and Figure 2. For example, $A _ { \mathrm { E O d } }$ in the paper is calculated as $M _ { 1 } \mathrm { E O p } + M _ { 0 } \mathrm { P E }$ , where
197
+ 168 $M _ { y } = n _ { y 0 } + n _ { y 1 }$ , such that EOd is a weighted sum of EOp and PE with weights being the number of
198
+ 169 samples in each class. In this expression, the imbalance between the two fairness criteria will grow as
199
+ 170 the degree of imbalance in the data increases. In contrast, our formulation expresses the constraints
200
+ 171 as the exact notion of each metric that is not biased by the statistics of the datset and we observe
201
+ 172 improved Pareto frontier as in Figure 2.
202
+ 173 We propose to optimize our threshold $\pmb { \theta }$ with alternating optimization method. Here we take EOp
203
+ 174 constraint as an example to show the alternating optimization steps, then $\mathcal { L } _ { f a i r } ( \pmb { \theta } )$ can be written as
204
+
205
+ $$
206
+ \begin{array} { r } { \mathcal { L } _ { f a i r } ^ { E O p } ( \pmb { \theta } ) = \left( \mathrm { T P } _ { 1 } ( \theta _ { 1 } ) - \mathrm { T P } _ { 0 } ( \theta _ { 0 } ) \right) ^ { 2 } . } \end{array}
207
+ $$
208
+
209
+ 175 The first step is to fix $\theta _ { 0 }$ and update $\theta _ { 1 }$ . We can approximate the terms that are related to $\theta _ { 1 }$ (e.g.,
210
+ 176 $\mathrm { T P _ { 1 } , F P _ { 1 } , T N _ { 1 } , F N _ { 1 } ) }$ in (1) with first-order Taylor expansion at $\theta _ { 1 } ^ { \tau - 1 }$ . For example,
211
+
212
+ $$
213
+ \mathrm { T P _ { 1 } } ( \theta _ { 1 } ) \approx \mathrm { T P _ { 1 } } ( \theta _ { 1 } ^ { \tau - 1 } ) + \frac { \partial \mathrm { T P _ { 1 } } } { \partial \theta _ { 1 } } \Big | _ { \theta _ { 1 } = \theta _ { 1 } ^ { \tau - 1 } } ( \theta _ { 1 } - \theta _ { 1 } ^ { \tau - 1 } )
214
+ $$
215
+
216
+ 177 From (1), we can easily derive that
217
+
218
+ $$
219
+ \begin{array} { r l } { \mathrm { T P } _ { 1 } ( \theta _ { 1 } ^ { \tau - 1 } ) = } & { { } 1 - \displaystyle \int _ { - \infty } ^ { \theta _ { 1 } ^ { \tau - 1 } } f _ { 1 1 } ( x ) d x , } \\ { \displaystyle \frac { \partial \mathrm { T P } _ { 1 } } { \partial \theta _ { 1 } } = } & { { } - f _ { 1 1 } ( \theta _ { 1 } ^ { \tau - 1 } ) . } \end{array}
220
+ $$
221
+
222
+ 178 Similarly, we can find the first order Taylor expansion of $\mathrm { F P _ { 1 } , F N _ { 1 } }$ , and $\mathrm { T N _ { 1 } }$ . Then, the update of $\theta _ { 1 }$
223
+ 179 w.r.t. (2) can be approximated with the following minimization problem w.r.t. $\Delta _ { 1 }$
224
+
225
+ $$
226
+ \begin{array} { r } { \Delta _ { 1 } ^ { \tau } : = \underset { \Delta _ { 1 } } { \mathrm { a r g m i n } } ( \eta ^ { \tau } + \alpha ^ { \tau } \Delta _ { 1 } ) ^ { 2 } + \lambda ( \epsilon ^ { \tau } + \beta ^ { \tau } \Delta _ { 1 } ) ^ { 2 } , } \end{array}
227
+ $$
228
+
229
+ where 180 $\Delta _ { 1 } = \theta _ { 1 } - \theta _ { 1 } ^ { \tau - 1 }$ and
230
+
231
+ $$
232
+ \begin{array} { l l } { \displaystyle \alpha _ { 1 } ^ { \tau } = \frac { n _ { 1 1 } } { N } f _ { 1 1 } ( \theta _ { 1 } ^ { \tau - 1 } ) - \frac { n _ { 0 1 } } { N } f _ { 0 1 } ( \theta _ { 1 } ^ { \tau - 1 } ) , } \\ { \displaystyle \beta _ { 1 } ^ { \tau } = - f _ { 1 1 } ( \theta _ { 1 } ^ { \tau - 1 } ) , } \\ { \displaystyle \eta _ { 1 } ^ { \tau } = \int _ { - \infty } ^ { \theta _ { 1 } ^ { \tau - 1 } } \big ( \frac { n _ { 1 1 } } { N } f _ { 1 1 } ( x ) + \frac { n _ { 0 1 } } { N } ( 1 - f _ { 0 1 } ( x ) \big ) d x + \int _ { - \infty } ^ { \theta _ { 0 } ^ { \tau - 1 } } \big ( \frac { n _ { 1 0 } } { N } f _ { 1 0 } ( x ) + \frac { n _ { 0 0 } } { N } ( 1 - f _ { 0 0 } ( x ) \big ) d x , } \\ { \displaystyle \epsilon _ { 1 } ^ { \tau } = \int _ { \infty } ^ { \theta _ { 1 } ^ { \tau - 1 } } f _ { 1 1 } ( x ) d x - \int _ { \infty } ^ { \theta _ { 0 } ^ { \tau - 1 } } f _ { 0 1 } ( x ) d x . } \end{array}
233
+ $$
234
+
235
+ 181 Taking the derivative of (8) w.r.t. $\Delta _ { 1 }$ and setting it to 0, we can easily obtain the closed-form solution of 182 $\Delta _ { 1 } ^ { \tau }$ as
236
+
237
+ $$
238
+ \Delta _ { 1 } ^ { \tau } = - \frac { \alpha ^ { \tau } \eta ^ { \tau } + \lambda \beta ^ { \tau } \epsilon ^ { \tau } } { ( \alpha ^ { \tau } ) ^ { 2 } + \lambda ( \beta ^ { \tau } ) ^ { 2 } } .
239
+ $$
240
+
241
+ Input dataset $\mathcal { X } \times \mathcal { A } \times \mathcal { Y } = \{ ( \mathbf { x } _ { i } , \mathbf { a } _ { i } , \mathbf { y } _ { i } ) \} _ { i = 1 } ^ { n }$ , classification model $h ( X )$ , hyperparameter $\lambda$ .
242
+ Output Group-specific threshold $\pmb { \theta } = ( \theta _ { 1 } , \theta _ { 0 } )$ .
243
+ Initialize $\pmb { \theta } \overset { - } { = } ( \bar { \theta _ { 1 } } , \theta _ { 0 } ) = ( 0 , 0 )$ .
244
+ 1. Given a classifier $H ( x )$ , estimate probability density function $f _ { y a } , y , a \in \{ 0 , 1 \}$ by maximum
245
+ likelihood estimation.
246
+ while not converge do 2. Calculate the optimal step $\Delta _ { 1 }$ as $\begin{array} { r } { \Delta _ { 1 } = - \frac { \alpha _ { 1 } \eta _ { 1 } + \lambda \beta _ { 1 } \epsilon _ { 1 } } { \alpha _ { 1 } ^ { 2 } + \lambda \beta _ { 1 } ^ { 2 } } } \end{array}$ , with $\alpha _ { 1 } , \beta _ { 1 } , \eta _ { 1 } , \epsilon _ { 1 }$ values shown in (9); 3. Update the threshold: $\theta _ { 1 } \gets \theta _ { 1 } + \Delta _ { 1 }$ ; 4. Calculate the optimal step $\Delta _ { 0 }$ as $\begin{array} { r } { \Delta _ { 0 } = - \frac { \alpha _ { 0 } \eta _ { 0 } + \lambda \beta _ { 0 } \epsilon _ { 0 } } { \alpha _ { 0 } ^ { 2 } + \lambda \beta _ { 0 } ^ { 2 } } } \end{array}$ − α0η0+λβ00α2+λβ2 with α0, β0, η0, 0 values calculated in a similar way as in (9): 5. Update the threshold: $\theta _ { 0 } \theta _ { 0 } + \Delta _ { 0 }$ .
247
+ end while
248
+
249
+ 183 The second step is to fix $\theta _ { 1 }$ and update $\theta _ { 0 }$ , and this can be achieved in a similar way of updating $\theta _ { 1 }$
250
+ 184 Then we can finalize the alternating optimization as:
251
+
252
+ $$
253
+ \begin{array} { r } { \theta _ { 0 } ^ { \tau } = \theta _ { 0 } ^ { \tau - 1 } + \Delta _ { 0 } ^ { \tau } , } \\ { \theta _ { 1 } ^ { \tau } = \theta _ { 1 } ^ { \tau - 1 } + \Delta _ { 1 } ^ { \tau } . } \end{array}
254
+ $$
255
+
256
+ 185 It is notable that in each iteration we derive the optimal update step $\theta$ , which eliminates the burden
257
+ 186 of tuning hyperparameter (such as learning rate) in iterative algorithm. The optimization step is
258
+ 187 summarized in Algorithm 1. The above algorithm can easily extend to multiple fairness constraints
259
+ 188 by adding corresponding squared-loss fairness terms to (2).
260
+ 189 Time Complexity: The alternating optimization of GSTAR model is of low computational cost. We
261
+ 190 take at most one pass of the data for learning the estimated probability density functions $f _ { y a }$ in (1)
262
+ 191 (we do not even need to traverse the data if the parameters (such mean and variance in Gaussian
263
+ 192 distribution) for the estimated probability density functions $f _ { y a }$ can be provided). The optimization
264
+ 193 of $\pmb \theta$ with alternating optimization is efficient since we only need $f _ { y a }$ as we have seen in (9) and (10).
265
+ 194 $\pmb \theta \in \mathbb { R } ^ { 2 }$ is a vector with fixed small size. Therefore, we need a constant time for each update. Overall,
266
+ 195 the time complexity of GSTAR is $O ( n + T )$ , where $n$ is the number of samples, and $T$ is the number
267
+ 196 of iterations in alternating optimization.
268
+ 197 We further derive the theoretical analysis of our GSTAR model on the balance between fairness
269
+ 198 and accuracy, which indicates that the optimal solution provides guarantees on model accuracy
270
+ 199 under the optimal fairness constraint. Details of the theoretical analysis is in the Supplementary
271
+ 200 material. Besides, if a unified threshold is necessary [3], i.e., $\theta _ { 1 } = \theta _ { 0 }$ , the optimization algorithm
272
+ 201 also applies and we only have one scalar variable in (2). When we have a unified threshold, we do not
273
+ 202 require sensitive information in the testing phase that we can conform more strict privacy regulations
274
+ 203 than group-aware thresholding. However, we have to sacrifice both fairness and accuracy as the
275
+ 204 thresholding is less flexible.
276
+
277
+ # 205 4 Experiments
278
+
279
+ In this section, we validate GSTAR model on four well-known fairness datasets and compare with other state-of-the-art methods. First, we plot Pareto frontiers of ours and FACT (MS) [10] to demonstrate the trade-offs between fairness and accuracy. Second, we evaluate the models with different fairness metrics and validate that our model is highly adaptive to any fairness metrics that are expressible with confusion matrix [7, 11, 2, 1]. Third, we use our model as a post-processing method to existing fair models and show that our model further improves existing fair models in an efficient and model-agnostic manner.
280
+
281
+ # 13 4.1 Experimental Setup
282
+
283
+ 214 We compare with multiple fairness approaches in the experiments. For clear demonstration of results,
284
+ 215 we use different shapes of marker for each comparing methods in Figure 2 and Figure 4. The compar
285
+ 216 ing methods include: Learning fair representations for kernel models (abbreviated as FGP) [23],
286
+
287
+ ![](images/565230b45ca3cf80fd5db341650e28a43250d364180ae4817bf68db498033a38.jpg)
288
+ Figure 2: Model-specific Pareto frontiers of equalized odds to show the upper bound of best achievable accuracy under different fairness constraints. Upper right region under the boundary shows better fairness and higher accuracy. We plot three variations of GSTAR (star-shaped) with different fairness objectives. GSTAR is the closest to the Pareto frontier which indicates the best trade-offs.
289
+
290
+ Fairness confusion tensor (abbreviated as FACT) [10], Disparate impact remover (abbreviated as DIR) [6], Adversarial de-biasing (abbreviated as AdvDeb) [24], Calibrated equalized odds post-processing (abbreviated as CEOPost) [20], Equality of opportunity in supervised learning (abbreviated as Odds) [7], Learning adversarially fair and transferable representations (abbreviated as LAFTR) [17], and Baseline: For CelebA dataset, we use ResNet50 [8] as a reference, and logistic regression for all other datasets. Our method is optimized with $\lambda$ in the range of $[ 1 0 ^ { - 1 } , 1 0 ^ { 4 } ]$ with alternating optimization method. All experiments are implemented with Pytorch framework on i9-9960X CPU and a Quadro RTX 6000 GPU.
291
+
292
+ We choose broadly used fairness metrics in evaluation including: equal opportunity difference and equalized odds difference (abbreviated as EOp, and EOd respectively) [7] ; 1-disparate impact (abbreviated as 1-DIMP) [1]; balanced accuracy difference (abbreviated as BD).
293
+
294
+ 228 We evaluate the methods on four fairness datasets: CelebA image dataset1 [15], Adult dataset from
295
+ 229 the UCI repository [12], COMPAS2 (Correctional Offender Management Profiling for Alternative
296
+ 230 Sanctions) dataset, and German credit dataset from the UCI repository [5]. All data is split as $70 \%$
297
+ 231 for training and $30 \%$ for testing. More details of the comparing methods, evaluation metrics, and
298
+ 232 datasets are provided in the Supplementary material.
299
+
300
+ # 4.2 Performance and Fairness-Accuracy Trade-Offs
301
+
302
+ In this subsection, we look into the performance evaluation of GSTAR comparing with other state-ofthe-art methods. We consider Pareto frontier to visualize the trade-offs between fairness and accuracy to demonstrate the measure of performance.
303
+
304
+ In Figure 2, we plot Pareto frontier, which is the upper bound for the accuracy-fairness trade-offs, desired output locates at the upper right region under the boundary which corresponds to higher values in accuracy and lower values in fairness discrepancy. With the same fairness constraints are given, we achieve a better frontier than the FACT [10] as we equally weigh on demographic statistics and have a better feasible region. To obtain our results (star points), we first estimate the logit distribution from the output of the baseline model, and then we get optimal adaptive thresholds with corresponding fairness metric by updating w.r.t. the objective function in (2). Here we have three combinations of fairness imposed to GSTAR: demographic parity (DP), equalized odds (EOd), and
305
+
306
+ ![](images/faeeab7cd7f97f0e628ac573c27aaab1a4f960e543cb8745e20f0bab62add685.jpg)
307
+ Figure 3: Quantitative evaluation on fairness and performance metrics. The bar plots indicate fairness measures (EOp, EOd, BD, 1-DISP) of each model. Lower fairness values in the left y-axis shows better fairness. The line plots indicate the performance measure (balanced accuracy (BA) and accuracy (ACC) of each model. Higher performance values in the right y-axis shows better classifcation performance. We consider three variations of GSTAR models (DP, EOd, DP+EOd).
308
+
309
+ 245 with both constraints $\mathrm { ( D P { + } E O d ) }$ . By post-processing on a simple baseline, we achieved significantly
310
+ 246 better fairness with small or no sacrifice in accuracy. In all datasets, GSATR got competitive or better
311
+ 247 results than other state-of-the-art methods on both fairness and accuracy.
312
+ 248 For example, we got $\pmb { \theta } _ { E O d } ^ { * } = ( 0 . 6 4 0 , - 0 . 6 2 7 ) ^ { \top }$ for the CelebA dataset. This shows that we have
313
+ 249 a higher threshold for the privileged group and a lower threshold for the unprivileged group. This
314
+ 250 optimal thresholding from GSTAR allows more samples from the privileged group to be correctly
315
+ 251 predicted as unattractive that would compensate for the discrimination of the original model. In other
316
+ 252 words, this improves predictive equality [2] with a huge amount from 0.235 to 0.014. Also, true
317
+ 253 positive rate difference (also known as equality of opportunity [7]) got reduced from 0.282 to 0.018.
318
+ 254 It is notable that GSTAR only sacrificed $2 . 2 \%$ of accuracy to bring the big improvement in fairness.
319
+ 255 Since the objective function of our model is independent to data dimensionality, our model is much
320
+ 256 more efficient especially for high dimensional data. We mostly outperform the computational cost
321
+ 257 comparing to the other methods. The comparison of computational time on the datasets can be found
322
+ 258 in the Supplementary material.
323
+
324
+ # 259 4.3 Flexibility and Multiple Fairness Constraints
325
+
326
+ Since each fairness metric has different interests, it has been theoretically proven that they cannot be perfectly satisfied all together [20, 2, 11]. Because of this inherent trade-offs between fairness metrics, most of the recent works focus on a single metric at a time to achieve fairness. However with GSTAR, we have the flexibility to optimize on multiple fairness constraints that can be represented in the confusion matrix format. Moreover, given the estimated distribution $f _ { y a }$ of a black-box classification model, we can adjust the optimal $\pmb \theta$ based on the needs by accommodating different fairness criteria.
327
+
328
+ Figure 3 demonstrates the result of the methods with fairness metrics and accuracy trade-off evaluations. Overall, the variations of GSTAR achieve the best fairness on each target fairness while preserving the performance. For example in Figure 3(a), GSTAR with EOd constraint has outstanding performance in most fairness metrics with comparable accuracy $( 8 0 . 3 \% )$ . Comparing with GSTAR (EOd), when we introduce EOd and DP together $( \mathrm { D P + E O d } )$ ), we achieve significantly better w.r.t. DP fairness with sacrificing a small amount of accuracy and EOd.
329
+
330
+ ![](images/99aaf30eada38a91a493c559194b114c06bbd339971f8a93609ffe3ec07e1b85.jpg)
331
+ Figure 4: Illustration of post-processing (magenta colored points) on existing fairness models (blue colored points). Given the outputs of each model, we efficiently improve existing fairness models with optimized group-aware thresholds from GSTAR.
332
+
333
+ 272 In general, by sacrificing individual fairness performance, we could introduce multiple constraints.
334
+ 273 Also, we implicitly observe that the more fairness constraints are introduced, the more accuracy is
335
+ 274 sacrificed. We empirically found that in some cases (e.g. Figure 3(c)), introducing multiple fairness
336
+ 275 is complementary to each other that improves both conditions.
337
+
338
+ # 276 4.4 Post-Processing on an Existing Fair Model
339
+
340
+ For a binary classifier that has a single fixed classification threshold (0 for out logit, and 0.5 for label probability), we can improve the trade-off between fairness and accuracy via GSTAR postprocessing. Given the logit/probability of the dataset from a black-box model, we can improve the fairness as illustrated in Figure 4. In most cases, we observe improvement in fairness after GSTAR post-processing. It is also interesting to note that by optimizing the different thresholds for each protected group, we even obtain better performance on both fairness and accuracy, which indicates that the threshold optimization can not only improve fairness but also accuracy.
341
+
342
+ 284 However, when the distribution of the logits/probability is highly extreme (such as the results of using
343
+ 285 GSTAR to post-process CEOPost), it is difficult to estimate the distribution and thus causes erroneous
344
+ 286 optimization in GSTAR. We empirically found that when the dataset is extremely imbalanced such
345
+ 287 that we do not have enough samples to estimate the logit/probability distribution, or black-box model
346
+ 288 is too certain to the prediction that samples are concentrated to certain output, this problem arises.
347
+
348
+ # 289 5 Conclusion and Discussion
349
+
350
+ In this paper, we propose a group-aware threshold adaptation method (GSTAR) to post-process a blackbox model and optimize over multiple fairness constraints.We directly optimize the classification threshold for each demographic group w.r.t. the classification error and multiple fairness constraints in a unified objective function, such that we can practically achieve an optimal trade-off between accuracy and fairness in fair classification. Our method is applicable to diverse notions of group fairness as the majority of fairness notions can be expressed as a linear or quadratic equation through confusion matrix. We empirically show that GSTAR is flexible with fairness regularization, efficient with low computational cost. We also notice that the adaptive thresholds benefit accuracy in some cases. GSTAR agrees to protect privacy such as article 17 of EU’s GDPR [21] with model-agnostic post-processing. We only require the estimated distribution of the output from a black-box model i.e., our post-processing method is oblivious to features. Thus training data is no longer needed and allowed to be discarded after training the black-box model.
351
+
352
+ Further, we empirically find that GSTAR is not applicable to post-process some classification models
353
+ 303 in the following situations: 1) the model does not provide logit/probability as the outcome; 2) The
354
+ 304 model provides an extreme distribution of the output logit/probability. For example, when the model
355
+ 305 is too certain about its prediction, it will be difficult to perform probability density estimation. In our
356
+ 306 future work, we will study possible strategies to solve the above limitations, and extend GSTAR to
357
+ 307 multi-class, multi-sensitive group problems and improve the fairness-accuracy trade-off in a more
358
+ 308 general scheme.
359
+
360
+ References
361
+ [1] Solon Barocas and Andrew D Selbst. Big data’s disparate impact. Calif. L. Rev., 104:671, 2016.
362
+ [2] Alexandra Chouldechova. Fair prediction with disparate impact: A study of bias in recidivism prediction instruments. Big data, 5(2):153–163, 2017.
363
+ [3] Sam Corbett-Davies, Emma Pierson, Avi Feller, Sharad Goel, and Aziz Huq. Algorithmic decision making and the cost of fairness. In KDD, pages 797–806, 2017.
364
+ [4] Julia Dressel and Hany Farid. The accuracy, fairness, and limits of predicting recidivism. Sci. Adv, 4(1):eaao5580, 2018.
365
+ [5] Dheeru Dua and Casey Graff. UCI machine learning repository, 2019.
366
+ [6] Michael Feldman, Sorelle A Friedler, John Moeller, Carlos Scheidegger, and Suresh Venkatasubramanian. Certifying and removing disparate impact. In KDD, pages 259–268, 2015.
367
+ [7] Moritz Hardt, Eric Price, and Nati Srebro. Equality of opportunity in supervised learning. In NeurIPS, pages 3315–3323, 2016.
368
+ [8] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016.
369
+ [9] Faisal Kamiran, Asim Karim, and Xiangliang Zhang. Decision theory for discrimination-aware classification. In ICDM, pages 924–929. IEEE, 2012.
370
+ [10] Joon Sik Kim, Jiahao Chen, and Ameet Talwalkar. Model-agnostic characterization of fairness trade-offs. arXiv preprint arXiv:2004.03424, 2020.
371
+ [11] Jon Kleinberg, Sendhil Mullainathan, and Manish Raghavan. Inherent trade-offs in the fair determination of risk scores. arXiv preprint arXiv:1609.05807, 2016.
372
+ [12] Ron Kohavi. Scaling up the accuracy of naive-bayes classifiers: A decision-tree hybrid. In KDD, volume 96, pages 202–207, 1996.
373
+ [13] Lydia T Liu, Sarah Dean, Esther Rolf, Max Simchowitz, and Moritz Hardt. Delayed impact of fair machine learning. arXiv preprint arXiv:1803.04383, 2018.
374
+ [14] Lydia T Liu, Max Simchowitz, and Moritz Hardt. The implicit fairness criterion of unconstrained learning. In ICML, pages 4051–4060, 2019.
375
+ [15] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In ICCV, pages 3730–3738, 2015.
376
+ [16] Vishnu Suresh Lokhande, Aditya Kumar Akash, Sathya N Ravi, and Vikas Singh. Fairalm: Augmented lagrangian method for training fair models with little regret. In ECCV, pages 365–381. Springer, 2020.
377
+ [17] David Madras, Elliot Creager, Toniann Pitassi, and Richard Zemel. Learning adversarially fair and transferable representations. arXiv preprint arXiv:1802.06309, 2018.
378
+ [18] Aditya Krishna Menon and Robert C Williamson. The cost of fairness in binary classification. In ACM FAccT, pages 107–118, 2018.
379
+ [19] Dino Pedreshi, Salvatore Ruggieri, and Franco Turini. Discrimination-aware data mining. In KDD, pages 560–568, 2008.
380
+ [20] Geoff Pleiss, Manish Raghavan, Felix Wu, Jon Kleinberg, and Kilian Q Weinberger. On fairness and calibration. In NeurIPS, pages 5680–5689, 2017.
381
+ [21] General Data Protection Regulation. Regulation eu 2016/679 of the european parliament and of the council of 27 april 2016. Official Journal of the European Union. Available at: http://ec. europa. eu/justice/data-protection/reform/files/regulation_oj_en. pdf (accessed 20 September 2017), 2016.
382
+ [22] Hee Jung Ryu, Hartwig Adam, and Margaret Mitchell. Inclusivefacenet: Improving face attribute detection with race and gender diversity. arXiv preprint arXiv:1712.00193, 2017.
383
+ [23] Zilong Tan, Samuel Yeom, Matt Fredrikson, and Ameet Talwalkar. Learning fair representations for kernel models. In AISTATS, pages 155–166, 2020.
384
+ [24] Brian Hu Zhang, Blake Lemoine, and Margaret Mitchell. Mitigating unwanted biases with adversarial learning. In AIES, pages 335–340, 2018.
385
+ [25] Han Zhao and Geoff Gordon. Inherent tradeoffs in learning fair representations. In NeurIPS, pages 15675–15685, 2019.
386
+
387
+ # Checklist
388
+
389
+ 1. For all authors...
390
+
391
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
392
+ (b) Did you describe the limitations of your work? [Yes] See Section 5.
393
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 5.
394
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
395
+
396
+ 2. If you are including theoretical results...
397
+
398
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 1 in the Supplementary material.
399
+ (b) Did you include complete proofs of all theoretical results? [Yes] See Section 1 in the Supplementary material.
400
+
401
+ 3. If you ran experiments...
402
+
403
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We will provide the code and instructions at request. The data used in the experiments are public available. See Section 2.3 in the Supplementary material.
404
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4.1.
405
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Section 4.3.
406
+ (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.1.
407
+
408
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
409
+
410
+ (a) If your work uses existing assets, did you cite the creators? [N/A]
411
+ (b) Did you mention the license of the assets? [N/A]
412
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
413
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
414
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
415
+
416
+ 5. If you used crowdsourcing or conducted research with human subjects...
417
+
418
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
419
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
420
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/S19eAF9ee/S19eAF9ee.md ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # STRUCTURED SEQUENCE MODELING WITH GRAPH CONVOLUTIONAL RECURRENT NETWORKS
2
+
3
+ Youngjoo Seo EPFL, Switzerland youngjoo.seo@epfl.ch
4
+
5
+ Michael Defferrard¨
6
+ EPFL, Switzerland
7
+ michael.defferrard@epfl.ch
8
+ Pierre Vandergheynst
9
+ EPFL, Switzerland
10
+ pierre.vandergheynst@epfl.ch
11
+ Xavier Bresson
12
+ EPFL, Switzerland
13
+ xavier.bresson@epfl.ch
14
+
15
+ # ABSTRACT
16
+
17
+ This paper introduces Graph Convolutional Recurrent Network (GCRN), a deep learning model able to predict structured sequences of data. Precisely, GCRN is a generalization of classical recurrent neural networks (RNN) to data structured by an arbitrary graph. Such structured sequences can represent series of frames in videos, spatio-temporal measurements on a network of sensors, or random walks on a vocabulary graph for natural language modeling. The proposed model combines convolutional neural networks (CNN) on graphs to identify spatial structures and RNN to find dynamic patterns. We study two possible architectures of GCRN, and apply the models to two practical problems: predicting moving MNIST data, and modeling natural language with the Penn Treebank dataset. Experiments show that exploiting simultaneously graph spatial and dynamic information about data can improve both precision and learning speed.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Many real-world data can be cast as structured sequences, with spatio-temporal sequences being a special case. A well-studied example of spatio-temporal data are videos, where succeeding frames share temporal and spatial structures. Many works, such as Donahue et al. (2015); Karpathy & FeiFei (2015); Vinyals et al. (2015), leveraged a combination of CNN and RNN to exploit such spatial and temporal regularities. Their models are able to process possibly time-varying visual inputs for variable-length prediction. These neural network architectures consist of combining a CNN for visual feature extraction followed by a RNN for sequence learning. Such architectures have been successfully used for video activity recognition, image captioning and video description.
22
+
23
+ More recently, interest has grown in properly fusing the CNN and RNN models for spatio-temporal sequence modeling. Inspired by language modeling, Ranzato et al. (2014) proposed a model to represent complex deformations and motion patterns by discovering both spatial and temporal correlations. They showed that prediction of the next video frame and interpolation of intermediate frames can be achieved by building a RNN-based language model on the visual words obtained by quantizing the image patches. Their highest-performing model, recursive CNN (rCNN), uses convolutions for both inputs and states. Shi et al. (2015) then proposed the convolutional LSTM network (convLSTM), a recurrent model for spatio-temporal sequence modeling which uses 2D-grid convolution to leverage the spatial correlations in input data. They successfully applied their model to the prediction of the evolution of radar echo maps for precipitation nowcasting.
24
+
25
+ The spatial structure of many important problems may however not be as simple as regular grids. For instance, the data measured from meteorological stations lie on a irregular grid, i.e. a network of heterogeneous spatial distribution of stations. More challenging, the spatial structure of data may not even be spatial, as it is the case for social or biological networks. Eventually, the interpretation that sentences can be regarded as random walks on vocabulary graphs, a view popularized by Mikolov et al. (2013), allows us to cast language analysis problems as graph-structured sequence models.
26
+
27
+ ![](images/bc5c5ccd950b0931976650108dec932da5c09eea0c33f2811817daf66f4eb37c.jpg)
28
+ Figure 1: Illustration of the proposed GCRN model for spatio-temporal prediction of graph-structured data. The technique combines at the same time CNN on graphs and RNN. RNN can be easily exchanged with LSTM or GRU networks.
29
+
30
+ ![](images/a8c0f2e3882ab26eeb26dbb84bd4e7b15d885d5b9212c832e5fae885167d1d8d.jpg)
31
+ Figure 2: Illustration of the neighborhood on an 8-nearest-neighbor grid graph. Isotropic spectral filters of support $K$ have access to nodes at most at $K - 1$ hops.
32
+
33
+ This work leverages on the recent models of Defferrard et al. (2016); Ranzato et al. (2014); Shi et al. (2015) to design the GCRN model for modeling and predicting time-varying graph-based data. The core idea is to merge CNN for graph-structured data and RNN to identify simultaneously meaningful spatial structures and dynamic patterns. A generic illustration of the proposed GCRN architecture is given by Figure 1.
34
+
35
+ # 2 PRELIMINARIES
36
+
37
+ # 2.1 STRUCTURED SEQUENCE MODELING
38
+
39
+ Sequence modeling is the problem of predicting the most likely future length- $K$ sequence given the previous $J$ observations:
40
+
41
+ $$
42
+ \hat { x } _ { t + 1 } , \ldots , \hat { x } _ { t + K } = \operatorname * { a r g m a x } _ { x _ { t + 1 } , \ldots , x _ { t + K } } P ( x _ { t + 1 } , \ldots , x _ { t + K } | x _ { t - J + 1 } , \ldots , x _ { t } ) ,
43
+ $$
44
+
45
+ where $x _ { t } ~ \in ~ \mathbf { D }$ is an observation at time $t$ and $\mathbf { D }$ denotes the domain of the observed features. The archetypal application being the $n$ -gram language model (with $n = J + 1 ,$ ), where $P ( x _ { t + 1 } | x _ { t - J + 1 } , . . . , x _ { t } )$ models the probability of word $x _ { t + 1 }$ to appear conditioned on the past $J$ words in the sentence (Graves, 2013).
46
+
47
+ In this paper, we are interested in special structured sequences, i.e. sequences where features of the observations $x _ { t }$ are not independent but linked by pairwise relationships. Such relationships are universally modeled by weighted graphs.
48
+
49
+ Data $x _ { t }$ can be viewed as a graph signal, i.e. a signal defined on an undirected and weighted graph $\mathcal { G } = ( \nu , \mathcal { E } , A )$ , where $\nu$ is a finite set of $| \nu | = n$ vertices, $\mathcal { E }$ is a set of edges and $A \in \mathbb { R } ^ { n \times n }$ is a weighted adjacency matrix encoding the connection weight between two vertices. A signal $x _ { t } : \mathcal { V } \overset { \cdot } { } \mathbb { R } ^ { d _ { x } }$ defined on the nodes of the graph may be regarded as a matrix $\boldsymbol { x } _ { t } \in \mathbb { R } ^ { n \times d _ { \boldsymbol { x } } }$ whose column $i$ is the $d _ { x }$ -dimensional value of $x _ { t }$ at the $i ^ { t h }$ node. While the number of free variables in a structured sequence of length $K$ is in principle $\mathcal { O } ( n ^ { K } d _ { x } { } ^ { K } )$ , we seek to exploit the structure of the space of possible predictions to reduce the dimensionality and hence make those problems more tractable.
50
+
51
+ # 2.2 LONG SHORT-TERM MEMORY
52
+
53
+ A special class of recurrent neural networks (RNN) that prevents the gradient from vanishing too quickly is the popular long short-term memory (LSTM) introduced by Hochreiter & Schmidhuber (1997). This architecture has proven stable and powerful for modeling long-range dependencies in various general-purpose sequence modeling tasks (Graves, 2013; Srivastava et al., 2015; Sutskever et al., 2014). A fully-connected LSTM (FC-LSTM) may be seen as a multivariate version of LSTM where the input $x _ { t } \in \mathbb { R } ^ { d _ { x } }$ , cell output $h _ { t } \in [ - 1 , 1 ] ^ { d _ { h } }$ and states $c _ { t } \in \mathbb { R } ^ { d _ { h } }$ are all vectors. In this paper, we follow the FC-LSTM formulation of Graves (2013), that is:
54
+
55
+ $$
56
+ \begin{array} { r l } & { i = \sigma ( W _ { x i } x _ { t } + W _ { h i } h _ { t - 1 } + w _ { c i } \odot c _ { t - 1 } + b _ { i } ) , } \\ & { f = \sigma ( W _ { x f } x _ { t } + W _ { h f } h _ { t - 1 } + w _ { c f } \odot c _ { t - 1 } + b _ { f } ) , } \\ & { c _ { t } = f _ { t } \odot c _ { t - 1 } + i _ { t } \odot \operatorname { t a n h } ( W _ { x c } x _ { t } + W _ { h c } h _ { t - 1 } + b _ { c } ) , } \\ & { o = \sigma ( W _ { x o } x _ { t } + W _ { h o } h _ { t - 1 } + w _ { c o } \odot c _ { t } + b _ { o } ) , } \\ & { h _ { t } = o \odot \operatorname { t a n h } ( c _ { t } ) , } \end{array}
57
+ $$
58
+
59
+ where $\odot$ denotes the Hadamard product, $\sigma ( \cdot )$ the sigmoid function $\sigma ( x ) ~ = ~ 1 / ( 1 + e ^ { - x } )$ and $i , f , o \in [ 0 , 1 ] ^ { d _ { h } }$ are the input, forget and output gates. The weights $W _ { x }$ $\ l _ { \cdot } \in \mathbb { R } ^ { d _ { h } \times d _ { x } }$ , $\dot { W } _ { h \cdot } \in \mathbb { R } ^ { d _ { h } \times d _ { h } }$ , $w _ { c } . \in \mathbb { R } ^ { d _ { h } }$ and biases $b _ { i } , \bar { b } _ { f } , b _ { c } , \bar { b _ { o } } \in \mathbb { R } ^ { d _ { h } }$ are the model parameters.1 Such a model is called fullyconnected because the dense matrices $W _ { x }$ · and $W _ { h }$ · linearly combine all the components of $x$ and $h$ . The optional peephole connections $w _ { c }$ · $\odot c _ { t }$ , introduced by Gers & Schmidhuber (2000), have been found to improve performance on certain tasks.
60
+
61
+ # 2.3 CONVOLUTIONAL NEURAL NETWORKS ON GRAPHS
62
+
63
+ Generalizing convolutional neural networks (CNNs) to arbitrary graphs is a recent area of interest. Two approaches have been explored in the literature: (i) a generalization of the spatial definition of a convolution (Masci et al., 2015; Niepert et al., 2016) and (ii), a multiplication in the graph Fourier domain by the way of the convolution theorem (Bruna et al., 2014; Defferrard et al., 2016). Masci et al. (2015) introduced a spatial generalization of CNNs to 3D meshes. The authors used geodesic polar coordinates to define convolution operations on mesh patches, and formulated a deep learning architecture which allows comparison across different meshes. Hence, this method is tailored to manifolds and is not directly generalizable to arbitrary graphs. Niepert et al. (2016) proposed a spatial approach which may be decomposed in three steps: (i) select a node, (ii) construct its neighborhood and (iii) normalize the selected sub-graph, i.e. order the neighboring nodes. The extracted patches are then fed into a conventional 1D Euclidean CNN. As graphs generally do not possess a natural ordering (temporal, spatial or otherwise), a labeling procedure should be used to impose it. Bruna et al. (2014) were the first to introduce the spectral framework described below in the context of graph CNNs. The major drawback of this method is its $\mathcal { O } ( n ^ { 2 } )$ complexity, which was overcome with the technique of Defferrard et al. (2016), which offers a linear complexity $\mathcal { O } ( | \mathcal { E } | )$ and provides strictly localized filters. Kipf & Welling (2016) took a first-order approximation of the spectral filters proposed by Defferrard et al. (2016) and successfully used it for semi-supervised classification of nodes. While we focus on the framework introduced by Defferrard et al. (2016), the proposed model is agnostic to the choice of the graph convolution operator $^ { \ast _ { \mathcal { G } } }$ .
64
+
65
+ As it is difficult to express a meaningful translation operator in the vertex domain (Bruna et al., 2014; Niepert et al., 2016), Defferrard et al. (2016) chose a spectral formulation for the convolution operator on graph $^ { \ast _ { \mathcal { G } } }$ . By this definition, a graph signal $x \in \overline { { \mathbb { R } ^ { n \times d _ { x } } } }$ is filtered by a non-parametric kernel $g _ { \theta } ( \Lambda ) = \mathrm { d i a g } ( \theta )$ , where $\boldsymbol { \theta } \in \mathbb { R } ^ { n }$ is a vector of Fourier coefficients, as
66
+
67
+ $$
68
+ y = g _ { \theta } * _ { \mathcal { G } } x = g _ { \theta } ( L ) x = g _ { \theta } ( U \Lambda U ^ { T } ) x = U g _ { \theta } ( \Lambda ) U ^ { T } x \in \mathbb { R } ^ { n \times d _ { x } } ,
69
+ $$
70
+
71
+ where $U \in \mathbb { R } ^ { n \times n }$ is the matrix of eigenvectors and $\boldsymbol { \Lambda } \in \mathbb { R } ^ { n \times n }$ the diagonal matrix of eigenvalues of the normalized graph Laplacian $\bar { L } \ = \ I _ { n } - D ^ { - 1 / 2 } A D ^ { - 1 / 2 } \ = U \bar { \Lambda } U ^ { T } \ \in \ \mathbb { R } ^ { n \times n }$ , where $I _ { n }$ is the identity matrix and $D \in \mathbb { R } ^ { n \times n }$ is the diagonal degree matrix with $D _ { i i } = \textstyle \sum _ { j } A _ { i j }$ (Chung, 1997). Note that the signal $x$ is filtered by $g _ { \boldsymbol { \theta } }$ with an element-wise multiplication of its graph Fourier transform $U ^ { T } x$ with $g _ { \theta }$ (Shuman et al., 2013). Evaluating (3) is however expensive, as the multiplication with $U$ is $\mathcal { O } ( n ^ { 2 } )$ . Furthermore, computing the eigendecomposition of $L$ might be prohibitively expensive for large graphs. To circumvent this problem, Defferrard et al. (2016) parametrizes $g _ { \theta }$ as a truncated expansion, up to order $K - 1$ , of Chebyshev polynomials $T _ { k }$ such that
72
+
73
+ $$
74
+ g _ { \theta } ( \Lambda ) = \sum _ { k = 0 } ^ { K - 1 } \theta _ { k } T _ { k } ( \tilde { \Lambda } ) ,
75
+ $$
76
+
77
+ where the parameter $\theta \in \mathbb { R } ^ { K }$ is a vector of Chebyshev coefficients and $T _ { k } ( \tilde { \Lambda } ) \ \in \ \mathbb { R } ^ { n \times n }$ is the Chebyshev polynomial of order $k$ evaluated at $\tilde { \Lambda } = 2 \Lambda / \lambda _ { m a x } - I _ { n }$ . The graph filtering operation can then be written as
78
+
79
+ $$
80
+ y = g _ { \theta } * _ { \mathcal { G } } x = g _ { \theta } ( L ) x = \sum _ { k = 0 } ^ { K - 1 } \theta _ { k } T _ { k } ( \tilde { L } ) x ,
81
+ $$
82
+
83
+ where $T _ { k } ( \tilde { L } ) \in \mathbb { R } ^ { n \times n }$ is the Chebyshev polynomial of order $k$ evaluated at the scaled Laplacian $\tilde { L } = 2 L / \lambda _ { m a x } - I _ { n }$ . Using the stable recurrence relation $T _ { k } ( x ) = 2 x T _ { k - 1 } ( x ) - T _ { k - 2 } ( x )$ with $T _ { 0 } = 1$ and $T _ { 1 } = x$ , one can evaluate (5) in $\mathcal { O } ( K \vert \mathcal { E } \vert )$ operations, i.e. linearly with the number of edges. Note that as the filtering operation (5) is an order $K$ polynomial of the Laplacian, it is $K$ -localized and depends only on nodes that are at maximum $K$ hops away from the central node, the $K$ -neighborhood. The reader is referred to Defferrard et al. (2016) for details and an in-depth discussion.
84
+
85
+ # 3 RELATED WORKS
86
+
87
+ Shi et al. (2015) introduced a model for regular grid-structured sequences, which can be seen as a special case of the proposed model where the graph is an image grid where the nodes are well ordered. Their model is essentially the classical FC-LSTM (2) where the multiplications by dense matrices $W$ have been replaced by convolutions with kernels $W$ :
88
+
89
+ $$
90
+ \begin{array} { r l } & { i = \sigma ( W _ { x i } * x _ { t } + W _ { h i } * h _ { t - 1 } + w _ { c i } \odot c _ { t - 1 } + b _ { i } ) , } \\ & { f = \sigma ( W _ { x f } * x _ { t } + W _ { h f } * h _ { t - 1 } + w _ { c f } \odot c _ { t - 1 } + b _ { f } ) , } \\ & { c _ { t } = f _ { t } \odot c _ { t - 1 } + i _ { t } \odot \operatorname { t a n h } ( W _ { x c } * x _ { t } + W _ { h c } * h _ { t - 1 } + b _ { c } ) , } \\ & { o = \sigma ( W _ { x o } * x _ { t } + W _ { h o } * h _ { t - 1 } + w _ { c o } \odot c _ { t } + b _ { o } ) , } \\ & { h _ { t } = o \odot \operatorname { t a n h } ( c _ { t } ) , } \end{array}
91
+ $$
92
+
93
+ where $^ *$ denotes the 2D convolution by a set of kernels. In their setting, the input tensor $\boldsymbol { x } _ { t } ~ \in$ $\mathbb { R } ^ { n _ { r } \times n _ { c } \times d _ { x } }$ is the observation of $d _ { x }$ measurements at time $t$ of a dynamical system over a spatial region represented by a grid of $n _ { r }$ rows and $n _ { c }$ columns. The model holds spatially distributed hidden and cell states of size $d _ { h }$ given by the tensors $c _ { t } , h _ { t } \ \in \ \mathbb { R } ^ { n _ { r } \times n _ { c } \times d _ { h } }$ . The size $m$ of the convolutional kernels $W _ { h . \cdot } \in \mathbb { R } ^ { m \times \bar { m } \times d _ { h } \times \bar { d } _ { h } }$ and $W _ { x }$ · $\in \mathbb { R } ^ { m \times m \times d _ { h } \times d _ { x } }$ determines the number of parameters, which is independent of the grid size $n _ { r } \times n _ { c }$ . Earlier, Ranzato et al. (2014) proposed a similar RNN variation which uses convolutional layers instead of fully connected layers. The hidden state at time $t$ is given by
94
+
95
+ $$
96
+ h _ { t } = \operatorname { t a n h } ( \sigma ( W _ { x 2 } \ast \sigma ( W _ { x 1 } \ast x _ { t } ) ) + \sigma ( W _ { h } \ast h _ { t - 1 } ) ) ,
97
+ $$
98
+
99
+ where the convolutional kernels $W _ { h } \in \mathbb { R } ^ { d _ { h } \times d _ { h } }$ are restricted to filters of size 1x1 (effectively a fully connected layer shared across all spatial locations).
100
+
101
+ Observing that natural language exhibits syntactic properties that naturally combine words into phrases, Tai et al. (2015) proposed a model for tree-structured topologies, where each LSTM has access to the states of its children. They obtained state-of-the-art results on semantic relatedness and sentiment classification. Liang et al. (2016) followed up and proposed a variant on graphs. Their sophisticated network architecture obtained state-of-the-art results for semantic object parsing on four datasets. In those models, the states are gathered from the neighborhood by way of a weighted sum with trainable weight matrices. Those weights are however not shared across the graph, which would otherwise have required some ordering of the nodes, alike any other spatial definition of graph convolution. Moreover, their formulations are limited to the one-neighborhood of the current node, with equal weight given to each neighbor.
102
+
103
+ Motivated by spatio-temporal problems like modeling human motion and object interactions, Jain et al. (2016) developed a method to cast a spatio-temporal graph as a rich RNN mixture which essentially associates a RNN to each node and edge. Again, the communication is limited to directly connected nodes and edges.
104
+
105
+ The closest model to our work is probably the one proposed by Li et al. (2015), which showed stat-of-the-art performance on a problem from program verification. Whereas they use the iterative procedure of the Graph Neural Networks (GNNs) model introduced by Scarselli et al. (2009) to propagate node representations until convergence, we instead use the graph CNN introduced by Defferrard et al. (2016) to diffuse information across the nodes. While their motivations are quite different, those models are related by the fact that a spectral filter defined as a polynomial of order $K$ can be implemented as a $K$ -layer GNN.2
106
+
107
+ # 4 PROPOSED GCRN MODELS
108
+
109
+ We propose two GCRN architectures that are quite natural, and investigate their performances in real-world applications in Section 5.
110
+
111
+ Model 1. The most straightforward definition is to stack a graph CNN, defined as (5), for feature extraction and an LSTM, defined as (2), for sequence learning:
112
+
113
+ $$
114
+ \begin{array} { r l } & { x _ { t } ^ { \mathrm { { C N N } } } = { \mathrm { C N N } } _ { \mathscr { G } } ( x _ { t } ) } \\ & { \qquad i = \sigma \big ( { W _ { x i } } { x _ { t } ^ { \mathrm { { C N N } } } } + { W _ { h i } } { h _ { t - 1 } } + { w _ { c i } } \odot { c _ { t - 1 } } + { b _ { i } } \big ) , } \\ & { f = \sigma \big ( { W _ { x f } } { x _ { t } ^ { { \mathrm { C N N } } } } + { W _ { h f } } { h _ { t - 1 } } + { w _ { c f } } \odot { c _ { t - 1 } } + { b _ { f } } \big ) , } \\ & { c _ { t } = f _ { t } \odot c _ { t - 1 } + i _ { t } \odot { \mathrm { t a n h } } ( { W _ { x c } } { x _ { t } ^ { \mathrm { { C N N } } } } + { W _ { h c } } { h _ { t - 1 } } + { b _ { c } } \big ) , } \\ & { o = \sigma \big ( { W _ { x o } } { x _ { t } ^ { { \mathrm { C N N } } } } + { W _ { h o } } { h _ { t - 1 } } + { w _ { c o } } \odot { c _ { t } } + { b _ { o } } \big ) , } \\ & { h _ { t } = o \odot { \mathrm { t a n h } } \big ( { c _ { t } } \big ) . } \end{array}
115
+ $$
116
+
117
+ In that setting, the input matrix $\boldsymbol { x } _ { t } \in \mathbb { R } ^ { n \times d _ { \boldsymbol { x } } }$ may represent the observation of $d _ { x }$ measurements at time $t$ of a dynamical system over a network whose organization is given by a graph $\mathcal { G }$ . $\boldsymbol { x } _ { t } ^ { \mathrm { C N N } }$ is the output of the graph CNN gate. For a proof of concept, we simply choose here $\begin{array} { r } { x _ { t } ^ { \mathrm { { C N N } } } = W ^ { \mathrm { { C N N } } } * _ { \mathcal { G } } x _ { t } . } \end{array}$ , where $W ^ { \mathrm { C N N } } \in \mathbf { \bar { \Gamma } } \mathbb { R } ^ { K \times d _ { x } \times \mathbf { \bar { d } } _ { x } }$ are the Chebyshev coefficients for the graph convolutional kernels of support $K$ . The model also holds spatially distributed hidden and cell states of size $d _ { h }$ given by the matrices $c _ { t } , h _ { t } \in \mathbb { R } ^ { n \times d _ { h } }$ . Peepholes are controlled by $w _ { c } . \in \mathbb { R } ^ { n \times d _ { h } }$ . The weights $V _ { h \cdot } \in \mathbb { R } ^ { d _ { h } \times d _ { h } }$ and $W _ { x }$ · $\mathbf { \Sigma } \in \mathbb { R } ^ { d _ { h } \times d _ { x } }$ are the parameters of the fully connected layers. An architecture such as (8) may be enough to capture the data distribution by exploiting local stationarity and compositionality properties as well as the dynamic properties.
118
+
119
+ Model 2. To generalize the convLSTM model (6) to graphs we replace the Euclidean 2D convolution $^ *$ by the graph convolution $^ { \ast _ { \mathcal { G } } }$ :
120
+
121
+ $$
122
+ \begin{array} { r l } & { i = \sigma ( W _ { x i } \ast _ { \mathcal { G } } x _ { t } + W _ { h i } \ast _ { \mathcal { G } } h _ { t - 1 } + w _ { c i } \odot c _ { t - 1 } + b _ { i } ) , } \\ & { f = \sigma ( W _ { x f } \ast _ { \mathcal { G } } x _ { t } + W _ { h f } \ast _ { \mathcal { G } } h _ { t - 1 } + w _ { c f } \odot c _ { t - 1 } + b _ { f } ) , } \\ & { c _ { t } = f _ { t } \odot c _ { t - 1 } + i _ { t } \odot \operatorname { t a n h } ( W _ { x c } \ast _ { \mathcal { G } } x _ { t } + W _ { h c } \ast _ { \mathcal { G } } h _ { t - 1 } + b _ { c } ) , } \\ & { o = \sigma ( W _ { x o } \ast _ { \mathcal { G } } x _ { t } + W _ { h o } \ast _ { \mathcal { G } } h _ { t - 1 } + w _ { c o } \odot c _ { t } + b _ { o } ) , } \\ & { h _ { t } = o \odot \operatorname { t a n h } ( c _ { t } ) . } \end{array}
123
+ $$
124
+
125
+ In that setting, the support $K$ of the graph convolutional kernels defined by the Chebyshev coefficients $W _ { h }$ · $\doteq \mathbb { R } ^ { K \times d _ { h } ^ { \bullet } \times d _ { h } }$ and $W _ { x }$ · $\breve { \in \mathbb { R } ^ { K \times d _ { h } \times d _ { x } } }$ determines the number of parameters, which is independent of the number of nodes $n$ . To keep the notation simple, we write $W _ { x i } * _ { \mathcal { G } } x _ { t }$ to mean a graph convolution of $x _ { t }$ with $d _ { h } d _ { x }$ filters which are functions of the graph Laplacian $L$ parametrized by $K$ Chebyshev coefficients, as noted in (4) and (5). In a distributed computing setting, $K$ controls the communication overhead, i.e. the number of nodes any given node $i$ should exchange with in order to compute its local states.
126
+
127
+ The proposed blend of RNNs and graph CNNs is not limited to LSTMs and is straightforward to apply to any kind of recursive networks. For example, a vanilla RNN $h _ { t } = \operatorname { t a n h } ( W _ { x } x _ { t } + W _ { h } h _ { t - 1 } )$
128
+
129
+ <table><tr><td>Architecture</td><td>Structure</td><td>Filter size</td><td>Parameters</td><td>Runtime</td><td>Test(w/o Rot)</td><td>Test(Rot)</td></tr><tr><td>FC-LSTM</td><td>N/A</td><td>N/A</td><td>142,667,776</td><td>N/A</td><td>4832</td><td>=</td></tr><tr><td>LSTM+CNN</td><td>N/A</td><td>5×5</td><td>13,524,496</td><td>2.10</td><td>3851</td><td>4339</td></tr><tr><td>LSTM+CNN</td><td>N/A</td><td>9×9</td><td>43,802,128</td><td>6.10</td><td>3903</td><td>4208</td></tr><tr><td>LSTM+GCNN</td><td>knn=8</td><td>K=3</td><td>1,629,712</td><td>0.82</td><td>3866</td><td>4367</td></tr><tr><td>LSTM+GCNN</td><td>knn=8</td><td>K=5</td><td>2,711,056</td><td>1.24</td><td>3495</td><td>3932</td></tr><tr><td>LSTM+GCNN</td><td>knn=8</td><td>K=7</td><td>3,792,400</td><td>1.61</td><td>3400</td><td>3803</td></tr><tr><td>LSTM+GCNN</td><td>knn=8</td><td>K=9</td><td>4,873,744</td><td>2.15</td><td>3395</td><td>3814</td></tr><tr><td>LSTM+GCNN</td><td>knn=4</td><td>K=7</td><td>3,792,400</td><td>1.61</td><td>3446</td><td>3844</td></tr><tr><td>LSTM+GCNN</td><td>knn=16</td><td>K=7</td><td>3,792,400</td><td>1.61</td><td>3578</td><td>3963</td></tr></table>
130
+
131
+ Table 1: Comparison between models. Runtime is the time spent per each mini-batch in seconds. Test cross-entropies correspond to moving MNIST, and rotating and moving MNIST. LSTM $\cdot +$ GCNN is Model 2 defined in (9). Cross-entropy of FC-LSTM is taken from Shi et al. (2015).
132
+
133
+ would be modified as
134
+
135
+ $$
136
+ h _ { t } = \operatorname { t a n h } ( W _ { x } * _ { \mathcal { G } } x _ { t } + W _ { h } * _ { \mathcal { G } } h _ { t - 1 } ) ,
137
+ $$
138
+
139
+ and a Gated Recurrent Unit (GRU) (Cho et al., 2014) as
140
+
141
+ $$
142
+ \begin{array} { r l } & { z = \sigma ( W _ { x z } \ast _ { \mathcal { G } } x _ { t } + W _ { h z } \ast _ { \mathcal { G } } h _ { t - 1 } ) , } \\ & { r = \sigma ( W _ { x r } \ast _ { \mathcal { G } } x _ { t } + W _ { h r } \ast _ { \mathcal { G } } h _ { t - 1 } ) , } \\ & { \tilde { h } = \operatorname { t a n h } ( W _ { x h } \ast _ { \mathcal { G } } x _ { t } + W _ { h h } \ast _ { \mathcal { G } } ( r \odot h _ { t - 1 } ) ) , } \\ & { h _ { t } = z \odot h _ { t - 1 } + ( 1 - z ) \odot \tilde { h } . } \end{array}
143
+ $$
144
+
145
+ As demonstrated by Shi et al. (2015), structure-aware LSTM cells can be stacked and used as sequence-to-sequence models using an architecture composed of an encoder, which processes the input sequence, and a decoder, which generates an output sequence. A standard practice for machine translation using RNNs (Cho et al., 2014; Sutskever et al., 2014).
146
+
147
+ # 5 EXPERIMENTS
148
+
149
+ # 5.1 SPATIO-TEMPORAL SEQUENCE MODELING ON MOVING-MNIST
150
+
151
+ For this synthetic experiment, we use the moving-MNIST dataset generated by Shi et al. (2015). All sequences are 20 frames long (10 frames as input and 10 frames for prediction) and contain two handwritten digits bouncing inside a $6 4 \times 6 4$ patch. Following their experimental setup, all models are trained by minimizing the binary cross-entropy loss using back-propagation through time (BPTT) and RMSProp with a learning rate of $1 0 ^ { - 3 }$ and a decay rate of 0.9. We choose the best model with early-stopping on validation set. All implementations are based on their Theano code and dataset.3 The adjacency matrix $A$ is constructed as a $\mathbf { k }$ -nearest-neighbor (knn) graph with Euclidean distance and Gaussian kernel between pixel locations. For a fair comparison with Shi et al. (2015) defined in (6), all GCRN experiments are conducted with Model 2 defined in (9), which is the same architecture with the 2D convolution $^ *$ replaced by a graph convolution $^ { \ast _ { \mathcal { G } } }$ . To further explore the impact of the isotropic property of our filters, we generated a variant of the moving MNIST dataset where digits are also rotating (see Figure 4).
152
+
153
+ Table 1 shows the performance of various models: (i) the baseline FC-LSTM from Shi et al. (2015), (ii) the 1-layer LSTM $^ +$ CNN from Shi et al. (2015) with different filter sizes, and (iii) the proposed LSTM+graph CNN(GCNN) defined in (9) with different supports $K$ . These results show the ability of the proposed method to capture spatio-temporal structures. Perhaps surprisingly, GCNNs can offer better performance than regular CNNs, even when the domain is a 2D grid and the data is images, the problem CNNs were initially developed for. The explanation is to be found in the differences between 2D filters and spectral graph filters. While a spectral filter of support $K = 3$ corresponds to the reach of a patch of size $5 \times 5$ (see Figure 2), the difference resides in the isotropic nature of the former and the number of parameters: $K = 3$ for the former and $5 ^ { 2 } = 2 5$ for the later.
154
+
155
+ ![](images/c0e894075958a2fe6ae45958014950a3aaf3f9b843faf87a98d2580afacc1d3b.jpg)
156
+ Figure 3: Cross-entropy on validation set: Left: performance of graph CNN with various filter support $K$ . Right: performance w.r.t. graph construction.
157
+
158
+ ![](images/1cc92b78c2a49f24902eeb6f096c1459249ef396fac9c72850f84cda785f4e32.jpg)
159
+ Figure 4: Qualitative results for moving MNIST, and rotating and moving MNIST. First row is the input sequence, second the ground truth, and third and fourth are the predictions of the $\mathrm { L S T M + C N N } ( 5 \times 5 )$ and $\mathrm { L S T M + G C N N } ( k n n = 8 , K = 7 )$ .
160
+
161
+ Table 1 indeed shows that LS $\mathrm { T M } { + } \mathrm { C N N } ( 5 \times 5 )$ rivals $\mathrm { L S T M + G C N N }$ with $K = 3$ . However, when increasing the filter size to $9 \times 9$ or $K = 5$ , the GCNN variant clearly outperforms the CNN variant. This experiment demonstrates that graph spectral filters can obtain superior performance on regular domains with much less parameters thanks to their isotropic nature, a controversial property. Indeed, as the nodes are not ordered, there is no notion of an edge going up, down, on the right or on the left. All edges are treated equally, inducing some sort of rotation invariance. Additionally, Table 1 shows that the computational complexity of each model is linear with the filter size, and Figure 3 shows the learning dynamic of some of the models.
162
+
163
+ # 5.2 NATURAL LANGUAGE MODELING ON PENN TREEBANK
164
+
165
+ The Penn Treebank dataset has 1,036,580 words. It was pre-processed in Zaremba et al. (2014) and split4 into a training set of $9 2 9 \mathrm { k }$ words, a validation set of 73k words, and a test set of ${ 8 2 } \mathrm { k }$ words. The size of the vocabulary of this corpus is 10,000. We use the gensim library5 to compute a word2vec model (Mikolov et al., 2013) for embedding the words of the dictionary in a 200-dimensional space. Then we build the adjacency matrix of the word embedding using a 4-nearest neighbor graph with cosine distance. Figure 6 presents the computed adjacency matrix, and its 3D visualization. We used the hyperparameters of the small configuration given by the code6 based on Zaremba et al. (2014): the size of the data mini-batch is 20, the number of temporal steps to unroll is 20, the dimension of the hidden state is 200. The global learning rate is 1.0 and the norm of the gradient is bounded by 5. The learning decay function is selected to be $\mathrm { 0 . 5 ^ { m a x ( 0 , \# e p o c h - 4 ) } }$ . All experiments have 13 epochs, and dropout value is 0.75. For Zaremba et al. (2014), the input representation $x _ { t }$ can be either the 200-dim embedding vector of the word, or the 10,000-dim one-hot representation of the word. For
166
+
167
+ ![](images/5aea0fe6f1f13974198278cfe12fec785421338be7b8b8b7b0603d98e18d7d64.jpg)
168
+
169
+ Figure 5: Learning dynamic of LSTM with and without graph structure and dropout regularization.
170
+
171
+ <table><tr><td>Architecture</td><td>Representation</td><td>Parameters</td><td>Train Perplexity</td><td>Test Perplexity</td></tr><tr><td>Zaremba et al. (2014) code6</td><td>embedding</td><td>681,800</td><td>36.96</td><td>117.29</td></tr><tr><td>Zaremba et al. (2014) code6</td><td>one-hot</td><td>34,011,600</td><td>53.89</td><td>118.82</td></tr><tr><td>LSTM</td><td>embedding</td><td>681,800</td><td>48.38</td><td>120.90</td></tr><tr><td>LSTM</td><td>one-hot</td><td>34,011,600</td><td>54.41</td><td>120.16</td></tr><tr><td>LSTM, dropout</td><td>one-hot</td><td>34,011,600</td><td>145.59</td><td>112.98</td></tr><tr><td>GCRN-M1</td><td>one-hot</td><td>42,011,602</td><td>18.49</td><td>177.14</td></tr><tr><td>GCRN-M1, dropout</td><td>one-hot</td><td>42,011,602</td><td>114.29</td><td>98.67</td></tr></table>
172
+
173
+ Table 2: Comparison of models in terms of perplexity. Zaremba et al. (2014) code6 is ran as benchmark algorithm. The original Zaremba et al. (2014) code used as input representation for $x _ { t }$ the 200-dim embedding representation of words, computed here by the gensim library5. As our model runs on the 10,000-dim one-hot representation of words, we also ran Zaremba et al. (2014) code on this representation. We re-implemented Zaremba et al. (2014) code with the same architecture and hyperparameters. We remind that GCRN-M1 refers to GCRN Model 1 defined in (8).
174
+
175
+ our models, the input representation is a one-hot representation of the word. This choice allows us to use the graph structure of the words.
176
+
177
+ Table 2 reports the final train and test perplexity values for each investigated model and Figure 5 plots the perplexity value vs. the number of epochs for the train and test sets with and without dropout regularization. Numerical experiments show:
178
+
179
+ 1. Given the same experimental conditions in terms of architecture and no dropout regularization, the standalone model of LSTM is more accurate than LSTM using the spatial graph information (120.16 vs. 177.14), extracted by graph CNN with the GCRN architecture of Model 1, Eq. (8).
180
+ 2. However, using dropout regularization, the graph LSTM model overcomes the standalone LSTM with perplexity values 98.67 vs. 112.98.
181
+ 3. The use of spatial graph information found by graph CNN speeds up the learning process, and overfits the training dataset in the absence of dropout regularization. The graph structure likely acts a constraint on the learning system that is forced to move in the space of language topics.
182
+ 4. We performed the same experiments with LSTM and Model 2 defined in (9). Model 1 significantly outperformed Model 2, and Model 2 did worse than standalone LSTM. This bad performance may be the result of the large increase of dimensionality in Model 2, as the dimension of the hidden and cell states changes from 200 to 10,000, the size of the vocabulary. A solution would be to downsize the data dimensionality, as done in Shi et al. (2015) in the case of image data.
183
+
184
+ ![](images/db4ee1673e3b3918a68b4668574358c8b6f41e4249c011cc1ed5e715b01017b4.jpg)
185
+
186
+ ![](images/1a0958b69c9ef0cec7f225791ed9902ac5872a3df2683f257db5466fc71df530.jpg)
187
+ Figure 6: Left: adjacency matrix of word embeddings. Right: 3D visualization of words’ structure.
188
+
189
+ # 6 CONCLUSION AND FUTURE WORK
190
+
191
+ This work aims at learning spatio-temporal structures from graph-structured and time-varying data. In this context, the main challenge is to identify the best possible architecture that combines simultaneously recurrent neural networks like vanilla RNN, LSTM or GRU with convolutional neural networks for graph-structured data. We have investigated here two architectures, one using a stack of CNN and RNN (Model 1), and one using convLSTM that considers convolutions instead of fully connected operations in the RNN definition (Model 2). We have then considered two applications: video prediction and natural language modeling. Model 2 has shown good performances in the case of video prediction, by improving the results of Shi et al. (2015). Model 1 has also provided promising performances in the case of language modeling, particularly in terms of learning speed. It has been shown that (i) isotropic filters, maybe surprisingly, can outperform classical 2D filters on images while requiring much less parameters, and (ii) that graphs coupled with graph CNN and RNN are a versatile way of introducing and exploiting side-information, e.g. the semantic of words, by structuring a data matrix.
192
+
193
+ Future work will investigate applications to data naturally structured as dynamic graph signals, for instance fMRI and sensor networks. The graph CNN model we have used is rotationally-invariant and such spatial property seems quite attractive in real situations where motion is beyond translation. We will also investigate how to benefit of the fast learning property of our system to speed up language modeling models. Eventually, it will be interesting to analyze the underlying dynamical property of generic RNN architectures in the case of graphs. Graph structures may introduce stability to RNN systems, and prevent them to express unstable dynamic behaviors.
194
+
195
+ # ACKNOWLEDGMENT
196
+
197
+ This research was supported in part by the European Union’s H2020 Framework Programme (H2020-MSCA-ITN-2014) under grant No. 642685 MacSeNet, and Nvidia equipment grant.
198
+
199
+ # REFERENCES
200
+
201
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral Networks and Locally Connected Networks on Graphs. In International Conference on Learning Representations (ICML), 2014.
202
+
203
+ Kyunghyun Cho, Bart Van Merrienboer, 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.
204
+
205
+ F. R. K. Chung. Spectral Graph Theory. American Mathematical Society, 1997.
206
+
207
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with ¨ fast localized spectral filtering. In Advances in Neural Information Processing Systems (NIPS), 2016.
208
+
209
+ Jeffrey Donahue, Lisa Anne Hendricks, Sergio Guadarrama, Marcus Rohrbach, Subhashini Venugopalan, Kate Saenko, and Trevor Darrell. Long-term recurrent convolutional networks for visual recognition and description. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015.
210
+
211
+ Felix A Gers and Jurgen Schmidhuber. Recurrent nets that time and count. In ¨ IEEE-INNS-ENNS International Joint Conference on Neural Networks, 2000.
212
+
213
+ Alex Graves. Generating sequences with recurrent neural networks. arXiv:1308.0850, 2013.
214
+
215
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 1997.
216
+
217
+ Ashesh Jain, Amir R. Zamir, Silvio Savarese, and Ashutosh Saxena. Structural-RNN: Deep Learning on SpatioTemporal Graphs. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
218
+
219
+ Andrej Karpathy and Li Fei-Fei. Deep visual-semantic alignments for generating image descriptions. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015.
220
+
221
+ Thomas N. Kipf and Max Welling. Semi-Supervised Classification with Graph Convolutional Networks. arXiv:1609.02907, 2016.
222
+
223
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
224
+
225
+ Xiaodan Liang, Xiaohui Shen, Jiashi Feng, Liang Lin, and Shuicheng Yan. Semantic object parsing with graph lstm. arXiv:1603.07063, 2016.
226
+
227
+ Jonathan Masci, Davide Boscaini, Michael M. Bronstein, and Pierre Vandergheynst. Geodesic convolutional neural networks on riemannian manifolds. In IEEE International Conference on Computer Vision (ICCV) Workshops, 2015.
228
+
229
+ T. Mikolov, K. Chen, G. Corrado, and J. Dean. Estimation of Word Representations in Vector Space. In International Conference on Learning Representations (ICLR), 2013.
230
+
231
+ Mathias Niepert, Mohamed Ahmed, and Konstantin Kutzkov. Learning Convolutional Neural Networks for Graphs. In International Conference on Machine Learning (ICML), 2016.
232
+
233
+ MarcAurelio Ranzato, Arthur Szlam, Joan Bruna, Michael Mathieu, Ronan Collobert, and Sumit Chopra. Video (language) modeling: a baseline for generative models of natural videos. arXiv:1412.6604, 2014.
234
+
235
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 2009.
236
+
237
+ Xingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-kin Wong, and Wang-chun Woo. Convolutional LSTM Network: A Machine Learning Approach for Precipitation Nowcasting. In Advances in Neural Information Processing Systems (NIPS), 2015.
238
+
239
+ D. Shuman, S. Narang, P. Frossard, A. Ortega, and P. Vandergheynst. The Emerging Field of Signal Processing on Graphs: Extending High-Dimensional Data Analysis to Networks and other Irregular Domains. IEEE Signal Processing Magazine, 2013.
240
+
241
+ Nitish Srivastava, Elman Mansimov, and Ruslan Salakhudinov. Unsupervised learning of video representations using lstms. In International Conference on Machine Learning (ICML), 2015.
242
+
243
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems (NIPS), 2014.
244
+
245
+ Kai Sheng Tai, Richard Socher, and Christopher D. Manning. Improved semantic representations from treestructured long short-term memory networks. In Association for Computational Linguistics (ACL), 2015.
246
+
247
+ 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 (CVPR), 2015.
248
+
249
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv:1409.2329, 2014.
md/train/SJ1Xmf-Rb/SJ1Xmf-Rb.md ADDED
@@ -0,0 +1,364 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FEARNET: BRAIN-INSPIRED MODEL FOR INCREMENTAL LEARNING
2
+
3
+ Ronald Kemker and Christopher Kanan∗
4
+
5
+ Carlson Center for Imaging Science Rochester Institute of Technology Rochester, NY 14623, USA {rmk6217,kanan}@rit.edu
6
+
7
+ # ABSTRACT
8
+
9
+ Incremental class learning involves sequentially learning classes in bursts of examples from the same class. This violates the assumptions that underlie methods for training standard deep neural networks, and will cause them to suffer from catastrophic forgetting. Arguably, the best method for incremental class learning is iCaRL, but it requires storing training examples for each class, making it challenging to scale. Here, we propose FearNet for incremental class learning. FearNet is a generative model that does not store previous examples, making it memory efficient. FearNet uses a brain-inspired dual-memory system in which new memories are consolidated from a network for recent memories inspired by the mammalian hippocampal complex to a network for long-term storage inspired by medial prefrontal cortex. Memory consolidation is inspired by mechanisms that occur during sleep. FearNet also uses a module inspired by the basolateral amygdala for determining which memory system to use for recall. FearNet achieves state-of-the-art performance at incremental class learning on image (CIFAR-100, CUB-200) and audio classification (AudioSet) benchmarks.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ In incremental classification, an agent must sequentially learn to classify training examples, without necessarily having the ability to re-study previously seen examples. While deep neural networks (DNNs) have revolutionized machine perception (Krizhevsky et al., 2012), off-the-shelf DNNs cannot incrementally learn classes due to catastrophic forgetting. Catastrophic forgetting is a phenomenon in which a DNN completely fails to learn new data without forgetting much of its previously learned knowledge (McCloskey & Cohen, 1989). While methods have been developed to try and mitigate catastrophic forgetting, as shown in Kemker et al. (2018), these methods are not sufficient and perform poorly on larger datasets. In this paper, we propose FearNet, a brain-inspired system for incrementally learning categories that significantly outperforms previous methods.
14
+
15
+ The standard way for dealing with catastrophic forgetting in DNNs is to avoid it altogether by mixing new training examples with old ones and completely re-training the model offline. For large datasets, this may require weeks of time, and it is not a scalable solution. An ideal incremental learning system would be able to assimilate new information without the need to store the entire training dataset. A major application for incremental learning includes real-time operation on-board embedded platforms that have limited computing power, storage, and memory, e.g., smart toys, smartphone applications, and robots. For example, a toy robot may need to learn to recognize objects within its local environment and of interest to its owner. Using cloud computing to overcome these resource limitations may pose privacy risks and may not be scalable to a large number of embedded devices. A better solution is on-device incremental learning, which requires the model to use less storage and computational power.
16
+
17
+ In this paper, we propose an incremental learning framework called FearNet (see Fig. 1). FearNet has three brain-inspired sub-systems: 1) a recent memory system for quick recall, 2) a memory system for long-term storage, and 3) a sub-system that determines which memory system to use for a particular example. FearNet mitigates catastrophic forgetting by consolidating recent memories into long-term storage using pseudorehearsal (Robins, 1995). Pseudorehearsal allows the network to revisit previous memories during incremental training without the need to store previous training examples, which is more memory efficient.
18
+
19
+ Problem Formulation: Here, incremental class learning consists of $T$ study-sessions. At time $t$ , the learner receives a batch of data $B _ { t }$ , which contains $N _ { t }$ labeled training samples, i.e., $B _ { t } ~ = ~ \{ ( \mathbf { x } _ { j } , y _ { j } ) \} _ { j = 1 } ^ { N _ { t } }$ , where $\mathbf { x } _ { j } \in \mathbb { R } ^ { d }$ is the input feature vector to be classified and $y _ { j }$ is its corresponding label. The number of training samples $N _ { t }$ may vary between sessions, and the data inside a study-session is not assumed to be independent and identically distributed (iid). During a study session, the learner only has access to its current batch, but it may use its own memory to store information from prior study sessions. We refer to the first session as the model’s “base-knowledge,” which contains exemplars from $M \geq 1$ classes. The batches learned in all subsequent sessions contain only one class, i.e., all $y _ { j }$ will be identical within those sessions.
20
+
21
+ # Novel Contributions: Our contributions include:
22
+
23
+ ![](images/9ec0369767a96c98cf47fe8ba08e1c364ce5daf78138cb6ec61cc3ee815bb4b4.jpg)
24
+ Figure 1: FearNet consists of three braininspired modules based on 1) mPFC (longterm storage), 2) HC (recent storage), and 3) BLA for determining whether to use mPFC or HC for recall.
25
+
26
+ 1. FearNet’s architecture includes three neural networks: one inspired by the hippocampal complex (HC) for recent memories, one inspired by the medial prefrontal cortex (mPFC) for long-term storage, and one inspired by the basolateral amygdala (BLA) that determines whether to use HC or mPFC for recall.
27
+
28
+ 2. Motivated by memory replay during sleep, FearNet employs a generative autoencoder for pseudorehearsal, which mitigates catastrophic forgetting by generating previously learned examples that are replayed alongside novel information during consolidation. This process does not involve storing previous training data.
29
+
30
+ 3. FearNet achieves state-of-the-art results on large image and audio datasets with a relatively small memory footprint, demonstrating how dual-memory models can be scaled.
31
+
32
+ # 2 RELATED WORK
33
+
34
+ Catastrophic forgetting in DNNs occurs due to the plasticity-stability dilemma (Abraham & Robins, 2005). If the network is too plastic, older memories will quickly be overwritten; however, if the network is too stable, it is unable to learn new data. This problem was recognized almost 30 years ago (McCloskey & Cohen, 1989). In French (1999), methods developed in the 1980s and 1990s are extensively discussed, and French argued that mitigating catastrophic forgetting would require having two separate memory centers: one for the long-term storage of older memories and another to quickly process new information as it comes in. He also theorized that this type of dual-memory system would be capable of consolidating memories from the fast learning memory center to longterm storage.
35
+
36
+ Catastrophic forgetting often occurs when a system is trained on non-iid data. One strategy for reducing this phenomenon is to mix old examples with new examples, which simulates iid conditions. For example, if the system learns ten classes in a study session and then needs to learn 10 new classes in a later study session, one solution could be to mix examples from the first study session into the later study session. This method is known as rehearsal, and it is one of the earliest methods for reducing catastrophic forgetting (Hetherington & Seidenberg, 1989). Rehearsal essentially uses an external memory to strengthen the model’s representations for examples learned previously, so that they are not overwritten when learning data from new classes. Rehearsal reduces forgetting, but performance is still worse than offline models. Moreover, rehearsal requires storing all of the training data. Robins (1995) argued that storing of training examples was inefficient and of “little interest,” so he introduced pseudorehearsal. Rather than replaying past training data, in pseudorehearsal, the algorithm generates new examples for a given class. In Robins (1995), this was done by creating random input vectors, having the network assign them a label, and then mixing them into the new training data. This idea was revived in Draelos et al. (2017), where a generative autoencoder was used to create pseudo-examples for unsupervised incremental learning. This method inspired FearNet’s approach to memory consolidation. Pseudorehearsal is related to memory replay that occurs in mammalian brains, which involves reactivation of recently encoded memories in HC so that they can be integrated into long-term storage in mPFC (Rasch & Born, 2013).
37
+
38
+ Recently there has been renewed interest in solving catastrophic forgetting in supervised learning. Many new methods are designed to mitigate catastrophic forgetting when each study session contains a permuted version of the entire training dataset (see Goodfellow et al. (2013)). Unlike incremental class learning, all labels are contained in each study session. PathNet uses an evolutionary algorithm to find the optimal path through a large DNN, and then freezes the weights along that path (Fernando et al., 2017). It assumes all classes are seen in each study session, and it is not capable of incremental class learning. Elastic Weight Consolidation (EWC) employs a regularization scheme that redirects plasticity to the weights that are least important to previously learned study sessions (Kirkpatrick et al., 2017). After EWC learns a study session, it uses the training data to build a Fisher matrix that determines the importance of each feature to the classification task it just learned. EWC was shown to work poorly at incremental class learning in Kemker et al. (2018).
39
+
40
+ The Fixed Expansion Layer (FEL) model mitigates catastrophic forgetting by using sparse updates (Coop et al., 2013). FEL uses two hidden layers, where the second hidden layer (i.e., the FEL layer) has connectivity constraints. The FEL layer is much larger than the first hidden layer, is sparsely populated with excitatory and inhibitory weights, and is not updated during training. This limits learning of dense shared representations, which reduces the risk of learning interfering with old memories. FEL requires a large number of units to work well (Kemker et al., 2018).
41
+
42
+ Gepperth & Karaoguz (2016) introduced a new approach for incremental learning, which we call GeppNet. GeppNet uses a self-organizing map (SOM) to reorganize the input onto a two-dimensional lattice. This serves as a long-term memory, which is fed into a simple linear layer for classification. After the SOM is initialized, it can only be updated if the input is sufficiently novel. This prevents the model from forgetting older data too quickly. GeppNet also uses rehearsal using all previous training data. A variant of GeppNet, GeppNet+STM, uses a fixed-size memory buffer to store novel examples. When this buffer is full, it replaces the oldest example. During pre-defined intervals, the buffer is used to train the model. Gepp$\mathbf { \Gamma } _ { \mathbf { N e t + S T M } }$ is better at retaining base-knowledge since it only trains during its consolidation phase, but the STM-free version learns new data better because it updates the model on every novel labeled input.
43
+
44
+ ![](images/9487165ad014d2cb3f67829861104cc2ddefd93cc570c6b1da29573fe8bec15b.jpg)
45
+ Figure 2: iCaRL’s performance depends heavily on the number of exemplars per class (EPC) that it stores. Reducing EPC from 20 (blue) to 1 (red) severely impairs its ability to recall older information.
46
+
47
+ iCaRL (Rebuffi et al., 2017) is an incremental class learning framework. Rather than directly using a DNN for classification, iCaRL uses it for supervised representation learning. During a study session, iCaRL updates a DNN using the study session’s data and a set of $J$ stored examples from earlier sessions $( J = 2 , 0 0 0$ for CIFAR-100 in their paper), which is a kind of rehearsal. After a study session, the $J$ examples retained are carefully chosen using herding. After learning the entire dataset, iCaRL has retained $J / T$ exemplars per class (e.g., $J / \bar { T } = 2 0$ for CIFAR-100). The DNN in iCaRL is then used to compute an embedding for each stored example, and then the mean embedding for each class seen is computed. To classify a new instance, the DNN is used to compute an embedding for it, and then the class with the nearest mean embedding is assigned. iCaRL’s performance is heavily influenced by the number of examples it stores, as shown in Fig. 2.
48
+
49
+ # 3 MAMMALIAN MEMORY: NEUROSCIENCE AND MODELS
50
+
51
+ FearNet is heavily inspired by the dual-memory model of mammalian memory (McClelland et al., 1995), which has considerable experimental support from neuroscience (Frankland et al., 2004; Takashima et al., 2006; Kitamura et al., 2017; Bontempi et al., 1999; Taupin & Gage, 2002; Gais et al., 2007). This theory proposes that HC and mPFC operate as complementary memory systems, where HC is responsible for recalling recent memories and mPFC is responsible for recalling remote (mature) memories. GeppNet is the most recent DNN to be based on this theory, but it was also independently explored in the 1990s in French (1997) and Ans & Rousset (1997). In this section, we review some of the evidence for the dual-memory model.
52
+
53
+ One of the major reasons why HC is thought to be responsible for recent memories is that if HC is bilaterally destroyed, then anterograde amnesia occurs with old memories for semantic information preserved. One mechanism HC may use to facilitate creating new memories is adult neurogenesis. This occurs in HC’s dentate gyrus (Altman, 1963; Eriksson et al., 1998). The new neurons have higher initial plasticity, but it reduces as time progresses (Deng et al., 2010).
54
+
55
+ In contrast, mPFC is responsible for the recall of remote (long-term) memories (Bontempi et al., 1999). Taupin & Gage (2002) and Gais et al. (2007) showed that mPFC plays a strong role in memory consolidation during REM sleep. McClelland et al. (1995) and Euston et al. (2012) theorized that, during sleep, HC reactivates recent memories to prevent forgetting which causes these recent memories to replay in mPFC as well, with dreams possibly being caused by this process. After memories are transferred from HC to mPFC, evidence suggests that corresponding memory in HC is erased (Poe, 2017).
56
+
57
+ Recently, Kitamura et al. (2017) performed contextual fear conditioning (CFC) experiments in mice to trace the formation and consolidation of recent memories to long-term storage. CFC experiments involve shocking mice while subjecting them to various visual stimuli (i.e., colored lights). They found that BLA, which is responsible for regulating the brain’s fear response, would shift where it retrieved the corresponding memory from (HC or mPFC) as that memory was consolidated over time. FearNet follows the memory consolidation theory proposed by Kitamura et al. (2017).
58
+
59
+ # 4 THE FEARNET MODEL
60
+
61
+ FearNet has two complementary memory centers, 1) a short-term memory system that immediately learns new information for recent recall (HC) and 2) a DNN for the storage of remote memories (mPFC). FearNet also has a separate BLA network that determines which memory center contains the associated memory required for prediction. During sleep phases, FearNet uses a generative model to consolidate data from HC to mPFC through pseudorehearsal. Pseudocode for FearNet is provided in the supplemental material. Because the focus of our work is not representation learning, we use pre-trained ResNet embeddings to obtain features that are fed to FearNet.
62
+
63
+ # 4.1 DUAL-MEMORY STORAGE
64
+
65
+ FearNet’s HC model is a variant of a probabilistic neural network (Specht, 1990). HC computes class conditional probabilities using stored training examples. Formally, HC estimates the probability that an input feature vector $\mathbf { x }$ belongs to class $k$ as
66
+
67
+ $$
68
+ P _ { H C } \left( C = k | \mathbf { x } \right) = \frac { \beta _ { k } } { \sum _ { k ^ { \prime } } \beta _ { k ^ { \prime } } }
69
+ $$
70
+
71
+ $$
72
+ \beta _ { k } = \left\{ \begin{array} { c c } { \big ( \epsilon + \operatorname* { m i n } _ { j } \| \mathbf x - \mathbf u _ { k , j } \| _ { 2 } \big ) ^ { - 1 } } & { \mathrm { i f ~ H C ~ c o n t a i n s ~ i n s t a n c e s ~ o f ~ c l a s s ~ } k } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} \right.
73
+ $$
74
+
75
+ where $\epsilon > 0$ is a regularization parameter and ${ \mathbf { u } } _ { k , j }$ is the $j ^ { : }$ ’th stored exemplar in HC for class $k$ . All exemplars are removed from HC after they are consolidated into mPFC.
76
+
77
+ FearNet’s mPFC is implemented using a DNN trained both to reconstruct its input using a symmetric encoder-decoder (autoencoder) and to compute $P _ { m P F C } \left( C = k | \mathbf { x } \right)$ . The autoencoder enables us to
78
+
79
+ ![](images/0a31f3f9e3363e7a1f2b1d9c767fa264123bab51cadfb522dfebe045d764880d.jpg)
80
+ Figure 3: The mPFC and BLA sub-systems in FearNet. mPFC is responsible for the long-term storage of remote memories. BLA is used during prediction time to determine if the memory should be recalled from short- or long-term memory.
81
+
82
+ use pseudorehearsal, which is described in more detail in Sec. 4.2. The loss function for mPFC is
83
+
84
+ $$
85
+ \mathcal { L } _ { m P F C } = \mathcal { L } _ { c l a s s } + \mathcal { L } _ { r e c o n } ,
86
+ $$
87
+
88
+ where $\mathcal { L } _ { c l a s s }$ is the supervised classification loss and $\mathcal { L } _ { r e c o n }$ is the unsupervised reconstruction loss, as illustrated in Fig. 3(a). For $\mathcal { L } _ { c l a s s }$ , we use standard softmax loss. $\mathcal { L } _ { r e c o n }$ is the weighted sum of mean squared error (MSE) reconstruction losses from each layer, which is given by
89
+
90
+ $$
91
+ \mathcal { L } _ { r e c o n } = \sum _ { j = 0 } ^ { M } \sum _ { i = 0 } ^ { H _ { j } - 1 } \left. h _ { e n c o d e r , ( i , j ) } - h _ { d e c o d e r , ( i , j ) } \right. _ { 2 } ^ { 2 }
92
+ $$
93
+
94
+ where $M$ is the number of mPFC layers, $H _ { j }$ is the number of hidden units in layer $j$ , $h _ { e n c o d e r , ( i , j ) }$ and $h _ { d e c o d e r , ( i , j ) }$ are the outputs of the encoder/decoder at layer $j$ respectively, and $\lambda _ { j }$ is the reconstruction weight for that layer. mPFC is similar to a Ladder Network (Rasmus et al., 2015), which combines classification and reconstruction to improve regularization, especially during lowshot learning. The $\lambda _ { j }$ hyperparameters were found empirically, with $\lambda _ { 0 }$ being largest and decreasing for deeper layers (see supplementary material). This prioritizes the reconstruction task, which makes the generated pseudo-examples more realistic. When training is completed during a study session, all of the data in HC is pushed through the encoder to extract a dense feature representation of the original data, and then we compute a mean feature vector $\mu _ { c }$ and covariance matrix $\Sigma _ { c }$ for each class $c$ . These are stored and used to generate pseudo-examples during consolidation (see Sec. 4.2). We study FearNet’s performance as a function of how much data is stored in HC in Sec. 6.2.
95
+
96
+ # 4.2 PSEUDOREHEARSAL FOR MEMORY CONSOLIDATION
97
+
98
+ During FearNet’s sleep phase, the original inputs stored in HC are transferred to mPFC using pseudo-examples created by an autoencoder. This process is known as intrinsic replay, and it was used by Draelos et al. (2017) for unsupervised learning.
99
+
100
+ Using the class statistics from the encoder, pseudo-examples for class $c$ are generated by sampling a Gaussian with mean $\mu _ { c }$ and covariance matrix $\Sigma _ { c }$ to obtain $\hat { \mathbf { x } } _ { r a n d }$ . Then, $\hat { \mathbf { x } } _ { r a n d }$ is passed through the decoder to generate a pseudo-example. To create a balanced training set, for each class that mPFC has learned, we generate $\lceil m \rceil$ pseudo-examples, where $m$ is the average number of examples per class stored in HC. The pseudo-examples are mixed with the data in HC, and the mixture is used to fine-tune mPFC using backpropagation. After consolidation, all units in HC are deleted.
101
+
102
+ # 4.3 NETWORK SELECTION USING BLA
103
+
104
+ During prediction, FearNet uses the BLA network (Fig. 3(b)) to determine whether to classify an input x using HC or mPFC. This can be challenging because if HC has only been trained on one class, it will put all of its probability mass on that class, whereas mPFC will likely be less confident. The output of BLA is given by $A \left( \mathbf { x } \right)$ and will be a value between 0 and 1, with a 1 indicating mPFC should be used. BLA is trained after each study session using only the data in HC and with pseudoexamples generated with mPFC, using the same procedure described in Sec. 4.2. Instead of using solely BLA to determine which network to use, we found that combining its output with those of mPFC and HC improved results. The predicted class $\hat { y }$ is computed as
105
+
106
+ $$
107
+ \hat { y } = \left\{ \begin{array} { c c } { \underset { \mathrm { a r g } } { \arg \operatorname* { m a x } } _ { k ^ { \prime } } P _ { H C } \left( C = k ^ { \prime } | \mathbf { x } \right) } & { \mathrm { i f } \ \psi > \operatorname* { m a x } _ { k } P _ { m P F C } \left( C = k | \mathbf { x } \right) } \\ { \underset { \mathrm { o t h e r w i s e } } { \arg \operatorname* { m a x } } } & { \mathrm { o t h e r w i s e } } \end{array} \right.
108
+ $$
109
+
110
+ where
111
+
112
+ $$
113
+ \psi = \left( 1 - A \left( \mathbf { x } \right) \right) ^ { - 1 } \operatorname* { m a x } _ { k } P _ { H C } \left( C = k | \mathbf { x } \right) A \left( \mathbf { x } \right)
114
+ $$
115
+
116
+ $\psi$ is the probability of the class according to HC weighted by the confidence that the associated memory is actually stored in HC. BLA has the same number of layers/units as the mPFC encoder, and uses a logistic output unit. We discuss alternative BLA models in supplemental material.
117
+
118
+ # 5 EXPERIMENTAL SETUP
119
+
120
+ Evaluating Incremental Learning Performance. To evaluate how well the incrementally trained models perform compared to an offline model, we use the three metrics proposed in Kemker et al. (2018). After each study session $t$ in which a model learned a new class $k$ , we compute the model’s test accuracy on the new class $( \alpha _ { n e w , t } )$ , the accuracy on the base-knowledge $( \alpha _ { b a s e , t } )$ , and the accuracy of all of the test data seen to this point $( \alpha _ { a l l , t } )$ . After all $T$ study sessions are complete, a model’s ability to retain the base-knowledge is given by $\begin{array} { r } { \Omega _ { b a s e } \ = \ \frac { 1 } { T - 1 } \sum _ { t = 2 } ^ { T } \frac { \alpha _ { b a s e , t } } { \alpha _ { o f f l i n e } } } \end{array}$ where $\alpha _ { o f f l i n e }$ is the accuracy of a multi-layer perceptron (MLP) trained offline (i.e., it is given all of the training data at once). The model’s ability to immediately recall new information is measured by 1T −1 PTt=2 αnew,t. Finally, we measure how well the model does on all available test data with Ωall = T −1 P t=2 αoffline αall,t . The $\Omega _ { a l l }$ metric shows how well new memories are integrated into the model over time. For all of the metrics, higher values indicate superior performance. Both $\Omega _ { b a s e }$ and $\Omega _ { a l l }$ are relative to an offline MLP model, so a value of 1 indicates that a model has similar performance to the offline baseline. This allows results across datasets to be better compared. Note that $\Omega _ { b a s e } > 1$ and $\Omega _ { a l l } > 1$ only if the incremental learning algorithm is more accurate than the offline model, which can occur due to better regularization strategies employed by different models.
121
+
122
+ Datasets. We evaluate all of the models on three benchmark datasets (Table 1): CIFAR-100, CUB-200, and AudioSet. CIFAR-100 is a popular image classification dataset containing 100 mutually-exclusive object categories, and it was used in Rebuffi et al. (2017) to evaluate iCaRL. All images are $3 2 \times 3 2$ pixels. CUB-200 is a fine-grained image classification dataset containing high resolution images of 200 different bird
123
+
124
+ Table 1: Dataset Specifications
125
+
126
+ <table><tr><td></td><td>CIFAR-100</td><td>CUB-200</td><td>AudioSet</td></tr><tr><td>Classification Task</td><td>RGB Image</td><td>RGB Image</td><td>Audio</td></tr><tr><td>Classes</td><td>100</td><td>200</td><td>100</td></tr><tr><td>Feature Shape</td><td>2.048</td><td>2,048</td><td>1,280</td></tr><tr><td>Train Samples</td><td>50,000</td><td>5,994</td><td>28,779</td></tr><tr><td>Test Samples</td><td>10,000</td><td>5,794</td><td>5,523</td></tr><tr><td>Train Samples/Class</td><td>500</td><td>29-30</td><td>250-300</td></tr><tr><td>Test Samples/Class</td><td>100</td><td>11-30</td><td>43-62</td></tr></table>
127
+
128
+ species (Welinder et al., 2010). We use the 2011 version of the dataset. AudioSet is an audio classification dataset (Gemmeke et al., 2017). We use the variant of AudioSet used by Kemker et al. (2018), which contains a 100 class subset such that none of the classes were super- or sub-classes of one another. Also, since the AudioSet data samples can have more than one class, the chosen samples had only one of the 100 classes chosen in this subset.
129
+
130
+ For CIFAR-100 and CUB-200, we extract ResNet-50 image embeddings as the input to each of the models, where ResNet-50 was pre-trained on ImageNet (He et al., 2016). We use the output after the mean pooling layer and normalize the features to unit length. For AudioSet, we use the audio CNN embeddings produced by pre-training the model on the YouTube-8M dataset (Abu-El-Haija et al., 2016). We use the pre-extracted AudioSet feature embeddings, which represent ten second sound clips (i.e., ten 128-dimensional vectors concatenated in order).
131
+
132
+ Comparison Models. We compare FearNet to FEL, GeppNet, GeppNet+STM, iCaRL, and an onenearest neighbor (1-NN). FEL, GeppNet, and GeppNet+STM were chosen due to their previously reported efficacy at incremental class learning in Kemker et al. (2018). iCARL is explicitly designed for incremental class learning, and represents the state-of-the-art on this problem. We compare against 1-NN due to its similarity to our HC model. 1-NN does not forget any previously observed examples, but it tends to have worse generalization error than parametric methods and requires storing all of the training data.
133
+
134
+ ![](images/8fe87b21db3278cee40742062caccd69283383f3df858d8c12bed9bd6756eed5.jpg)
135
+ Figure 4: Mean-class test accuracy of all classes seen so far.
136
+
137
+ In each of our experiments, all models take the same feature embedding as input for a given dataset. This required modifying iCaRL by turning its CNN into a fully connected network. We performed a hyperparameter search for each model/dataset combination to tune the number of units and layers (see Supplemental Materials).
138
+
139
+ Training Parameters. FearNet was implemented in Tensorflow. For mPFC and BLA, each fully connected layer uses an exponential linear unit activation function (Clevert et al., 2016). The output of the encoder also connects to a softmax output layer. Xavier initialization is used to initialize all weight layers (Glorot & Bengio, 2010), and all of the biases are initialized to one. BLA’s architecture is identical to mPFC’s encoder, except it has a logistic output unit, instead of a softmax layer.
140
+
141
+ mPFC and BLA were trained using NAdam. We train mPFC on the base-knowledge set for 1,000 epochs, consolidate HC over to mPFC for 60 epochs, and train BLA for 20 epochs. Because mPFC’s decoder is vital to preserving memories, its learning rate is $1 / 1 0 0$ times lower than the encoder. We performed a hyperparameter search for each dataset and model, varying the model shape (64-1,024 units), depth (2-4 layers), and how often to sleep (see Sec. 6.2). Across datasets, mPFC and BLA performed best with two hidden layers, but the number of units per layer varied across datasets. The specific values used for each dataset are given in supplemental material. In preliminary experiments, we found no benefit to adding weight decay to mPFC, likely because the reconstruction task helps regularize the model.
142
+
143
+ # 6 EXPERIMENTAL RESULTS
144
+
145
+ Unless otherwise noted, each class is only seen in one unique study-session and the first baseknowledge study session contains half the classes in the dataset. We perform additional experiments to study how changing the number of base-knowledge classes affects performance in Sec. 6.2. Unless otherwise noted, FearNet sleeps every 10 study sessions across datasets.
146
+
147
+ # 6.1 STATE-OF-THE-ART COMPARISON
148
+
149
+ Table 2 shows incremental class learning summary results for all six methods. FearNet achieves the best $\Omega _ { b a s e }$ and $\Omega _ { a l l }$ on all three datasets. Fig. 4 shows that FearNet more closely resembles the offline MLP baseline than other methods. $\Omega _ { n e w }$ measures test accuracy on the most recently trained class. 1 For FearNet, this measures the performance of HC and BLA. $\Omega _ { n e w }$ does not account for how well the class was consolidated into mPFC which happens later during a sleep phase; however, $\Omega _ { a l l }$ does account for this. FEL achieves a high $\Omega _ { n e w }$ score because it is able to achieve nearly perfect test accuracy on every new class it learns, but this results in forgetting more quickly than FearNet. 1-NN is similar to our HC model; but on its own, it fails to generalize as well as FearNet, is memory inefficient, and is slow to make predictions. The final mean-class test accuracy for the offline MLP used to normalize the metrics is $6 9 . 9 \%$ for CIFAR-100, $5 9 . 8 \%$ for CUB-200, and $4 5 . 8 \%$ for AudioSet.
150
+
151
+ Table 2: State-of-the-art comparison on CIFAR-100, CUB-200, and AudioSet. The best $\Omega _ { a l l }$ for each dataset are in bold. $\Omega _ { b a s e }$ and $\Omega _ { a l l }$ are normalized by the offline MLP baseline.
152
+
153
+ <table><tr><td>Model</td><td colspan="2">CIFAR-100 Sbase Ωnew all</td><td colspan="2">CUB-200 Snew</td><td colspan="2">AudioSet Ωnew</td><td colspan="2">Mean Sbase</td></tr><tr><td>1-Nearest Neighbor|</td><td>|0.878</td><td>0.648</td><td>Sbase |0.746</td><td>Ωaul 0.434</td><td>Sbase 10.655</td><td>0.269</td><td>Sall 0.613</td><td>Sall</td></tr><tr><td>GeppNet+STM</td><td>0.866</td><td>0.879 0.408 0.800</td><td>0.764</td><td>0.694 0.204 0.645</td><td>0.941</td><td>0.861</td><td>[0.760 0.857</td><td>0.729 0.769</td></tr><tr><td>GeppNet</td><td>0.833</td><td>0.529 0.754</td><td>0.727</td><td>0.558 0.645</td><td>0.932</td><td>0.372</td><td>0.831</td><td>0.759</td></tr><tr><td>FEL</td><td>0.707</td><td>0.999 0.619</td><td>0.702</td><td>0.976 0.641</td><td>0.491</td><td>0.499 1.000 0.456</td><td>0.879</td><td></td></tr><tr><td>iCaRL</td><td>0.746</td><td>0.807 0.749</td><td>0.942 0.547</td><td>0.864</td><td>0.740 0.487</td><td>0.733</td><td>0.633 0.801</td><td>0.572 0.782</td></tr><tr><td>FearNet</td><td>0.927</td><td>0.824 0.947</td><td>0.924</td><td>0.598 0.891</td><td>0.962</td><td>0.455 0.932</td><td>0.938</td><td>0.923</td></tr></table>
154
+
155
+ <table><tr><td></td><td colspan="2">CIFAR-100</td><td colspan="2">CUB-200</td><td colspan="2">AudioSet</td></tr><tr><td></td><td>Oracle</td><td>With BLA</td><td>Oracle</td><td>With BLA</td><td>Oracle</td><td>With BLA</td></tr><tr><td>Sbase</td><td>0.965</td><td>0.927</td><td>0.968</td><td>0.924</td><td>0.970</td><td>0.962</td></tr><tr><td>Snew</td><td>0.912</td><td>0.824</td><td>0.729</td><td>0.598</td><td>0.701</td><td>0.455</td></tr><tr><td>Ωau</td><td>1.002</td><td>0.947</td><td>0.936</td><td>0.891</td><td>0.972</td><td>0.932</td></tr></table>
156
+
157
+ Table 3: FearNet performance when the location of the associated memory is known using an oracle versus using BLA.
158
+
159
+ # 6.2 ADDITIONAL EXPERIMENTS
160
+
161
+ Novelty Detection with BLA. We evaluated the performance of BLA by comparing it to an oracle version of FearNet, i.e., a version that knew if the relevant memory was stored in either mPFC or HC. Table 3 shows that FearNet’s BLA does a good job at predicting which network to use; however, the decrease in $\Omega _ { n e w }$ suggests BLA is sometimes using mPFC when it should be using HC.
162
+
163
+ When should the model sleep? To study how the frequency of memory consolidation affects FearNet’s performance, we trained FearNet on CUB-200 and varied the sleep frequency from 1-15 study sessions. When FearNet increases the number of classes it learns before sleeping (Fig. 5), it is better able to retain its base-knowledge, but this reduces its ability to recall new information. In humans, sleep deprivation is known to impair new learning (Yoo et al., 2007), and that forgetting occurs during sleep (Poe, 2017). Each time FearNet sleeps, the mPFC weights are perturbed which can cause it to gradually forget older memories. Sleeping less causes HC’s recall performance to deteriorate.
164
+
165
+ ![](images/2f78923b9aae75d6dcc03f23fbd92ef51d126b3d916bf7c065180de4a5bced14.jpg)
166
+ Figure 5: FearNet performance as the sleep frequency decreases.
167
+
168
+ Multi-Modal Incremental Learning. As shown in Sec. 6.1, FearNet can incrementally learn and retain information from a single dataset, but how does it perform if new inputs differ greatly from previously learned ones? This scenario is one of the first shown to cause catastrophic forgetting in MLPs. To study this, we trained FearNet to incrementally learn CIFAR-100 and AudioSet, which after training is a 200-way classification problem. To do this, AudioSet’s features are zero-padded to make them the same length as CIFAR-100s. Table 4 shows the performance of FearNet for three separate training paradigms: 1) FearNet learns CIFAR-100 as the base
169
+
170
+ <table><tr><td></td><td colspan="2">Base-Knowledge CIFAR-100 AudioSet 50/50 Mix</td></tr><tr><td>Sbase|</td><td>0.995 0.845</td><td>0.837</td></tr><tr><td>Snew</td><td>0.693 0.903</td><td>0.822</td></tr><tr><td>Saul</td><td>0.854 0.634</td><td>0.820</td></tr></table>
171
+
172
+ Table 4: Multi-modal incremental learning experiment. FearNet was trained with various base-knowledge sets (column-header) and then incrementally trained on all remaining data.
173
+
174
+ knowledge and then incrementally learns AudioSet; 2) FearNet learns AudioSet as the baseknowledge and then incrementally learns CIFAR-100; and 3) the base-knowledge contains a 50/50 split from both datasets with FearNet incrementally learning the remaining classes. Our results suggest FearNet is capable of incrementally learning multi-modal information, if the model has a good starting point (high base-knowledge); however, if the model starts with lower base-knowledge performance (e.g., AudioSet), the model struggles to learn new information incrementally (see Supplemental Material for detailed plots).
175
+
176
+ Base-Knowledge Effect on Performance. In this section, we examine how the size of the baseknowledge (i.e., number of classes) affects FearNet’s performance on CUB-200. To do this, we varied the size of the base-knowledge from 10-150 classes, with the remaining classes learned incrementally. Detailed plots are provided in the Supplemental Material. As the base-knowledge size increases, there is a noticeable increase in overall model performance because 1) mPFC has a better learned representation from a larger quantity of data and 2) there are not as many incremental learning steps remaining for the dataset, so the base-knowledge performance is less perturbed.
177
+
178
+ # 7 DISCUSSION
179
+
180
+ FearNet’s mPFC is trained to both discriminate examples and also generate new examples. While the main use of mPFC’s generative abilities is to enable psuedorehearsal, this ability may also help make the model more robust to catastrophic forgetting. Gillies (1991) observed that unsupervised networks are more robust (but not immune) to catastrophic forgetting because there are no target outputs to be forgotten. Since the pseudoexample generator is learned as a unsupervised reconstruction task, this could explain why FearNet is slow to forget old information.
181
+
182
+ Table 5 shows the memory requirements for each model in Sec. 6.1 for learning CIFAR-100 and a hypothetical extrapolation for learning 1,000 classes. This chart accounts for a fixed model capacity and storage of any data or class statistics. FearNet’s memory footprint is comparatively small because it only stores class statistics rather than some or all of the raw training data, which makes it better suited for deployment.
183
+
184
+ <table><tr><td>Model</td><td>100 Classes</td><td>1,000 Classes</td></tr><tr><td>1-NN</td><td>4.1 GB</td><td>40.9 GB</td></tr><tr><td>GeppNet+STM</td><td>4.1 GB</td><td>41.0 GB</td></tr><tr><td>GeppNet</td><td>4.1 GB</td><td>41.0 GB</td></tr><tr><td>FEL</td><td>272.5MB</td><td>395.0 MB</td></tr><tr><td>iCaRL</td><td>17.6 MB</td><td>166.0 MB</td></tr><tr><td>FearNet</td><td>10.7MB</td><td>74.4 MB</td></tr></table>
185
+
186
+ An open question is how to deal with storage and updating of class statistics if classes are seen in more than one study sessions. One possibility is to use a running update for the class means and covariances, but it may
187
+
188
+ Table 5: Memory requirements to train CIFAR-100 and the amount of memory that would be required if these models were trained up to 1,000 classes.
189
+
190
+ be better to favor the data from the most recent study session due to learning in the autoencoder.
191
+
192
+ FearNet assumed that the output of the mPFC encoder was normally distributed for each class, which may not be the case. It would be interesting to consider modeling the classes with a more complex model, e.g., a Gaussian Mixture Model. Robins (1995) showed that pseudorehearsal worked reasonably well with randomly generated vectors because they were associated with the weights of a given class. Replaying these vectors strengthened their corresponding weights, which could be what is happening with the pseudo-examples generated by FearNet’s decoder.
193
+
194
+ The largest impact on model size is the stored covariance matrix $\Sigma _ { c }$ for each class. We tested a variant of FearNet that used a diagonal $\Sigma _ { c }$ instead of a full covariance matrix. Table 6 shows that performance degrades, but FearNet still works.
195
+
196
+ <table><tr><td></td><td>Full Covariance</td><td>Diagonal Covariance</td></tr><tr><td>Sbase</td><td>0.942</td><td>0.781</td></tr><tr><td>Snew</td><td>0.805</td><td>0.877</td></tr><tr><td>Ωall</td><td>0.959</td><td>0.800</td></tr><tr><td>Model Size</td><td>10.7MB</td><td>3.8 MB</td></tr></table>
197
+
198
+ FearNet can be adapted to other paradigms, such as unsupervised learning and regression. For unsupervised learning, FearNet’s mPFC already does a form of it implicitly. For regression, this would require changing mPFC’s loss function and may require grouping input feature vectors into similar collections. FearNet could also be adapted to perform the supervised data permutation experiment per
199
+
200
+ Table 6: Using a diagonal covariance matrix for FearNet’s class statistics instead of a full covariance matrix on CIFAR-100.
201
+
202
+ formed by Goodfellow et al. (2013) and Kirkpatrick et al. (2017). This would likely require storing statistics from previous permutations and classes. FearNet would sleep between learning different permutations; however, if the number of classes was high, recent recall may suffer.
203
+
204
+ # 8 CONCLUSION
205
+
206
+ In this paper, we proposed a brain-inspired framework capable of incrementally learning data with different modalities and object classes. FearNet outperforms existing methods for incremental class learning on large image and audio classification benchmarks, demonstrating that FearNet is capable of recalling and consolidating recently learned information while also retaining old information. In addition, we showed that FearNet is more memory efficient, making it ideal for platforms where size, weight, and power requirements are limited. Future work will include 1) integrating BLA directly into the model (versus training it independently); 2) replacing HC with a semi-parametric model; 3) learning the feature embedding from raw inputs; and 4) replacing the pseduorehearsal mechanism with a generative model that does not require the storage of class statistics, which would be more memory efficient.
207
+
208
+ # REFERENCES
209
+
210
+ Wickliffe C Abraham and Anthony Robins. Memory retention–the synaptic stability versus plasticity dilemma. Trends in Neurosciences, 28(2):73–78, 2005.
211
+
212
+ Sami Abu-El-Haija, Nisarg Kothari, Joonseok Lee, et al. Youtube- $s \mathrm { m }$ : A large-scale video classification benchmark. arXiv:1609.08675, 2016.
213
+
214
+ Joseph Altman. Autoradiographic investigation of cell proliferation in the brains of rats and cats. The Anatomical Record, 145(4):573–591, 1963.
215
+
216
+ Bernard Ans and Stphane Rousset. Avoiding catastrophic forgetting by coupling two reverberating neural networks. Comptes Rendus de l’Acadmie des Sciences - Series III - Sciences de la Vie, 320 (12):989 – 997, 1997. ISSN 0764-4469.
217
+
218
+ Bruno Bontempi, Catherine Laurent-Demir, Claude Destrade, and Robert Jaffard. Time-dependent reorganization of brain circuitry underlying long-term memory storage. Nature, 400(6745):671– 675, 1999.
219
+
220
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network ´ learning by exponential linear units (elus). In ICLR, 2016.
221
+
222
+ Robert Coop, Aaron Mishtal, and Itamar Arel. Ensemble learning in fixed expansion layer networks for mitigating catastrophic forgetting. IEEE Trans. on Neural Networks and Learning Systems, 24(10):1623–1634, 2013.
223
+
224
+ Wei Deng, James B Aimone, and Fred H Gage. New neurons and new memories: how does adult hippocampal neurogenesis affect learning and memory? Nature Reviews Neuroscience, 11(5): 339–350, 2010.
225
+
226
+ Timothy J Draelos, Nadine E Miner, Christopher C Lamb, Jonathan A Cox, Craig M Vineyard, Kristofor D Carlson, William M Severa, Conrad D James, and James B Aimone. Neurogenesis deep learning: Extending deep networks to accommodate new classes. In International Joint Conference on Neural Networks, pp. 526–533. IEEE, 2017.
227
+
228
+ Peter S Eriksson, Ekaterina Perfilieva, Thomas Bjork-Eriksson, Ann-Marie Alborn, Claes Nordborg, ¨ Daniel A Peterson, and Fred H Gage. Neurogenesis in the adult human hippocampus. Nature medicine, 4(11):1313–1317, 1998.
229
+
230
+ David R Euston, Aaron J Gruber, and Bruce L McNaughton. The role of medial prefrontal cortex in memory and decision making. Neuron, 76(6):1057–1070, 2012.
231
+
232
+ 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:1701.08734, 2017.
233
+
234
+ Paul W Frankland, Bruno Bontempi, Lynn E Talton, Leszek Kaczmarek, and Alcino J Silva. The involvement of the anterior cingulate cortex in remote contextual fear memory. Science, 304 (5672):881–883, 2004.
235
+
236
+ Robert M French. Pseudo-recurrent connectionist networks: An approach to the ‘sensitivitystability’ dilemma. Connection Science, 9(4):353–380, 1997.
237
+
238
+ Robert M French. Catastrophic forgetting in connectionist networks. Trends in Cognitive Sciences, 3(4):128–135, 1999.
239
+
240
+ Steffen Gais, Genevieve Albouy, M \` elanie Boly, Thien Thanh Dang-Vu, Annabelle Darsaud, Martin ´ Desseilles, Geraldine Rauchs, Manuel Schabus, Virginie Sterpenich, Gilles Vandewalle, et al. ´ Sleep transforms the cerebral trace of declarative memories. Proceedings of the National Academy of Sciences, 104(47):18778–18783, 2007.
241
+
242
+ Jort F. Gemmeke, Daniel P. W. Ellis, Dylan Freedman, Aren Jansen, Wade Lawrence, R. Channing Moore, Manoj Plakal, and Marvin Ritter. Audio set: An ontology and human-labeled dataset for audio events. In ICASSP, New Orleans, LA, 2017.
243
+
244
+ Alexander Gepperth and Cem Karaoguz. A bio-inspired incremental learning architecture for applied perceptual problems. Cognitive Computation, 8(5):924–934, 2016.
245
+
246
+ AJ Gillies. The Stability/Plasticity Dilemma in Self-organising Neural Networks. PhD thesis, MSc Thesis, Computer Science Department, University of Otago, New Zealand, 1991.
247
+
248
+ 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, pp. 249–256, 2010.
249
+
250
+ Ian J Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv:1312.6211, 2013.
251
+
252
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CPVR, pp. 770–778, 2016.
253
+
254
+ P Hetherington and Mark S Seidenberg. Is there catastrophic interference in connectionist networks. In Proceedings of the 11th annual conference of the cognitive science society, volume 26, pp. 33. Erlbaum Hillsdale, NJ, 1989.
255
+
256
+ Ronald Kemker, Marc McClure, Angelina Abitino, Tyler Hayes, and Christopher Kanan. Measuring catastrophic forgetting in neural networks. In AAAI, 2018.
257
+
258
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, et al. Overcoming catastrophic forgetting in neural networks. Proc. of the National Academy of Sciences, pp. 201611835, 2017.
259
+
260
+ Takashi Kitamura, Sachie K Ogawa, Dheeraj S Roy, Teruhiro Okuyama, Mark D Morrissey, Lillian M Smith, Roger L Redondo, and Susumu Tonegawa. Engrams and circuits crucial for systems consolidation of a memory. Science, 356(6333):73–78, 2017.
261
+
262
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems 25, pp. 1097– 1105, 2012.
263
+
264
+ Fei Tony Liu, Kai Ming Ting, and Zhi-Hua Zhou. Isolation forest. In Data Mining, 2008. ICDM’08. Eighth IEEE International Conference on, pp. 413–422. IEEE, 2008.
265
+
266
+ James L McClelland, Bruce L McNaughton, and Randall C O’reilly. Why there are complementary learning systems in the hippocampus and neocortex: insights from the successes and failures of connectionist models of learning and memory. Psychological review, 102(3):419, 1995.
267
+
268
+ Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. Psychology of learning and motivation, 24:109–165, 1989.
269
+
270
+ Gina R Poe. Sleep is for forgetting. Journal of Neuroscience, 37(3):464–473, 2017.
271
+
272
+ Bjorn Rasch and Jan Born. About sleeps role in memory. ¨ Physiological reviews, 93(2):681–766, 2013.
273
+
274
+ Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semisupervised learning with ladder networks. In NIPS, pp. 3546–3554, 2015.
275
+
276
+ Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, and Christoph H Lampert. iCaRL: Incremental classifier and representation learning. In CVPR, 2017.
277
+
278
+ Anthony Robins. Catastrophic forgetting, rehearsal and pseudorehearsal. Connection Science, 7(2): 123–146, 1995.
279
+
280
+ Peter J Rousseeuw and Katrien Van Driessen. A fast algorithm for the minimum covariance determinant estimator. Technometrics, 41(3):212–223, 1999.
281
+
282
+ Bernhard Scholkopf, John C. Platt, John C. Shawe-Taylor, Alex J. Smola, and Robert C. Williamson. ¨ Estimating the support of a high-dimensional distribution. Neural Comput., 13(7):1443–1471, July 2001.
283
+
284
+ Donald F Specht. Probabilistic neural networks. Neural networks, 3(1):109–118, 1990.
285
+
286
+ A Takashima, Karl Magnus Petersson, F Rutters, I Tendolkar, O Jensen, MJ Zwarts, BL McNaughton, and G Fernandez. Declarative memory consolidation in humans: a prospective functional magnetic resonance imaging study. Proceedings of the National Academy of Sciences of the United States of America, 103(3):756–761, 2006.
287
+
288
+ Philippe Taupin and Fred H Gage. Adult neurogenesis and neural stem cells of the central nervous system in mammals. Journal of neuroscience research, 69(6):745–749, 2002.
289
+
290
+ P. Welinder, S. Branson, T. Mita, C. Wah, F. Schroff, S. Belongie, and P. Perona. Caltech-UCSD Birds 200. Technical Report CNS-TR-2010-001, California Institute of Technology, 2010.
291
+
292
+ Seung-Schik Yoo, Peter T Hu, Ninad Gujar, Ferenc A Jolesz, and Matthew P Walker. A deficit in the ability to form new human memories without sleep. Nature Neuroscience, 10(3):385–392, 2007.
293
+
294
+ # A SUPPLEMENTAL MATERIAL
295
+
296
+ # A.1 MODEL HYPERPARAMETERS
297
+
298
+ Table S1 shows the training parameters for the FearNet model for each dataset. We also experimented with various dropout rates, weight decay, and various activation functions; however, weight decay did not work well with FearNet’s mPFC.
299
+
300
+ Table S1: FearNet Training Parameters
301
+
302
+ <table><tr><td>Hyperparameter</td><td colspan="2">Values</td></tr><tr><td>Learning Rate</td><td colspan="2">2.10-3 450 (AudioSet &amp; CIFAR-100)</td></tr><tr><td>Mini-Batch Size</td><td colspan="2">200 (CUB-200)</td></tr><tr><td rowspan="2">mPFCBase-Knowledge Epochs Memory Consolidation Epochs</td><td colspan="2">1,000</td></tr><tr><td colspan="2">60</td></tr><tr><td rowspan="2">BLA Training Epochs</td><td>20</td><td></td></tr><tr><td>CIFAR-100: [140,130]</td><td></td></tr><tr><td rowspan="2">Hidden Layer Size</td><td>CUB-200:[350,300]</td><td></td></tr><tr><td>AudioSet: [300,100]</td><td></td></tr><tr><td>Sleep Frequency</td><td colspan="2">10 (see Sec. 6.2)</td></tr><tr><td>Dropout Rate</td><td colspan="2">0.25</td></tr><tr><td>Unsupervised Loss Weights (入)</td><td colspan="2">[104,1.0,0.1]</td></tr><tr><td>Hidden Layer Activation Weight Decay</td><td colspan="2">Exponential Linear Units 0.0</td></tr></table>
303
+
304
+ Table S2 shows the training parameters for the iCaRL framework used in this paper. We adapted the code from the author’s GitHub page for our own experiments. The ResNet-18 convolutional neural network was replaced with a fully-connected neural network. We experimented with various regularization strategies to increase the initial base-knowledge accuracy with weight decay working
305
+
306
+ the best. The values that are given as a range of values are the hyperparameter search spaces.
307
+ Table S2: iCaRL Training Parameters
308
+
309
+ <table><tr><td>Hyperparameter</td><td>Values</td></tr><tr><td>Learning Rate</td><td>2.10-3</td></tr><tr><td>Mini-Batch Size</td><td>450</td></tr><tr><td>Exemplars per Class (EPC)</td><td>20</td></tr><tr><td>Hidden Layer Size</td><td>64-1024</td></tr><tr><td>Number of Hidden Layers</td><td>2-4</td></tr><tr><td>Dropout Rate</td><td>[0.5,0.75,1.00]</td></tr><tr><td>HiddenLayer Activation</td><td>ReLU</td></tr><tr><td>Weight Decay</td><td>[0.0,10-5,10-4,5 · 10-4]</td></tr></table>
310
+
311
+ Table S3 shows the training parameters for GeppNet and GeppNet+STM. Parameters not listed here are the default parameters defined by Gepperth & Karaoguz (2016). The values that are given as a range of values are the hyperparameter search spaces.
312
+ Table S3: GeppNet Training Parameters
313
+
314
+ <table><tr><td>Hyperparameter</td><td>Values</td></tr><tr><td>SOM Lattice Shape (N)</td><td>20-36</td></tr><tr><td>Non-Linearity Suppression Threshold (0)</td><td>0.1-0.75</td></tr><tr><td>Incremental Class Learning Iterations (Tinc2 - Tinc1)</td><td>[2,000,20,000]</td></tr></table>
315
+
316
+ Table S4 shows the training parameters for the Fixed Expansion Layer (FEL). The number of units in the FEL layer is given by
317
+
318
+ $$
319
+ \mathrm { F E L ~ U n i t s } = { \frac { H ^ { 2 } + H K } { K } }
320
+ $$
321
+
322
+ where $H$ is the number of units in the first hidden-layer and $K$ is the maximum number of classes in the dataset. The values that are given as a range of values are the hyperparameter search spaces.
323
+
324
+ Table S4: FEL Training Parameters
325
+
326
+ <table><tr><td>Hyperparameter</td><td>Values</td></tr><tr><td>Hidden Layer Size (H)</td><td>64-1800</td></tr><tr><td>FEL Layer Size Number of Hidden Layers</td><td>See Equation 6</td></tr><tr><td>Mini-Batch Size</td><td>2 8</td></tr><tr><td>Initial Learning Rate</td><td>10-2</td></tr><tr><td></td><td></td></tr></table>
327
+
328
+ # A.2 ICARL PERFORMANCE WITH MORE EXEMPLARS
329
+
330
+ Table S5 provides additional experimental results for when there are more exemplars per class (EPC) for the iCaRL framework. Rebuffi et al. (2017) used 20 EPC in their original paper; however, we increased the number to 100 EPC to see if storing more training data helped iCaRL. Although a higher EPC does increase iCaRL performance, it still does not outperform FearNet. Note that CUB-200 only has about 30 training samples per class, so iCaRL is storing the entire training set for 100 EPC. Our main results use the default value of 20.
331
+
332
+ # A.3 BLA VARIANTS
333
+
334
+ Our BLA model is a classifier that determines whether a prediction should be made using HC (recent memory) or mPFC (remote memory). An alternative approach would be to use an outlier detection algorithm that determines whether the data being processed by a sub-network is an outlier for that sub-network and should therefore be processed by the other sub-network. To explore this alternative BLA formulation, we experimented with three outlier detection algorithms: 1) one-class support vector machine (SVM) (Scholkopf et al., 2001), 2) determining if the data fits into a Gaussian dis- ¨ tribution using a minimum covariance determinant estimation (i.e., elliptical envelope) (Rousseeuw
335
+
336
+ Table S5: iCaRL’s performance when the stored EPC is increased from 20 to 100.
337
+
338
+ <table><tr><td>Model</td><td>CIFAR-100 Sbase Ωnew aul</td><td>CUB-200 Sbase Ωnew</td><td>Ωall</td><td>AudioSet Sbase Ωnew</td><td>Ωau</td><td>Mean Sbase</td></tr><tr><td>iCaRL (20 EPC)</td><td>0.746 0.807 0.749</td><td>0.942</td><td>0.547 0.864</td><td>0.740 0.487</td><td>0.733</td><td>Ωall [0.801</td></tr><tr><td>iCaRL (100 EPC)</td><td>0.842 0.719 0.822</td><td>0.951</td><td>0.554 0.882</td><td>0.820 0.419</td><td>0.771</td><td>0.782 0.871 0.825</td></tr><tr><td>FearNet</td><td>0.927 0.824 0.947</td><td>0.924</td><td>0.598 0.891</td><td>0.962 0.455</td><td>0.932</td><td>0.938 0.923</td></tr></table>
339
+
340
+ & Driessen, 1999), and 3) the isolation forest (Liu et al., 2008). All three of these methods set a rejection criterion for if the test sample exists in HC; whereas the binary MLP reports a probability on how likely the test sample resides in HC. Table S6 compares these individual methods. Isolation Forest and Elliptic Envelope seem to prefer the data in HC, one-class SVM prefers the data in mPFC, and our binary MLP worked best at choosing the correct sub-network to use.
341
+
342
+ <table><tr><td rowspan=1 colspan=2>BLA Method</td><td rowspan=1 colspan=1>ΩbaseΩnewaul</td></tr><tr><td rowspan=4 colspan=2>Isolation ForestElliptic EnvelopeOne-Class SVMBinary MLP</td><td rowspan=1 colspan=1>0.3280.8230.368</td></tr><tr><td rowspan=1 colspan=1>elope</td><td rowspan=1 colspan=1>0.5180.8230.541</td></tr><tr><td rowspan=1 colspan=1>0.7180.4330.702</td></tr><tr><td rowspan=1 colspan=1>0.9270.9240.947</td></tr></table>
343
+
344
+ Table S6: Performance of different BLA variants.
345
+
346
+ # A.4 FEARNET ALGORITHM
347
+
348
+ Pseudocode for FearNet’s training and prediction algorithms are given in Algorithms 1 and 2 respectively. The variables match the ones defined in the paper.
349
+
350
+ <table><tr><td>Algorithm1: FearNet Training</td><td>Algorithm 2: FearNet Prediction</td></tr><tr><td>Data: X,y Classes/Study-Sessions: T; K: Sleep Frequency; Initialize mPFC with base-knowledge;</td><td>Data: X A(X) ← PBLA (C =1|X); ← maxk PHc(C=k|X)A(X). 1-A(X)</td></tr><tr><td>Store μt,Σt for each class in the base-knowledge; forc←T/2toTdo StoreX,y for class c in HC;</td><td>if &gt; maxk PmPFc (C = k|X) then return arg maxk PHc (C = k|X);</td></tr><tr><td>if c%K==O then Fine-tune mPFC with X,y in HC and pseudo- examples generated by mPFC decoder; Update μt,∑t for all classes seen so far;</td><td>else return arg maXk PmPFc (C = k/|X);</td></tr></table>
351
+
352
+ # A.5 MULTI-MODAL LEARNING EXPERIMENT
353
+
354
+ Fig. S1 shows the plots for the multi-modal experiments in Sec. 6.2. The three base-knowledge experiments were 1) CIFAR-100 is the base-knowledge and AudioSet is trained incrementally, 2) AudioSet is the base-knowledge and then AudioSet is trained incrementally, and 3) the base-knowledge is a $5 0 / 5 0 ~ \mathrm { m i x }$ of the two datasets and then the remaining classes are trained incrementally. For all three base-knowledge experiments, we show the mean-class accuracy on the base-knowledge and the entire test set. FearNet works well when it adequately learns the base-knowledge (Experiment #1 and #3); however, when FearNet learns it poorly, incremental learning deteriorates.
355
+
356
+ # A.6 BASE-KNOWLEDGE EFFECT ON PERFORMANCE
357
+
358
+ Fig. S2 shows the effect of the base-knowledge’s size on FearNet’s performance. As expected, $\Omega _ { b a s e }$ increases because there are not as many sleep phases to overwrite existing base-knowledge. $\Omega _ { n e w }$ remains relatively even because the size of the base-knowledge has no effect on the HC model’s ability to immediately recall new information; however, there is a very slight decrease that corresponds to the BLA model erroneously favoring mPFC in a few cases. Most importantly, $\Omega _ { a l l }$ sees an increase in performance because; like $\Omega _ { b a s e }$ , there are not as many sleep phases to perturb older memories in mPFC.
359
+
360
+ ![](images/1ee9cfc995cd1eecefdcd49c0badb1e9c5563f08021c359856092693a85d6752.jpg)
361
+ Figure S1: Detailed plots for the multi-modal experiment. The top row is when the base-knowledge was CIFAR-100, the middle row is when the base-knowledge was AudioSet, and the bottom row is when the base-knowledge was a $5 0 / 5 0 ~ \mathrm { m i x }$ from the two datasets. The left column represents the mean-class accuracy on the base-knowledge test set and the right column computes mean-class accuracy on the entire test set.
362
+
363
+ ![](images/e8820c9ee2b911f01bafc12161f3da93d222287445581a28a5c6c5c91bd828c6.jpg)
364
+ Figure S2: FearNet performance as a function of base-knowledge size.
md/train/ee6W5UgQLa/ee6W5UgQLa.md ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MULTIMODALQA: COMPLEX QUESTION ANSWERING OVER TEXT, TABLES AND IMAGES
2
+
3
+ Alon Talmor∗,1,2 Ori Yoran∗,1,2 Amnon Catav∗,2 Dan Lahav∗,2 Yizhong Wang3
4
+ Akari Asai3 Gabriel Ilharco3 Hannaneh Hajishirzi2,3 Jonathan Berant1,2
5
+
6
+ 1The Allen Institute for AI, 2Tel-Aviv University, 3University of Washington {alont,oriy,jonathan}@allenai.org
7
+ {amnoncatav,lahav}@mail.tau.ac.il
8
+ {yizhongw,akari,gamaga,hannaneh}@cs.washington.edu
9
+
10
+ # ABSTRACT
11
+
12
+ When answering complex questions, people can seamlessly combine information from visual, textual and tabular sources. While interest in models that reason over multiple pieces of evidence has surged in recent years, there has been relatively little work on question answering models that reason across multiple modalities. In this paper, we present MULTIMODALQA (MMQA): a challenging question answering dataset that requires joint reasoning over text, tables and images. We create MMQA using a new framework for generating complex multi-modal questions at scale, harvesting tables from Wikipedia, and attaching images and text paragraphs using entities that appear in each table. We then define a formal language that allows us to take questions that can be answered from a single modality, and combine them to generate cross-modal questions. Last, crowdsourcing workers take these automatically generated questions and rephrase them into more fluent language. We create 29,918 questions through this procedure, and empirically demonstrate the necessity of a multi-modal multi-hop approach to solve our task: our multi-hop model, ImplicitDecomp, achieves an average $\mathrm { F _ { 1 } }$ of 51.7 over cross-modal questions, substantially outperforming a strong baseline that achieves $3 8 . 2 \mathrm { F _ { 1 } }$ , but still lags significantly behind human performance, which is at $9 0 . 1 \mathrm { F _ { 1 } }$ .
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ When presented with complex questions, people often do not know in advance what source(s) of information are relevant for answering it. In general scenarios, these sources can encompass multiple modalities, be it paragraphs of text, structured tables, images or combinations of those. For instance, a user might ponder “When was the famous painting with two touching fingers completed?”, if she cannot remember the exact name of the painting. Answering this question is made possible by integrating information across both the textual and visual modalities.
17
+
18
+ Recently, there has been substantial interest in question answering (QA) models that reason over multiple pieces of evidence (multi-hop questions (Yang et al., 2018; Talmor & Berant, 2018; Welbl et al., 2017)). In most prior work, the question is phrased in natural language and the answer is in a context, which may be a paragraph (Rajpurkar, 2016), a table (Pasupat & Liang, 2015), or an image (Antol et al., 2015). However, there has been relatively little work on answering questions that require integrating information across modalities. Hannan et al. (2020) created MANYMODALQA: a dataset where the context for each question includes information from multiple modalities. However, the answer to each question can be derived from a single modality only, and no cross-modality reasoning is needed. Thus, the task is focused on identifying the relevant modality. Recently, Chen et al. (2020b) presented HYBRIDQA, a dataset that requires reasoning over tabular and textual data. While HYBRIDQA requires cross-modal reasoning, it does not require visual inference, limiting the types of questions that can be represented (See Table 1 for a comparison between the datasets).
19
+
20
+ # Multimodal Context
21
+
22
+ ![](images/5c1613ac705899207e7e983dc4f8aad672769668f3aa396af2992ec3ecdfc5b5.jpg)
23
+ Q: Which B.Piazza titlecame earlier: the movie S.Stalone'sson staredinor the movie with halfofalady'sface on the poster? A:Tell Me That You Love Me, Junie Moon
24
+ Figure 1: Example of a MMQA question, answer and context. In green are the text modality question and answer, and in red the image modality. The table is used to perform the year comparison between the answers of the text and image question parts.
25
+
26
+ In this work, we present MMQA, the first large-scale (29,918 examples) QA dataset that requires integrating information across free text, semi-structured tables, and images, where $3 5 . 7 \%$ of the questions require cross-modality reasoning. Figure 1 shows an example question: “Which B.Piazza title came earlier: the movie S. Stallon’s son starred in, or the movie with half of a lady’s face on the poster?”. Answering this question entails (i) decomposing the question into a sequence of simpler questions, (ii) determining the modalities for the simpler questions and answering them, i.e., information on the poster is in an image, the information on ${ } ^ { \mathfrak { a } } S .$ Stallon’s son” is in free text, and the years of the movies are in the table, (iii) combining the information from the simpler questions to compute the answer: “Tell Me that you love me, Junie Moon”.
27
+
28
+ Our methodology for creating MMQA involves three high-level steps. (a) Context construction: we harvest tables from Wikipedia, and connect each table to images and paragraphs that appear in existing Reading Comprehension (RC) datasets (Kwiatkowski et al., 2019; Clark et al., 2019; Yang et al., 2018); (b) Question generation: Following past work (Talmor & Berant, 2018), we use the linked structure of the context to automatically generate questions that require multiple reasoning operations (composition, conjunction, comparison) across modalities in pseudo-language ; (c) Paraphrasing: we use crowdsourcing workers to paraphrase the pseudo-language questions into more fluent English.
29
+
30
+ To tackle MMQA, we introduce ImplicitDecomp, a new model that predicts a program that specifies the required reasoning steps over different modalities, and executes the program with dedicated text, table, and image models. ImplicitDecomp performs multi-hop multimodal reasoning without the need for an explicit decomposition of the question.
31
+
32
+ We empirically evaluate MMQA by comparing ImplicitDecomp to strong baselines that do not perform cross-modal reasoning and to human performance. We find that on multimodal questions, ImplicitDecomp improves $\mathrm { F _ { 1 } }$ from
33
+
34
+ Table 1: A comparison of MULTIMODALQA to MANYMODALQA and HYBRIDQA. We compare dataset size, use of images, and whether the dataset supports multihop questions and an open-domain full-wiki setup.
35
+
36
+ <table><tr><td>Dataset</td><td>Size</td><td>Full- wiki</td><td>Uses images</td><td>Multi- hop</td></tr><tr><td>MANYMODALQA</td><td>10K</td><td>X</td><td>√</td><td>X</td></tr><tr><td>HYBRIDQA</td><td>70K</td><td>X</td><td>×</td><td>√</td></tr><tr><td>MULTIMODALQA</td><td>30K</td><td>√</td><td>√</td><td>√</td></tr></table>
37
+
38
+ $3 8 . 2 5 1 . 7 $ over a single-hop approach. Humans are able to reach $9 0 . 1 \mathrm { F _ { 1 } }$ , significantly outperforming our best model. Because automatic evaluation is non-trivial, we also manually analyze human performance and find humans correctly answer $9 4 . 5 \%$ of the questions in MMQA. Finally, our dataset can be used in an open-domain setup over all of Wikipedia. In this setup, the $\mathrm { F _ { 1 } }$ of humans is 84.8.
39
+
40
+ To summarize, our key contributions are:
41
+
42
+ • MMQA: a dataset with 29,918 questions and answers, $3 5 . 7 \%$ of which require cross-modal reasoning. • A methodology for generating multimodal questions over text, tables and images at scale. • ImplicitDecomp, A model for implicitly decomposing multimodal questions, which improves on a single-hop model by 13.5 absolute $\mathrm { F _ { 1 } }$ points on questions requiring cross-modal reasoning. • Our dataset and code are available at https://allenai.github.io/multimodalqa.
43
+
44
+ # 2 DATASET GENERATION
45
+
46
+ Our goal is to develop a method that allows generating complex questions over multiple modalities at scale. An overview of the methodology is captured in Figure 2. We first select a Wikipedia table as an anchor, to which we add images and texts paragraphs and obtain a context. Single modality questions are generated based on these contexts, and used to automatically create multimodal, multihop questions. AMT workers rephrase the questions into natural language, and finally distractor paragraphs and images are selected for each question. We now elaborate on the 6 steps of the process.
47
+
48
+ ![](images/c677a9a1b1216fe181547eefdaed522f58fff6f5ef071ef7e788cd277e95cbb4.jpg)
49
+ Figure 2: An overview of MMQA dataset generation process.
50
+
51
+ 2.1 Wikipedia tables as anchors The 01-01-2020 English Wikipedia dump contains roughly $3 M$ tables. We extracted all tables and selected those that meet the following criteria: (a) The tables contain 10-25 rows (b) At least 3 images are associated with the table. This results in a total of $7 0 0 \mathrm { k }$ tables. (see supp. material for more information). These tables are the anchors of our contexts, which we enrich with images and text for multimodal question generation. A key element of the tables are Wikipedia Entities (WikiEntities) that appear in them, i.e., concepts linked to other Wikipedia entries. We use them to connect different modalities, bridge questions, and solve ambiguities (details below).
52
+
53
+ 2.2 Connecting Images and Text to Tables Images. We consider two cases: (a) in-table images and (b) images from pages of linked WikiEntities. In the former, the images are featured inside the table cells. In the latter, the table contains a column of WikiEntities that potentially have images, e.g. a table describing the filmography of an actor often contains a column of film names, which may have posters in their respective pages. To associate entities with their representative image, we map entities and their profile images in their Wikipedia pages. Overall, we obtain 57,713 images, with 889 in-table images and 56,824 WikiEntities images. Text. We build on texts from contexts appearing in existing reading comprehension datasets. We elaborate on this process next.
54
+
55
+ 2.3 Generating Single-Modality Questions Tables. We generate pseudo-language table questions in the following form “In [table title] of [Wikipedia page title] which cells in [column X] have the [value Y] in [column Z]?”. We additionally support numeric computations over columns classified as dates or numbers, such as min and max values, e.g., “In [Doubles] of [WCT Tournament of Champions], what was the MOST RECENT [Year](s) where the [Location] was [Forest Hills]”.
56
+
57
+ Images. We use crowdsourcing to generate single-modality questions about images. We generated two types of image questions, based on the images we retrieved from the previous step: (i) questions over a single image, (ii) questions over a list of images.
58
+
59
+ When generating single-image questions, we show Amazon Mechanical Turk (AMT) crowd workers an image alongside its WikiEntity, and ask them to phrase a question about the image with the entity being the focus of the question. E.g, if the entity is “Roger Federer”, a potential question is “What’s the hair color of Roger Federer?”. For questions to have meaning in an open-domain setting, we primed AMT workers to ask questions that correspond to “stable” features, i.e., features that are unlikely to change in different images and are thus appropriate in an open-domain setting.
60
+
61
+ Table 2: All 16 compositional templates in MMQA with an example and their relative frequency.
62
+
63
+ <table><tr><td rowspan=1 colspan=1>Type</td><td rowspan=1 colspan=1>Q&amp;A</td><td rowspan=1 colspan=1>%</td></tr><tr><td rowspan=1 colspan=1>TextQ</td><td rowspan=1 colspan=1>What wasthe territorial capitalof the territory opposingOhioin theToledoWar?Detroit</td><td rowspan=1 colspan=1>31.0</td></tr><tr><td rowspan=1 colspan=1>TableQ</td><td rowspan=1 colspan=1>DoestheGerman state Baden-Wurttemberg orThuringia have moreresidents?Baden-Wurttemberg</td><td rowspan=1 colspan=1>18.3</td></tr><tr><td rowspan=1 colspan=1>ImageQ</td><td rowspan=1 colspan=1>WhatweaponisthestatueinNottinghamholding?bow</td><td rowspan=1 colspan=1>8.9</td></tr><tr><td rowspan=1 colspan=1>Compose(TextQ,TableQ)</td><td rowspan=1 colspan=1>Atwhatagedid theCleveland Cavaliersplayer with 6190rebounds enter the NBA?19</td><td rowspan=1 colspan=1>7.8</td></tr><tr><td rowspan=1 colspan=1>ImageListQ</td><td rowspan=1 colspan=1>Whatisthecommon nameof thebushwarblerinThailand that hasanorange stripe above itseye?Chestnut-crowned bush warbler</td><td rowspan=1 colspan=1>6.1</td></tr><tr><td rowspan=1 colspan=1>Compose(TableQ,ImageListQ)</td><td rowspan=1 colspan=1>Thefilm that starredChrisEllisonwhereamanwasholding anewspaper on the poster, was released what year?1988</td><td rowspan=1 colspan=1>5.4</td></tr><tr><td rowspan=1 colspan=1>Compose(ImageQ,TableQ)</td><td rowspan=1 colspan=1>OntheposterfortheTVshowinwhich TomMisonplayedDorianCrane,what kind of structure can be seen behind the two men? castle</td><td rowspan=1 colspan=1>4.5</td></tr><tr><td rowspan=1 colspan=1>Compare(Compose(TableQ,ImageQ),TableQ)</td><td rowspan=1 colspan=1>Which manufacturerhas fewerwinsattheFirst Data 5Oo:Buick or thebrand with across for a logo?Buick</td><td rowspan=1 colspan=1>3.5</td></tr><tr><td rowspan=1 colspan=1>Compose(TableQ,TextQ)</td><td rowspan=1 colspan=1>Onwhat date did the original artistwho sangSweetChildof Mine haveaconcert atUSBank Stadium?July 30,2017</td><td rowspan=1 colspan=1>3.2</td></tr><tr><td rowspan=1 colspan=1>Intersect(TableQ,TextQ)</td><td rowspan=1 colspan=1>Who was the artistfor DamonFox in20o6who also sings &quot;You gotthemoves like Jagger&quot;?Christina Aguilera</td><td rowspan=1 colspan=1>2.6</td></tr><tr><td rowspan=1 colspan=1>Compose(TextQ,ImageListQ)</td><td rowspan=1 colspan=1>Ontheposterfor themoviebasedonthebook &quot;ActlikeaLady,ThinkLikea Man,&quot;how many people are there in total? nine</td><td rowspan=1 colspan=1>2.4</td></tr><tr><td rowspan=1 colspan=1>Intersect(ImageListQ,TableQ)</td><td rowspan=1 colspan=1>WhatcoversoftheChandlerCanterburyfilmsfrom2oo9hasmorethanoneperson?PowderBlueBallsOut,Gary theTennisCoach,After.Life</td><td rowspan=1 colspan=1>2.3</td></tr><tr><td rowspan=1 colspan=1>Compare(TableQ,Compose(TableQ,TextQ))</td><td rowspan=1 colspan=1>DidChelseaorclubthat singsYou&#x27;llNeverWalkAlonerank higherinDeloitteFootball MoneyLeague20o7?Chelsea</td><td rowspan=1 colspan=1>2.1</td></tr><tr><td rowspan=1 colspan=1>Compose(ImageQ,TextQ)</td><td rowspan=1 colspan=1>DidGary Oldmantakepart inthemoviewhoseposterfeaturestwomenholding handguns,and which had MarkL.Smith as a writer? no</td><td rowspan=1 colspan=1>1.0</td></tr><tr><td rowspan=1 colspan=1>Compare(Compose(TableQ,ImageQ),Compose(TableQ,TextQ))</td><td rowspan=1 colspan=1>Wasthefilmthat featuresa gianteyeonitsposter or the firstWolverinemovie theearlierfilm thatScott Silverworkedon? Requiem fora Dream</td><td rowspan=1 colspan=1>0.8</td></tr><tr><td rowspan=1 colspan=1>Intersect(ImageListQ,TextQ)</td><td rowspan=1 colspan=1>Whatcommonlaw statewith aneagleontheflag hasan institutionin the North region of DivisionIIof theNCCAA?Iowa</td><td rowspan=1 colspan=1>0.2</td></tr></table>
64
+
65
+ For questions with a list of images, we use images that appear in the same column of a table. To generate these questions, AMT workers were given the images and asked to phrase a binary question about a distinctive feature of the entities that a subset of the images share. E.g., given a list of statues, the worker could ask “Which of the statues features a horse?” This process results in 2,764 single image questions and 7,773 list image questions that are later used to create multimodal questions.
66
+
67
+ Text. To obtain questions answerable over text paragraphs we build on existing reading comprehension datasets: Natural Questions (NQ) (Kwiatkowski et al., 2019) consists of about $3 0 0 K$ questions issued to the Google search engine. This dataset mostly contains simple questions where a single paragraph suffices to answer each question. BoolQ (Clark et al., 2019) contains 15, 942 yes/no questions, gathered using the same pipeline as NQ. HotpotQA (Yang et al., 2018) contains $1 1 2 K$ training questions, where crowd workers were shown pairs of related Wikipedia paragraphs and were asked to author questions that require multi-hop reasoning over the paragraphs.
68
+
69
+ To use questions from the above datasets as building blocks for multi-hop multimodal questions, we unified them into a corpus that consists of triples of (i) a text question, (ii) an answer and (iii) 1-2 gold paragraphs from Wikipedia. We link a question to a table, by matching WikiEntities in the table to entities in the text of the question (see supplementary material for further details). Overall, we retrieved 6,644 questions from NQ, 1,246 from BoolQ and 4,733 from HotpotQA.
70
+
71
+ 2.4 Generating multimodal complex questions We present an automatic method for creating at scale multimodal compositional questions (i,e., questions that require answering a sequence of subquestions to conclude the final answer). Our first step is to introduce a formal language that allows to combine questions answerable from a single modality. Below we introduce the logical operations that allow to generate such pseudo-language (PL) questions, while keeping a formal representation of how they were constructed. In Table 2, we illustrate this process with all 16 different compositional templates used for question generation. We now describe our logical operations.
72
+
73
+ Logical Operations Functions in our formal language take arguments and return a PL partial question, as well as answers that can be a list of one or more strings, or a list of one or more WikiEntities. All operations have access to the full context. In addition, we prepend a prefix containing the Wikipedia table name and page title—e.g. “In the Filmography of Brad Pitt,”—to all our PL questions to support an open-domain QA setup. Our set of logical operations are:
74
+
75
+ 1. TABLEQ: Returns a question from the table questions generated in $\ S 2 . 3$ , as well as a list of WikiEntities or a list of strings as answers.
76
+
77
+ 2. TEXTQ: Returns a text corpus question (see $\ S 2 . 3$ ) and a list of WikiEntities or strings as answers.
78
+
79
+ 3. IMAGEQ: Returns a question about a single image associated with a WikiEntity and a single token answer from a fixed vocabulary (see $\ S 2 . 3 \AA$ ).
80
+
81
+ 4. IMAGELISTQ: Returns a question about a list of images and a list of WikiEntities corresponding to the images that answer the question (see $\ S 2 . 3$ ).
82
+
83
+ 5. COMPOSE $( \cdot , \cdot )$ : Takes a PL question containing a single WikiEntity as a first argument, and a PL question that produces that WikiEntity as the output answer as its second argument. E.g., COMPOSE(“Where was Barack Obama born?”,“Who was the 44th president of the USA?”). The function replaces the WikiEntity in the first-argument PL question with the second-argument PL question and returns the resulting PL question (“Where was the 44th president of the USA born?”).
84
+
85
+ 6. INTERSECT $( \cdot , \cdot )$ : Takes two PL questions that return lists of more than one WikiEntity, and returns their intersection as the answer. The resulting $\mathrm { P L }$ question is of the form ${ } ^ { \cdot } P L _ { 1 }$ and $P L _ { 2 }$ ” omitting $\mathrm { P L _ { 2 } }$ ’s first word (“Who was born in Hawaii and is the parent of Sasha Obama?”).
86
+
87
+ 7. COMPARE $( \cdot , \cdot )$ : Takes two PL questions each returning one WikiEntity that can be linked to one cell in the table, denoted by $\mathrm { { A n s } _ { 1 } }$ , $\mathrm { { A n s } _ { 2 } }$ . We first choose a numeric or date column in the table, if such exists. We then compare the values of this column corresponding to the rows of $\mathbf { A n s } _ { 1 }$ and Ans2. Depending on the comparison outcome, output one of $( \mathrm { A n s _ { 1 } }$ , Ans2) as the operation answer. The PL question created is of the form “What has compare-op numeric-column-name, $P L _ { 1 }$ or $P L _ { 2 }$ ?” omitting $\mathrm { P L _ { 1 } }$ and $\mathrm { P L _ { 2 } }$ ’s first word. E.g. “What has most recent creation year, the rocket of Appolo program, or the rocket of Gemini program?”
88
+
89
+ 2.5 Paraphrasing using AMT We used English-speaking AMT workers to paraphrase automaticallygenerated PL questions into natural language (NL). Each question was paraphrased by 1 worker and validated by 1-3 other workers. To avoid annotator bias (Geva et al., 2019), the number of annotators who worked on both the training and evaluation set was kept to a minimum. We also deployed a feedback mechanism, where workers receive a bonus if a baseline model correctly answered the question after their first paraphrasing attempt, but incorrectly after they refined the paraphrase. See supp. material for print-screens of the AMT annotator interface.
90
+
91
+ To generate diversity, workers got a bonus if the normalized edit distance of a paraphrase compared to the PL question was higher than 0.7. A total of 971 workers were involved, and 29,918 examples were produced with an average cost of $0 . 3 3 \ S$ per question. We split the dataset into 23,817 training, 2,441 development (dev.), and 3,660 test set examples. Context components in the dev. and test sets are disjoint, and were constructed from a disjoint set of single-modality questions.
92
+
93
+ A shortcoming of our method for automatically generating examples is that the question distribution does not come from a “natural” source. We argue that developing models that are capable of performing reasoning over multiple modalities is an important direction and MMQA provides an opportunity to develop and evaluate such models. Moreover, this method allows to control the compositional questions created, proving effective in creating a cheap and scalable dataset.
94
+
95
+ 2.6 Adding distractors to the context Images. Questions from the IMAGELISTQ operator require reasoning over a list of images from the same column, and hence do not require additional distractors. For IMAGEQ questions (single-image), we randomly add images that are associated with the WikiEntities that appear in the table, setting a maximum of 15 distractors per question.
96
+
97
+ Text. We used DPR (Karpukhin et al., 2020), a neural information retrieval model, to retrieve distractors for all questions. Each context includes exactly 10 paragraphs, where 1-2 are gold paragraphs and the rest are distractors. Specifically, we encode the first 2 paragraphs of each Wikipedia article with the DPR encoder, and use as distractors the paragraphs with the highest dot product between their encoding and the question encoding. We do not allow: (a) an overlap between the distractors in the training and evaluation sets, (b) distractors originating from the gold article, (c) distractors containing an exact match to the gold answer.
98
+
99
+ To summarize, each of our examples contains a question, an answer, the formal representation of the PL question (ignored by our models), and all distractors and gold context for all modalities. This renders MMQA useful for both open-domain multimodal QA, as well as context-dependant QA.
100
+
101
+ ![](images/53d9aa241337ef2392714bb6dfb2adc55db8678aa5705c36b68b58c902fb16dd.jpg)
102
+ Figure 3: Domain diversity in MMQA. The area of each color corresponds to the topic frequency in the dataset.
103
+
104
+ # 3 DATASET ANALYSIS
105
+
106
+ To highlight the diversity of MMQA we analyze its key statistics, domains, and lexical richness.
107
+
108
+ Key Statistics MMQA contains 29, 918 questions, and their main statistics are in Table 3. Since we focus on multimodality, we upsample the number of multimodal questions in the dev. and test sets compared to the training set. Also, about $60 \%$ of the questions in MMQA are compositional. Questions are relatively long (18.2 words), but answers tend to be short (2.1 words). The answer for each question can be a single answer or a list of answers. While list answers comprise only $7 . 4 \%$ of the data, when considering compositional questions that contain an intermediate question within them, the proportion of list answers in intermediate questions is higher $( 1 8 . 9 \% )$ ).
109
+
110
+ Table 3: Key statistics for MMQA.
111
+
112
+ <table><tr><td>Measurement</td><td>Value</td></tr><tr><td># Distinct Questions</td><td>29,918</td></tr><tr><td>Train multimodal questions</td><td>34.6%</td></tr><tr><td>Dev.+test multimodal questions</td><td>40.1%</td></tr><tr><td>Train compositional questions</td><td>58.8%</td></tr><tr><td>Dev.+test compositional questions</td><td>62.3%</td></tr><tr><td>Average question length (words)</td><td>18.2</td></tr><tr><td>Average # of answers per question</td><td>1.16</td></tr><tr><td>List answers</td><td>7.4%</td></tr><tr><td>List answers per intermediate question</td><td>18.9%</td></tr><tr><td>Average answer length (words)</td><td>2.1</td></tr><tr><td># of distinct words in questions</td><td>49,649</td></tr><tr><td># of distinct words in answers</td><td>20,820</td></tr><tr><td># of distinct context tables</td><td>11,022</td></tr></table>
113
+
114
+ Domain Diversity Figure 3 shows a sample of questions from MMQA categorized to different domains. While entertainment categories occupy a large portion of our dataset (Films $36 \%$ , TV $19 \%$ ), we observe questions represent a wide variety of topics.
115
+
116
+ Lexical Richness Workers received a bonus when substantially modifying the PL questions. We observe that the average normalized edit distance between the NL questions and the PL questions is high (0.7), that NL questions are shorter (avg. length of 20.02 vs. 22.16 words for PL questions), and use a richer vocabulary (#unique words 39, 319 vs 37, 108).
117
+
118
+ # 4 MODELS
119
+
120
+ Here we present our baseline models. We first train models that interact with a single modality given a question (§4.1), and use those as building blocks in our multimodal approaches (§4.2). We denote the question by $Q$ , context paragraphs by $\mathcal { P }$ , Table by $T$ and context images by $\mathcal { T }$ .
121
+
122
+ # 4.1 SINGLE-MODALITY QA MODULES
123
+
124
+ Text QA Module Following prior work (Min et al., $2 0 1 9 \mathrm { a }$ ; Asai et al., 2020), our text QA module takes as input a question $Q$ and a paragraph $p \in \mathcal P$ and answers $Q$ by selecting a span in each paragraph $p$ independently, predicting the start and end positions (Devlin et al., 2019). Additionally, the model returns four scores for for every paragraph $p$ corresponding to: if the answer is $( i )$ a span in $p$ ; $( i i )$ “yes”; $( i i i )$ “no”; or $( i \nu )$ not in $p$ . At inference time, the model selects the paragraph that has the lowest score for $i \nu$ – the answer is not the paragraph. Our model is based on a pre-trained RoBERTa-large model (Liu et al., 2019), fine-tuned on MMQA.
125
+
126
+ Table QA Module Following prior work (Herzig et al., 2020), our table QA module takes as input the question $Q$ and the table $T$ , and selects a subset of the table cells and an aggregation operation to compute the final answer. Specifically, we linearize the table $T$ by rows, with column names prepended to the corresponding cells (Chen et al., 2019). For example, this converts the table in Figure 1 to the following text: “Row 1: year is 1957; title is a dangerous age; role is David. Row 2...”. Next, we concatenate the question to the linearized table, and encode them using RoBERTa-large. We then pass the contextualized representation of every token in the table cell to a linear classifier that computes the probability of the token being selected. The score for a cell is the average of its tokens. Cells with probability $> 0 . 5$ are selected. Finally, another linear multi-class classifier predicts an aggregation operation from SUM, MEAN, COUNT, YES, NO, and NONE. Aggregation operations are applied on the selected cells, YES and NO operations output “yes” or “no”, and the NONE operation outputs all selected cells.
127
+
128
+ Image QA Module Questions with visual information are handled by a multimodal transformer that processes the text question and pre-computed image features. For a question $Q$ and a set of images $\mathcal { T }$ , we feed the model the question and the visual features $\Phi ( i )$ extracted from each image $i \in \mathcal { T }$ , along with the name of the WikiEntity associated with the image. For each image and question, the model predicts an answer from a fixed vocabulary determined by the answers in the training set and 3 special tokens: $y _ { \mathrm { d t r } }$ , $y _ { \mathrm { p } }$ and $y _ { \mathrm { n } }$ . In questions where the expected answer is a phrase (e.g., ImageQ), we return the answer from the image where $p ( y _ { \mathrm { d t r } } )$ is lowest (similar to text QA). In questions where the expected answer is a subset of the images (e.g., Compose(TableQ,ImageQ)), we return all images where $p ( y _ { \mathrm { p } } ) > p ( y _ { \mathrm { n } } )$ . Our model is based on the pre-trained model VILBERT-MT1 (Lu et al., 2020). Visual features are extracted by a vision network $\Phi$ , comprised of a Faster R-CNN (Ren et al., 2015) pre-trained on Visual Genome (Krishna et al., 2017).
129
+
130
+ # 4.2 MULTIMODALITY QA MODELS
131
+
132
+ We turn to models that interact with multiple modalities.
133
+
134
+ Multi-Hop Implicit Decomposition (ImplicitDecomp) Our dataset is designed to test reasoning across modalities. As a first attempt towards this goal, we introduce a 2-hop implicit decomposition baseline, capable of combining information scattered across modalities (illustrated in Figure 4).
135
+
136
+ We first train a question-type classifier, based on RoBERTa-large, that takes a question $Q$ as input, and predicts one of the 16 possible question types (Table 2). The question type can be viewed as a program, specifying the relevant modalities, their order, and the logical operations. For example, if the question type is Compose(TextQ,TableQ), the first hop should be conducted on the table $T$ , and the second hop on the paragraphs $\mathcal { P }$ . In each hop, we feed the model with the question $Q$ , the question type, the hop number, and the context of the corresponding modality. The model automatically identifies which part of the question is relevant at the current hop and does not explicitly decompose the question into sub-questions (hence the name implicit decomposition). In the second hop, answers from the first hop are also given as input so that the model can leverage this information and conduct cross-modal reasoning to output the final answer. For all single-modality question types (such as TextQ and TableQ), the model uses only the first hop to get the answer.
137
+
138
+ Single-Hop Routing (AutoRouting) A simple approach for answering questions without cross-modal reasoning is to first determine the modality where the answer is expected to occur, and then run the corresponding single-modality module. We use the aforementioned question type classifier to determine the modality where the answer will appear, route the question and the context for the predicted modality into the corresponding module, and use the output as the final answer.
139
+
140
+ Question-only and Context-only baselines We run the question-only and context-only baselines, suggested by Kaushik & Lipton (2018). Our question-only baseline is BART-large (Lewis et al., 2019): a sequence-to-sequence model that directly generates the answer given the question. For the context-only baseline, we first predict the question type using the classifier described above to pick a target module. We then feed the relevant context to the target module, replacing the question with an empty string.
141
+
142
+ # 4.3 TRAINING AND SUPERVISION
143
+
144
+ Our dataset provides rich supervision including not only the final answer but also question types and intermediate results. Therefore, we can train the pipeline modules in a supervised fashion. Specifically, we train the question type classifier using a cross entropy loss w.r.t the gold question type. For AutoRouting, each QA module is trained with the subset of samples whose final answer can be extracted from the corresponding modality. For ImplicitDecomp, only one model is trained per modality, which is used to answer both the first-hop and second-hop questions. The question-only and context-only baselines are trained in the corresponding format.
145
+
146
+ ![](images/838228a9af05a2952896cfe89472ebe9701295d9d6234c351935f7aed3b0739e.jpg)
147
+ Figure 4: ImplicitDecomp: Modules with the same color share parameters. In this example, the text QA module is activated to produce the 1st-hop answer, and this intermediate answer is fed into the Image QA model to produce the final answer. Question type ([Q Type]) is determined by a separate classifier.
148
+
149
+ # 5 EXPERIMENTS
150
+
151
+ We evaluate models in three different setups: (1) questions that require a single modality to answer (Single Modality); (2) questions that require reasoning over multiple modalities (Multi Modality); (3) and all questions $( A l l )$ . Our evaluation metrics need to support lists of answers, and thus we use average $\mathrm { F _ { 1 } }$ and Exact Match (EM), as described in Dua et al. (2019), where answers on the gold and predicted lists are aligned. Human performance is estimated with 9 expert annotators, who answered 145 questions. Test results are are reported using a single run (one random seed).
152
+
153
+ We show results in Table 4.2 ImplicitDecomp achieves significantly higher performance $( 5 5 . 9 \mathrm { F _ { 1 , } } )$ compared to the other baselines, but lower than human performance $( 9 1 . 2 \mathrm { F _ { 1 } }$ with provided context, and $8 4 . 8 \mathrm { F _ { 1 } }$ in the open-domain setting over all of Wikipedia), suggesting ample room for improvement. On the Multi Modality subset, ImplicitDecomp
154
+
155
+ Table 4: Test set results
156
+
157
+ <table><tr><td></td><td>Single Modality</td><td colspan="2">Mutli Modality</td><td colspan="2">All</td></tr><tr><td></td><td>EM</td><td>F1 EM</td><td>F1</td><td>EM</td><td>F1</td></tr><tr><td>Question-only2 Context-only</td><td>14.2 8.0</td><td>17.0 10.2</td><td>16.9 19.5 6.6 8.5</td><td>15.3 7.4</td><td>18.0 9.5</td></tr><tr><td>AutoRouting ImplicitDecomp</td><td>48.9 51.1</td><td>57.1 58.8</td><td>32.0 38.2 46.5 51.7</td><td>42.1 49.3</td><td>49.5 55.9</td></tr><tr><td>Human</td><td>87.9</td><td>92.5</td><td>84.8 90.1</td><td>86.2</td><td>91.2</td></tr></table>
158
+
159
+ substantially improves performance compared to AutoRouting $\mathrm { 3 8 . 2 } \mathrm { 5 1 . 7 } $ , emphasizing the superiority of our approach on multi-hop questions, while on single-hop questions this gap is smaller.
160
+
161
+ Since automatic evaluation of performance is non-trivial in our setup, we also manually evaluate human performance. In $9 4 . 5 \%$ of the cases, answers are either identical or semantically equivalent to the gold answer, $0 . 7 \%$ have an error in the question, and $4 . 8 \%$ are human errors. Human errors are owing to the length of the context, resulting in human fatigue (which models do not suffer from).
162
+
163
+ Analysis To demonstrate that ImplicitDecomp indeed performs multi-hop reasoning, successfully answering intermediate questions, we analyze ImplicitDecomp predictions for multimodal questions generated using the Compose, Compare and Intersect operations (Table 5). For these questions, we find that when the 1st-hop answer is correct, the model achieves an $\mathrm { F _ { 1 } }$ of 63.9, whereas when the 1st-hop prediction is incorrect, the $\mathrm { F _ { 1 } }$ drops to 37.4. This suggests that the model relies on the 1st-hop answer, effectively performing multi-hop reasoning. Last, our question type classifier obtains a high accuracy of $9 1 . 5 \%$ on the test set.
164
+
165
+ Table 5: Examples where ImplicitDecomp correctly answers both the intermediate and the entire question, and a breakdown of the 1st-hop $\mathrm { F _ { 1 } }$ and final $\mathrm { F _ { 1 } }$ for the three logical operations: Compose, Compare, and Intersect.
166
+
167
+ <table><tr><td rowspan=1 colspan=1>Type</td><td rowspan=1 colspan=1>Question</td><td rowspan=1 colspan=1>1st-hop prediction</td><td rowspan=1 colspan=1>Final prediction</td><td rowspan=1 colspan=1>1st-hop F1</td><td rowspan=1 colspan=1>F1</td></tr><tr><td rowspan=1 colspan=1>Compose</td><td rowspan=1 colspan=1>WhatpartdidKymKarathplayintheTVshowwhose poster featuresa dog?</td><td rowspan=1 colspan=1>Lassie</td><td rowspan=1 colspan=1>Kathy Vaughn</td><td rowspan=1 colspan=1>62.3</td><td rowspan=1 colspan=1>50.8</td></tr><tr><td rowspan=1 colspan=1>Compare</td><td rowspan=1 colspan=1>Whichvideo gamewasWes Johnson involved in earlier:Fallout4 or the gamewhose cover shows agun-wielding man?</td><td rowspan=1 colspan=1>Hammer&amp;Sickle</td><td rowspan=1 colspan=1>Hammer&amp;Sickle</td><td rowspan=1 colspan=1>55.7</td><td rowspan=1 colspan=1>61.1</td></tr><tr><td rowspan=1 colspan=1>Intersect</td><td rowspan=1 colspan=1>Whichalbum,released inDecemberof201l,hasamanwearingsunglasses on its cover, and was released under the RCA label?</td><td rowspan=1 colspan=1>TY.O,Back to Love</td><td rowspan=1 colspan=1>Back to Love</td><td rowspan=1 colspan=1>33.5</td><td rowspan=1 colspan=1>55.1</td></tr></table>
168
+
169
+ To test whether the compositional questions created are indeed multi-hop, we conducted a qualitative analysis over 50 questions as suggested by (Min et al., 2019b). We find that $6 \%$ are of the Weak Distractors category, that is, questions such as “What year... ” when there is only one year appearing in the context, making the question easy. $2 \%$ have Redundant evidence, that is, questions such as “Which Donald Trump TV show has ...” where there is only one TV show starring Donald Trump, making the rest of the question redundant. The remaining $92 \%$ indeed require multi-hop reasoning.
170
+
171
+ # 6 RELATED WORK
172
+
173
+ Visual question answering—i.e., the task of answering questions about images—has been widely explored in previous work (Antol et al., 2015; Zhang et al., 2016; Goyal et al., 2017; Johnson et al., 2017; Hudson & Manning, 2019; Zellers et al., 2019; Singh et al., 2019; Methani et al., 2020), ranging from synthetic images to scientific plots. Our work differs significantly from those, by including more complex, multi-hop questions that require reasoning over text, tables and images. Currently, the most successful paradigm in VQA is fine-tuning models pre-trained on large amounts of image captioning data (Tan & Bansal, 2019; Lu et al., 2019; 2020; Su et al., 2020; Chen et al., 2020c; Li et al., 2020), an approach we follow for answering image-related questions.
174
+
175
+ MANYMODALQA (Hannan et al., 2020) move beyond directing the question to an image-only context, to choosing between an image, a text, and a table. Their work focuses on routing the question to the correct context modality. Our question-type classifier, based on RoBERTa-large reaches an accuracy of $9 1 . 4 \%$ on our 16 possible question types, showing that the main challenge in MMQA is reasoning over the context rather than identifying the question type.
176
+
177
+ HYBRIDQA (Chen et al., 2020b) presents a cross-modality reasoning challenge over tabular and textual data. A fundamental difference is that our setup offers cross-modality reasoning over images as well. In addition, our approach is cheaper to annotate since it requires only paraphrasing, and the question type distribution is more controllable (we offer 16 major question types vs. 6 in HYBRIDQA). Moreover, our text passages are chosen using the question, answer and table, while in HYBRIDQA only WikiEntities from the table are used to find text passages.
178
+
179
+ The model proposed in HYBRIDQA introduces a heuristic for linking the text passage to the table cells, which may lead to performance degradation. Conversely, our model uses (automaticallyannotated) intermediate multi-hop answers, to perform reasoning and linking implicitly over the full table and text, which should lead to more robust reasoning, in particular when reasoning over multiple table cells, as well as for narrative tracking and co-reference over the full text. In parallel to this work, a new open-domain variant of HYBRIDQA has been released by Chen et al. (2020a).
180
+
181
+ # 7 CONCLUSION
182
+
183
+ We present MMQA, a new QA dataset that contains 29,918 examples, $3 5 . 7 \%$ of which require crossmodality reasoning. We describe a novel framework for generating complex multimodal questions at scale, and showcase the diversity and multimodal properties of the resulting dataset. We evaluate MMQA using a variety of models, and confirm that the best model exploits the multimodality of the dataset and takes into account multi-hop reasoning via implicit decomposition. However, human performance substantially exceeds the best model, establishing the need for further research involving multiple modalities in question answering systems, which we hope that our work will drive.
184
+
185
+ # 8 ACKNOWLEDGMENTS
186
+
187
+ We thank our colleagues at The Allen Institute of AI, James Ferguson and Amir Globerson. This research was partially supported by The Blavatnik Computer Science Research Fund and The Yandex Initiative for Machine Learning, and the European Union’s Seventh Framework Programme (FP7) under grant agreement no. 802800-DELPHI. Special thanks to Carrot Search which allowed use to use their FoamTree visualization.
188
+
189
+ # REFERENCES
190
+
191
+ Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C. Lawrence Zitnick, and Devi Parikh. VQA: Visual Question Answering. In International Conference on Computer Vision (ICCV), 2015.
192
+
193
+ Akari Asai, Kazuma Hashimoto, Hannaneh Hajishirzi, Richard Socher, and Caiming Xiong. Learning to retrieve reasoning paths over wikipedia graph for question answering. ArXiv, abs/1911.10470, 2020.
194
+
195
+ Wenhu Chen, Hongmin Wang, Jianshu Chen, Yunkai Zhang, Hong Wang, Shiyang Li, Xiyou Zhou, and William Yang Wang. Tabfact: A large-scale dataset for table-based fact verification. arXiv preprint arXiv:1909.02164, 2019.
196
+
197
+ Wenhu Chen, Ming-Wei Chang, Eva Schlinger, William Wang, and William W Cohen. Open question answering over tables and text. arXiv preprint arXiv:2010.10439, 2020a.
198
+
199
+ Wenhu Chen, Hanwen Zha, Zhiyu Chen, Wenhan Xiong, Hong Wang, and William Wang. Hybridqa: A dataset of multi-hop question answering over tabular and textual data, 2020b.
200
+
201
+ Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Learning universal image-text representations. In Proceedings of the 2020 European Conference on Computer Vision, 2020c. URL https://www.ecva.net/papers/ eccv_2020/papers_ECCV/papers/123750103.pdf.
202
+
203
+ Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. Boolq: Exploring the surprising difficulty of natural yes/no questions. arXiv preprint arXiv:1905.10044, 2019.
204
+
205
+ J. Devlin, M. Chang, K. Lee, and K. Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In North American Association for Computational Linguistics (NAACL), 2019.
206
+
207
+ D. Dua, Y. Wang, P. Dasigi, G. Stanovsky, S. Singh, and M. Gardner. Drop: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In North American Association for Computational Linguistics (NAACL), 2019.
208
+
209
+ Mor Geva, Yoav Goldberg, and Jonathan Berant. Are we modeling the task or the annotator? an investigation of annotator bias in natural language understanding datasets. arXiv preprint arXiv:1908.07898, 2019.
210
+
211
+ Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the V in VQA matter: Elevating the role of image understanding in Visual Question Answering. In Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
212
+
213
+ Darryl Hannan, Akshay Jain, and Mohit Bansal. Manymodalqa: Modality disambiguation and qa over diverse inputs, 2020.
214
+
215
+ Jonathan Herzig, P. Nowak, Thomas Müller, Francesco Piccinno, and Julian Martin Eisenschlos. Tapas: Weakly supervised table parsing via pre-training. In ACL, 2020.
216
+
217
+ Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6700–6709, 2019.
218
+
219
+ J. Johnson, B. Hariharan, L. van der Maaten, L. Fei-Fei, C. L. Zitnick, and R. Girshick. Clevr: A diagnostic dataset for compositional language and elementary visual reasoning. In Computer Vision and Pattern Recognition (CVPR), 2017.
220
+
221
+ Vladimir Karpukhin, Barlas Oguz, Sewon Min, Ledell Wu, Sergey Edunov, Danqi Chen, and ˘ Wen-tau Yih. Dense passage retrieval for open-domain question answering. arXiv preprint arXiv:2004.04906, 2020.
222
+
223
+ Divyansh Kaushik and Zachary C Lipton. How much reading does reading comprehension require? a critical investigation of popular benchmarks. In EMNLP, 2018.
224
+
225
+ Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International journal of computer vision, 123(1):32–73, 2017.
226
+
227
+ Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:453–466, 2019.
228
+
229
+ Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension, 2019.
230
+
231
+ Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In European Conference on Computer Vision, pp. 121–137. Springer, 2020.
232
+
233
+ Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
234
+
235
+ Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In Advances in Neural Information Processing Systems, pp. 13–23, 2019.
236
+
237
+ Jiasen Lu, Vedanuj Goswami, Marcus Rohrbach, Devi Parikh, and Stefan Lee. 12-in-1: Multi-task vision and language representation learning. In The IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
238
+
239
+ Nitesh Methani, Pritha Ganguly, Mitesh M Khapra, and Pratyush Kumar. Plotqa: Reasoning over scientific plots. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 1527–1536, 2020.
240
+
241
+ Sewon Min, Eric Wallace, Sameer Singh, Matt Gardner, Hannaneh Hajishirzi, and Luke Zettlemoyer. Compositional questions do not necessitate multi-hop reasoning. In ACL, 2019a.
242
+
243
+ Sewon Min, Eric Wallace, Sameer Singh, Matt Gardner, Hannaneh Hajishirzi, and Luke Zettlemoyer. Compositional questions do not necessitate multi-hop reasoning. arXiv preprint arXiv:1906.02900, 2019b.
244
+
245
+ P. Pasupat and P. Liang. Compositional semantic parsing on semi-structured tables. In Association for Computational Linguistics (ACL), 2015.
246
+
247
+ P. Rajpurkar. SQuAD. https://rajpurkar.github.io/SQuAD-explorer/, 2016.
248
+
249
+ 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.
250
+
251
+ Amanpreet Singh, Vivek Natarajan, Meet Shah, Yu Jiang, Xinlei Chen, Dhruv Batra, Devi Parikh, and Marcus Rohrbach. Towards vqa models that can read. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8317–8326, 2019.
252
+
253
+ Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pre-training of generic visual-linguistic representations. In Proceedings of the 2020 International Conference on Learning Representations, 2020. URL https://arxiv.org/abs/1908.08530.
254
+
255
+ A. Talmor and J. Berant. The web as knowledge-base for answering complex questions. In North American Association for Computational Linguistics (NAACL), 2018.
256
+
257
+ Hao Tan and Mohit Bansal. LXMERT: Learning cross-modality encoder representations from transformers. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLPIJCNLP), pp. 5100–5111, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1514. URL https://www.aclweb.org/anthology/ D19-1514.
258
+
259
+ J. Welbl, P. Stenetorp, and S. Riedel. Constructing datasets for multi-hop reading comprehension across documents. arXiv preprint arXiv:1710.06481, 2017.
260
+
261
+ Z. Yang, P. Qi, S. Zhang, Y. Bengio, W. W. Cohen, R. Salakhutdinov, and C. D. Manning. HotpotQA: A dataset for diverse, explainable multi-hop question answering. In Empirical Methods in Natural Language Processing (EMNLP), 2018.
262
+
263
+ Rowan Zellers, Yonatan Bisk, Ali Farhadi, and Yejin Choi. From recognition to cognition: Visual commonsense reasoning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6720–6731, 2019.
264
+
265
+ Peng Zhang, Yash Goyal, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Yin and Yang: Balancing and answering binary visual questions. In Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
266
+
267
+ # A APPENDIX
268
+
269
+ Please see separate file for supplementary material.
md/train/n-219jrTht/n-219jrTht.md ADDED
@@ -0,0 +1,472 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # On the Explanatory Power of Decision Trees
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Decision trees have long been recognized as models of choice in sensitive applica
11
+ 2 tions where interpretability is of paramount importance. In this paper, we examine
12
+ 3 the computational ability of Boolean decision trees in deriving, minimizing, and
13
+ 4 counting sufficient reasons and contrastive explanations. We prove that the set
14
+ 5 of all sufficient reasons of minimal size for an instance given a decision tree can
15
+ 6 be exponentially larger than the size of the input (the instance and the decision
16
+ 7 tree). Therefore, generating the full set of sufficient reasons can be out of reach. In
17
+ 8 addition, computing a single sufficient reason does not prove enough in general;
18
+ 9 indeed, two sufficient reasons for the same instance may differ on many features.
19
+ 10 To deal with this issue and generate synthetic views of the set of all sufficient
20
+ 11 reasons, we introduce the notions of relevant features and of necessary features that
21
+ 12 characterize the (possibly negated) features appearing in at least one or in every
22
+ 13 sufficient reason, and we show that they can be computed in polynomial time. We
23
+ 14 also introduce the notion of explanatory importance, that indicates how frequent
24
+ 15 each (possibly negated) feature is in the set of all sufficient reasons. We show how
25
+ 16 the explanatory importance of a feature and the number of sufficient reasons can be
26
+ 17 obtained via a model counting operation, which turns out to be practical in many
27
+ 18 cases. We also explain how to enumerate sufficient reasons of minimal size. We
28
+ 19 finally show that, unlike sufficient reasons, the set of all contrastive explanations
29
+ 20 for an instance given a decision tree can be derived, minimized and counted in
30
+ 21 polynomial time.
31
+
32
+ # 22 1 Introduction
33
+
34
+ 23 In essence, explaining a decision to a person is to give the details or reasons that help a person
35
+ 24 (the explainee) understand why the decision has been made. This is a significant issue especially
36
+ 25 when decisions are made by Machine Learning (ML) models, such as random forests, Markov
37
+ 26 networks, support vector machines, and deep neural networks. Actually, with the growing number
38
+ 27 of applications that rely on ML techniques, researches on eXplainable AI (XAI) have become
39
+ 28 increasingly important, by providing efficient methods for interpreting ML models, and explaining
40
+ 29 their decisions (see for instance [10, 11, 12, 13, 16, 19, 22, 23, 24, 28, 30]).
41
+ 30 When dealing with Boolean classifiers, which is what we do in this paper, two decisions are possible,
42
+ 31 only: 1 for the instances classified as positive instances, and 0 for the remaining ones (the negative
43
+ 32 instances). Whatever the way $_ { \textbf { \em x } }$ has been classified, an explainee may seek for explanations from
44
+ 33 two distinct types [23]. On the one hand, abductive explanations for $_ { \textbf { \em x } }$ are intended to explain why $_ { \textbf { \em x } }$
45
+ 34 has been classified in the way it has been classified by the ML model (thus, addressing the “Why?”
46
+ 35 question). On the other hand, the purpose of contrastive (also known as counterfactual) explanations
47
+ 36 for $_ { \textbf { \em x } }$ is to explain why $_ { \textbf { \em x } }$ has not been classified by the ML model as the explainee expected it (thus,
48
+ 37 addressing the “Why not?” question). In both cases, explanations that are as simple as possible are
49
+ 38 preferred (where simplicity is modeled as irredundancy, or even as size minimality).
50
+ 39 Although there is no formal notion of interpretability [21], for classification problems, decision trees
51
+ 40 [3, 26] are arguably among the most interpretable ML models. Because of their interpretability,
52
+ 41 decision trees are often considered as target models for distilling a black-box model into a compre
53
+ 42 hensible one [4, 10]. Furthermore, decision trees are often the components of choice for building
54
+ 43 (less interpretable, but potentially more accurate) ensemble classifiers, such as random forests [2] and
55
+ 44 gradient boosted decision trees [5].
56
+ 45 The interpretability of decision trees is endowed with two key characteristics. On the one hand,
57
+ 46 decision trees are transparent: each node in a decision tree has some meaning, and the principles used
58
+ 47 for generating all nodes can be explained. On the other hand, decision trees are locally explainable:
59
+ 48 by construction of a decision tree $T$ , any input instance $_ { \textbf { \em x } }$ is mapped to a unique root-to-leaf path
60
+ 49 that yields to a decision label. The subset of (positive and negative) features $t _ { x } ^ { T }$ occurring in the
61
+ 50 path used to find the right label 1 or 0 for $_ { \textbf { \em x } }$ in the decision tree $T$ can be viewed as a “direct reason”
62
+ 51 for classifying $_ { \textbf { \em x } }$ as a positive instance or as a negative instance. $t _ { x } ^ { T }$ is an abductive explanation for
63
+ 52 $_ { \textbf { \em x } }$ given $T$ , which explains why $_ { \textbf { \em x } }$ has been classified by $T$ as it has been classified. Indeed, every
64
+ 53 instance $\mathbf { x } ^ { \prime }$ that coincides with $_ { \textbf { \em x } }$ on $t _ { x } ^ { T }$ is classified by $T$ in the same way as $_ { \textbf { \em x } }$ . However, such
65
+ 54 “direct reasons” can contain arbitrarily many redundant features [17]. This motivates to take account
66
+ 55 for other types of abductive explanations in the case of decision trees, namely, sufficient reasons [7]
67
+ 56 (also known as prime implicant explanations [29]), that are irredundant abductive explanations, and
68
+ 57 minimal sufficient reasons (i.e., those sufficient reasons of minimal size).
69
+ 58 In this paper, we examine the computational ability of Boolean decision trees in deriving, minimizing
70
+ 59 and counting sufficient reasons and contrastive explanations. We prove that the set of all sufficient
71
+ 60 reasons of minimal size for an instance given a decision tree can be exponentially larger than the size
72
+ 61 of the input. When this is the case, generating the full set of sufficient reasons (i.e., the complete
73
+ 62 reason for the instance [7]) is typically out of reach. In addition, computing a single sufficient reason
74
+ 63 does not prove enough in general; indeed; two sufficient reasons for the same instance may differ on
75
+ 64 many features. To deal with this issue and generate synthetic views of the set of all sufficient reasons,
76
+ 65 we introduce the notions of relevant features and of necessary features that characterize the (possibly
77
+ 66 negated) features appearing in at least one or in every sufficient reason, and we show that they can be
78
+ 67 computed in polynomial time. We also introduce the notion of explanatory importance, that indicates
79
+ 68 how frequent each (possibly negated) feature is in the set of all sufficient reasons. Though deriving
80
+ 69 the explanatory importance of a feature in the set of sufficient reasons and determining the cardinality
81
+ 70 of this set are two computationally demanding tasks, we show how they can be achieved thanks to
82
+ 71 model counting operation, which turns out to be practical in many cases. We also explain how to
83
+ 72 enumerate sufficient reasons of minimal size, which is a way to count them when they are not too
84
+ 73 numerous. We finally show that, from a computational standpoint, contrastive explanations highly
85
+ 74 depart from sufficient reasons. Indeed, the set of all contrastive explanations for an instance given a
86
+ 75 decision tree can be computed in polynomial time. As a consequence, such explanations can also be
87
+ 76 minimized and counted in polynomial time.
88
+ 77 The rest of the paper is organized as follows. Preliminaries about decision trees, abductive reasons,
89
+ 78 and contrastive explanations are given in Section 2. The computation of all sufficient reasons is
90
+ 79 considered in Section 3. Necessary and relevant features are presented in this section, as well as
91
+ 80 the approach for assessing the explanatory importance of a feature and for counting the number of
92
+ 81 sufficient reasons. We also explain there how minimal sufficient reasons can be enumerated. An
93
+ 82 algorithm for computing all the contrastive explanations for the instance given the decision tree is
94
+ 83 presented in Section 4. Experimental results are reported in Section 5. Finally, Section 6 concludes
95
+ 84 the paper. All the proofs and additional empirical results are reported as a supplementary material.
96
+
97
+ # 85 2 Decision Trees, Abductive and Contrastive Explanations
98
+
99
+ 86 For an integer $n$ , let $[ n ]$ be the set $\{ 1 , \cdots , n \}$ . By ${ \mathcal { F } } _ { n }$ we denote the class of all Boolean functions
100
+ 87 from $\{ 0 , 1 \bar \} ^ { n }$ to $\{ 0 , 1 \}$ , and we use $X _ { n } = \{ x _ { 1 } , \cdot \cdot \cdot , x _ { n } \}$ to denote the set of input Boolean variables,
101
+ 88 corresponding to the features under consideration. Any assignment $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ is called an instance.
102
+ 89 If $f ( { \pmb x } ) = 1$ for some $f \in \mathcal { F } _ { n }$ , then $_ { \textbf { \em x } }$ is called a model of $f$ . $_ { \textbf { \em x } }$ is a positive instance when $f ( { \pmb x } ) = 1$
103
+ 90 and a negative instance when $f ( { \pmb x } ) = 0$ .
104
+ 91 We refer to $f$ as a propositional formula when it is described using the Boolean connectives $\wedge$
105
+ 92 (conjunction), $\vee$ (disjunction) and $\neg$ (negation), together with the Boolean constants 1 (true) and 0
106
+ 93 (false). As usual, a literal $\ell$ is a variable $x _ { i }$ (a positive literal) or its negation $\neg x _ { i }$ , also denoted $\overline { { x } } _ { i }$ (a
107
+ 94 negative literal). A positive literal $x _ { i }$ is associated with a positive feature (i.e., $x _ { i }$ is set to 1), while a
108
+ 95 negative literal $\overline { { x } } _ { i }$ is associated with a negative feature (i.e., $x _ { i }$ is set to 0). A term (or monomial) $t$ is
109
+ 96 a conjunction of literals, and a clause $c$ is a disjunction of literals. A DNF formula is a disjunction
110
+ 97 of terms and a CNF formula is a conjunction of clauses. The set of variables occurring in a formula
111
+ 98 $f$ is denoted $V a r ( f )$ . A formula $f$ is consistent if and only if it has a model. A CNF formula is
112
+ 99 monotone whenever every occurrence of a literal in the formula has the same polarity (i.e., if a literal
113
+ 100 occurs positively (resp. negatively) in the formula, then it does not have any negative (resp. positive)
114
+ 101 occurrence in the formula). A formula $f _ { 1 }$ implies a formula $f _ { 2 }$ , noted $f _ { 1 } \models f _ { 2 }$ , if and only if every
115
+ 102 model of $f _ { 1 }$ is a model of $f _ { 2 }$ . Two formulae $f _ { 1 }$ and $f _ { 2 }$ are equivalent, noted $f _ { 1 } \equiv f _ { 2 }$ whenever they
116
+ 103 have the same models. The conditioning of a formula $f$ by a literal $\ell$ , denoted $f \mid \ell$ , is the formula
117
+ 104 obtained from $f$ by replacing each occurrence of $x _ { i }$ with 1 (resp. 0) and each occurrence of $\overline { { x } } _ { i }$ with 0
118
+ 105 (resp. 1) if $\ell = x _ { i }$ (resp. $\ell = \overline { { x } } _ { i }$ ).
119
+ 106 In what follows, we shall often treat assignments as terms, and terms and clauses as sets of literals.
120
+ 107 Given an assignment $z \in \{ 0 , 1 \} ^ { n }$ , the corresponding term is defined as
121
+
122
+ ![](images/06b4efff3f201077dfe01cba37433417efc5861eb79b21fc130ae6485bebde8d.jpg)
123
+ Figure 1: A decision tree $T$ for recognizing Cattleya orchids. The left (resp. right) child of any decision node labelled by $x _ { i }$ corresponds to the assignment of $x _ { i }$ to 0 (resp. 1).
124
+
125
+ $$
126
+ t _ { z } = \bigwedge _ { i = 1 } ^ { n } x _ { i } ^ { z _ { i } } { \mathrm { ~ w h e r e ~ } } x _ { i } ^ { 0 } = { \overline { { x } } } _ { i } { \mathrm { ~ a n d ~ } } x _ { i } ^ { 1 } = x _ { i }
127
+ $$
128
+
129
+ 108 A term $t$ covers an assignment $_ z$ if $t \subseteq t _ { z }$ . An implicant of a Boolean function $f$ is a term that implies
130
+ 109 $f$ . A prime implicant of $f$ is an implicant $t$ of $f$ such that no proper subset of $t$ is an implicant of $f$ .
131
+ 110 Dually, an implicate of a Boolean function $f$ is a clause that is implied by $f$ , and a prime implicate of
132
+ 111 $f$ is an implicate $c$ of $f$ such that no proper subset of $c$ is an implicate of $f$ .
133
+ 112 With these basic notions in hand, we shall focus on the following representation class of Boolean
134
+ 113 functions:
135
+ 114 Definition 1 (Decision Tree). A (Boolean) decision tree is a binary tree $T$ , each of whose internal
136
+ 115 nodes is labeled with one of $n$ input Boolean variables, and whose leaves are labeled 0 or 1. Every
137
+ 116 variable is assumed (without loss of generality) to appear at most once on any root-to-leaf path
138
+ 117 (read-once property). The value $T ( \pmb { x } ) \in \{ 0 , 1 \}$ of $T$ on an input instance $_ { \textbf { \em x } }$ is given by the label of
139
+ 118 the leaf reached from the root as follows: at each node, go to the left or right child depending on
140
+ 119 whether the input value of the corresponding variable is 0 or 1, respectively. The size of $T$ , denoted
141
+ 120 $| T |$ , is given by the number of its nodes.
142
+ 121 The class of decision trees over $X _ { n }$ is denoted $\mathbb { D } \mathbb { T } _ { n }$ . It is well-known that any decision tree $T \in \mathsf { D T } _ { n }$
143
+ 122 can be transformed in linear time into an equivalent disjunction of terms, denoted $\tt D N F ( T )$ , where
144
+ 123 each term corresponds to a path from the root to a leaf labeled with 1. Dually, $T$ can be transformed
145
+ 124 in linear time into a conjunction of clauses, denoted $\mathrm { C N F } ( T )$ , where each clause is the negation of the
146
+ 125 term describing a path from the root to a leaf labeled with 0.
147
+
148
+ 126 For illustration, the following toy example will be used throughout the paper as a running example:
149
+
150
+ 127 Example 1. The decision tree in Figure 1 separates Cattleya orchids from other orchids using the
151
+ 128 following features: $x _ { 1 }$ : “has fragrant flowers”, $x _ { 2 }$ : “has one or two leaves”, $x _ { 3 }$ : “has large flowers”,
152
+ 129 and $x _ { 4 }$ : “is sympodial”.
153
+ 30 As a salient characteristic, decision trees convey a single explicit abductive explanation for classifying
154
+ 31 any input instance:
155
+
156
+ Definition 2 (Direct Reason). Let 32 $T \in \mathsf { D T } _ { n }$ and $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ . The direct reason for $_ { \textbf { \em x } }$ given $T$ is the term, denoted 33 $t _ { x } ^ { T }$ , corresponding to the unique root-to-leaf path of $T$ that is compatible with $_ { \textbf { \em x } }$ .
157
+
158
+ 34 Another important notion of abductive explanations is the following concept of sufficient reason[7],
159
+ 35 that, unlike the notion of direct reason, is not specific to decision trees:
160
+
161
+ Definition 3 (Sufficient Reason). Let 136 $f \in \mathcal { F } _ { n }$ and $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ such that $f ( { \pmb x } ) = 1$ (resp. $f ( { \pmb x } ) = 0 ,$ ).
162
+ 137 A sufficient reason for $_ { \textbf { \em x } }$ given $f$ is a prime implicant $t$ of $f$ (resp. $\neg f$ ) that covers $_ { \textbf { \em x } }$ . $s r ( { \pmb x } , f )$
163
+ 138 denotes the set of sufficient reasons for $_ { \textbf { \em x } }$ given $f$ .
164
+
165
+ 139 Thus, a sufficient reason [7] (also known as prime implicant explanation [29]) for an instance $_ { \textbf { \em x } }$ given
166
+ 140 a class described by a Boolean function $f$ is a subset $t$ of the characteristics of $_ { \textbf { \em x } }$ that is minimal w.r.t.
167
+ 141 set inclusion such that any instance $\mathbf { x } ^ { \prime }$ sharing this set $t$ of characteristics is classified by $f$ as $_ { \textbf { \em x } }$ is.
168
+ 142 Thus, when $f ( { \pmb x } ) = 1$ , $t$ is a sufficient reason for $_ { \textbf { \em x } }$ given $f$ if and only if $t$ is a prime implicant of $f$
169
+ 143 such that $_ { \textbf { \em x } }$ implies $t$ , and when $f ( { \pmb x } ) = 0$ , $t$ is a sufficient reason for $_ { \textbf { \em x } }$ given $f$ if and only if $t$ is a
170
+ 144 prime implicant of $\neg f$ such that $t$ covers $_ { \textbf { \em x } }$ . Accordingly, sufficient reasons are suited to explain why
171
+ 145 the instance at hand $_ { \textbf { \em x } }$ has been classified by $f$ as it has been classified. Unlike direct reasons [17],
172
+ 146 sufficient reasons do not contain any redundant feature.
173
+ 47 When considering the sufficient reasons of the input instance, one may be interested in focusing on
174
+ 48 the shortest ones, alias the minimal sufficient reasons. Those reasons are valuable since conciseness
175
+ 49 is often a desirable property of explanations (Occam’s razor). Formally:
176
+
177
+ Definition 4 (Minimal Sufficient Reason). Let 50 $f \in \mathcal { F } _ { n }$ and $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ . A minimal sufficient reason 51 for $_ { \textbf { \em x } }$ given $f$ is a sufficient reason for $_ { \textbf { \em x } }$ given $f$ that contains a minimal number of literals.
178
+
179
+ 152 Finally, unlike direct and (possibly minimal) sufficient reasons that aim to explain the classification
180
+ 153 of the instance $_ { \textbf { \em x } }$ under consideration as achieved by the classifier $f$ , contrastive explanations are
181
+ 154 valuable when $_ { \textbf { \em x } }$ has not been classified by $f$ as expected by the explainee. In this case, one looks for
182
+ 155 minimal subsets of the features that when switched in $_ { \textbf { \em x } }$ are enough to get instances that are classified
183
+ 156 positively (resp. negatively) by $f$ if $_ { \textbf { \em x } }$ is classified negatively (resp. positively) by $f$ . Formally, a
184
+ 157 contrastive explanation for $_ { \textbf { \em x } }$ given $f$ [15] is a subset $t$ of the characteristics of $_ { \textbf { \em x } }$ that is minimal
185
+ 158 w.r.t. set inclusion among those such that at least one instance $\mathbf { x } ^ { \prime }$ that coincides with $_ { \textbf { \em x } }$ except on the
186
+ 159 characteristics from $t$ is not classified by $f$ as $_ { \textbf { \em x } }$ is.
187
+
188
+ Definition 5 (Contrastive Explanation). Let $f \in \mathcal { F } _ { n }$ and $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ such that $f ( { \pmb x } ) = 1$ (resp. $f ( { \pmb x } ) = 0 ,$ ). A contrastive explanation for $_ { \textbf { \em x } }$ given $f$ is a term t over $X _ { n }$ such that $t \subseteq t _ { x }$ , $t _ { x } \wedge t$ is not an implicant of $f$ (resp. $\neg f )$ ), and for every $\ell \in t$ , $t \setminus \{ \ell \}$ does not satisfy this last condition.
189
+
190
+ 163 Example 2. Based on our running example, we can observe that $T ( \pmb { x } ) = 1$ for the instance
191
+ 164 $\pmb { x } = ( 1 , 1 , 1 , 1 )$ . The direct reason for $_ { \textbf { \em x } }$ given $T$ is the term $t _ { x } ^ { T } = x _ { 1 } \wedge x _ { 2 } \wedge x _ { 3 } \wedge x _ { 4 }$ . $x _ { 1 } \wedge x _ { 4 }$ and
192
+ 165 $x _ { 2 } \wedge x _ { 3 } \wedge x _ { 4 }$ are the sufficient reasons for $_ { \textbf { \em x } }$ given $T$ . $x _ { 1 } \wedge x _ { 4 }$ is the unique minimal sufficient reason
193
+ 166 for $_ { \textbf { \em x } }$ given $T$ . $x _ { 4 }$ , $x _ { 1 } \wedge x _ { 2 }$ , and $x _ { 1 } \wedge x _ { 3 }$ are the contrastive explanations for $_ { \textbf { \em x } }$ given $T$ . Thus, the
194
+ 167 instance $( 1 , 1 , 1 , 0 )$ that differs with $_ { \textbf { \em x } }$ only on $x _ { 4 }$ is not classified by $T$ as $_ { \textbf { \em x } }$ is $( ( 1 , 1 , 1 , 0 )$ is classified
195
+ 168 as a negative instance).
196
+ 169 We mention in passing that when dealing with decision trees $T$ , we could have focused only on
197
+ 170 explanations for the positive instances $_ { \textbf { \em x } }$ given $T$ . This comes from the fact that $\mathbb { D } \mathbb { T } _ { n }$ is closed under
198
+ 171 negation, in the sense that for any $T \in \mathsf { D T } _ { n }$ , $\neg T$ can be obtained by just replacing from $T$ the label
199
+ 172 of each leaf with its complement. So, for any instance $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ , a direct reason (resp. sufficient
200
+ 173 reason, minimal sufficient reason, contrastive explanation) explaining why $T ( { \pmb x } ) = 0$ is precisely the
201
+ 174 same as a direct reason (resp. sufficient reason, minimal sufficient reason, contrastive explanation)
202
+ 175 explaining why $( \neg T ) ( { \pmb x } ) = { \bar { 1 } }$ . Considering $T$ or its negation $\neg T$ has no computational impact since
203
+ 176 $\neg T$ can be computed in time linear in the size of $T$ .
204
+
205
+ # 177 3 Computing All Sufficient Reasons
206
+
207
+ 178 Sufficient reasons can be exponentially numerous. When switching from the direct reason for
208
+ 179 an instance (that is unique but not always redundancy-free) to its sufficient reasons, a main obstacle
209
+ 180 to be dealt with lies in the number of reasons to be considered. Indeed, even for the restricted class
210
+ 181 of decision trees with logarithmic depth, an input instance can have exponentially many sufficient
211
+ 182 reasons:
212
+
213
+ ![](images/db2a5437074379661004bed2173191f91491967548948fa2cda660b68aa58dc2.jpg)
214
+ Figure 2: Two sufficient reasons for an mnist instance (top), and an explanatory heat map and the explanatory features for an mnist instance (bottom).
215
+
216
+ Proposition 1. There is a decision tree 183 $T \in \mathsf { D T } _ { n }$ of depth $\log _ { 2 } ( n + 1 )$ such that for any $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ , the number of sufficient reasons for 184 $_ { \textbf { \em x } }$ given $T$ is at least $\lfloor { \frac { 3 } { 2 } } ^ { \frac { n + 1 } { 2 } } \rfloor$ .
217
+
218
+ By definition, the minimal sufficient reasons for $_ { \textbf { \em x } }$ given $T$ cannot be more numerous than its sufficient reasons. However, focusing on minimal sufficient reasons does not solve the problem since an instance can also have exponentially many minimal sufficient reasons:
219
+
220
+ Propositisuch that 2. For econtains $n \in \mathbb N$ such that des and th $n$ is odd, there is e is an instance e s $T \in \mathsf { D T } _ { n }$ of depth the numb $\textstyle { \frac { n + 1 } { 2 } }$ $T$ $2 n + 1$ $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ minimal sufficient reasons for x given T is equal to 2 n−1.
221
+
222
+ 191 In many practical cases, the number of sufficient reasons for an instance given a decision tree can
223
+ 192 be very large. Figure 2 (top) shows an mnist instance (the leftmost subfigure) that has 482 185 073
224
+ 193 664 sufficient reasons. Among them there are very dissimilar sufficient reasons. As an illustration,
225
+ 194 the two rightmost subfigures present two sufficient reasons for this instance, and they differ on many
226
+ 195 features (blue (resp. red) dots correspond to pixels on (resp. off)).
227
+ 196 For such datasets, computing the set of all the sufficient reasons for a given instance is not always
228
+ 197 feasible. Furthermore, if the computation succeeds but the number of sufficient reasons is huge, their
229
+ 198 (disjunctively interpreted) set, alias the complete reason for the instance [7], can hardly be considered
230
+ 199 as intelligible by the explainee. Finally, due to the number of sufficient reasons and their diversity,
231
+ 200 deriving one of them is not informative enough. Thus, one needs to design approaches to synthesizing
232
+ 201 their set while avoiding the two pitfalls (the computational one and the informational one).
233
+
234
+ Synthesizing the set of sufficient reasons. In this objective, the following notions of necessary / (ir)relevant features appear useful. These notions of necessity and relevance echo the ones that have been considered in [9] for logic-based abduction.
235
+
236
+ Definition 6 (Explanatory Features). Let $f \in \mathcal { F } _ { n }$ , and $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ be an instance. Let e be an explanation type.
237
+
238
+ • A literal \` over $X _ { n }$ is a necessary feature for the family e of explanations for $_ { \textbf { \em x } }$ given $f$ if and only if \` belongs to every explanation t for $_ { \textbf { \em x } }$ given $f$ such that $t$ is of type e. $N e c _ { e } ( { \pmb x } , f )$ denotes the set of all necessary features for the family e of explanations for $_ { \textbf { \em x } }$ given $f$ .
239
+
240
+ • A literal $\ell$ over $X _ { n }$ is $a$ relevant feature for the family e of explanations for $_ { \textbf { \em x } }$ given $f$ if and only if \` belongs to at least one explanation $t$ for $_ { \textbf { \em x } }$ given $f$ such that $t$ is of type e. $R e l _ { e } ( { \pmb x } , f )$ denotes the set of all relevant features for the family e of explanations for $_ { \textbf { \em x } }$ given $f$ . $I r r _ { e } ( { \pmb x } , f )$ , which is the complement of $R e l _ { e } ( { \pmb x } , f )$ in the set of all literals over $X _ { n }$ , denotes the set of all irrelevant features for the family e of explanations for $_ { \textbf { \em x } }$ given $f$ .
241
+
242
+ 15 The necessary (resp. irrelevant) features for the family $s$ of sufficient reasons for $_ { \textbf { \em x } }$ given $f$ are the
243
+ 16 most (resp. less) important features for explaining the classification of $_ { \textbf { \em x } }$ by $f$ , since they belong to
244
+ 17 every (resp. no) sufficient reason for $_ { \textbf { \em x } }$ given $f$ .
245
+
246
+ When a single sufficient reason $t$ for $_ { \textbf { \em x } }$ given $f$ has been computed, the cardinality of $t$ deprived from the features of $N e c _ { s } ( { \pmb x } , f )$ is small, and the cardinality of the symmetric difference between $t$ and $R e l _ { s } ( { \pmb x } , f )$ is small as well, $t$ can be viewed as a good representative of the complete reason for $_ { \textbf { \em x } }$ given $f$ in the sense that a sufficient reason $t ^ { \prime }$ for $_ { \textbf { \em x } }$ given $f$ that differs a lot from $t$ cannot exist.
247
+
248
+ In the case when $f$ is a decision tree $T$ , though the set of all sufficient reasons for $_ { \textbf { \em x } }$ given $T$ cannot be generated when it is too large, $N e c _ { s } ( { \pmb x } , f )$ , $R e l _ { s } ( { \pmb x } , f )$ , and $I r r _ { s } ( { \pmb x } , f )$ can be derived efficiently:
249
+
250
+ Proposition 3. Let $T \in \mathsf { D T } _ { n }$ , and $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ . Computing $N e c _ { s } ( { \pmb x } , T )$ , $R e l _ { s } ( { \pmb x } , f )$ , and $I r r _ { s } ( { \pmb x } , T )$ can be done in $\mathcal { O } ( ( n + | T | ) \times | T | )$ time.
251
+
252
+ 226 Going a step further consists in evaluating the explanatory importance of every (positive or negative)
253
+ 227 feature:
254
+
255
+ Definition 7 (Explanatory Importance). Let $f \in { \mathcal { F } } _ { n } ,$ , and $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ be an instance. Let e be an explanation type, and $E _ { e } ( x , f )$ the set of all explanations for $_ { \textbf { \em x } }$ given $f$ that are of type e. The explanatory importance of a literal $\ell$ over $X _ { n }$ for $_ { \textbf { \em x } }$ given $f$ w.r.t. e is given by
256
+
257
+ $$
258
+ I m p _ { e } ( \ell , \pmb { x } , f ) = \frac { \# ( \{ t \in E _ { e } ( \pmb { x } , f ) : \ell \in t \} ) } { \# ( E _ { e } ( \pmb { x } , f ) ) } .
259
+ $$
260
+
261
+ 228 Example 3. On the running example, we have $N e c _ { s } ( { \pmb x } , T ) = \{ x _ { 4 } \}$ , and ${ R e l _ { s } } ( { \pmb x } , T ) = \{ { x } _ { 1 } , { x } _ { 2 } , { x } _ { 3 } .$ ,
262
+ 229 $x _ { 4 } \}$ . We also have $I m p _ { s } ( x _ { 4 } , { \pmb x } , T ) = 1$ $, I m p _ { s } ( x _ { 1 } , { \pmb x } , T ) = I m p _ { s } ( x _ { 2 } , { \pmb x } , T ) = I m p _ { s } ( x _ { 3 } , { \pmb x } , T ) = \frac { 1 } { 2 }$ ,
263
+ 230 and $I m p _ { s } ( \ell , { \pmb x } , T ) = 0$ for every other literal $\ell$ (the negative ones over $\{ x _ { 1 } , x _ { 2 } , x _ { 3 } , x _ { 4 } \} ,$ ).
264
+ 231 The notion of explanatory importance must not be confused with the notions of feature importance
265
+ 232 (which can be defined and assessed in many different ways): the former is local (i.e., relative to an
266
+ 233 instance) and not global, it concerns literals and not variables (polarity matters), and it is about the
267
+ 234 explanation task, not the prediction one.
268
+ 235 In order to compute the explanatory importance of a literal, a straightforward approach consists in
269
+ 236 enumerating the explanations of $E _ { e } ( { \pmb x } , \bar { f } )$ . This is feasible when this set is not too large, which is not
270
+ 237 always the case for sufficient reasons even when $f$ is a decision tree $T$ . Thus, for dealing with the
271
+ 238 remaining case, an alternative approach must be looked for.
272
+ 239 We designed such an approach for computing $I m p _ { s } ( \boldsymbol { \ell } , \pmb { x } , T )$ . We know that $s r ( \pmb { x } , T )$ is by construc
273
+ 240 tion the set of prime implicants of $g = \{ c \cap t _ { \pmb { x } } : c \in \mathbb { C } \mathbb { N } \mathbb { F } ( T ) \}$ . Thus, we exploited the translation
274
+ 241 presented in [18] showing how to associate in polynomial time with a given CNF formula (here,
275
+ 242 $g$ ) another formula (over a distinct set of variables), let us say $h$ , such that the models of $h$ are
276
+ 243 in one-to-one correspondence with the prime implicants of $g$ . In our case, the translation can be
277
+ 244 simplified because $g$ is a monotone CNF formula. Since $h$ is not primarily a CNF formula, leveraging
278
+ 245 Tseitin transformation [31], we turned $h$ in linear time into a query-equivalent CNF formula $i$ . Note
279
+ 246 that every auxiliary variable that is introduced in $i$ is defined from the other variables (those occurring
280
+ 247 in $h$ ), so that the number of models of $i$ is the same as the number of models of $h$ . Finally, we took
281
+ 248 advantage of the compilation-based model counter D4 [20] to compile $i$ into a d-DNNF circuit [6],
282
+ 249 and this enabled us to compute in time polynomial in the size of $i$ both the number of sufficient
283
+ 250 reasons and the explanatory importance of every literal (indeed, the d-DNNF language supports in
284
+ 251 polytime the model counting query and the conditioning transformation [8]). We show in Section
285
+ 252 5 that, despite a high complexity in the worst case (the size of $i$ can be exponential in $| T | )$ , this
286
+ 253 approach based on knowledge compilation proves quite efficient in practice.
287
+
288
+ Clearly enough, when $I m p _ { e } ( \ell , \pmb { x } , T )$ has been computed for every $\ell$ , one can easily generate explanatory heat maps. Figure 2 (bottom) shows an mnist instance (the leftmost subfigure) that has 19 115 685 sufficient reasons, 6 necessary literals, and 94 relevant literals. The central subfigure is the corresponding heat map. Blue (resp. red) pixels correspond to positive (resp. negative) literals in the instance, and the intensity of the color aims to reflect the explanatory importance of the corresponding literal. The rightmost subfigure gives the explanatory features (dark pixels are associated with necessary literals, and light pixels to relevant literals).
289
+
290
+ 261 Enumerating the minimal sufficient reasons. An approach to synthesizing the set of sufficient
291
+ 262 reasons consists in focusing on the minimal ones. Indeed, though the set of minimal sufficient reasons
292
+ 263 for an instance given a decision tree can be exponentially large, the number of minimal sufficient
293
+ 264 reasons cannot exceed the number of sufficient reasons, and it can be significantly lower in practice.
294
+
295
+ However, unlike sufficient reasons that can be generated in polynomial time using a greedy algorithm (see e.g., [17]), computing minimal reasons is not an easy task:
296
+
297
+ Proposition 4. Let $T \in \mathsf { D T } _ { n }$ and $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ . Computing a minimal sufficient reason for $_ { \textbf { \em x } }$ given $T$ is NP-hard.
298
+
299
+ 269 Despite this intractability result, minimal sufficient reasons can be generated in many practical cases.
300
+ 270 A common approach for handling NP-optimization problems is to rely on modern constraint solvers.
301
+ 271 One follows this direction here and casts the task of finding minimal sufficient reasons as a Boolean
302
+ 272 constraint optimization problem. We first need to recall that a PARTIAL MAXSAT problem consists
303
+ 273 of a pair $( C _ { \mathrm { s o f t } } , C _ { \mathrm { h a r d } } )$ where $C _ { \mathrm { s o f t } }$ and $C _ { \mathrm { h a r d } }$ are (finite) set of clauses. The goal is to find a Boolean
304
+ 274 assignment that maximizes the number of clauses $c$ in $C _ { \mathrm { s o f t } }$ that are satisfied, while satisfying all
305
+ 275 clauses in $C _ { \mathrm { h a r d } }$ .
306
+
307
+ Proposition 5. Let $T$ be a decision tree in $\mathbb { D } \mathbb { T } _ { n }$ and $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ be an instance such that $T ( \pmb { x } ) = 1$ . Let $( C _ { \mathrm { s o f t } } , C _ { \mathrm { h a r d } } )$ be an instance of the PARTIAL MAXSAT problem such that:
308
+
309
+ The intersection of 276 $t _ { x }$ with $t _ { x ^ { * } }$ where $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } } ^ { * }$ is an optimal solution of $( C _ { \mathrm { h a r d } } , C _ { \mathrm { s o f t } } )$ , is a minimal 277 sufficient reason for $_ { \textbf { \em x } }$ given $T$ .
310
+
311
+ 78 Clearly enough, if $_ { \textbf { \em x } }$ is such that $T ( { \pmb x } ) = 0$ , then it is enough to consider the same instance of
312
+ 79 PARTIAL MAXSAT as above, except that $C _ { \mathrm { h a r d } } = \{ c \cap t _ { x } : c \in \mathbb { C } \mathbb { N } \mathbb { F } ( \neg T ) \}$ .
313
+ 80 Finally, one can take advantage of this PARTIAL MAXSAT characterization for generating a preset
314
+ number of minimal sufficient reasons (basically, one generates a first reason $t$ , then one adds to $C _ { \mathrm { h a r d } }$
315
+ 2 the negation of $t$ as a clause as well as a CNF encoding of a cardinality constraint for ensuring that the
316
+ 83 next reasons to be generated have the same size as the one of $t$ , and we resume until the bound is
317
+ 84 reached or no solution exists).
318
+
319
+ # 85 4 Computing All Contrastive Explanations
320
+
321
+ Interestingly, it has been shown that sufficient reasons and contrastive explanations are connected by a minimal hitting set duality [15]. This duality can be leveraged to derive one of the two sets of explanations from the other one using algorithms for computing minimal hitting sets [27, 32].
322
+
323
+ However, in the case of decision trees, a more direct and much more efficient approach to derive all the contrastive explanations for $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ given $T \in \mathbb { D T } _ { n }$ can be designed. Indeed, unlike what happens for sufficient reasons (see Section 3), the set of all contrastive explanations for $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ given a decision tree $T \in \mathsf { D T } _ { n }$ can be computed in polynomial time from $_ { \textbf { \em x } }$ and $T$ :
324
+
325
+ Proposition 6. The set of all contrastive explanations for $\pmb { x } \in \{ 0 , 1 \} ^ { n }$ given a decision tree $T \in \mathsf { D T } _ { n }$ can be computed in time polynomial in $n + | T |$ as min( $\{ c \cap t _ { x } : c \in \mathrm { C N F } ( f ) \} , \subseteq )$ .
326
+
327
+ Example 4. On the running example, we have $\mathsf { F } ( T ) = \{ x _ { 1 } \vee x _ { 2 } , x _ { 1 } \vee \overline { { x _ { 2 } } } \vee x _ { 3 } , x _ { 1 } \vee \overline { { x _ { 2 } } } \vee \overline { { x _ { 3 } } } \vee x _ { 4 } ,$ $\overline { { x _ { 1 } } } \vee x _ { 2 } \vee x _ { 3 } \vee x _ { 4 }$ , $\overline { { x _ { 1 } } } \vee x _ { 2 } \vee \overline { { x _ { 3 } } } \vee x _ { 4 }$ , $\overline { { x _ { 1 } } } \vee \overline { { x _ { 2 } } } \vee x _ { 3 } \vee x _ { 4 } , \overline { { x _ { 1 } } } \vee \overline { { x _ { 2 } } } \vee \overline { { x _ { 3 } } } \vee x _ { 4 } \Big \}$ . Thus, with $\pmb { x } = ( 1 , 1 , 1 , 1 )$ , we have mi $n \big ( \{ c \cap t _ { \pmb { x } } : c \in \mathtt { C N F } ( f ) \} , \underline { { \mathsf { C } } } \big ) = \{ x _ { 1 } \vee x _ { 2 } , x _ { 1 } \vee x _ { 3 } , x _ { 4 } \}$ , which corresponds to the contrastive explanations $x _ { 1 } \wedge x _ { 2 }$ , $x _ { 1 } \wedge x _ { 3 }$ , $x _ { 4 }$ for $_ { \textbf { \em x } }$ given $T$ (viewing clauses and terms as sets of literals).
328
+
329
+ As straightforward consequences of Proposition 6, computing necessary $/$ relevant features and computing the explanatory importance of features w.r.t. contrastive explanations can be achieved in time polynomial in $n + | T |$ . Similarly, statistics about the size of contrastive explanations can be easily established, and contrastive explanations can be easily minimized and counted.
330
+
331
+ # 5 Experiments
332
+
333
+ Empirical setting. We have considered 90 datasets, which are standard benchmarks from the wellknown repositories Kaggle (www.kaggle.com), OpenML (www.openml.org), and UCI (archive.
334
+
335
+ Table 1: Empirical results based on 12 datasets.
336
+
337
+ <table><tr><td></td><td colspan="3">Decision Tree</td><td colspan="2">ISufficientl</td><td colspan="2">IMinimall</td><td colspan="2">#Nec.Features</td><td colspan="2">#Rel. Features</td></tr><tr><td>Dataset</td><td>%A</td><td>#N</td><td>#B</td><td>med</td><td>max</td><td>med</td><td>max</td><td>med</td><td>max</td><td>med</td><td>max</td></tr><tr><td>recidivism</td><td>63.41</td><td>13828.80</td><td>147.60</td><td>14</td><td>22</td><td>13</td><td>22</td><td>6</td><td>19</td><td>60</td><td>98</td></tr><tr><td>adult</td><td>81.36</td><td>12934.00</td><td>2974.80</td><td>16</td><td>36</td><td>16</td><td>36</td><td>7</td><td>22</td><td>263</td><td>543</td></tr><tr><td>bank marketing</td><td>87.40</td><td>6656.40</td><td>1432.60</td><td>14</td><td>21</td><td>14</td><td>21</td><td>3</td><td>16</td><td>247</td><td>398</td></tr><tr><td>bank</td><td>88.99</td><td>5523.60</td><td>977.80</td><td>13</td><td>24</td><td>13</td><td>24</td><td>4</td><td>15</td><td>200</td><td>330</td></tr><tr><td>lending loan</td><td>73.49</td><td>2610.40</td><td>1131.40</td><td>16</td><td>31</td><td>16</td><td>31</td><td>8</td><td>25</td><td>226</td><td>442</td></tr><tr><td>contraceptive</td><td>50.44</td><td>1252.20</td><td>88.60</td><td>11</td><td>20</td><td>11</td><td>20</td><td>8</td><td>17</td><td>25</td><td>47</td></tr><tr><td>compas</td><td>65.98</td><td>1230.00</td><td>46.20</td><td>6</td><td>14</td><td>6</td><td>14</td><td>3</td><td>12</td><td>16</td><td>33</td></tr><tr><td>christine</td><td>63.36</td><td>853.20</td><td>426</td><td>12</td><td>47</td><td>12</td><td>47</td><td>8</td><td>41</td><td>92</td><td>202</td></tr><tr><td>farm-ads</td><td>86.75</td><td>544.80</td><td>264.60</td><td>20</td><td>99</td><td>20</td><td>99</td><td>16</td><td>92</td><td>73</td><td>192</td></tr><tr><td>mnist49</td><td>95.47</td><td>539.60</td><td>267.90</td><td>22</td><td>30</td><td>22</td><td>30</td><td>9</td><td>19</td><td>91</td><td>166</td></tr><tr><td>spambase</td><td>91.94</td><td>536.40</td><td>264.80</td><td>15</td><td>29</td><td>15</td><td>29</td><td>9</td><td>24</td><td>68</td><td>146</td></tr><tr><td>mnist38</td><td>96.07</td><td>506.60</td><td>251.40</td><td>19</td><td>28</td><td>19</td><td>28</td><td>8</td><td>20</td><td>93.50</td><td>157</td></tr><tr><td></td><td colspan="4">#Sufficient</td><td colspan="2"></td><td colspan="2">#Contrastive</td><td colspan="2">#Minimal</td></tr><tr><td>Dataset</td><td colspan="2">med</td><td colspan="2">max</td><td></td><td>med</td><td>max</td><td>med</td><td></td><td></td><td>max</td></tr><tr><td>recidivism</td><td colspan="2">10387</td><td colspan="2">9734080</td><td></td><td>54</td><td>145</td><td>3</td><td>16</td><td>2</td><td>144</td></tr><tr><td>adult</td><td colspan="2"></td><td colspan="2">≥ 1573835722607300000000000</td><td></td><td>201</td><td>470</td><td>4</td><td>16</td><td>3</td><td>256</td></tr><tr><td>bank marketing</td><td colspan="2"></td><td colspan="2">≥7460375213484350000000</td><td></td><td>189</td><td>337</td><td>4</td><td>13</td><td>8</td><td>432</td></tr><tr><td>bank</td><td colspan="2"></td><td colspan="2">≥7433951979018500000</td><td></td><td>150</td><td>277</td><td>4</td><td>13</td><td>4</td><td>168</td></tr><tr><td>lending loan</td><td colspan="2">459258918095775</td><td colspan="2">943243242816203000000000000000</td><td></td><td>157</td><td>311</td><td>3</td><td>12</td><td>3</td><td>192</td></tr><tr><td>contraceptive</td><td colspan="2">20.50</td><td colspan="2"></td><td>4272</td><td>21</td><td>52</td><td>2</td><td>11</td><td>2</td><td>48</td></tr><tr><td>compas</td><td colspan="2">16</td><td colspan="2"></td><td>444</td><td>13</td><td>33</td><td>2</td><td>11</td><td>2</td><td>21</td></tr><tr><td>christine</td><td colspan="2">63108</td><td colspan="2">2167735434744</td><td></td><td>71</td><td>151</td><td>3</td><td>8</td><td>2</td><td>4096</td></tr><tr><td>farm-ads</td><td colspan="2">1177,50 7392384</td><td colspan="2">921895392 715892613696000</td><td></td><td>59 61</td><td>166 106</td><td>2 2</td><td>10 12</td><td></td><td></td></tr><tr><td>mnist49 spambase</td><td colspan="2">15712</td><td colspan="2">2535069312</td><td></td><td>50</td><td>107</td><td>2</td><td>11</td><td>4</td><td>10000</td></tr><tr><td>mnist38</td><td colspan="2">14849376</td><td colspan="2">16922386736640</td><td></td><td>62</td><td>107</td><td>3</td><td>11</td><td></td><td>384</td></tr><tr><td></td><td colspan="2"></td><td colspan="2"></td><td></td><td></td><td></td><td></td><td></td><td>32</td><td>3072</td></tr></table>
338
+
339
+ 6 ics.uci.edu/ml/). mnist38 and mnist49 are subsets of the mnist dataset, restricted to the 7 instances of 3 and 8 (resp. 4 and 9) digits. Because some datasets are suited to the multi-label 8 classification task, we used the standard “one versus all” policy to deal with them: all the classes but 09 the target one are considered as the complementary class of the target. Categorical features have been treated as arbitrary numbers (the scale is nominal). As to numeric features, no data preprocessing has taken place: these features have been binarized on-the-fly by the decision tree learning algorithm that 12 has been used.
340
+
341
+ 313 For every benchmark $b$ , a 10-fold cross validation process has been achieved. Namely, a set of 10
342
+ 314 decision trees $T _ { b }$ have been computed and evaluated from the labelled instances of $b$ , partitioned into
343
+ 315 10 parts. One part was used as the test set and the remaining 9 parts as the training set for generating
344
+ 316 a decision tree. This tree is thus in 1-to-1 correspondence with the test set chosen within the whole
345
+ 317 dataset $b$ . The classification performance for $b$ was measured as the mean accuracy obtained over the
346
+ 318 10 decision trees generated from $b$ . The CART algorithm, and more specifically its implementation
347
+ 319 provided by the Scikit-Learn library [25] has been used to learn decision trees. All hyper-parameters
348
+ 320 of the learning algorithm have been set to their default value. Notably, decision trees have been
349
+ 321 learned using the Gini criterion, and without any maximal depth or any other manual limitation.
350
+
351
+ For each benchmark $b$ , each decision tree $T _ { b }$ , and a subset of at most 100 instances $_ { \textbf { \em x } }$ picked up at random in the test set following a uniform distribution, we computed a sufficient reason for $_ { \textbf { \em x } }$ given $T _ { b }$ (using the standard greedy algorithm run on the direct reason $t _ { x } ^ { T _ { b } }$ ), and a minimal sufficient reason for $_ { \textbf { \em x } }$ given $T _ { b }$ using the PARTIAL MAXSAT encoding presented in Proposition 5. This enabled us to draw some statistics (median, maximum) about the sizes of the reasons that have been generated. Using the algorithm presented in the proof of Proposition 3, we also derived the necessary and relevant explanatory features for each $_ { \textbf { \em x } }$ , and again drew some statistics about them. Exploiting the model counter D4, we computed the number of sufficient reasons for $_ { \textbf { \em x } }$ given $T _ { b }$ , as well as the explanatory importance of every feature. Taking advantage of the algorithm given in Proposition 4, we computed the number of contrastive explanations for $_ { \textbf { \em x } }$ given $T _ { b }$ , and drew some statistics about those numbers and about the sizes of the contrastive explanations. Finally, using the approach described in Section 3, we enumerated all the minimal sufficient reasons for $_ { \textbf { \em x } }$ given $T _ { b }$ up to a limit of $1 0 0 0 0$ , and again drew some statistics about the numbers of minimal sufficient reasons. Of course, for each computation, we measured the corresponding runtimes since this is fundamental to determine the extent to which the algorithms are practical (details are provided as a supplementary material).
352
+
353
+ 337 All the experiments have been conducted on a computer equipped with Intel(R) XEON E5-2637 CPU
354
+ 338 $\textcircled { \omega } 3 . 5 \ : \mathrm { G H z }$ and $1 2 8 \mathrm { G i B }$ of memory. D4 [20] was run with its default parameters. For computing
355
+ 339 minimal reasons, we used the Pysat library [14], which provides the implementation of the RC2
356
+ 340 PARTIAL MAXSAT solver. This solver was run using the parameters corresponding to the “Glucose”
357
+ 341 setting. A time-out of 100s per instance was set for D4.
358
+
359
+ Results. Table 1 (top and bottom) reports an excerpt of our results, focusing on 12 benchmarks out of 90 (the selected datasets are among those containing many instances and/or many features). The leftmost column gives the name of the dataset $b$ . Columns $\% { \dot { A } }$ , $\% N$ , and $\# B$ give, respectively, the mean accuracy over the 10 decision trees, the average number of nodes in those trees, and the average number of binary features they are based on. The next columns give statistics (median, maximum) about, respectively, the size of the sufficient reasons (|Sufficient|) and of the minimal sufficient reasons (|Minimal|) that have been computed, as well as about the number of necessary (#Nec. Features) and relevant $( \# \mathsf { R e l }$ . Features) features that appear in the full set of sufficient reasons for the instance. Table 1 (bottom) give statistics (median, maximum) about, respectively, the number of sufficient reasons (#Sufficient), the number of contrastive explanations (#Contrastive) and their sizes (|Contrastive|), and finally the number of minimal sufficient reasons ( $\#$ Minimal).
360
+
361
+ 353 As to the computation times, it turns out that all the algorithms described in the previous sections
362
+ 354 proved as efficient in practice. This is not surprising for those algorithms having a polytime worst-case
363
+ 355 complexity (the greedy algorithm for computing a sufficient reason, the one for deriving explanatory
364
+ 356 features, and the one for computing all the contrastive explanations). It was less obvious at first
365
+ 357 sight for the algorithms used for counting the number of sufficient reasons and for computing the
366
+ 358 explanatory importance of features. However, all the computations that have been run have terminated
367
+ 359 in due time, except for 3 datasets out of 90, namely adult, bank_marketing, and bank. For these
368
+ 360 datasets, the time limit of 100s has been reached for, respectively, 203, 150, and 336 instances out of
369
+ 361 1000 (in this case, the median number of sufficient reasons has not been reported). Notably, for all
370
+ 362 the 90 datasets but those 3, the median time required for counting the number of sufficient reasons
371
+ 363 and computing the explanatory importance of features never exceeded 1s. Computing a minimal
372
+ 364 sufficient reason, and more generally all such reasons looked challenging as well, due to both the
373
+ 365 intrinsic complexity of computing a minimal sufficient reason and to their number. Nevertheless,
374
+ 366 our enumeration algorithm succeeded in deriving all the minimal sufficient reasons for every dataset
375
+ 367 except 3 out of 90, namely farm-ads, mnist49, and gisette. For these datasets, the limit of 10
376
+ 368 000 reasons has been reached for, respectively, 5, 16, and 3 instances out of 1000. Interestingly,
377
+ 369 the median time needed to derive all the minimal sufficient reasons for the instances for which the
378
+ 370 computation has been successful exceeded 1s only for 2 datasets (adult and bank_marketing).
379
+ 371 Beyond providing evidence that the number of reasons can be huge, our experiments have highlighted
380
+ 372 that the greedy algorithm for deriving a sufficient reason computes in practice a minimal sufficient
381
+ 373 reason in many cases. They have also shown that the number of explanatory relevant features for an
382
+ 374 instance is typically much lower than the number of binary features used to describe it, and that the
383
+ 375 number of explanatory necessary features is also significantly lower than the number of explanatory
384
+ 376 relevant features. The gap between the two explains the possibly enormous number of sufficient
385
+ 377 reasons. When considering the full set of reasons, a considerable difference between the number of
386
+ 378 sufficient reasons and the number of minimal sufficient reasons can also be observed. Finally, like
387
+ 379 minimal sufficient reasons, the number of contrastive explanations appears in many cases not very
388
+ 380 large, which is a good point from an intelligibility perspective.
389
+
390
+ # 81 6 Conclusion
391
+
392
+ In light of our results, it turns out that the explanatory power of decision trees goes far beyond its ability to generate direct reasons. From a decision tree, the explanatory importance of features and the minimal sufficient reasons for an instance can be computed efficiently most of the time. For decision trees, fully addressing the “Why not?” question also appears as easier than fully addressing the “Why?” question: computing the full set of sufficient reasons for the instance at hand is typically out of reach, while computing its full set of contrastive explanations is tractable.
393
+
394
+ 388 Accordingly, the language of decision trees appears not only as appealing for the learning purpose,
395
+ 389 but also as a good target when one needs to reason on the various forms of explanations (abductive
396
+ 390 and contrastive ones) associated with the predictions made. This coheres with (and completes) the
397
+ 391 results reported in [1], showing that many other explanation and verification tasks are tractable for
398
+ 392 decision tree classifiers.
399
+
400
+ representations. In Proc. of KR’20, pages 838–849, 2020. [2] L. Breiman. Random forests. Machine Learning, 45(1):5–32, 2001.
401
+ [3] L. Breiman, J. H. Friedman, R. A. Olshen, and C. J. Stone. Classification and Regression Trees. Wadsworth, 1984.
402
+ [4] L. Breiman and N. Shang. Born again trees. Technical report, https://www.stat.berkeley.edu/ breiman/BAtrees.pdf, 1996.
403
+ [5] T. Chen and C. Guestrin. XGBoost: A scalable tree boosting system. In Proc. of KDD’16, page 785–794, 2016.
404
+ [6] A. Darwiche. Decomposable negation normal form. Journal of the Association for Computing Machinery, 48(4):608–647, 2001.
405
+ [7] A. Darwiche and A. Hirth. On the reasons behind decisions. In Proc. of ECAI’20, pages 712–720, 2020.
406
+ [8] A. Darwiche and P. Marquis. A knowledge compilation map. Journal of Artificial Intelligence Research, 17:229–264, 2002.
407
+ [9] Th. Eiter and G. Gottlob. The complexity of logic-based abduction. Journal of the Association for Computing Machinery, 42(1):3–42, 1995.
408
+ [10] N. Frosst and G. E. Hinton. Distilling a neural network into a soft decision tree. In Proc. of the First International Workshop on Comprehensibility and Explanation in AI and ML, volume 2071 of CEUR Workshop Proceedings. CEUR-WS.org, 2017.
409
+ [11] R. Guidotti, A. Monreale, S. Ruggieri, F. Turini, F. Giannotti, and D. Pedreschi. A survey of methods for explaining black box models. ACM Computing Surveys, 51(5):93:1–93:42, 2019.
410
+ [12] S. Hooker, D. Erhan, P-J. Kindermans, and B. Kim. A benchmark for interpretability methods in deep neural networks. In Proc. of NeurIPS’19, pages 9737–9748, 2019.
411
+ [13] J. Huysmans, K. Dejaeger, C. Mues, J. Vanthienen, and B. Baesens. An empirical evaluation of the comprehensibility of decision table, tree and rule based predictive models. Decis. Support Syst., 51(1):141–154, 2011.
412
+ [14] A. Ignatiev, A. Morgado, and J. Marques-Silva. PySAT: A Python toolkit for prototyping with SAT oracles. In Proc. of SAT’18, pages 428–437, 2018.
413
+ [15] A. Ignatiev, N. Narodytska, N. Asher, and J. Marques-Silva. On relating ’why?’ and ’why not?’ explanations. CoRR, abs/2012.11067, 2020.
414
+ [16] A. Ignatiev, N. Narodytska, and J. Marques-Silva. Abduction-based explanations for machine learning models. In Proc. of AAAI’19, pages 1511–1519, 2019.
415
+ [17] Y. Izza, A. Ignatiev, and J. Marques-Silva. On explaining decision trees. CoRR, abs/2010.11034, 2020.
416
+ [18] S. Jabbour, J. Marques-Silva, L. Sais, and Y. Salhi. Enumerating prime implicants of propositional formulae in conjunctive normal form. In Proc. of JELIA’14, pages 152–165, 2014.
417
+ [19] 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 Proc. of ICML’18, pages 2668–2677, 2018.
418
+ [20] J.-M. Lagniez and P. Marquis. An Improved Decision-DNNF Compiler. In Proc. of IJCAI’17, pages 667–673, 2017.
419
+ [21] Z. C. Lipton. The mythos of model interpretability. Communications of the ACM, 61(10):36–43, 2018.
420
+ [22] S. Lundberg and S-I. Lee. A unified approach to interpreting model predictions. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Proc. of NIPS’17, pages 4765–4774, 2017.
421
+ [23] T. Miller. Explanation in artificial intelligence: Insights from the social sciences. Artificial Intelligence, 267:1–38, 2019.
422
+
423
+ 443 [24] Ch. Molnar. Interpretable Machine Learning - A Guide for Making Black Box Models Explain
424
+ 444 able. Leanpub, 2019.
425
+ 445 [25] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel,
426
+ 446 P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher,
427
+ 447 M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine
428
+ 448 Learning Research, 12:2825–2830, 2011.
429
+ 449 [26] J. R. Quinlan. Induction of decision trees. Machine Learning, 1(1):81–106, 1986.
430
+ 450 [27] R. Reiter. A theory of diagnosis from first principles. Artificial Intelligence, 32:57–95, 1987.
431
+ 451 [28] M. Ribeiro, S. Singh, and C. Guestrin. “Why should I trust you?”: Explaining the predictions
432
+ 452 of any classifier. In Proc. of KDD’16, pages 97–101, 2016.
433
+ 453 [29] A. Shih, A. Choi, and A. Darwiche. A symbolic approach to explaining Bayesian network
434
+ 454 classifiers. In Proc. of IJCAI’18, pages 5103–5111, 2018.
435
+ 455 [30] A. Shih, A. Darwiche, and A. Choi. Verifying binarized neural networks by Angluin-style
436
+ 456 learning. In Proc. of SAT’19, pages 354–370, 2019.
437
+ 457 [31] G.S. Tseitin. On the complexity of derivation in propositional calculus, chapter Structures in
438
+ 458 Constructive Mathematics and Mathematical Logic, pages 115–125. Steklov Mathematical
439
+ 459 Institute, 1968.
440
+ 460 [32] F. Wotawa. A variant of Reiter’s hitting-set algorithm. Inf. Process. Lett., 79(1):45–51, 2001.
441
+
442
+ 1. For all authors...
443
+
444
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
445
+ (b) Did you describe the limitations of your work? [Yes]
446
+ (c) Did you discuss any potential negative societal impacts of your work? [No] One cannot expect any negative impact (the paper is about explaining predictions).
447
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
448
+
449
+ 2. If you are including theoretical results...
450
+
451
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] As a supplementary material.
452
+
453
+ 3. If you ran experiments...
454
+
455
+ (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]
456
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
457
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] But the results we obtained have been averaged over a number of trials.
458
+ (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]
459
+
460
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
461
+
462
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
463
+ (b) Did you mention the license of the assets? [Yes]
464
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] The pieces of software we used are furnished as a supplementary material.
465
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] This issue is irrelevant for this paper.
466
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] The datasets we used are anonymized and do not contain personally identifiable information or offensive content.
467
+
468
+ 5. If you used crowdsourcing or conducted research with human subjects...
469
+
470
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [No] We did not use crowdsourcing or conducted research with human subjects.
471
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [No] We did not use crowdsourcing or conducted research with human subjects.
472
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [No] We did not use crowdsourcing or conducted research with human subjects.
md/train/r1DPFCyA-/r1DPFCyA-.md ADDED
@@ -0,0 +1,593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DISCRIMINATIVE K-SHOT LEARNING USINGPROBABILISTIC MODELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ This paper introduces a probabilistic framework for $\mathbf { k }$ -shot image classification. The goal is to generalise from an initial large-scale classification task to a separate task comprising new classes and small numbers of examples. The new approach not only leverages the feature-based representation learned by a neural network from the initial task (representational transfer), but also information about the classes (concept transfer). The concept information is encapsulated in a probabilistic model for the final layer weights of the neural network which acts as a prior for probabilistic $\mathbf { k }$ -shot learning. We show that even a simple probabilistic model achieves state-of-the-art on a standard $\mathbf { k }$ -shot learning dataset by a large margin. Moreover, it is able to accurately model uncertainty, leading to well calibrated classifiers, and is easily extensible and flexible, unlike many recent approaches to $\mathbf { k }$ -shot learning.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ A child encountering images of helicopters for the first time is able to generalize to instances with radically different appearance from only a handful of labelled examples. This remarkable feat is supported in part by a high-level feature-representation of images acquired from past experience. However, it is likely that information about previously learned concepts, such as aeroplanes and vehicles, is also leveraged (e.g. that sets of features like tails and rotors or objects like pilots/drivers are likely to appear in new images). The goal of this paper is to build machine systems for performing $\mathbf { k }$ -shot learning, which leverage both existing feature representations of the inputs and existing class information that have both been honed by learning from large amounts of labelled data.
12
+
13
+ K-shot learning has enjoyed a recent resurgence in the academic community (Lake et al., 2015; Koch et al., 2015; Vinyals et al., 2016; Snell et al., 2017; Srivastava & Salakhutdinov, 2013). Current stateof-the-art methods use complex deep learning architectures and claim that learning good features for $\mathbf { k }$ -shot learning entails training for $k$ -shot specifically via episodic training that simulates many $\mathbf { k }$ -shot tasks. In contrast, this paper proposes a general framework based upon the combination of a deep feature extractor, trained on batch classification, and traditional probabilistic modelling. It subsumes two existing approaches in this vein (Srivastava & Salakhutdinov, 2013; Burgess et al., 2016), and is motivated by similar ideas from multi-task learning (Bakker & Heskes, 2003). The intuition is that deep learning will learn powerful feature representations, whereas probabilistic inference will transfer top-down conceptual information from old classes. Representational learning is driven by the large number of training examples from the original classes making it amenable to standard deep learning. In contrast, the transfer of conceptual information to the new classes relies on a relatively small number of existing classes and $\mathbf { k }$ -shot data points, which means probabilistic inference is appropriate.
14
+
15
+ While generalisation accuracy is often the key objective when training a classifier, calibration is also a fundamental concern in many applications such as decision making for autonomous driving and medicine. Here, calibration refers to the agreement between a classifier’s uncertainty and the frequency of its mistakes, which has recently received increased attention. For example, Guo et al., 2017 show that the calibration of deep architectures deteriorates as depth and complexity increase. Calibration is closely related to catastrophic forgetting in continual learning. However, to our knowledge, uncertainty has so far been over-looked by the $\mathbf { k }$ -shot community even though it is high in this setting.
16
+
17
+ Our basic setup mimics that of the motivating example above: a standard deep convolutional neural network (CNN) is trained on a large labelled training set. This learns a rich representation of images at the top hidden layer of the CNN. Accumulated knowledge about classes is embodied in the top layer softmax weights of the network. This information is extracted by training a probabilistic model on these weights. K-shot learning can then 1) use the representation of images provided by the CNN as input to a new softmax function, 2) learn the new softmax weights by combining prior information about their likely form derived from the original dataset with the k-shot likelihood.
18
+
19
+ # The main contributions of our paper are:
20
+
21
+ 1) We propose a probabilistic framework for k-shot learning. It combines deep convolutional features with a probabilistic model that treats the top-level weights of a neural network as data, which can be used to regularize the weights at k-shot time in a principled Bayesian fashion. We show that the framework recovers $L _ { 2 }$ -regularised logistic regression, with an automatically determined setting of the regularisation parameter, as a special case.
22
+
23
+ 2) We show that our approach achieves state-of-the-art results on the miniImageNet dataset by a wide margin of roughly $6 \%$ for 1- and 5-shot learning. We further show that architectures with better batch classification accuracy also provide features which generalize better at $\mathbf { k }$ -shot time. This finding is contrary to the current belief that episodic training is necessary for good performance and puts the success of recent complex deep learning approaches to $\mathbf { k }$ -shot learning into context.
24
+
25
+ 3) We show on miniImageNet and CIFAR-100 that our framework achieves a good trade-off between classification accuracy and calibration, and it strikes a good balance between learning new classes and forgetting the old ones.
26
+
27
+ # 2 PROBABILISTIC K-SHOT LEARNING
28
+
29
+ K-shot learning task. We consider the following discriminative $\mathbf { k }$ -shot learning task: First, we receive a large dataset $\widetilde { \mathcal { D } } = \{ \widetilde { \mathbf { u } } _ { i } , \widetilde { y } _ { i } \} _ { i = 1 } ^ { \widetilde { N } }$ of images $\widetilde { \mathbf { u } } _ { i }$ and labels $\widetilde { y } _ { i } \in \{ 1 , \ldots , \widetilde { C } \}$ that indicate which of the $\widetilde { C }$ classes each image belongs to. Second, we receive a small dataset $\mathcal { D } = \{ \mathbf { u } _ { i } , y _ { i } \} _ { i = 1 } ^ { N }$ of $C$ new classes, $y _ { i } \in \{ \widetilde { C } + 1 , \widetilde { C } + C \}$ , with $k$ images from each new class. Our goal is to construct a model that can leverage the information in $\widetilde { \mathcal { D } }$ and $\mathcal { D }$ to predict well on unseen images $\mathbf { u } ^ { * }$ from the new classes; the performance is evaluated against ground truth labels $y ^ { * }$ .
30
+
31
+ Summary. In contrast to several recent $\mathbf { k }$ -shot learning approaches that mimic the $\mathbf { k }$ -shot learning task by episodic training on simulated $\mathbf { k }$ -shot tasks, we propose to use the large dataset $\widetilde { \mathcal { D } }$ to train a powerful feature extractor on batch classification, which can then be used in conjunction with a simple probabilistic model to perform k-shot learning. In 2003, Bakker & Heskes introduced a general probabilistic framework for multi-task learning with multi-head models, in which all parameters of a generic feature extractor are shared between a set of tasks, and only the weights of the top linear layer (the “heads”) are task dependent. In the following, we frame k-shot learning in a similar setting and propose a probabilistic framework for $\mathbf { k }$ -shot learning in this vein. Our framework comprises four phases that we refer to as 1) representational learning, 2) concept learning, 3) $k$ -shot learning, and 4) $k$ -shot testing, cf. Fig. 1 (right).
32
+
33
+ We then show that, for certain modelling assumptions, the obtained method is equivalent/related to regularised logistic regression with a specific choice for the regularisation parameter.
34
+
35
+ ![](images/05e7b76b9d4184116c57ca3c381979d553b04840cc4f3fe43ca24a9ff259946b.jpg)
36
+ Figure 1: left: Shared feature extractor $\Phi _ { \varphi }$ and separate top linear layers W and $\widetilde { \mathrm { W } }$ with corresponding softmax units on old and new classes. right: Graphical model for probabilistic $\mathbf { k }$ -shot learning.
37
+
38
+ We provide a high-level description of the probabilistic framework and present a more detailed derivation in Appendix A. While it might appear overly formal, the resulting scheme will be simple and practical, and the probabilistic phrasing will make it extensible and automatic (no free parameters).
39
+
40
+ Feature extractor and representational learning. We first introduce a convolutional neural network (CNN) $\Phi _ { \varphi }$ as feature extractor whose last hidden layer activations are mapped to two sets of softmax output units corresponding to the $\widetilde { C }$ classes in the large dataset $\widetilde { \mathcal { D } }$ and the $C$ classes in the small dataset $\mathcal { D }$ , respectively. These separate mappings are parametrized by weight matrices $\widetilde { \mathrm { W } }$ for the old classes and $\mathrm { W }$ for the new classes. Denoting the output of the final hidden layer as $\mathbf { x } = \Phi _ { \varphi } ( \mathbf { u } )$ , the first softmax units compute $p ( \widetilde { y } _ { n } | \widetilde { \mathbf { x } } _ { n } , \widetilde { \mathbf { W } } ) = \mathrm { s o f f m a x } ( \widetilde { \mathbf { W } } \widetilde { \mathbf { x } } _ { n } )$ and the second $p ( y _ { n } | \mathbf { x } _ { n } , \mathrm { W } ) = \operatorname { s o f t m a x } ( \mathrm { W } \mathbf { x } _ { n } )$ , cf. Fig. 1 (left).
41
+
42
+ For representational learning (phase $^ { l }$ ) the large dataset $\widetilde { \mathcal { D } }$ is used to train the CNN $\Phi _ { \varphi }$ using standard deep learning optimisation approaches. This involves learning the parameters $\varphi$ of the feature extractor up to the last hidden layer, as well as the softmax weights $\widetilde { \mathrm { W } }$ . The network parameters $\varphi$ are fixed from this point on and shared across later phases.
43
+
44
+ Probabilistic modelling. The next goal is to build a probabilistic method for $\mathrm { k }$ -shot prediction that transfers structure from the trained softmax weights $\widetilde { \mathrm { W } }$ to the new $\mathbf { k }$ -shot softmax weights $\mathrm { W }$ and combines it with the $\mathbf { k }$ -shot training examples. Thus, given a test image $\mathbf { u } ^ { * }$ during $k$ -shot testing (phase 4), we compute its feature representation $\mathbf { x } ^ { * } = \Phi ( \mathbf { u } ^ { * } )$ , and the prediction for the new label $y ^ { * }$ is found by averaging the softmax outputs over the posterior distribution of the softmax weights given the two datasets,
45
+
46
+ $$
47
+ p ( y ^ { * } \mid \mathbf { x } ^ { * } , \mathcal { D } , \widetilde { \mathcal { D } } ) = \int p ( y ^ { * } \mid \mathbf { x } ^ { * } , \mathbf { W } ) p ( \mathbf { W } \mid \mathcal { D } , \widetilde { \mathcal { D } } ) \mathrm { d } \mathbf { W } .
48
+ $$
49
+
50
+ To this end, we consider a general class of probabilistic models in which the two sets of softmax weights are generated from shared hyperparameters $\theta$ , so that $p ( \widetilde { \mathrm { W } } , \mathrm { W } , \theta ) = p ( \theta ) p ( \widetilde { \mathrm { W } } | \theta ) p ( \mathrm { W } | \theta )$ as indicated in the graphical model in Fig. 1 (right). In this way, the large dataset $\widetilde { \mathcal { D } }$ contains information about $\theta$ that in turn constrains the new softmax weights W. We further assume that there is very little uncertainty in $\widetilde { \mathrm { W } }$ once the large initial training set is observed and so a maximum a posteriori (MAP) estimate, as returned by standard deep learning, suffices. As a consequence of this approximation and the structure of the model, the original data $\widetilde { \mathcal { D } }$ are not required for the $\mathbf { k }$ -shot learning phase. Instead, the weights learned from these data, ${ \widetilde { \mathrm { W } } } ^ { \mathrm { M A P } }$ , can themselves be treated as observed data, which induce a predictive distribution over the $\mathbf { k }$ -shot weights $p ( \mathrm { W } | \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } )$ via Bayes’ rule. This argument is fully explained in Appendix A. We refer to this step as concept learning (phase 2) and note that all probabilistic modelling happens in the definition of $p ( \widetilde { \mathrm { W } } , \mathrm { W } , \theta )$ , (see Secs. 2.2 and 2.3).
51
+
52
+ During $k$ -shot learning (phase 3) we treat this predictive distribution as our new prior on the weights and again use Bayes’ rule to combine it with the softmax likelihood of the $\mathbf { k }$ -shot training examples $\mathcal { D }$ to obtain a new posterior over the weights that now also incorporates $\mathcal { D }$ ,
53
+
54
+ $$
55
+ p ( \mathbf { W } \mid \mathcal { D } , \widetilde { \mathcal { D } } ) \approx p ( \mathbf { W } \mid \mathcal { D } , \widetilde { \mathbf { W } } ^ { \mathrm { M A P } } ) \propto p ( \mathbf { W } \mid \widetilde { \mathbf { W } } ^ { \mathrm { M A P } } ) \prod _ { n = 1 } ^ { N } p ( y _ { n } | \mathbf { x } _ { n } , \mathbf { W } ) .
56
+ $$
57
+
58
+ Finally, we approximate Eq. (2) by its MAP estimate ${ \mathrm { W } } ^ { \mathrm { M A P } }$ , so that the integral in Eq. (1) becomes
59
+
60
+ $$
61
+ p ( y ^ { * } \mid \mathbf { x } ^ { * } , \mathcal { D } , \widetilde { \mathcal { D } } ) \approx p ( y ^ { * } \mid \mathbf { x } ^ { * } , \mathcal { D } , \widetilde { \mathbf { W } } ^ { \mathrm { M A P } } ) \approx p ( y ^ { * } \mid \mathbf { x } ^ { * } , \mathbf { W } ^ { \mathrm { M A P } } ) .
62
+ $$
63
+
64
+ # 2.2 CHOOSING A MODEL FOR THE WEIGHTS
65
+
66
+ The probabilistic model over the weights is key: a good model will transfer useful knowledge that improves performance. However, the usual trade-off between model complexity and learnability is particularly egregious in our setting as the weights $\widetilde { \mathrm { W } }$ are few and high-dimensional and the number of $\mathbf { k }$ -shot samples is small. With an eye on simplicity, we make two simplifying assumptions. First, treating the weights from the hidden layer to the softmax outputs as a vector, we assume independence.
67
+
68
+ Second, we assume the distribution between the weights of old and new classes to be identical,
69
+
70
+ $$
71
+ p ( \widetilde { \mathbf { W } } , \mathbf { W } , \theta ) = p ( \theta ) \prod _ { c ^ { \prime } = 1 } ^ { \widetilde { C } } p ( \widetilde { \mathbf { w } } _ { c ^ { \prime } } | \theta ) \prod _ { c = 1 } ^ { C } p ( \mathbf { w } _ { c } | \theta ) \mathrm { w h e r e } p ( \widetilde { \mathbf { w } } _ { c ^ { \prime } } | \theta ) \overset { \mathrm { d i s t } } { = } p ( \mathbf { w } _ { c } | \theta ) .
72
+ $$
73
+
74
+ After extensive testing, we found that a Gaussian model for the weights strikes the best compromise in the trade-off between complexity and learnability, cf. Sec. 4.2 for a detailed model comparison.
75
+
76
+ # 2.3 GAUSSIAN MODEL AND ITS RELATION TO LOGISTIC REGRESSION
77
+
78
+ Our method. We use a simple Gaussian model $p ( \mathbf { w } | \boldsymbol { \theta } ) = \mathcal { N } ( \mathbf { w } | \boldsymbol { \mu } , \boldsymbol { \Sigma } )$ with its conjugate Normalinverse-Wishart prior $p ( \theta ) = p ( \mu , \Sigma ) = \mathcal { N } \mathcal { T } \mathcal { W } ( \mu , \Sigma | \mu _ { 0 } , \kappa _ { 0 } , \Lambda _ { 0 } , \nu _ { 0 } )$ , and estimate MAP solutions for the parameters $\theta ^ { \mathrm { M A P } } = \{ \mu ^ { \mathrm { M A P } } , \Sigma ^ { \mathrm { M A P } } \}$ |. The approximations discussed in Sec. 2.1 lead to $p ( \mathrm { W } \mid \tilde { \mathcal { D } } ) \approx p ( \mathrm { W } \mid \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } ) = \mathcal { N } ( \mathrm { W } \mid \mu ^ { \mathrm { M A P } } , \Sigma ^ { \mathrm { M A P } } )$ , and the posterior at $\mathbf { k }$ -shot time becomes
79
+
80
+ $$
81
+ p ( \mathrm { W } | \mathcal { D } , \widetilde { \mathcal { D } } ) \propto \mathcal { N } ( \mathrm { W } | \mu ^ { \mathrm { M A P } } , \Sigma ^ { \mathrm { M A P } } ) \prod _ { n = 1 } ^ { N } p ( y _ { n } | \mathbf { x } _ { n } , \mathrm { W } ) .
82
+ $$
83
+
84
+ For details see Appendix C.1. For $\mathrm { k }$ -shot testing we use the MAP estimates for the weights of the new classes. We found that restricting the covariance matrix to be isotropic, $\Sigma = \sigma ^ { 2 } \mathrm { I }$ , performed best at $\mathbf { k }$ -shot learning, probably due to the small number of data points to learn from as mentioned above.
85
+
86
+ Relation to logistic regression. Standard logistic regression corresponds to the maximum likelihood (MLE) solution of the softmax likelihood $p ( y _ { n } \mid \mathbf { x } _ { n } , \mathrm { W } ) \ = \ \mathrm { s o f t m a x } ( \mathrm { W } \mathbf { x } _ { n } )$ . Often, $L _ { 2 }$ - regularisation on the weights W with inverse regularisation strength $1 / C _ { \mathrm { r e g } }$ is used; the solution to this regularised optimisation problem corresponds to the MAP solution of a model with isotropic Gaussian prior on the weights with zero mean: This method is analogous to Eq. (5). However, $\begin{array} { r } { p ( \mathrm { W } | \mathcal { D } ) \propto \mathcal { N } ( \mathrm { W } | 0 , \frac { 1 } { 2 } C _ { \mathrm { r e g } } \mathrm { I } ) \prod _ { n = 1 } ^ { N } p ( y _ { n } | \mathbf { x } _ { n } , \mathrm { W } ) } \end{array}$ i) modelling assumptions and approximations are made explicit, ii) it is strictly more general and can incorporate non-zero means $\mu ^ { \mathrm { { \dot { M A P } } } }$ , whereas standard regularised logistic regression assumes zero mean, and iii) the probabilistic interpretation provides a principled way of choosing the regularisation constant using the trained weights $\widetilde { \mathrm { W } }$ : $C _ { \mathrm { r e g } } = 2 \sigma _ { \mathrm { W } } ^ { 2 }$ , where $\sigma _ { \widetilde { \mathrm { W } } } ^ { 2 }$ is the empirical variance of the weights ${ \widetilde { \mathrm { W } } } ^ { \mathrm { M A P } }$ . In $\mathbf { k }$ f f-shot learning, alternative (frequentist) methods such as cross-validation suffer in the face of the small number of $\mathbf { k }$ -shot examples, and are not applicable in 1-shot learning at all.
87
+
88
+ # 3 RELATED WORK
89
+
90
+ Embedding methods map the k-shot training and test points into a non-linear space and perform classification by assessing which training points are closest, according to a metric, to the test points. Siamese Networks (Koch et al., 2015) train the embedding using a same/different prediction task derived from the original dataset and use a weighted $L _ { 1 }$ metric for classification. Matching Networks (Vinyals et al., 2016) construct a set of $\mathbf { k }$ -shot learning tasks from the original dataset to train an embedding defined through an attention mechanism that linearly combines training labels weighted by their proximity to test points. More recently, Prototypical Networks (Snell et al., 2017) are a streamlined version of Matching Networks in which embedded classes are summarised by their mean in the embedding space. These embedding methods learn representations for $\mathbf { k }$ -shot learning, but do not directly leverage concept transfer.
91
+
92
+ Amortised optimisation methods (Ravi & Larochelle, 2017) also simulate related k-shot learning tasks from the initial dataset, but instead train a second network to initialise and optimise a CNN to perform accurate classification on these small datasets. This method can then be applied for new k-shot tasks.
93
+
94
+ Importantly, both embedding and amortised inference methods improve when the system is trained for a specific $k$ -shot task: to perform well in 5-shot learning, training is carried out with episodes containing 5 examples in each class. The general statement appears to be that training specifically for $\mathbf { k }$ -shot learning is essential for building features which generalise well at $\mathbf { k }$ -shot testing time. The approach proposed in this paper is more flexible; it is not tailored for a specific $k$ and, thus, does not require retraining when switching, e.g., from 5-shot to 10-shot learning. Moreover, Snell et al. (2017)
95
+
96
+ find that using a larger number of $\mathbf { k }$ -shot classes for the training episodes (e.g., train with $2 0 \mathrm { k }$ -shot classes per episode when testing on only 5 new $\mathbf { k }$ -shot classes) can be beneficial, and they choose this number by cross-validation on a validation-set. This is in alignment with our finding that training with more data and more classes improves performance at $\mathbf { k }$ -shot time.
97
+
98
+ Deep probabilistic methods include the approach developed in this paper. The methods in this family are not unique to deep learning, and the idea of treating weights as data from which to transfer has been widely applied in multi-task learning (Bakker & Heskes, 2003). The work most closely related to our own is not an approach to $\mathbf { k }$ -shot learning per se, but rather a method for training CNNs with highly imbalanced classes (Srivastava & Salakhutdinov, 2013). It is similar in that it trains a form of Gaussian mixture model over the final layer weights using MAP inference that regularises learning. Burgess et al. (2016) propose an elegant approach to $\mathbf { k } .$ -shot learning that is an instance of the framework described here: a Gaussian model is fit to the weights with MAP inference. The evaluation is promising, but preliminary. One of the goals of this paper is to provide a comprehensive evaluation. While not using a probabilistic approach, Qiao et al., 2017 develop a method for $\mathbf { k }$ -shot learning that trains a recognition model to amortise MAP inference for the softmax weights which can then be used at k-shot learning time. While this method trains the mapping from activation to weights jointly with the classifier, and thus does not learn from the weights per se, it does exploit the structure in the weights for k-shot learning.
99
+
100
+ # 4 EXPERIMENTS
101
+
102
+ The code used to produce the following experiments will be made available after review.
103
+
104
+ Dataset. miniImageNet has become a standard testbed for k-shot learning and is derived from the ImageNet ILSVRC12 dataset (Russakovsky et al., 2015) by extracting 100 out of the 1000 classes. Each class contains 600 images downscaled to $8 4 \times 8 4$ pixels. We use the 100 classes (64 train, 16 validation, 20 test) proposed by Ravi & Larochelle (2017). As our approach does not require a validation set, we use both the training and validation data for the representational learning.
105
+
106
+ Representational learning. We employ standard CNNs that are inspired by ResNet-34 (He et al., 2016) and VGG (Simonyan & Zisserman, 2014) for the representational learning on the $\widetilde { C }$ base classes, cf. Phase 1 in Sec. 2.1. These trained networks provide both ${ \widetilde { \mathrm { W } } } ^ { \mathrm { M A P } }$ and the fixed feature representation $\Phi _ { \varphi }$ for the $\mathbf { k }$ -shot learning and testing. We employed standard data augmentation from ImageNet for the representational learning but highlight that no data augmentation was used during the $\mathbf { k }$ -shot training and testing. For details on the architecture, training, and data augmentation see Appendix D.4. t-SNE embeddings (Van der Maaten & Hinton, 2008) of the learned last layer weights show sensible clusters, which highlights the structure exploited by the probabilistic model, see Appendix E.1.
107
+
108
+ Baselines and competing methods. We compare against several baselines as well as recent stateof-the-art methods mentioned in Sec. 3. The baselines are computed on the features $\mathbf { x } = \Phi _ { \phi } ( \mathbf { u } )$ from the last hidden layer of the trained CNN: (i) Nearest Neighbours with cosine distance and (ii) regularized logistic regression with regularisation constant set either by cross-validation or (iii) using the variance of the weights, $C = 2 \sigma _ { W } ^ { 2 }$ , as motivated by our probabilistic framework, cf. Sec. 2.3. We also compare against three recent $\mathbf { k }$ -shot methods: (i) Matching Networks1 (Vinyals et al., 2016), (ii) Prototypical Networks, with numbers reported from Snell et al., 2017 and (iii) Meta-learner LSTM, with numbers reported from Ravi & Larochelle, 2017.
109
+
110
+ Testing protocol. We evaluate the methods on 600 random k-shot tasks by randomly sampling 5 classes from the 20 test classes and perform 5-way $\mathbf { k }$ -shot learning. Following Snell et al. (2017), we use 15 randomly selected images per class for $\mathbf { k }$ -shot testing to compute accuracies and calibration.
111
+
112
+ # 4.1 RESULTS ON miniIMAGENET
113
+
114
+ Overall k-shot performance. We report performance on the miniImageNet dataset in Tab. 1 and Figs. 2 and 3. The best method uses as feature extractor a modified ResNet-34 with 256 features, trained with all 600 examples per training class, and a simple isotropic Gaussian model on the weights for concept learning. Despite its simplicity, our method achieves state-of-the-art and beats prototypical networks by a wide margin of about $6 \%$ . The baseline methods using the same feature extractor are also state-of-the-art compared to prototypical networks and both logistic regressions show comparable accuracy to our methods except for on 1-shot learning. In terms of log-likelihoods, Log Reg $\bar { C } = 2 \sigma _ { \widetilde { W } } ^ { 2 } )$ ) fares slightly better, whereas Log Reg (cv) is much worse.
115
+
116
+ Table 1: Accuracy on 5-way classification on miniImageNet. Our best method, an isotropic Gaussian model using ResNet-34 features consistently outperforms all competing methods by a wide margin.
117
+
118
+ <table><tr><td>Method</td><td>1-shot</td><td>5-shot</td><td>10-shot</td></tr><tr><td>ResNet-34 + Isotropic Gaussian (ours)</td><td>56.3 ± 0.4%</td><td>73.9 ± 0.3%</td><td>78.5 ± 0.3%</td></tr><tr><td>Matching Networks (reimplemented, 1-shot)</td><td>46.8 ± 0.5%</td><td>=</td><td></td></tr><tr><td>Matching Networks (reimplemented, 5-shot)</td><td></td><td>62.7 ± 0.5%</td><td></td></tr><tr><td>Meta-LearnerLSTM(Ravi&amp;Larochelle,2017)</td><td>43.4 ± 0.8%</td><td>60.6 ± 0.7%</td><td></td></tr><tr><td>Prototypical Nets (1-shot) (Snell et al., 2017)</td><td>49.4 ± 0.8%</td><td>65.4 ± 0.7%</td><td></td></tr><tr><td>Prototypical Nets (5-shot) (Snell et al., 2017)</td><td>45.1 ± 0.8%</td><td>68.2 ± 0.7%</td><td></td></tr></table>
119
+
120
+ ![](images/2abc8431807cb98b08f5efed3aa341b8068966734595e8e18b2bc4047ae8316f.jpg)
121
+ Figure 2: Results for miniImageNet with ResNet-34 style architecture and 600 training images per class. From left to right: accuracy and log likelihood (higher is better) for different k, Expected Calibration Error (ECE, lower is better) vs accuracy for 5-shot learning, and Calibration curve for 5-shot learning. Results on other architectures can be found in Appendix E.2
122
+
123
+ Deeper features lead to better k-shot learning. We investigate the influence of different feature extractors of increasing complexity on performance in Fig. 3: i) a VGG style network (500 train images per class), ii) a ResNet-34 (500 examples per class), and iii) a ResNet-34 (all 600 examples per class). We find that the complexity of the feature extractor as well as training set size consistently correlate with the accuracy at $\mathbf { k }$ -shot time. For instance, on 5-shot, Gauss (iso) achieves $6 5 \%$ accuracy with a VGG network and $7 4 \%$ with a ResNet trained with all available data, a significant increase of almost $1 0 \%$ . Moreover, Gauss (iso) outperforms Log Reg $( C = 2 \sigma _ { W } ^ { 2 } )$ on 1-shot learning across fmodels, and performs similarly on 5- and 10-shot. We attribute the difference to the former’s ability to also model the mean of the Gaussian, whereas logistic regression assumes a zero mean.
124
+
125
+ Importantly, this result implies that training specifically for $\mathbf { k }$ -shot learning is not necessary for achieving high generalisation performance on this $\mathbf { k }$ -shot problem. On the contrary, training a powerful deep feature extractor on batch classification using all of the available training data, then building a simple probabilistic model using the learned features and weights achieves state-of-the-art. Recent models that use episodic training cannot leverage such deep feature extractors as for them the depth of the model is limited by the nature of training itself. The reference baseline in the $\mathbf { k }$ -shot learning literature is nearest neighbours, which performs on par with Gauss (iso) on 1-shot learning but is outperformed by all methods on 5- and 10-shot. This is evidence that building a simple classifier on top of the learned features works significantly better for k-shot learning than nearest neighbours.
126
+
127
+ Calibration. A classifier is said to be calibrated when the probability it predicts for belonging to a given class is on par with the probability of it being the correct prediction. In other words, when examples for which it predicts a probability $p$ of belonging to a given class are correctly classified for a fraction $p$ of the examples. A calibration curve visualises the proportion of examples correctly classified as a function of their predicted probability; a perfectly calibrated classifier should result in a diagonal line. Following Guo et al. (2017), we consider the log likelihood on the $\mathbf { k }$ -shot test examples as well as Expected Calibration Error (ECE) as summary measures of calibration. ECE can be interpreted as the weighted average of the distance of the calibration curve to the diagonal. We find that Log Reg $C = 2 \bar { \sigma } _ { \widetilde { W } } ^ { 2 } ,$ ) and Gauss (iso) provide better accuracy and calibration than Log fReg (cross-validation), cf. Fig. 2. The difference in calibration quality for different regularisations of logistic regression highlights the importance of choosing the right constant, as we discuss now.
128
+
129
+ ![](images/34602529141e976b5411c28bcce3497ad243c5e6887b4a21cb7c66d0c8c625df.jpg)
130
+ Figure 3: Comparison of different network architectures and training set sizes on the k-shot learning task: VGG style network (trained on 500 images per class) and ResNet-34 style network (trained on 500 and 600 images per class, respectively). Both, deeper networks and larger number of training images, give rise to features that transfer better to k-shot learning.
131
+
132
+ ![](images/1466dac2146a89967aac74d59260f7d2012b5cc9089cd459d7154dc65008ca14.jpg)
133
+ Figure 4: Choice of regularisation constant for logistic regression for $\mathbf { k }$ -shot learning. Results for $C _ { \mathrm { r e g } } ^ { - } = 2 \sigma _ { \mathrm { W } } ^ { 2 }$ are drawn as black triangles. Dashed lines correspond to logistic regression with crossfvalidated (changing) regularisation constant. Colour brightness of the markers ranges from dark $( C = 1 0 ^ { - 5 }$ ) to bright $C = 1 0 $ ). ECE plots are provided in Appendix E.3.
134
+
135
+ Choice of the regularisation constant for logistic regression. The results so far suggest that training a simple linear model such as regularised logistic regression might be sufficient to perform well in $\mathbf { k }$ -shot learning. However, while the accuracy at $\mathbf { k }$ -shot time does not vary dramatically as the regularisation constant changes, the calibration does, and jointly maximizing both quantities is not possible, cf. the first two plots of Fig. 4. The standard (frequentist) method to tune this constant is cross validation, which is not applicable in the 1-shot setting, and suffers from lack of data in 5- and 10-shot. Contrary, our probabilistic framework provides a principled way of selecting this regularisation parameter by transfer from the training weights: Log Reg $\dot { ( } C = 2 \dot { \sigma } _ { \widetilde { W } } ^ { 2 }$ ) strikes a good fbalance between accuracy and log-likelihood. The third plot in Fig. 4 reports log-likelihood as a function of accuracy and provides further visualisation of the achieved trade-off between accuracy and calibration for Log Reg $( C = 2 \sigma _ { W } ^ { 2 } )$ ), as well as the failure of Log Reg (cross-validation) to fachieve a good compromise in 5- and 10-shot.
136
+
137
+ Evaluation in an online setting. We also briefly consider the online setting, in which we jointly test on 80 old and 5 new classes, for which catastrophic forgetting (French, 1999) is a well known problem. During $\mathbf { k }$ -shot learning and testing we employ a softmax which includes both the new and the old weights resulting in a total of 85 weight vectors. We utilise ResNet-34 trained on 500 images per class to retain 100 test images on the old classes. While the k-shot weights were modelled probabilistically, we use the MAP estimate $\widetilde { W } ^ { \mathrm { M A P } }$ for the old weights. Accuracies are reported in
138
+
139
+ ![](images/bfdb92abd1775509a6e5e3559880b374e980dfff29d687fa07c29e8a04a43bb2.jpg)
140
+ Figure 5: Online learning with ResNet-34 features. Gauss (iso) and Log Reg $( 2 \sigma _ { \widetilde { W } } ^ { 2 } )$ strike a good ftrade-off between learning on new classes and forgetting of old classes. Unregularised Log Reg (MLE) and Log Reg $( 2 \sigma _ { \widetilde { W } } ^ { 2 }$ , only new), which has not been trained in the presence of the old weights, either fcompletely forget the old classes or do not learn anything, respectively.
141
+
142
+ Fig. 5 for i) all the 85 classes, ii) the old 80 classes only, and iii) the new 5 classes only. For 5- and 10-shot, Gauss (iso) and Log Reg $( 2 \sigma _ { \widetilde { W } } ^ { 2 } )$ only lose a couple of percent on the accuracy of the old fclasses, and perform well on the new classes, striking a good trade-off between forgetting and learning at k-shot time. For unregularised (MLE) logistic regression, the new weights completely dominate the old ones, highlighting that the right regularisation is important. Yet, cross-validation in this setting is often very challenging. When training Logistic Regression without including the old weights (“only new”), the new weights are dominated by the old ones and fail to learn the new classes, making training in the presence of the old weights an essential component for online learning.
143
+
144
+ # 4.2 MODEL COMPARISON ON CIFAR-100
145
+
146
+ We performed an extensive comparison between different probabilistic models of the weights using different inference procedures, which we present in Appendix E.4. We report results on the CIFAR-100 dataset on (i) Gaussian, (ii) mixture of Gaussians, and (iii) Laplace, all with either MAP estimation or Hybrid Monte Carlo sampling. We found that the simple Gaussian model is on par with or outperforms other methods at k-shot time, which we attribute to it striking a good balance between choosing a complex model, which may better fit the weights, and statistical efficiency, as the number of weights $\widetilde { C }$ (80 in our case) is often smaller than the dimensionality of the feature representation (256 in our case), cf. Sec. 2. This finding is supported by computing the log-likelihood of held out training weights under such model, with the Gaussian model performing best. Experiments using Hybrid Monte Carlo sampling for $\mathbf { k }$ -shot learning returned very similar performance to MAP estimation and at a much higher computational cost, due to the difficulty of performing sampling in such a high dimensional parameter space. Our recommendation is that practitioners should use simple models and employ simple inference schemes to estimate all free parameters thereby avoiding expending valuable data on validation sets.
147
+
148
+ # 5 CONCLUSION
149
+
150
+ We present a probabilistic framework for $\mathbf { k }$ -shot learning that exploits the powerful features and class information learned by a neural network on a large training dataset. Probabilistic models are then used to transfer information in the network weights to new classes. Experiments on miniImageNet using a simple Gaussian model within our framework achieve state-of-the-art for 1-shot and 5-shot learning by a wide margin, and at the same time return well calibrated predictions. This finding is contrary to the current belief that episodic training is necessary to learn good $\mathbf { k }$ -shot features and puts the success of recent complex deep learning approaches to $\mathbf { k }$ -shot learning into context. The new approach is flexible and extensible, being applicable to general discriminative models and $\mathbf { k } .$ - shot learning paradigms. For example, preliminary results on online $\mathbf { k }$ -shot learning indicate that the probabilistic framework mitigates catastrophic forgetting by automatically balancing performance on the new and old classes.
151
+
152
+ The Gaussian model is closely related to regularised logistic regression, but provides a principled and fully automatic way to regularise. This is particularly important in $\mathbf { k }$ -shot learning, as it is a low-data regime, in which cross-validation performs poorly and where it is important to train on all available data, rather than using validation sets.
153
+
154
+ # REFERENCES
155
+
156
+ Bart Bakker and Tom Heskes (2003). Task Clustering and Gating for Bayesian Multitask Learning. Journal of Machine Learning Research 4, pp. 83–99.
157
+
158
+ Jordan Burgess, James Robert Lloyd, and Zoubin Ghahramani (2016). One-Shot Learning in Discriminative Neural Networks. NIPS Bayesian Deep Learning workshop.
159
+
160
+ Robert M French (1999). Catastrophic forgetting in connectionist networks. Trends in cognitive sciences 3.4, pp. 128–135.
161
+
162
+ Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger (2017). On Calibration of Modern Neural Networks. arXiv e-print: 1706.04599.
163
+
164
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun (2016). Deep Residual Learning for Image Recognition. In: The IEEE Conference on Computer Vision and Pattern Recognition (CVPR). eprint: 1512.03385.
165
+
166
+ Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov (2015). Siamese neural networks for oneshot image recognition. Deep Learning workshop, International Conference of Machine Learning.
167
+
168
+ Brenden Lake, Ruslan Salakhutdinov, and Joshua Tenenbaum (2015). Human-level concept learning through probabilistic program induction. Science 350.6266, pp. 1332–1338.
169
+
170
+ Siyuan Qiao, Chenxi Liu, Wei Shen, and Alan Yuille (2017). Few-Shot Image Recognition by Predicting Parameters from Activations. arXiv e-print: 1706.03466.
171
+
172
+ Sachin Ravi and Hugo Larochelle (2017). Optimization as a model for few-shot learning. In: International Conference on Learning Representations. Vol. 1. 2, p. 6.
173
+
174
+ 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 (2015). ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV) 115.3, pp. 211–252. DOI: 10.1007/s11263-015-0816-y.
175
+
176
+ Karen Simonyan and Andrew Zisserman (2014). Very deep convolutional networks for large-scale image recognition. arXiv e-print:1409.1556.
177
+
178
+ Jake Snell, Kevin Swersky, and Richard Zemel (2017). Prototypical Networks for Few-shot Learning. arXiv e-print: 1703.05175.
179
+
180
+ Nitish Srivastava and Ruslan R Salakhutdinov (2013). Discriminative transfer learning with treebased priors. In: Advances in Neural Information Processing Systems, pp. 2094–2102.
181
+
182
+ Laurens Van der Maaten and Geoffrey Hinton (2008). Visualizing Data using t-SNE. Journal of Machine Learning Research 9, pp. 2579–2605.
183
+
184
+ Oriol Vinyals, Charles Blundell, Tim Lillicrap, Daan Wierstra, et al. (2016). Matching networks for one shot learning. In: Advances in Neural Information Processing Systems, pp. 3630–3638.
185
+
186
+ # Appendix to “Discriminative $\mathbf { k }$ -shot learning using probabilistic models”
187
+
188
+ A DETAILS ON THE DERIVATION AND APPROXIMATIONS FROM SEC. 2.1
189
+
190
+ As stated in the main text, the probabilistic $\mathbf { k }$ -shot learning approach comprises four phases mirroring the dataflow:
191
+
192
+ Phase 1: Representational learning. The large dataset $\widetilde { \mathcal { D } }$ is used to train the CNN $\Phi _ { \varphi }$ using standard deep learning optimisation approaches. This involves learning both the parameters $\varphi$ of the feature extractor up to the last hidden layer, as well as the softmax weights $\widetilde { \mathrm { W } }$ . The network parameters $\varphi$ are fixed from this point on and shared across phases. This is a standard setup for multitask learning and in the present case it ensures that the features derived from the representational learning can be leveraged for $\mathbf { k }$ -shot learning.
193
+
194
+ Phase 2: Concept learning. The softmax weights $\widetilde { \mathrm { W } }$ are effectively used as data for concept learning by training a probabilistic model that detects structure in these weights which can be transferred for $\mathbf { k }$ -shot learning. This approach will be justified in the next section. For the moment, we consider a general class of probabilistic models in which the two sets of weights are generated from shared hyperparameters $\theta$ , so that $p ( \widetilde { \mathrm { W } } , \mathrm { W } , \theta ) = p ( \theta ) p ( \widetilde { \mathrm { W } } | \theta ) p ( \mathrm { W } | \theta )$ (see Fig. 1).
195
+
196
+ Phases 3 and ${ \bf 4 } \colon { \bf k }$ -shot learning and testing. Probabilistic $\mathbf { k }$ -shot learning leverages the learned representation $\Phi _ { \varphi }$ from phase 1 and the probabilistic model $p ( \widetilde { \mathrm { W } } , \mathrm { W } , \theta )$ from phase 2 to build a (posterior) predictive model for unseen new examples using examples from the small dataset $\mathcal { D }$ .
197
+
198
+ PROBABILISTIC MODEL OF THE WEIGHTS
199
+
200
+ Given the dataflow and the assumed probabilistic model in Fig. 1 (right), a completely probabilistic approach would involve the following steps.
201
+
202
+ In the concept learning phase, the initial dataset would be used to form the posterior distribution over the concept hyperparameters $p ( \boldsymbol { \theta } \mid \widetilde { \mathcal { D } } )$ . The $\mathbf { k }$ -shot learning phase combines the information about the new weights provided by $\widetilde { \mathcal { D } }$ with the information in the k-shot dataset $\mathcal { D }$ to form the posterior distribution
203
+
204
+ $$
205
+ p ( \mathrm { W } \mid \mathcal { D } , \widetilde { \mathcal { D } } ) \propto p ( \mathrm { W } \mid \widetilde { \mathcal { D } } ) \prod _ { n } p ( y _ { n } \mid \mathbf { x } _ { n } , \mathrm { W } ) \mathrm { w h e r e } p ( \mathrm { W } \mid \widetilde { \mathcal { D } } ) = \int p ( \mathrm { W } \mid \theta ) p ( \theta \mid \widetilde { \mathcal { D } } ) \mathrm { d } \theta .
206
+ $$
207
+
208
+ To see this, notice that
209
+
210
+ $$
211
+ \begin{array} { r } { p ( \mathrm { W } | \mathcal { D } , \widetilde { \mathcal { D } } ) \propto p ( \mathrm { W } , \mathcal { D } , \widetilde { \mathcal { D } } ) = p ( \widetilde { \mathcal { D } } ) p ( W | \widetilde { \mathcal { D } } ) p ( \mathcal { D } | \widetilde { \mathcal { D } } , \mathrm { W } ) . } \end{array}
212
+ $$
213
+
214
+ The graphical model in Fig. 1 entails that $\mathcal { D }$ is conditionally independent from $\widetilde { \mathcal { D } }$ given $\mathrm { W }$ , such that
215
+
216
+ $$
217
+ p ( \mathcal { D } \mid \mathrm { W } , \widetilde { \mathcal { D } } ) = p ( \mathcal { D } \mid \mathrm { W } ) = \prod _ { n } p ( y _ { n } \mid x _ { n } , \mathrm { W } ) .
218
+ $$
219
+
220
+ We recover Eq. (6) by adding $p ( \widetilde { \mathcal { D } } )$ to the constant of proportionality.
221
+
222
+ Inference in this model is generally intractable and requires approximations. The main challenge is computing the posterior distribution over the hyper-parameters given the initial dataset. However, progress can be made if we assume that the posterior distribution over the weights can be well approximated by the MAP value $p ( \widetilde { \mathrm { W } } | \widetilde { \mathcal { D } } ) \approx \delta ( \widetilde { \mathrm { W } } - \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } )$ . This is an arguably justifiable assumption as the initial dataset is large and so the posterior will concentrate on narrow modes (with similar predictive performance). In this case $p ( \theta | \mathcal { \widetilde { D } } ) \approx p ( \theta | \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } )$ and, due to the structure of the probabilistic model, all instances of $\widetilde { \mathcal { D } }$ in Eq. (6) and Eq. (1) can be replaced by the analogous expressions involving ${ \widetilde { \mathrm { W } } } ^ { \mathrm { M A P } }$ . This greatly simplifies the learning pipeline as the probabilistic modelling only needs to have access to the weights returned by representational learning. Remaining intractabilities involve only a small number of data points $\mathcal { D }$ and can be handled using standard approximate inference tools. The following summarizes the approximations and computational steps for each phase of training.
223
+
224
+ Phase 1: Representational learning. Deep learning is used to train a CNN. The representation of input images at the last hidden layer, $\mathbf { x } = \Phi _ { \varphi } ( \mathbf { u } )$ , is used in subsequent phases. The final layer softmax weights are assumed to be MAP estimates $\widetilde { \mathrm { W } } ^ { \mathrm { M A P } }$ .
225
+
226
+ Phase 2: Concept learning. A probabilistic model is fit directly to the MAP weights $p ( \theta | \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } ) \propto \bar { p ( \theta ) } p ( \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } | \theta ) .$ . For conjugate models a full posterior can be retained, otherwise a MAP estimate $p ( \theta | \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } ) \approx \delta ( \theta - \theta ^ { \mathrm { M A P } } )$ is used.
227
+
228
+ Phase 3: $\mathbf { k }$ -shot learning. The posterior distribution over the new softmax weights $\begin{array} { r } { p ( \mathrm { W } | \mathcal { D } , \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } ) \propto p ( \mathrm { W } | \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } ) \prod _ { n = 1 } ^ { \tilde { N } } p ( y _ { n } | \mathbf { x } _ { n } , \mathrm { W } ) } \end{array}$ is generally intractable. The posterior can, however, be approximated using the MAP estimate $p ( \mathrm { W } | \mathcal { D } , \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } ) \approx \delta ( \mathrm { W } - \mathrm { W } ^ { \mathrm { M A P } } )$ or through sampling $\mathrm { W } _ { m } \sim p ( \mathrm { W } | \mathcal { D } , \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } )$ . Note that $\begin{array} { r } { p ( \mathrm { W } | \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } ) = \int p ( \mathrm { W } | \boldsymbol { \theta } ) p ( \boldsymbol { \theta } | \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } ) \mathrm { d } \boldsymbol { \theta } } \end{array}$ is analytic for conjugate models and, if instead a MAP estimate for $\theta$ is provided by the concept modelling stage, then $\bar { p } ( \mathrm { W } | \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } ) \approx p ( \mathrm { W } | \theta ^ { \mathrm { M A P } } )$ .
229
+
230
+ Phase 4: $\mathbf { k }$ -shot testing. Approximate inference is used to compute $p ( y ^ { * } \mid \mathbf { x } ^ { * } , \mathcal { D } , \widetilde { \mathrm { W } } ^ { \mathrm { M A P } } ) \ =$ $\begin{array} { r } { \int p ( y ^ { * } \mid \mathbf { x ^ { * } } , \operatorname { W } ) p ( \operatorname { W } \mid \mathcal { D } , \widetilde { \operatorname { W } } ^ { \mathrm { M A P } } ) \mathrm { d W } } \end{array}$ . If the $\mathbf { k }$ -shot learning phase provides a MAP estimate of W then $p ( y ^ { * } \mid \mathbf { x } ^ { * } , \mathcal { D } , \widetilde { \mathbf { W } } ^ { \mathrm { M A P } } ) \ \approx \ p ( y ^ { * } \mid \mathbf { x } ^ { * } , \mathbf { W } ^ { \mathrm { M A P } } )$ . If samples are returned then $\begin{array} { r } { p ( y ^ { * } \mid \mathbf { x } ^ { * } , \mathcal { D } , \widetilde { \mathbf { W } } ^ { \mathrm { M A P } } ) \approx \frac { 1 } { M } \sum _ { m = 1 } ^ { M } p ( y ^ { * } \mid \mathbf { x } ^ { * } , \mathbf { W } _ { m } ) } \end{array}$ .
231
+
232
+ # B APPROXIMATE INFERENCE METHODS
233
+
234
+ In this section we briefly discuss different inference methods for the probabilistic models. In the main text we only considered MAP inference as we found that other more complicated inference schemes do not yield a practical benefit. However, in Appendix E.4 we provide a detailed model comparison, in which we also consider other approximate inference methods.
235
+
236
+ In all cases the gradients of the densities w.r.t. W can be computed, enabling MAP inference in the k-shot learning phase to be efficiently performed via gradient-based optimisation using L-BFGS (Liu & Nocedal, 1989). Alternatively, Markov Chain Monte Carlo (MCMC) sampling can be performed to approximate the associated integral, see Eq. (1). Due to the high dimensionality of the space and as gradients are available, we employ Hybrid Monte Carlo (HMC) (Neal et al., 2011) sampling in the form of the recently proposed NUTS sampler that automatically tunes the HMC parameters (step size and number of leapfrog steps) (Hoffman & Gelman, 2014). For the GMMs we employed pymc3 (Salvatier et al., 2016) to perform MAP inference.
237
+
238
+ # C MODELS FOR THE PRIOR ON THE WEIGHTS
239
+
240
+ As discussed in Sec. 2.1, we specify our model through $p ( \mathrm { W } , \widetilde { \mathrm { W } } , \theta )$ thus defining $p ( \mathrm { W } \vert \widetilde { \mathrm { W } } ^ { M A P } )$ in Eq. (2). This section analyses different priors on the weights: (i) Gaussian models, (ii) Gaussian mixture models, and (iii) Laplace distribution. In the main paper, we only use a Gaussian model with MAP inference, as we saw no significant advantage in using other, more complex models. However, we provide an extensive comparison of the different models in Appendix E.4.
241
+
242
+ # C.1 GAUSSIAN MODEL
243
+
244
+ Possibly the simplest approach consists of modelling $p ( \mathrm { W } | \widetilde { \mathrm { W } } )$ as a Gaussian distribution:
245
+
246
+ $$
247
+ p ( \mathbf { W } \mid \widetilde { \mathbf { W } } ) = \int \mathcal { N } ( \mathbf { W } \mid \boldsymbol { \mu } , \boldsymbol { \Sigma } ) p ( \boldsymbol { \mu } , \boldsymbol { \Sigma } \mid \widetilde { \mathbf { W } } ) \mathrm { d } \boldsymbol { \mu } \mathrm { d } \boldsymbol { \Sigma } .
248
+ $$
249
+
250
+ Details for this section can be found in Murphy, 2012. The normal-inverse-Wishart distribution for $\mu$ and $\Sigma$ is a conjugate prior for the Gaussian, which allows for the posterior to be written in closed form. More precisely,
251
+
252
+ $$
253
+ \begin{array} { l } { { \displaystyle p ( \mu , \Sigma ) = \mathcal { N } T \mathcal { W } ( \mu , \Sigma \mid \mu _ { 0 } , \kappa _ { 0 } , \Lambda _ { 0 } , \nu _ { 0 } ) } } \\ { { \displaystyle \quad = \frac { 1 } { Z } | \Sigma | ^ { - ( \nu _ { 0 } + p ) / 2 + 1 } e ^ { - \frac { 1 } { 2 } t r ( \Lambda _ { 0 } \Sigma ^ { - 1 } ) - \frac { \kappa _ { 0 } } { 2 } ( \mu - \mu _ { 0 } ) ^ { t } \Sigma ^ { - 1 } ( \mu - \mu _ { 0 } ) } , } } \end{array}
254
+ $$
255
+
256
+ where $Z$ is the normalising constant. The posterior $p ( \mu , \Sigma | \widetilde { \mathrm { W } } )$ also follows a normal-inverse-Wishart distribution:
257
+
258
+ $$
259
+ p ( \mu , \Sigma | \widetilde { \mathbf { W } } ) = { \mathcal { N } } \widetilde { \cal T } \mathcal { W } ( \mu , \Sigma | \mu _ { \widetilde { N } } , \kappa _ { \widetilde { N } } , \Lambda _ { \widetilde { N } } , \nu _ { \widetilde { N } } ) ,
260
+ $$
261
+
262
+ where
263
+
264
+ $$
265
+ \begin{array} { r l } & { \displaystyle \mu _ { \widetilde { N } } = \frac { \kappa _ { 0 } } { \kappa _ { 0 } + \widetilde { N } } \mu _ { 0 } + \frac { \widetilde { N } } { \kappa _ { 0 } + \widetilde { N } } \overline { { \widetilde { \mathrm { W } } } } } \\ & { \displaystyle \kappa _ { \widetilde { N } } = \kappa _ { 0 } + \widetilde { N } } \\ & { \displaystyle \Lambda _ { \widetilde { N } } = \Lambda _ { 0 } + S + \frac { \kappa _ { 0 } \widetilde { N } } { \kappa _ { 0 } + \widetilde { N } } ( \overline { { \widetilde { \mathrm { W } } } } - \mu _ { 0 } ) ( \overline { { \widetilde { \mathrm { W } } } } - \mu _ { 0 } ) ^ { t } } \\ & { \displaystyle \nu _ { \widetilde { N } } = \nu _ { 0 } + \widetilde { N } , } \end{array}
266
+ $$
267
+
268
+ and $S$ is the sample covariance of $\widetilde { \mathrm { W } }$ .
269
+
270
+ For this model, we can integrate (9) in closed form, which results in the following multivariate Student $t$ -distribution:
271
+
272
+ $$
273
+ p ( \mathrm { W } | \widetilde { \mathrm { W } } ) = t _ { \nu _ { \widetilde { N } } - p + 1 } \left( \mu _ { \widetilde { N } } , \frac { \Lambda _ { \widetilde { N } } ( \kappa _ { \widetilde { N } } + 1 ) } { \kappa _ { \widetilde { N } } ( \nu _ { \widetilde { N } } - p + 1 ) } \right) .
274
+ $$
275
+
276
+ As with other approaches, one can also compute the MAP solutions for the mean $\mu _ { \mathrm { M A P } }$ and covariance $\Sigma _ { \mathrm { M A P } }$ , such that $p ( \mathrm { W } \mid \widetilde { \mathrm { W } } ) = \mathcal { N } ( \mathrm { W } \mid \mu _ { \mathrm { M A P } } , \Sigma _ { \mathrm { M A P } } )$ .
277
+
278
+ For both the analytic posterior and the MAP approximation, $p ( \mathrm { W } | \widetilde { \mathrm { W } } )$ depends on the hyperparameters of the normal-inverse-Wishart distribution: $\mu _ { 0 } , \nu _ { 0 } , \kappa _ { 0 }$ and $\Lambda _ { 0 }$ . There are different ways to choose these hyperparameters. One way would be by optimising the log probability of held out training weights, see Appendix E.4 for a brief discussion. In practise, it is common to choose uninformative or data dependent priors as discussed by Murphy (2012, Chapter 4).
279
+
280
+ # C.2 MIXTURE OF GAUSSIANS (GMM)
281
+
282
+ A Gaussian mixture model can potentially leverage cluster structure in the weights (animal classes might have similar weights, for example). This is related to the tree-based prior proposed in Srivastava & Salakhutdinov (2013). MAP inference is performed because exact inference is intractable. Similarly to the Gaussian case, different structures for the covariance of each cluster were tested. In our experiments, we fit the parameters of the GMM via maximum likelihood using the EM algorithm. GMM consists on modelling $p ( \mathrm { W } | \widetilde { \mathrm { W } } )$ as a mixture of Gaussians with $S$ components:
283
+
284
+ $$
285
+ \begin{array} { r } { \rho ( \mathbf { W } \mid \widetilde { \mathbf { W } } ) = \displaystyle \int \left( \displaystyle \sum _ { s = 1 } ^ { S } \pi _ { s } \mathcal { N } ( \mathbf { W } \mid \mu _ { s } , \Sigma _ { s } ) \right) p ( \mu _ { 1 } , \dots , \mu _ { S } , \Sigma _ { 1 } , \dots , \Sigma _ { S } \mid \widetilde { \mathbf { W } } ) \mathrm { d } \mu _ { 1 } \dots \mathrm { d } \mu _ { S } \mathrm { d } \Sigma _ { 1 } \dots \mathrm { d } \Sigma _ { S } , } \end{array}
286
+ $$
287
+
288
+ where cluster $\textstyle \sum _ { s = 1 } ^ { S } \pi _ { s } = 1$ . In this work, we only compute the MAP mean and covariance for each of theto averaging over the parameters of the mixture. The resulting posterior is
289
+
290
+ $$
291
+ p ( \mathbf { W } \mid \widetilde { \mathbf { W } } ) = \sum _ { s = 1 } ^ { S } \pi _ { s } \mathcal { N } ( \mathbf { W } \mid \mu _ { M A P , s } , \Sigma _ { M A P , s } ) .
292
+ $$
293
+
294
+ The components of the mixture are fit in two ways. For CIFAR-100, the classes are grouped into 20 superclasses, each containing 5 of the 100 classes. One option is therefore to initialize 20 components, each fit with the data points in the corresponding superclass. For each such individual Gaussian, the MAP inference method presented in the previous section can be used. In order to increase the number of weight examples in each superclass, we merge the original superclasses into 9 larger superclasses. The merging of the superclasses is the following:
295
+
296
+ Aquatic mammals $^ +$ fish
297
+
298
+ • flowers $^ +$ fruit and vegetables $^ +$ trees
299
+ • insects $^ +$ non-insect invertebrates $^ +$ reptiles
300
+ medium-sized mammals $^ +$ small mammals
301
+ • large carnivores $^ +$ large omnivores and herbivores
302
+ • people
303
+ • large man-made outdoor things $^ +$ large natural outdoor things food containers $^ +$ household electrical devices $^ +$ household furniture • Vehicles $1 +$ Vehicles 2.
304
+
305
+ The parameters of the mixture can also be fit using maximum likelihood with EM. We use the implementation of EM in scikit-learn. Both 3 and 10 clusters are considered in CIFAR-100. Weight log-likelihoods under this model and k-shot performance can be found in Appendix E.4.
306
+
307
+ Note that, similarly to the Gaussian model, we consider isotropic, diagonal or full covariance models for the covariance matrices.
308
+
309
+ # C.3 LAPLACE DISTRIBUTION
310
+
311
+ Sparsity is an attractive feature which could be helpful for modelling the weights. Indeed, it is reasonable to assume that each class uses a set of characteristic features which drive classification accuracy, while others are irrelevant. Sparse models would then provide sensible regularization. As such, we consider a product of independent Laplace distribution. Sec. 2.3 highlights the relation between a Gaussian prior on the weights and $L _ { 2 }$ regularised logistic regression. One can similarly show that the Laplace prior is related to $L _ { 1 }$ regularised logistic regression, which is well known for encouraging sparse weight vectors.
312
+
313
+ We consider a prior which factors along the feature dimensions:
314
+
315
+ $$
316
+ p ( \widetilde { \mathbf { W } } | \{ \mu _ { j } \} , \{ \lambda _ { j } \} ) = \prod _ { j } ^ { p } \frac { 1 } { 2 \lambda _ { j } } \exp \left( - \sum _ { i } ^ { \widetilde { C } } \frac { | \widetilde { \mathbf { W } } _ { i j } - \boldsymbol { \mu } _ { j } | } { \lambda _ { j } } \right) .
317
+ $$
318
+
319
+ where the product over $j$ is along the feature dimensions and the sum over $i$ is across the classes. We fit the parameters $\mu$ and $\lambda$ via maximum likelihood:
320
+
321
+ $$
322
+ \begin{array} { l } { \displaystyle \mu _ { \mathrm { M L E } , j } = \mathrm { m e d i a n } _ { i } ( \widetilde { \mathrm { W } } _ { i j } ) } \\ { \displaystyle \lambda _ { \mathrm { M L E } , j } = \frac { 1 } { N } \sum _ { i } | \widetilde { \mathrm { W } } _ { i j } - \mu _ { j } | , } \end{array}
323
+ $$
324
+
325
+ such that
326
+
327
+ $$
328
+ p ( \mathrm { W } | \widetilde { \mathrm { W } } ) = \prod _ { j } ^ { p } \frac { 1 } { 2 \lambda _ { \mathrm { M L E } , j } } \exp \left( - \sum _ { i } ^ { C } \frac { | \mathrm { W } _ { i j } - \mu _ { \mathrm { M L E } , j } | } { \lambda _ { \mathrm { M L E } , j } } \right) .
329
+ $$
330
+
331
+ An isotropic Laplace model with mean $\mu$ and scale $\lambda$ is also considered:
332
+
333
+ $$
334
+ p ( \widetilde { \mathrm { W } } \left| \mu , \lambda \right) = \frac { 1 } { 2 \lambda } \exp \left( - \frac { \sum _ { i j } \left| \widetilde { \mathrm { W } } _ { i j } - \mu \right| } { \lambda } \right) ,
335
+ $$
336
+
337
+ where
338
+
339
+ $$
340
+ \begin{array} { l } { \displaystyle \mu _ { \mathrm { M L E } } = \mathrm { m e d i a n } ( \widetilde { \mathrm { W } } ) } \\ { \displaystyle \lambda _ { \mathrm { M L E } } = \frac { 1 } { N p } \sum _ { i j } \big | \widetilde { \mathrm { W } } _ { i j } - \mu \big | , } \end{array}
341
+ $$
342
+
343
+ # D TRAINING AND EVALUATION PROCEDURE DETAILS
344
+
345
+ # D.1 miniIMAGENET
346
+
347
+ To construct miniImageNet we use the same classes as initially proposed by Ravi & Larochelle (2017) and used in (Snell et al., 2017), which is split into 64 training classes (cf. Tab. 2), 16 validation classes (cf. Tab. 3), and 20 test classes (cf. Tab. 4). We will make a full list of image files available.
348
+
349
+ As we do not require a validation set, we combine the training and validation set to form an extended training set. We extract 600 images per class from the ImageNet 2012 Challange dataset (Krizhevsky et al., 2012), scale the shorter side to 84 pixels and then centrally crop to $8 4 \times 8 4$ pixels, that is, we preserve the original aspect ratio of the image content. We use these coloured $8 4 \times 8 4 \times 3$ images as input for representational and $\mathbf { k }$ -shot learning and testing.
350
+
351
+ In order to train very deep models, such as a ResNet, we need to perform data augmentation as is the case when training full ImageNet. We use the following standard data augmentation from ImageNet that we adapt to the size of the input images:
352
+
353
+ • random horizontal flipping • randomly paste image into $1 0 0 \times 1 0 0$ frame and cut out central $8 4 \times 8 4$ pixels • randomly change brightness, contrast, saturation and lighting
354
+
355
+ We highlight that we do not perform any data augmentation for the k-shot learning and $\mathbf { k }$ -shot testing but use the original $8 4 \times 8 4$ colour images as input to the feature extractor.
356
+
357
+ # D.2 CIFAR-100
358
+
359
+ CIFAR-100 consists of 100 classes each with 500 training and 100 test images of size $3 2 \times 3 2$ . The classes are grouped into 20 superclasses with 5 classes each. For example, the superclass ”fish” contains the classes aquarium fish, flatfish, ray, shark, and trout. Unless otherwise stated, we used a random split into 80 base classes and $2 0 \mathrm { k }$ -shot learning classes.
360
+
361
+ For $\mathbf { k }$ -shot learning and testing, we split the 100 classes into 80 base classes used for network training and $2 0 \mathrm { k \Omega }$ -shot learning classes.
362
+
363
+ classes_base $\begin{array} { r l } { \mathbf { \Psi } } & { { } = \mathbf { \Psi } \left[ \begin{array} { l } { \mathbf { \Psi } } \end{array} \right. } \end{array}$ 0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 13, 14, 15, 16, 17, 18, 19, 21, 22, 24, 25, 27, 28, 32, 34, 35, 36, 38, 40, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 69, 70, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
364
+ ]
365
+ classes_heldout $\begin{array} { r l r } { \mathrm { ~ ~ \psi ~ } } & { { } = } & { [ } \end{array}$ 8, 11, 12, 20, 23, 26, 29, 30, 31, 33, 37, 39, 41, 47, 57, 68, 71, 72, 81, 84
366
+ ]
367
+
368
+ We provide an exhaustive comparison of different probabilistic models for this $\mathbf { k }$ -shot learning task in Appendix E.4.
369
+
370
+ # D.3 NETWORK ARCHITECTURE AND TRAINING: RESNET INSPIRED
371
+
372
+ The network architecture is inspired by the ResNet-34 architecture for ImageNet (He et al., 2016) that uses convolution blocks, with two convolutions each, that are bridged by skip connections. As a base, we utilise the example code2 provided by tensorpack (https://github.com/ppwwyyxx/tensorpack), a neural network training library built on top of tensorflow (Mart´ın Abadi et al., 2015). We adapt the number of features as well as the size of the last fully connected layer to account for the smaller number of training samples and training classes. The final architecture is detailed in Tab. 5.
373
+
374
+ n03400231 frying pan, frypan, skillet
375
+ n02108551 Tibetan mastiff
376
+ n02687172 aircraft carrier, carrier, flattop, attack aircraft carrier
377
+ n04296562 stage
378
+ n13133613 ear, spike, capitulum
379
+ n02165456 ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle
380
+ n03337140 file, file cabinet, filing cabinet
381
+ n02966193 carousel, carrousel, merry-go-round, roundabout, whirligig
382
+ n02074367 dugong, Dugong dugon
383
+ n02105505 komondor
384
+ n04389033 tank, army tank, armored combat vehicle, armoured combat vehicle
385
+ n09246464 cliff, drop, drop-off
386
+ n03924679 photocopier
387
+ n03527444 holster
388
+ n04612504 yawl
389
+ n01749939 green mamba
390
+ n04251144 snorkel
391
+ n03347037 fire screen, fireguard
392
+ n04067472 reel
393
+ n03998194 prayer rug, prayer mat
394
+ n13054560 bolete
395
+ n02747177 ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin
396
+ n04435653 tile roof
397
+ n02108089 boxer
398
+ n03908618 pencil box, pencil case
399
+ n01770081 harvestman, daddy longlegs, Phalangium opilio
400
+ n03676483 lipstick, lip rouge
401
+ n03220513 dome
402
+ n04515003 upright, upright piano
403
+ n04258138 solar dish, solar collector, solar furnace
404
+ n04509417 unicycle, monocycle
405
+ n01704323 triceratops
406
+ n04443257 tobacco shop, tobacconist shop, tobacconist
407
+ n02089867 Walker hound, Walker foxhound
408
+ n01910747 jellyfish
409
+ n02111277 Newfoundland, Newfoundland dog
410
+ n04243546 slot, one-armed bandit
411
+ n01558993 robin, American robin, Turdus migratorius
412
+ n03047690 clog, geta, patten, sabot
413
+ n03854065 organ, pipe organ
414
+ n03476684 hair slide
415
+ n02113712 miniature poodle
416
+ n07747607 orange
417
+ n03838899 oboe, hautboy, hautbois
418
+ n07584110 consomme
419
+ n02795169 barrel, cask
420
+ n03017168 chime, bell, gong
421
+ n04275548 spider web, spider’s web
422
+ n04604644 worm fence, snake fence, snake-rail fence, Virginia fence
423
+ n02606052 rock beauty, Holocanthus tricolor
424
+ n01843383 toucan
425
+ n02457408 three-toed sloth, ai, Bradypus tridactylus
426
+ n03062245 cocktail shaker
427
+ n03207743 dishrag, dishcloth
428
+ n02108915 French bulldog
429
+ n06794110 street sign
430
+ n02823428 beer bottle
431
+ n03888605 parallel bars, bars
432
+ n04596742 wok
433
+ n02091831 Saluki, gazelle hound
434
+ n02101006 Gordon setter
435
+ n02120079 Arctic fox, white fox, Alopex lagopus
436
+ n01532829 house finch, linnet, Carpodacus mexicanus
437
+ n07697537 hotdog, hot dog, red hot
438
+
439
+ Table 2: Training classes for miniImageNet as proposed by Ravi & Larochelle (2017)
440
+
441
+ n03075370 combination lock
442
+ n02971356 carton
443
+ n03980874 poncho
444
+ n02114548 white wolf, Arctic wolf, Canis lupus tundrarum
445
+ n03535780 horizontal bar, high bar
446
+ n03584254 iPod
447
+ n02981792 catamaran
448
+ n03417042 garbage truck, dustcart
449
+ n03770439 miniskirt, mini
450
+ n02091244 Ibizan hound, Ibizan Podenco
451
+ n02174001 rhinoceros beetle
452
+ n09256479 coral reef
453
+ n02950826 cannon
454
+ n01855672 goose
455
+ n02138441 meerkat, mierkat
456
+ n03773504 missiles
457
+ n02116738 African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus
458
+ n02110063 malamute, malemute, Alaskan malamute
459
+ n02443484 black-footed ferret, ferret, Mustela nigripes
460
+ n03146219 cuirass
461
+ n03775546 mixing bowl
462
+ n03544143 hourglass
463
+ n04149813 scoreboard
464
+ n03127925 crate
465
+ n04418357 theater curtain, theatre curtain
466
+ n02099601 golden retriever
467
+ n02219486 ant, emmet, pismire
468
+ n03272010 electric guitar
469
+ n04146614 school bus
470
+ n02129165 lion, king of beasts, Panthera leo
471
+ n04522168 vase
472
+ n07613480 trifle
473
+ n02871525 bookshop, bookstore, bookstall
474
+ n01981276 king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica
475
+ n02110341 dalmatian, coach dog, carriage dog
476
+ n01930112 nematode, nematode worm, roundworm
477
+
478
+ ResNet-34 inspired for miniImageNet
479
+
480
+ <table><tr><td>Output size</td><td colspan="2">Layers</td></tr><tr><td>84×84×3</td><td colspan="2">Input patch</td></tr><tr><td>42 × 42 × 32</td><td colspan="2">5 × 5,32, stride 2</td></tr><tr><td>42 × 42 × 32</td><td>[3 × 3,32] 3 × 3,32</td><td rowspan="2">×3</td></tr><tr><td>21 × 21×64</td><td>[3 × 3,64] ×4 3× 3,64</td></tr><tr><td>11 × 11 × 128</td><td>[3 × 3,128] 3 ×3,128</td><td rowspan="2">×6 ×3</td></tr><tr><td>6×6×256</td><td>[3 × 3,256] 3 ×3,256</td></tr><tr><td>256</td><td colspan="2"> global average pooling</td></tr><tr><td>C</td><td colspan="2">fully connected, softmax</td></tr></table>
481
+
482
+ Table 5: Network architecture. All unnamed layers are 2D convolutions with stated kernel size and padding SAME; the output of the shaded layer corresponds to $\Phi _ { \varphi } ( \mathbf { u } )$ , the feature space representation of the image u, which is used as input for probabilistic $\mathbf { k }$ -shot learning.
483
+
484
+ The network is trained using a decaying learning rate schedule and momentum SGD and is implemented in tensorpack using tensorflow.
485
+
486
+ VGG-style Network for CIFAR-100
487
+
488
+ <table><tr><td>Output size</td><td>Layers</td></tr><tr><td>32 × 32×3</td><td>Input patch</td></tr><tr><td>16 ×16×64 8×8×64</td><td>2×(Conv2D,ELU),Pool 2×(Conv2D,ELU),Pool</td></tr><tr><td>4×4×128</td><td>2×(Conv2D,ELU),Pool</td></tr><tr><td>2×2×128</td><td>2×(Conv2D,ELU),Pool</td></tr><tr><td>2×2×128</td><td>Dropout (0.5)</td></tr><tr><td>256</td><td>FullyConnected, ELU</td></tr><tr><td>256</td><td>Dropout (0.5)</td></tr><tr><td>128</td><td>FullyConnected, ELU</td></tr><tr><td>C</td><td>FullyConnected, SoftMax</td></tr></table>
489
+
490
+ D.4 NETWORK ARCHITECTURE AND TRAINING: VGG INSPIRED
491
+ VGG-style Network for miniImageNet
492
+ Table 6: Network architectures. All 2D convolutions have kernel size $3 \times 3$ and padding SAME; max-pooling is performed with stride 2. The output of the shaded layer corresponds to $\Phi _ { \varphi } ( u )$ , the feature space representation of the image $u$ , which is used as input for probabilistic k-shot learning
493
+
494
+ <table><tr><td>Output size</td><td>Layers</td></tr><tr><td>84×84×3 42 × 42 × 32 21 × 21×64</td><td>Input patch 2×(Conv2D,ELU),Pool 2×(Conv2D,ELU),Pool 11 × 11 × 128 2×(Conv2D,ELU),Pool</td></tr><tr><td>6×6×128 3×3×128 3×3×128</td><td>2×(Conv2D,ELU),Pool 2×(Conv2D,ELU),Pool Dropout (0.5)</td></tr><tr><td>512</td><td>FullyConnected, ELU</td></tr><tr><td>512 256</td><td>Dropout (0.5)</td></tr><tr><td>C</td><td>FullyConnected, ELU FullyConnected, SoftMax</td></tr></table>
495
+
496
+ The network architecture was inspired by the VGG networks Simonyan & Zisserman, 2014, but does not employ batch normalisation Ioffe & Szegedy, 2015. To speed up training, we employ exponential linear units (ELUs), which have been reported to lead to faster convergence as compared to ordinary ReLUs Clevert et al., 2015. To regularise the networks, we employ dropout (Srivastava, Hinton, et al., 2014) and regularisation of the weights in the fully connected layers. The networks are trained with the ADAM optimiser Kingma & Ba, 2014 with decaying learning rate.
497
+
498
+ The network is implemented in tensorpack using tensorflow.
499
+
500
+ ![](images/24aeedb39ec86a94aaff7d6f4c45a90304c6181dbeb70488554d9ac9c1e2d287.jpg)
501
+ Figure 6: t-SNE embedding of the CIFAR-100 weights $\widetilde { \mathrm { W } }$ trained using a VGG style architecture. The points are coloured according to their respective superclass. The colouring by superclass makes the structure in the weights evident, as t-SNE overall recovers the structure in the dataset. For instance, oak tree, palm tree, willow tree and pine tree form a cluster on the bottom right. This structure motivates our approach, as the training weights contain information which may be useful at $\mathbf { k }$ -shot time, for instance given a few example from chestnut trees.
502
+
503
+ ![](images/9a7bf6dd84c6f01fc75e5535055295f2dde23f3ffc3010ff2244284f61a71424.jpg)
504
+ Figure 7: t-SNE embedding of the miniImageNet weights trained using a ResNet-34 architecture. Structure is still present and we observe meaningful patterns, even though the classes in miniImageNet are more unique than in CIFAR-100. For instance, goose, house finch, toucan, Arctic fox, green mamba and other animals are clustered on the top, with birds close to each other. Examples of other small clusters include poncho and miniskirt, or organ and oboe. For readability, not all class names are plotted.
505
+
506
+ # E EXTENDED EXPERIMENTS
507
+
508
+ # E.1 T-SNE EMBEDDING OF THE WEIGHTS
509
+
510
+ We provide t-SNE embeddings for the weights of a VGG network trained in CIFAR-100 and a ResNet34 trained on miniImageNet. A structure in the weights is apparent and provides motivation for our framework. The results can be seen in Fig. 6 and Fig. 7.
511
+
512
+ # E.2 EXTENDED RESULTS ON miniIMAGENET
513
+
514
+ Fig. 8 provides extended results on $\mathbf { k }$ -shot learning for the miniImageNet dataset for different network architectures. We investigate the influence of different feature extractors of increasing complexity and training data size on performance on: i) a VGG style network trained on 500 images per class, ii) a ResNet-34 trained on 500 examples per class, and iii) a ResNet-34 trained on all 600 examples per class.
515
+
516
+ # E.3 CHOICE OF REGULARISATION CONSTANT
517
+
518
+ Fig. 9 reports accuracy and calibration in terms of Expected Calibration Error (ECE) (lower is better) and log likelihoods (higher is better) for different regularisations of logistic regression for all three model architectures considered.
519
+
520
+ ![](images/2fa9dcedc3e2ad9bb81730a425916fb0df31a973f5aecfa9f8ba854d9fa434ad.jpg)
521
+ Figure 8: Extended results for the miniImageNet dataset utilising different network architectures and representational training. top: a ResNet-34 trained with all 600 examples per class; middle: a ResNet-34 trained with 500 images per class; bottom: a VGG style network trained with 500 images per class. We highlight that for all three architectures the order of the different methods as well as the main messages are the same. However, the general performance in terms of accuracy and calibration differ between the architectures. The more complex architecture trained on most images performs best in terms of accuracy, indicating that it learns better features for $\mathbf { k }$ -shot learning. Both ResNets behave very similarly on calibration whereas the VGG-style network performs better (lower ECE and higher log likelihood as well as more diagonal calibration curve). This is in line with observations by Guo et al. (2017) that calibration of deep architectures gets worse as depth and complexity increase.
522
+
523
+ ![](images/84f491fdb00b6cb7bec2df1c1ea54cc5e57068ca1a00f2d9ce7d626b5c50a6c3.jpg)
524
+ Figure 9: Choice of regularisation constant for logistic regression on k-shot learning. Note that all three rows use the same raw data that are only visualised differently. Top: Summary of accuracy and calibration in terms of log likelihood and Expected Calibration Error (ECE). Middle: detailed plot of ECE vs. accuracy. Bottom: detailed plot of log likelihood vs. accuracy. Results for $C _ { \mathrm { r e g } } = \overset { * } { 2 } \sigma _ { \widetilde { \mathrm { W } } } ^ { 2 }$ fare drawn as black triangles. Dashed lines correspond to logistic regression with cross-validated (changing) regularisation constant. Colour brightness of the markers ranges from dark $( C = 1 0 ^ { - 5 }$ ) to bright ( $C = 1 0 $ ). In addition to Fig. 4 we also provide results for calibration in terms of ECE (lower is better), which are consistent with log likelihoods (higher is better): The Bayesian inspired choice of the regularisation parameter strikes a good balance between accuracy and calibration and consistently outperforms cross-validated choice of the parameter.
525
+
526
+ # E.4 MODEL ASSESSMENT IN CIFAR-100
527
+
528
+ This section reports an extensive model comparison on CIFAR-100, both for the model of the weights $p ( \mathrm { W } | \widetilde { \mathrm { W } } )$ and for the inference procedure at $\mathbf { k }$ -shot time (MAP or Hybrid Monte Carlo (HMC) sampling using NUTS (Hoffman & Gelman, 2014), see the description of approximate inference algorithms in Appendix B). We report log-likelihood of the weights under different models, as well as accuracy, log-likelihood and calibration in a k-shot learning task. Tab. 7 and Tab. 8 show descriptions of the methods analysed for respectively phase 2 (concept learning) and phase 3 ( $\mathbf { k }$ -shot learning) of our $\mathbf { k }$ -shot pipeline described in Sec. 2.1.
529
+
530
+ <table><tr><td rowspan="2">Method name</td><td colspan="2">Phase 2: Concept learning</td></tr><tr><td>Priordistribution</td><td>Inference</td></tr><tr><td>Gauss (iso)</td><td>Gaussian isotropic covariance</td><td>MAP</td></tr><tr><td>Gauss (MAP prior)</td><td>Gaussian isotropic covariance</td><td>MAP</td></tr><tr><td>Gauss (integr. prior)</td><td>Gaussian full covariance</td><td>Integrated</td></tr><tr><td>GMM (supercl.)</td><td>GMM on superclasses iso.cov.</td><td>MAP</td></tr><tr><td>GMM (3, iso)</td><td>GMM on 3 clusters iso. cov.</td><td>MLE</td></tr><tr><td>GMM (3, diag)</td><td>GMM on 3 clusters diagonal cov.</td><td>MLE</td></tr><tr><td>GMM (10, iso)</td><td>GMM on 10 clusters iso. cov.</td><td>MLE</td></tr><tr><td>Laplace (diag)</td><td>Laplace diagonal covariance</td><td>MLE</td></tr></table>
531
+
532
+ Table 7: Description of the inference for the parameters of the prior in phase 2 (concept learning) for the models in from Fig. 10. This specifies the inference procedure for $\theta$ in $p ( \mathbf { w } \mid \boldsymbol { \theta } )$ after observing the training weights $\widetilde { \mathrm { W } }$ .
533
+
534
+ <table><tr><td rowspan="2">Method name</td><td colspan="2">Phase 3: k-shot learning</td></tr><tr><td>Prior distribution</td><td>Inference</td></tr><tr><td>Gauss (iso) MAP</td><td>Gaussian</td><td>MAP</td></tr><tr><td>Gauss (MAP prior) MAP</td><td>Gaussian</td><td>MAP</td></tr><tr><td>Gauss (MAP prior) HMC</td><td>Gaussian</td><td>HMC</td></tr><tr><td>Gauss ( :(integr. prior)MAP</td><td>Gaussian</td><td>MAP</td></tr><tr><td>Gauss (integr. prior) HMC</td><td>Gaussian</td><td>HMC</td></tr><tr><td>GMM (supercl.) MAP</td><td>GMM on superclasses</td><td>MAP</td></tr><tr><td>GMM (3,iso) MAP</td><td>GMM on 3 isotropic comp.</td><td>MAP</td></tr><tr><td>Laplace (diag) HMC</td><td>Laplace (diagonal)</td><td>HMC</td></tr><tr><td>Laplace (diag) MAP</td><td>Laplace (diagonal)</td><td>MAP</td></tr></table>
535
+
536
+ Table 8: Methods and inference procedure during phase 3 $\mathbf { k }$ -shot learning) for the models used in Fig. 10. This specifies the inference procedure used when computing $p ( \mathrm { W } | \mathrm { \widehat { \mathcal { D } } } , \widetilde { \mathrm { W } } )$ for the specified prior distribution.
537
+
538
+ In the main text, we only consider an isotropic Gaussian model with MAP inference since we do not observe benefits from using alternative methods in terms of $\mathbf { k }$ -shot performance and calibration. Moreover, while we report results on a VGG-like architecture, we could also use a ResNet architecture, and preliminary results point to the same conclusion as experiments on miniImageNet when switching from VGG to ResNet: the deeper features consistently lead to higher $\mathbf { k }$ -shot performance on all methods whereas the ordering of the methods stays roughly the same.
539
+
540
+ Analysis of the models on held-out training weights. First, we analyse how well the different prior models for the new softmax weights are able to fit the $\widetilde { C }$ training weights $\widetilde { \mathrm { W } }$ . We randomly excluded 10 of those weights and evaluated their held-out negative log likelihood given the remaining $C - 1 0$ weights. We emphasise that this approach also constitutes a principled way to set the hyperparameters of the prior and, critically, relies on an explicit probabilistic model.
541
+
542
+ The negative log probabilities are averaged over 50 random splits and results of best optimised values w.r.t. hyperparameters are shown in Tab. 9 for CIFAR-100 (lower is better). We find that all models
543
+
544
+ ![](images/953c6f23804e6219e6ece708a197cd141af454587feeceb14d0180c671a22efa.jpg)
545
+
546
+ Table 9: Held-out log probabilities on random 70/10-splits of the training weights for the different models on CIFAR-100. Values are averaged over 50 splits.
547
+
548
+ ![](images/a8e6e0bdc72e26a75fe56a83c9f0f11fdb2663e07ddffdf549944f8e983d295f.jpg)
549
+ Figure 10: Results on CIFAR-100 for VGG style architecture. We report accuracy, log-likelihood and calibration for the methods and inference procedures presented in Tab. 8. With the exception of GMM (10, iso) and Laplace, all methods are similar terms of accuracy and log-likelihood. Gauss (integr. prior) HMC and Gauss (MAP) HMC are slightly better calibrated than our proposed Gauss (MAP) iso, but require significantly more computation for the sampling procedure.
550
+
551
+ behave very similar but that multivariate Gaussian models generally outperform other models. We attribute the good performance of the simpler models to the small number of data points $( C - 1 0 = 7 0 $ training weights) and the high dimensionality of the space, which entail that fitting even simple models is difficult. Thus, more complicated models cannot improve over them.
552
+
553
+ $\mathbf { k }$ -shot performance in CIFAR-100. Accuracies are measured on a 5-way classification task on the $\mathbf { k }$ -shot classes for $k \in \{ 1 , 5 , 1 0 \}$ . Results were averaged two-fold: (i) 20 random splits of the 5 $\mathbf { k }$ -shot classes; (ii) 10 repetitions of each split with different $\mathbf { k }$ -shot training examples. Among our models, no statistically significant difference in accuracy is observed, with the exception of Laplace MAP and GMM (iso), which consistently underperforms. These findings are consistent in terms of log-likelihoods, see the first and second plots in Fig. 10.
554
+
555
+ Finally, our methods are generally well calibrated, with Gaussian models generally better than Laplace models. Moreover, all methods (with the exception of Laplace and GMM (10, iso) have low ECE and high accuracy, see the third and fourth plots of Fig. 10. While Gauss (integr. prior) HMC and Gauss (MAP) HMC are sightly better calibrated than our proposed method in the main paper, Gauss (MAP) iso, we believe the gain in calibration is not worth the significant increase in computational resources needed for the sampling procedure. Interestingly, both GMM approaches are not able to outperform the other, simpler models. This is in line with the previous observation that the simpler models are better able to explain the weights. Again, we attribute this inability of mixture models to use their larger expressivity/capacity to the small number of data points and the high-dimensionality of weight-space which means learning even simple models is difficult. These observations suggest that the use of mixture models in this type of $\mathbf { k }$ -shot learning framework is not beneficial and is in contrast to the approach of Srivastava & Salakhutdinov (2013), who employ a tree-structured mixture model. The authors show compare a model in which the assignments to the superclasses in the tree are optimized over against a model with a naive initialisation of the superclass assignments, and show that the first outperforms the second. However, they do not compare against a simpler baseline, e.g., a single Gaussian model.
556
+
557
+ Overall, we observe that there is no significant benefit of more complex methods over the simple isotropic Gaussian, either in terms of accuracy, log-likelihood or calibration. Thus, our recommendation is that practitioners should use simple models and employ simple inference schemes to estimate all free parameters thereby avoiding expending valuable data on validation sets
558
+
559
+ # REFERENCES
560
+
561
+ Djork-Arne Clevert, Thomas Unterthiner, & Sepp Hochreiter (2015). Fast and accurate deep network ´ learning by exponential linear units (elus). arXiv e-print:1511.07289.
562
+
563
+ Chuan Guo, Geoff Pleiss, Yu Sun, & Kilian Q Weinberger (2017). On Calibration of Modern Neural Networks. arXiv e-print: 1706.04599.
564
+
565
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, & Jian Sun (2016). Deep Residual Learning for Image Recognition. In: The IEEE Conference on Computer Vision and Pattern Recognition (CVPR). eprint: 1512.03385.
566
+
567
+ Matthew D Hoffman & Andrew Gelman (2014). The No-U-turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research 15.1, pp. 1593–1623.
568
+
569
+ Sergey Ioffe & Christian Szegedy (2015). Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv e-print:1502.03167.
570
+
571
+ Diederik Kingma & Jimmy Ba (2014). Adam: A method for stochastic optimization. arXiv eprint:1412.6980.
572
+
573
+ Alex Krizhevsky, Ilya Sutskever, & Geoffrey Hinton (2012). Imagenet classification with deep convolutional neural networks. In: Advances in Neural Information Processing Systems, pp. 1097– 1105.
574
+
575
+ Dong C Liu & Jorge Nocedal (1989). On the limited memory BFGS method for large scale optimization. Mathematical programming 45.1, pp. 503–528.
576
+
577
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike ´ Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Wattenberg, ´ Martin Wicke, Yuan Yu, & Xiaoqiang Zheng (2015). TensorFlow: Large-Scale Machine Learning on Heterogeneous Systems. Software available from tensorflow.org.
578
+
579
+ Kevin Murphy (2012). Machine Learning: A Probabilistic Perspective. The MIT Press.
580
+
581
+ Radford M Neal et al. (2011). MCMC using Hamiltonian dynamics. Handbook of Markov Chain Monte Carlo 2.11.
582
+
583
+ Sachin Ravi & Hugo Larochelle (2017). Optimization as a model for few-shot learning. In: International Conference on Learning Representations. Vol. 1. 2, p. 6.
584
+
585
+ John Salvatier, Thomas. Wiecki, & Christopher Fonnesbeck (2016). Probabilistic programming in Python using PyMC3. PeerJ Computer Science 2, e55.
586
+
587
+ Karen Simonyan & Andrew Zisserman (2014). Very deep convolutional networks for large-scale image recognition. arXiv e-print:1409.1556.
588
+
589
+ Jake Snell, Kevin Swersky, & Richard Zemel (2017). Prototypical Networks for Few-shot Learning. arXiv e-print: 1703.05175.
590
+
591
+ Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, & Ruslan Salakhutdinov (2014). Dropout: a simple way to prevent neural networks from overfitting. Journal of machine learning research 15.1, pp. 1929–1958.
592
+
593
+ Nitish Srivastava & Ruslan R Salakhutdinov (2013). Discriminative transfer learning with tree-based priors. In: Advances in Neural Information Processing Systems, pp. 2094–2102.
md/train/r1QZ3zbAZ/r1QZ3zbAZ.md ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADVERSARIAL EXAMPLES FOR NATURAL LANGUAGECLASSIFICATION PROBLEMS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Modern machine learning algorithms are often susceptible to adversarial examples — maliciously crafted inputs that are undetectable by humans but that fool the algorithm into producing undesirable behavior. In this work, we show that adversarial examples exist in natural language classification: we formalize the notion of an adversarial example in this setting and describe algorithms that construct such examples. Adversarial perturbations can be crafted for a wide range of tasks — including spam filtering, fake news detection, and sentiment analysis — and affect different models — convolutional and recurrent neural networks as well as linear classifiers to a lesser degree. Constructing an adversarial example involves replacing $10 { - } 3 0 \%$ of words in a sentence with synonyms that don’t change its meaning. Up to $90 \%$ of input examples admit adversarial perturbations; furthermore, these perturbations retain a degree of transferability across models. Our findings demonstrate the existence of vulnerabilities in machine learning systems and hint at limitations in our understanding of classification algorithms.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Modern machine learning algorithms are often susceptible to adversarial examples — maliciously crafted inputs that are undetectable by humans but that fool the algorithm into producing undesirable behavior. Adversarial examples arise in image classification (Szegedy et al., 2014), speech recognition (Carlini et al., 2016), reinforcement learning (Behzadan & Munir, 2017) and in other domains. The existence of adversarial inputs has obvious security implications and also reveals important shortcomings in our understanding of modern machine learning algorithms.
12
+
13
+ In this work, we study adversarial perturbations in the context of natural language, and show that common text classification algorithms are affected by adversarially crafted inputs. Our work formalizes the notion of an adversarial example in natural language classification and proposes algorithms for constructing such examples. We also investigate reasons that give rise to adversarial examples, and identify two distinct factors affecting the vulnerability of a model; the first originates in the embedding layer of a neural network classifier, while the second originates in the hidden layers.
14
+
15
+ Constructing adversarial inputs typically involves replacing $10 { - } 3 0 \%$ of words in a sentence with synonyms that don’t change its original meaning. Our experiments suggest that such inputs can be consistently constructed across multiple domains — including spam classification, fake news detection, and sentiment analysis — and in different models — convolutional and recurrent neural networks as well as linear classifiers to a lesser degree. Up to $90 \%$ of input examples admit adversarial perturbations; furthermore, these perturbations retain a degree of transferability across models.
16
+
17
+ Our findings suggest the existence of vulnerabilities in text classification systems and hint at limitations in our understanding of these systems. More generally, our work highlights the need to further investigate adversarial inputs in natural language tasks as well as in classification problems over discrete inputs.
18
+
19
+ Task: Spam filtering. Classifier: LSTM. Original label: $100 \%$ Spam. New label: $89 \%$ Non-Spam.
20
+
21
+ Text: your application petition has been accepted recognized thank you for your loan borrower request petition , which we recieved yesterday , your refinance subprime application petition has been accepted recognized good credit or not , we are ready to give you a $\$ 5$ oov loan , after further review , our lenders have established the lowest monthly payments . approval process will take only 1 minute . please visit the confirmation link below and fill-out our short 30 second secure web-form . http : oov
22
+
23
+ # Task: Sentiment analysis. Classifier: CNN. Original label: $81 \%$ Positive. New label: $100 \%$ Negative.
24
+
25
+ Text: i went moved to wing wednesday which is all-you-can-eat wings for $\$ 5$ oov even though they raise the prices it ’s still ever really great deal . you can eat as many wings you want to get all the different flavors tastes and have a good time enjoying the atmosphere . the girls are smoking hot ! all the types of sauces dressings are awesome ! and i had at least 25 wings in one sitting . i would definitely certainly go again just simply not every wednesday friday maybe once a month .
26
+
27
+ Task: Fake news detection. Classifier: Naive Bayes. Original label: $9 7 \%$ Fake. New label: $100 \%$ Real
28
+
29
+ Text: trump supporter whose brutal ferocious beating by black mob gangsta was caught on video tape asks demands : “ what happened to america ? ” [ video ] , ” david oov , a 49 year old former chicago rochester man who was brutally beaten by a mob lowlife of black democrats asks demands , “ what happened to america ? ” here is his very sad disappointing story
30
+
31
+ Figure 1: Adversarial examples for three natural language classification tasks. Replacing a fraction of the words in a document with adversarially-chosen synonyms fools classifiers into predicting an incorrect label. The new document is classified correctly by humans, and preserves most of the original meaning, although it contains small factual and grammatical errors.
32
+
33
+ # 2 BACKGROUND
34
+
35
+ We study classification problems, in which the goal is to learn a mapping $f : \mathcal { X } \mathcal { Y }$ from an input $x \in \mathcal { X }$ to a target label $y \in \mathcal { V }$ , which lies in some finite set of $K$ classes $\mathcal { V } = \{ y _ { 1 } , y _ { 2 } , . . . , y _ { K } \}$ . The classifier $f$ associates a score $f _ { y _ { k } } ( x )$ to each class $y _ { k }$ and outputs the class with the highest score. In this paper, $f$ will be parametrized by a deep neural network or a linear model.
36
+
37
+ # 2.1 ADVERSARIAL EXAMPLES AND IMAGE CLASSIFICATION
38
+
39
+ Despite recent successes, modern classification algorithms based on deep neural networks are susceptible to adversarial examples (Szegedy et al., 2014), which are maliciously crafted inputs that are indistinguishable from real examples by humans, but that cause the algorithm to misbehave.
40
+
41
+ In the context of image classification, given a classifier $f$ , we say that $x ^ { \prime }$ is an adversarial perturbation of $x$ targeting class $y ^ { \prime }$ (distinct from the true class $y$ of $x$ ) if
42
+
43
+ $$
44
+ f ( x ^ { \prime } ) = y ^ { \prime } { \mathrm { ~ } } { \mathrm { a n d ~ } } \| x - x ^ { \prime } \| \leq \epsilon .
45
+ $$
46
+
47
+ The norm $\lVert \cdot \rVert$ captures the notion of an imperceptible perturbation; popular choices include the $\ell _ { 2 }$ or the $\ell _ { \infty }$ norms. For simplicity, we refer to $x ^ { \prime }$ as an adversarial example for $f$ .
48
+
49
+ Adversarial examples can be obtained by solving an optimization problem of the form
50
+
51
+ $$
52
+ \operatorname* { m a x } _ { x ^ { \prime } } J ( x ^ { \prime } ) \mathrm { s . t . } \| x - x ^ { \prime } \| \leq \epsilon ,
53
+ $$
54
+
55
+ in which the objective $J ( x ^ { \prime } )$ measures the extent to which $x ^ { \prime }$ is adversarial and may be a function of a target class $y ^ { \prime } \ne y$ , e.g. $\dot { J } ( x ^ { \prime } ) = f _ { y ^ { \prime } } ( x ^ { \prime } )$ . Algorithms for solving the above objective include the Fast Gradient Sign method or iterative methods based on constrained gradient descent (Goodfellow et al., 2014; Papernot et al., 2016).
56
+
57
+ # 2.2 CLASSIFYING NATURAL LANGUAGE UTTERANCES
58
+
59
+ Text classification problems arise in varous domains, including biomedical (Aggarwal & Zhai, 2012), spam filtering (Androutsopoulos et al., 2000), and financial (Schumaker & Chen, 2009).
60
+
61
+ Linear classifiers with $n$ -gram features often perform surprisingly well on text classification benchmarks (Wang & Manning, 2012). In recent years, variants of recurrent networks — especially classifiers based on long short-term memory (Hochreiter & Schmidhuber, 1997) — have helped improve state-of-the-art accuracy; most recently, convolutional neural networks have been shown to be competitive with recurrent methods (Kim, 2014; Zhang et al., 2015)
62
+
63
+ Natural language classification problems distinguish themselves from image classification by their discrete nature (the inputs $x$ consist of discrete symbols such as characters or words) and by their higher dimensionality, which is typically proportional to vocabulary size. Furthermore, natural language representations are in a sense “higher-level” than image pixels, since they raw words encode significantly more meaning than raw pixel values. These differences pose natural constraints on the notion of an adversarial example, which our work explores.
64
+
65
+ # 3 ADVERSARIAL EXAMPLES FOR NATURAL LANGUAGE CLASSIFICATION
66
+
67
+ This work explores adversarial examples in the context of natural language classification. Defining adversarial inputs for text classifiers is complicated by two problems: first, there is no simple notion of metric between utterances (making it difficult to define an imperceptible perturbation); second, discrete inputs are not amenable to gradient-based methods and thus require new optimization algorithms.
68
+
69
+ In this section, we first propose a general notion of adversarial perturbation that applies to both continuous and discrete inputs. Then, we instantiate this notion in the context of language classification. Finally, we propose a general optimization algorithm for constructing adversarial inputs; the following section examines our approach experimentally.
70
+
71
+ # 3.1 ALTERED ADVERSARIAL EXAMPLES
72
+
73
+ A large class of adversarial inputs are formed by adding imperceptible perturbations to ordinary dataset samples. We propose to refer to this general type of adversarial attack as altered adversarial examples.
74
+
75
+ Given a classifier $f$ , we say that $x ^ { \prime }$ is an adversarial alteration of $x$ targeting class $y ^ { \prime }$ if
76
+
77
+ $$
78
+ f ( x ^ { \prime } ) = y ^ { \prime } { \mathrm { ~ } } { \mathrm { a n d ~ } } c ( x , x ^ { \prime } ) \leq \gamma ,
79
+ $$
80
+
81
+ for some domain-specific constraint function $c : \mathcal { X } \times \mathcal { X } \to \mathbb { R } _ { + } ^ { L }$ and a vector of bounds $\gamma \in \mathbb { R } ^ { L }$ that capture the notion of imperceptible alteration via $L \geq 1$ constraints. For example, in the context of chemical molecules, we may use $c$ to capture the edit distance between $x$ and $x ^ { \prime }$ or the similarity of the molecules’ three-dimensional structure. In the context of image classification, we recover the original notion of adversarial examples by taking $c$ to be an $\ell _ { 2 }$ or $\ell _ { \infty }$ norm constraint.
82
+
83
+ Our definition in contrast to other types of adversarial inputs explored in the literature. These include obfuscated examples (Carlini et al., 2016) — in which the input appears as white noise but triggers unwanted behavior (e.g., audio that turns on a smartphone) — and concatenative examples (Jia & Liang, 2017) — in which the input is combined with a distracting sequence that contains irrelevant information. Altered examples, on the other hand, encompass the original notion of adversarial perturbation, and apply in arguably more common settings, such as in classification.
84
+
85
+ # 3.2 ADVERSARIAL EXAMPLES FOR NATURAL LANGUAGE CLASSIFICATION
86
+
87
+ In a natural language context, we would intuitively like the altered examples $x ^ { \prime }$ to retain the same meaning as the original $x$ .In some settings, it may also be sufficient to generate examples that humans and machines classify into different classes, without requiring that they exactly paraphrase the initial input.
88
+
89
+ To capture the above intuition, we propose to use a specially-crafted constraint function $c ( \boldsymbol { x } , \boldsymbol { x } ^ { \prime } )$ ; the goal of this function is to ensure that both utterances share the same meaning and retain common syntactic properties (e.g. the style of writing should remain similar). Specifically, the function $c$ is comprised on two constraints that capture sentence similarity on two levels.
90
+
91
+ Semantic similarity. We propose capturing the meaning of an utterance using the notion of a thought vector (Bengio et al., 2003; Mikolov et al., 2013). A thought vector can be seen as a mapping from sentences to a vector space, in which sentences with similar meanings are close to each other. In this context, our constraint is defined as
92
+
93
+ $$
94
+ \| v - v ^ { \prime } \| _ { 2 } < \gamma _ { 1 }
95
+ $$
96
+
97
+ where $v$ and $v ^ { \prime }$ are thought vectors associated with $x$ and $x ^ { \prime }$ , respectively, and $\gamma _ { 1 }$ is a hyperparameter.
98
+
99
+ There exist many ways of computing thought vectors for sentences, most of which will be compatible with our optimization algorithm. In the rest of the paper, we will restrict our attention to thought vectors that are averages of the vectors for individual words.
100
+
101
+ Syntactic similarity. Generally, thought vectors do not capture the syntactic validity of a sentence; for example, rearranging all the words in a sentence will produce the same word vector average. To ensure that adversarial sentences are well-formed, we introduce a syntactic constraint, which relies on a language model $P : \mathcal { X } [ 0 , 1 ]$ . Specifically, we require that the language model probability be similar between the perturbed and the original example.
102
+
103
+ $$
104
+ | \log P ( x ^ { \prime } ) - \log P ( x ) | < \gamma _ { 2 }
105
+ $$
106
+
107
+ We suggest training a language model on the same dataset as $f$ ; this allows the model to capture the extent to which $x$ “looks like” a spam message or a movie review. We also require that the language model probabilities of $x$ and $x ^ { \prime }$ be similar: thus if $x$ is an ungrammatical sentence (i.e. a review uses incorrect English), then $x ^ { \prime }$ should retain a similar level of correctness.
108
+
109
+ # 3.3 GREEDY CONSTRUCTION OF ALTERED ADVERSARIAL EXAMPLES
110
+
111
+ Altered adversarial examples can be obtained by solving an optimization problem of the form
112
+
113
+ $$
114
+ \operatorname* { m a x } _ { x ^ { \prime } } J ( x ^ { \prime } ) \mathrm { s . t . } c ( x , x ^ { \prime } ) \leq \gamma ,
115
+ $$
116
+
117
+ in which the objective $J ( x ^ { \prime } )$ measures the extent to which $x ^ { \prime }$ is adversarial and may be a function of a target class $y ^ { \prime } \ne y$ , e.g. $J ( x ^ { \prime } ) = f _ { y ^ { \prime } } ( x ^ { \prime } )$ . We propose solving this optimization problem approximately using a greedy heuristic outlined as Algorithm 1.
118
+
119
+ In brief, we propose an iterative procedure that considers at each step all valid one-word changes to a sentence (i.e. which satisfy our constraints) and chooses the one that improves the objective the most. This procedure effectively replaces individual words with their synonyms, resulting in a new sentence of the same length that approximately preserves the original meaning.
120
+
121
+ Data: Datapoint $x$ , termination threshold $\tau$ , neighborhood size $N$ , parameters $\gamma _ { 1 } , \gamma _ { 2 } , \delta$ .
122
+ We initialize the algorithm at the uncorrupted data point: $x ^ { \prime } \gets x$ ;
123
+ while Objective is below the threshold $J ( x ^ { \prime } ) < \tau$ and fraction of words replaced is less than $\delta$ do Create a working set $W = \emptyset$ ; for each word $w$ in $x$ do for each word $\bar { w }$ among the $N$ closest to w and different from $w$ do substitute $w ^ { \prime }$ with $\bar { w }$ to get $\bar { x }$ and if $\bar { x }$ satisfies Equ. (5), then $W W \cup \{ x ^ { \prime } \}$ ; Choose highest scoring world replacement $x ^ { \prime } \arg \operatorname* { m a x } _ { \bar { x } \in W } J ( \bar { x } )$ or if $W = \emptyset$ , then break ;
124
+ return $x ^ { \prime }$ ;
125
+
126
+ Algorithm inputs. Algorithm 1 requires access to a target classifier $f$ ; it transforms $x$ into $x ^ { \prime }$ by optimizing the objective $J$ . We assume that $x$ is a set of $n$ discrete symbols called words and denoted by $w _ { i }$ for $i = 1 , 2 , . . . , n$ . Although we define our algorithm in the context of natural language, it easily extends to general discrete problems as well.
127
+
128
+ Optimization strategies. First, we place a bound $\delta$ on the fraction of words that can be substituted, i.e. $\textstyle \sum _ { i = 1 } ^ { n } \mathbb { I } \{ w _ { i } \neq w _ { i } ^ { \prime } \} \leq \delta \cdot n$ ; this enables us to “give up” on an example when it clearly does not admit an adversarial alteration. We also set a minimum threshold $\tau$ on the objective (e.g. the minimum desired score of the target label) and terminate when we reach it.
129
+
130
+ <table><tr><td>bad</td><td>delicious</td><td>enjoy</td></tr><tr><td>inclement</td><td>yummy</td><td>enjoying</td></tr><tr><td>mala</td><td>scrumptious</td><td>enjoys</td></tr><tr><td>naughty</td><td>appetizing</td><td>experience</td></tr><tr><td>rotten</td><td>tasty</td><td>savor</td></tr><tr><td>amiss</td><td>delectable</td><td>savoring</td></tr></table>
131
+
132
+ Table 1: Nearest neighbors in word vector space (Mrksiˇ c et al., 2016). ´
133
+
134
+ Word replacement. We replace words with their nearest neighbors in a suitable word vector space, and consider the $N$ closest neighbors. Thus, the neighbors are normally words that are likely to occur in the same context as the original word. To ensure that the replacements are also synonyms, we use the GloVE word vectors post-processed by with the method of Mrksiˇ c et al. (2016); this ensures that the vectors satisfy linguistic constraints ´ imposed by known synonym relations, and ensures that words with a similar meaning appear close to each other in the vector space (see Table 1).
135
+
136
+ # 4 EXPERIMENTS
137
+
138
+ # 4.1 TASKS
139
+
140
+ We study adversarial examples on three natural language classification tasks, summarized in Table 2. We held out $10 \%$ of the training set for validation; all adversarial examples are generated and evaluated on the test set. Likewise, we trained a trigram language model on the training set of each task and we instantiated the semantic constraint with the word vectors of Mrksiˇ c et al. (2016). We ´ describe our three classification tasks below.
141
+
142
+ Table 2: Summary of datasets and tasks
143
+
144
+ <table><tr><td>Dataset</td><td>Task</td><td>#Train</td><td>#Test</td></tr><tr><td>Trec07p</td><td> Spam filtering</td><td>67.9k</td><td>7.5k</td></tr><tr><td>Yelp</td><td>Sentiment analysis</td><td>560k</td><td>38k</td></tr><tr><td>News</td><td>Fake news detection</td><td>5.3k</td><td>1.0k</td></tr></table>
145
+
146
+ Spam filtering. The TREC 2007 Public Spam Corpus $( T r e c 0 7 p )$ contains 50,199 spam emails and 25,220 ham (non-spam) emails. We preprocess the data by removing all meta data and HTML tags. There is no standard split for this dataset, so we randomly pick $10 \%$ as a test set.
147
+
148
+ Sentiment analysis. The Yelp Review
149
+
150
+ Polarity dataset (Yelp; Zhang et al., 2015) consists of almost 600,000 customer reviews from Yelp, covering primarily restaurant reviews. Each review is labeled as either positive or negative.
151
+
152
+ Fake news detection. The News dataset (McIntire, 2017) contains 6,336 articles scraped from online sources, and includes both real and fake news. Each article contains a headline and body text (which we concatenated before classification) and is associated with a binary label.
153
+
154
+ # 4.2 MODELS
155
+
156
+ We study adversarial example on a range of models that are widely used for classification; these include both linear classifiers and state-of-the-art deep learning algorithms.
157
+
158
+ Naive Bayes. This linear model has a long history in text classification and it is still popular for its simplicity. We convert each document into a bag-of-words representation, and following Wang & Manning (2012), we binarize the word features and use a multinomial model for classification.
159
+
160
+ Long short-term memory. Long-short term memory (LSTM; Hochreiter & Schmidhuber, 1997) is widely used in sequence modeling. We built a single-layer LSTM with 512 hidden units as in Zhang et al. (2015). The input to the LSTM is first transformed to a 300-dimensional vector using pretrained word2vec embeddings (Mikolov et al., 2013). We then average the outputs of the LSTM at each timestep to obtain a feature vector for a final logistic regression to predict the sentiment.
161
+
162
+ Shallow word-level convolutional networks. An alternative approach to text classification are convolutional neural networks (CNNs; Kim, 2014) We train a CNN with an embedding layer (as in the LSTM) a temporal convolutional layer, followed by max-pooling over time, and a fully connected layer for classification. We use a uniform filter size of 3 in each convolutional feature map; all other settings are identical to those of Kim (2014).
163
+
164
+ Deep character-level convolutional networks. We implement the character-level network of Conneau et al. (2016), which includes 4 stages. Each stage has 2 convolutional layers with batch normalization and 1 max-pooling layer; convolutional and pooling layers have strides of 1 and 2, respectively and filters of size 3. We start with 64 feature maps, and double the amount after each pooling step, concluding with $\mathbf { k }$ -max pooling layer with $k = 8$ . The resulting activations in $\mathbb { R } ^ { 4 0 9 6 }$ are classified by 3 fully connected layers.
165
+
166
+ # 4.3 MAIN EXPERIMENTS
167
+
168
+ Table 3 shows the accuracy of each classification model on the three datasets as well as on adversarial inputs generated using Algorithm 1. We manually selected the optimization settings that led to a reasonable tradeoff between the strength and the coherence of the adversarial examples. Specifically, in all experiments, we used a target of $\tau = 0 . 7$ a neighborhood size of $N = 1 5$ , and parameters $\gamma _ { 1 } = 0 . 2$ and $\delta = 0 . 5$ ; we set the syntactic bound to $\gamma _ { 2 } = 2$ nats for sentiment analysis and fake news detection and $\gamma _ { 2 } = \infty$ for spam; spam messages were often malformed an the lan
169
+
170
+ Table 3: Classifier accuracy on each dataset. CLN, RND, and ADV stand for clean, randomly corrupted, and adversarially corrupted inputs, respectively.
171
+
172
+ <table><tr><td colspan="2">Data</td><td>NB</td><td>LSTM</td><td>WCNN</td><td>VDCNN</td></tr><tr><td rowspan="3">Trec07p</td><td>CLN</td><td>97.1%</td><td>99.1%</td><td>99.7%</td><td rowspan="3"></td></tr><tr><td>RND</td><td>97.7%</td><td>98.6%</td><td>99.6%</td></tr><tr><td>ADV</td><td>15.1%</td><td>39.8%</td><td>64.5%</td></tr><tr><td rowspan="3">Yelp</td><td>CLN</td><td>87.9%</td><td>95.3%</td><td>94.9%</td><td>95.1%</td></tr><tr><td>RND</td><td>86.8%</td><td>94.5%</td><td>94.7%</td><td>93.1%</td></tr><tr><td>ADV</td><td>9.0%</td><td>24.0%</td><td>39.0%</td><td>53.0%</td></tr><tr><td rowspan="3">News</td><td>CLN</td><td>91.0%</td><td>93.0%</td><td>96.0%</td><td>93.4%</td></tr><tr><td>RND</td><td>84.0%</td><td>94.6%</td><td>93.3%</td><td>92.7%</td></tr><tr><td>ADV</td><td>9.0%</td><td>37.0%</td><td>71.0%</td><td>11.0%</td></tr></table>
173
+
174
+ guage model was no longer useful. We also compare against random perturbations obtained by replacing the arg max in Algorithm 1 with random sampling.
175
+
176
+ All models are susceptible to adversarial examples to a certain degree, which depends in part on the task. Certain problems, such as spam filtering seem easier to classify and are less amenable to adversarial inputs; conversely, it is easier to fool the models on more difficult tasks, such as fake news detection. All methods are equally robust to random perturbations (just as image classifiers typically are), suggesting that adversarial inputs reside in very specific directions off the manifold of normal samples.
177
+
178
+ # 4.4 HUMAN EVALUATION
179
+
180
+ Table 4: Human classification accuracy on adversarial examples for the LSTM model.
181
+
182
+ <table><tr><td>Input</td><td>Trec07p</td><td>Yelp</td><td>News</td></tr><tr><td>Original</td><td>87%</td><td>93%</td><td>64%</td></tr><tr><td>Adversarial</td><td>93%</td><td>87%</td><td>58%</td></tr></table>
183
+
184
+ We verified the quality and the coherence of our examples via human experiments on Amazon Mechanical Turk. First, we subsampled a 100 random test set examples and asked human evaluators to assign labels (e.g. positive or negative review) to both the original data points, and their adversarially altered versions. We averaged the opinions of five different evaluations for each query. We found that human evaluators achieved similar accuracies on both types of inputs, suggesting that our adversarial alterations preserved key semantics sufficiently well to be recognized by a human. Human accuracy generally falls below that of the algorithms: the fake news task is inherently difficult, while non-spam email is often misclassified since there is no standard definition for “ham” emails; on sentiment analysis, both accuracies are within a reasonable margin of error.
185
+
186
+ Next, we asked human annotators to rate the “writing quality” of the same set of examples on a scale of one to five, with five being the highest possible quality and likely generated by a human, and one being the lowest quality, likely generated by a machine. Table 5 shows that humans tend to assign similar scores to both sets of samples. Although our adversarial examples were not perfectly formed, these results suggest that they were of comparable quality to the original examples (which also contained multiple spelling and grammar errors).
187
+
188
+ # 4.5 ERROR ANALYSIS
189
+
190
+ We found that our adversarial examples exhibit three kinds of errors: syntactic, semantic, and factual. Syntactic errors are ungrammatical word substitutions; these include replacing ”isis claim responsibility for shooting” with ”isis petition responsibility for shooting” and ”never before has an fbi director” to ”never until has an fbi director”; the first error is due to multiple word meanings, while the latter is due to the words being unrelated (and far in word vector space).
191
+
192
+ Table 5: Human classification accuracy on adversarial examples for the LSTM model.
193
+
194
+ <table><tr><td>Input</td><td>Trec07p</td><td>Yelp</td><td>News</td></tr><tr><td>Original</td><td>2.64</td><td>2.37</td><td>2.72</td></tr><tr><td>Adversarial</td><td>2.75</td><td>2.38</td><td>2.47</td></tr></table>
195
+
196
+ Semantic errors arise when the meaning of a sentence is altered. Most often, this is due to multiple word senses — e.g., ”isis claim responsibility for shooting” to ”isis claim responsibility for filming” — or due to word embedding errors — e.g., ”isis claim responsibility for ceasefire”. Factual errors are a special case when the sentence becomes obviously false, e.g. when chainging ”Monday, March 16” changed to ”Thursday, March $1 6 ^ { \circ }$ , or ”FBI assistant director james kallstrom” to ”Pentagon assistant director james kallstrom”, or ”republicans backing Trump” to ”republicans backing Obama”. These may not be an issue with fake reviews or fake news, and may be remedied via specialized techniques, e.g. by performing Named Entity Recognition.
197
+
198
+ # 4.6 TRANSFERABILITY
199
+
200
+ Table 6: Transferability of adversarial examples on the Yelp dataset. Row $i$ and column $j$ show the accuracy of adversarial samples generated for model $i$ evaluated on model $j$ .
201
+
202
+ <table><tr><td>NB</td><td>LSTM</td><td>WCNN</td><td>VDCNN</td></tr><tr><td>NB 20%</td><td>77%</td><td>75%</td><td>88%</td></tr><tr><td>LSTM 67%</td><td>17%</td><td>64%</td><td>83%</td></tr><tr><td>WCNN 63%</td><td>64%</td><td>17%</td><td>84%</td></tr><tr><td>VDCNN7%</td><td>85%</td><td>87%</td><td>23%</td></tr></table>
203
+
204
+ An intriguing property of image classification models is that adversarial examples generated for one classifier are likely to be misclassified by ther classifiers. We also examined whether adversarial texts transfer between the four models, focusing on the Yelp dataset. As seen in Table 6, there is a moderate degree of transferability between models. Interestingly, adversarial examples for three word level models (NB, LSTM, WCNN) do not generalize as well to the character level deep CNN as to other word level models, which suggests that the choice of input representation (character or word) is a factor that affects transferability.
205
+
206
+ # 4.7 EXPLAINING ADVERSARIAL EXAMPLES
207
+
208
+ We attribute the existence of adversarial examples to two factors, which we refer to as embeddingbased and representation-based. A neural network classifier for text contains two stages: first, an embedding layer maps discrete words into continuous vectors; then, the embeddings are classified via convolutional or fully-connected layers.
209
+
210
+ Representation-based errors arise in the higher layers of the network; these layers are very similar to those of image classifiers and are therefore susceptible to the same types of attacks. In other words, by replacing a word, we may adversarially push the embedding representation off the learned manifold into an adversarial region, causing a mislabel. Representation-level adversarial perturbations have been studied by Miyato et al. (2017) in the context of adversarial training, and we observed them in our experiments as well.
211
+
212
+ On the other hand, embedding-based errors can be attributed to the inherently high dimensionality of the vocabulary, and can be studied by looking at linear classifiers. For example, a perturbation for Naive Bayes implies that words which we consider equivalent (e.g., definitely and certainly)
213
+
214
+ occur with different frequencies among the two classes. This, in turn, can happen for two reasons: firstly, since the vocabulary is large, such words will arise due to statistical noise, unless the dataset is also very large; secondly, two words may truly have different conditional class probabilities, either because of multiple meanings (e.g., awfully great deal and awfully bad) or because of hidden patterns that we don’t understand (dogs are truly mentioned more often in spam than cats).
215
+
216
+ # 5 DISCUSSION
217
+
218
+ # 5.1 APPLICATIONS OF LANGUAGE-BASED ADVERSARIAL EXAMPLES
219
+
220
+ Our work demonstrates the existence of adversarial examples in state-of-the-art models for spam and sentiment classification (the fake news state-of-the-art is not yet established). The existence and transferability of such examples (obtained with very simple methods), hint at the existence of vulnerabilities in a number of systems; thes include text filtering systems (e.g., spam, racism), online ranking algorithms, speech command processors, and others. More generally, together with the work of Jia & Liang (2017), our observations lend further evidence to the prevalence of adversarial attacks in the natural language domain.
221
+
222
+ On the other hand, adversarial inputs can also improve algorithms via adversarial training (Shrivastava et al., 2016) by serving as extra data and thus increasing performance and robustness to adversarial attacks. Miyato et al. (2017) showed that adversarial perturbations to word embeddings are useful for semi-supervised learning; our findings hint at the possibility of adversarial training in the space of words.
223
+
224
+ # 5.2 COMPARISON TO OTHER DOMAINS
225
+
226
+ We found that adversarial examples are somewhat less abundant than in computer vision, especially on “easy” tasks such as spam classification. Interestingly, they affect linear models more; this smaller gap can be explained by the fact that text classification models are relatively shallow and word inputs are in a sense “higher-level” than pixels: they are more susceptible to perturbations and leave less work to the rest of the network. Although defining a metric between utterance is nontrivial, it is also somewhat more forgiving: in many domains (such as spam) grammatical errors are common, and the meaning does not get lost (or seem unnatural) with errors.
227
+
228
+ Finally, it’s interesting to note that language-based problems have more direct access to the system being attacked; adversarial images are typically processed by real-world sensors, which affects their strength Kurakin et al. (2016); language-based examples are fed into the system directly, which could make them more potent.
229
+
230
+ # 5.3 FUTURE WORK
231
+
232
+ Our results demonstrate the existence of natural-language adversarial perturbations. However, our simple perturbations could be improved via a more sophisticated algorithm that takes advantage of language processing technologies, such as syntactic parsing, named entity recognition, or paraphrasing, or that could be assisted by humans. Furthermore, the existing search procedure naturally generalizes to beam search, and could modify phrases rather than words. Interesting extensions apply to character-based substitutions, targeting both word- and character-based systems.
233
+
234
+ # 6 CONCLUSION
235
+
236
+ We generalize the concept of adversarial examples to natural language classification by proposing a simple yet effective similarity metric for text. Then evaluate our approach on several classification tasks and show that a simple greedy algorithm is effective at finding adversarial examples in each setting.
237
+
238
+ The presence of adversarial examples for text classification poses threat to real-world machine learning systems. We further study of adversarial examples for text classification with help defend these systems and improve the accuracy of classification algorithms via adversarial training.
239
+
240
+ # REFERENCES
241
+
242
+ Charu C Aggarwal and ChengXiang Zhai. Mining text data. Springer Science & Business Media, 2012.
243
+
244
+ Ion Androutsopoulos, John Koutsias, Konstantinos V Chandrinos, George Paliouras, and Constantine D Spyropoulos. An evaluation of naive bayesian anti-spam filtering. arXiv preprint cs/0006013, 2000.
245
+
246
+ Vahid Behzadan and Arslan Munir. Vulnerability of deep reinforcement learning to policy induction attacks. arXiv preprint arXiv:1701.04143, 2017.
247
+
248
+ Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic´ language model. Journal of machine learning research, 3(Feb):1137–1155, 2003.
249
+
250
+ Nicholas Carlini, Pratyush Mishra, Tavish Vaidya, Yuankai Zhang, Micah Sherr, Clay Shields, David Wagner, and Wenchao Zhou. Hidden voice commands. In USENIX Security Symposium, pp. 513– 530, 2016.
251
+
252
+ Alexis Conneau, Holger Schwenk, Lo¨ıc Barrault, and Yann Lecun. Very deep convolutional networks for text classification. arXiv preprint arXiv:1606.01781, 2016.
253
+
254
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
255
+
256
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
257
+
258
+ Robin Jia and Percy Liang. Adversarial examples for evaluating reading comprehension systems. arXiv preprint arXiv:1707.07328, 2017.
259
+
260
+ Yoon Kim. Convolutional neural networks for sentence classification. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2014.
261
+
262
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
263
+
264
+ George McIntire. Fake news dataset. https://github.com/GeorgeMcIntire/fake_ real_news_dataset, 2017. Accessed: 2017-10-27.
265
+
266
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
267
+
268
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. arXiv preprint arXiv:1704.03976, 2017.
269
+
270
+ Nikola Mrksiˇ c, Diarmuid ´ O S ´ eaghdha, Blaise Thomson, Milica Ga ´ siˇ c, Lina Rojas-Barahona, Pei- ´ Hao Su, David Vandyke, Tsung-Hsien Wen, and Steve Young. Counter-fitting word vectors to linguistic constraints. In Proceedings of HLT-NAACL, 2016.
271
+
272
+ Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In Security and Privacy (EuroS&P), 2016 IEEE European Symposium on, pp. 372–387. IEEE, 2016.
273
+
274
+ Robert P Schumaker and Hsinchun Chen. Textual analysis of stock market prediction using breaking financial news: The azfin text system. ACM Transactions on Information Systems (TOIS), 27(2): 12, 2009.
275
+
276
+ Ashish Shrivastava, Tomas Pfister, Oncel Tuzel, Josh Susskind, Wenda Wang, and Russ Webb. Learning from simulated and unsupervised images through adversarial training. arXiv preprint arXiv:1612.07828, 2016.
277
+
278
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In ICLR 2014, 2014.
279
+
280
+ Sida Wang and Christopher D Manning. Baselines and bigrams: Simple, good sentiment and topic classification. In Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics: Short Papers-Volume 2, pp. 90–94. Association for Computational Linguistics, 2012.
281
+
282
+ Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In Advances in Neural Information Processing Systems, pp. 649–657, 2015.
283
+
284
+ Classifier: LSTM. Original label: $91 \%$ Fake News. New label: $1 \%$ Fake News.
285
+
286
+ Text: difference discrepancy between growing up in the 1960s compared to 2016 , ” you are here $:$ home / us / difference discrepancy between growing up in the 1960s compared to 2016 difference between growing up in the 1960s compared to 2016 october 27 , 2016 pinterest seth oov reports that in august of this year , campus carry went moved into effect on texas ’ public demographic college campuses , enabling authorizing students and staff with among valid concealed handgun licenses to legally carry their firearms . predictably , leftists democrats freaked out at the idea of people legally carrying firearms in their “ safe spaces . ” as we reported back in august , the most famous form of protest on texas college campuses was “ oov not oov , ” a movement where students who opposed objected campus carry took picked adult sex toys with them all across the campus . related $:$ campus carry starts today monday in texas ; here ’s how liberal students are protesting ... despite these oov , campus carry is in effect in texas , and there is not mass murder happening in oov , classrooms , or professors ’ offices . who ’d have oov , right ? well ,
287
+
288
+ Classifier: Naive Bayes. Original label: $96 \%$ Fake News. New label: $0 \%$ Fake News.
289
+
290
+ Text: israel votes $:$ netanyahu ’s last-ditch vow to his base foundation - a dead peace process ( $^ +$ video ) , ” politicians make many campaign movements promises they do n’t intend to deliver render on . but netanyahu ’s promise monday thu to never agree subscribe to a palestinian state fits his record . israeli prime minister benjamin netanyahu talks as he visits a construction site in oov oov , east jerusalem , monday thu march 16 , 2015 , a day ahead of legislative elections . netanyahu is seeking his fourth iii term as prime minister . with via israel ’s final pre-election polls pointing portraying to a difficult road for prime minister benjamin netanyahu to stay in power , he spent his final days on the campaign trail throwing red meat to his base foundation . oov oov warned israeli voters that only mr. netanyahu has the strength to stand up to “ ” hussein obama . ” ” campaign movements ads advertisement compared israeli oov workers and regulators to hamas militants and called his opponents tools of shadowy foreign financiers ( a strange charge given his own close ties to us casino poker billionaire sheldon adelson ) . but on monday the prime minister delivered his show oov : vote
291
+
292
+ Classifier: WordCNN. Original label: $91 \%$ Fake News. New label: $1 \%$ Fake News.
293
+
294
+ Task:“ we must smash the clinton machine : democratic elites and the media sold out to hillary this time , but change is coming ” , ” a times story headlined “ obama gingrich privately stealthily tells narrates donors contributors time is coming to unite behind hillary ” had obama gingrich telling dnc high oov to “ come together . ” in it obama “ did n’t explicitly call on sanders to quit ” but a “ white house official ” confirmed his “ unusually candid ” words . it was a plant dressed up as a scoop . obama spoke not privately but on background , and not to his donors contributors but through via them ( and the paper ) to his base . it was a different portrait of obama as oov $:$ political , financial and media elites oligarchs , all working as one to put down a revolt . obama gingrich ’s neutrality is a polite scam . his ��� private ” chat came entered before voters in 29 states even had their say . presidents never let appointees make endorsements , but three obama cabinet secretaries – agriculture husbandry ’s tom vilsack , oov ’s julian castro and labor ’s thomas perez – backed clinton
295
+
296
+ Figure 2: Examples of adversarial text generated for Fake News Detection
297
+
298
+ # A APPENDIX
299
+
300
+ We include multiple examples of adversarially perturbed inputs in this appendix. We provide examples for each model and each task.
301
+
302
+ Classifier: Naive Bayes. Original label: $90 \%$ Negative. New label: $18 \%$ Negative.
303
+
304
+ Text: i ordered a carne asada burrito and it was garbage junk ! the carne asada tasted bad , thin and hard , just bad quality . roberto enrico ’s is not that great but it ’s better than this place
305
+
306
+ lassifier: LSTM. Original label: $9 7 \%$ Negative. New label: $0 \%$ Negative.
307
+
308
+ Text: this that place location is far from the the best pho experience i ’ve ever had ( that is almost a bad pun ) . it ’s really not bad , but there are much better vietnamese restaurants in vegas . the pho broth is n’t on the same level as pho so 1 or lemongrass cafe . for some reason , they were out of bean sprouts sprout and while i do n’t love them , i ’ve become accustomed to having them in my pho . finally , i was a little disappointed that they do n’t serve tripe in any of their pho variations . overall , although i did enjoy the soup , i probably wo n’t return . i need to try the jenni jenny pho place just down the street . if that does n’t work out , i ’ll just have to make the extra drive to chinatown .
309
+
310
+ Classifier: WordCNN. Original label: $90 \%$ Negative. New label: $10 \%$ Negative.
311
+
312
+ Text: give this place location 2 stars because of the new car buying experience . i have always owned possessed an acura and never really encountered problems with buying a new car . i was referred to a salesman chip , who by the way is amazing ! ! ! he was n’t there at the time and i wanted to purchase a brand new car , so i saw the next salesman named steve craig w. he was just as amazing as chip . he worked with us throughout our process and was incredibly patient with us . at the end of our car buying , we had a bump in the road and had a huge misunderstanding about the price of the car . steve w. remained retained professional and patient with us . when the sales manager , chris kyle b. came out , he was n’t happy with us . he was a tad bit short tempered with us and made us feel like crap . it ruined my experience with buying a car with acura , which is probably the reason why i am looking in henderson or california to buy ( has a much more competitive price as well
313
+
314
+ Classifier: VDCNN. Original label: $94 \%$ Negative. New label: $8 \%$ Negative.
315
+
316
+ Text: i wanted want to love you spicy pickle , but it was your pickle dill i liked enjoyed best . i had the bandito panini gorgonzola with peppered turkey , pepperjack , roasted red peppers , sundried tomatoes , chipotle mayo . i took the sandwich to go and by the time i got to eat , it was pretty soggy . the blend of flavors did n’t save it . i ’ll have to give it a second chance and dine in , maybe try a specialty sandwich instead equally .
317
+
318
+ Classifier: LSTM. Original label: $9 7 \%$ Negative. New label: $0 \%$ Negative.
319
+
320
+ Text: long lines but amazing surprising burger cheeseburger and fries chips as always consistently . i always get the double double and the fries nuggets animal style . you can not go wrong with that . manager was super sweet sugary and nice good
321
+
322
+ Classifier: Naive Bayes. Original label: $9 9 \%$ Negative. New label: $0 \%$ Negative.
323
+
324
+ Text: must preface this review by saying that this is the only time i visited nicky ’s thai kitchen ( or pittsburgh for that matter ) , so it could just be a fluke - maybe the chef had a bad day - but this is the second worst largest thai food i ’ve had anywhere in the world ... the worst largest was in aruba . i ’m a fan of thai food as you can tell - craving it even when on vacation in aruba - so i have a certain expectation when i saw the 4-star ratings for this restaurant . but was n’t i disappointed disappoint ! we ordered drunken noodles and panang curry , both with beef , and spicy . typical thai dish right ? wrong . what we got are two tasteless dorky dishes . the drunken noodles dish is not just bland and way too mild , but both the veggie and meat tasted stale old . the panang curry was equally unimpressive bland . the color of the broth may be right , but there is only a hint of curry taste in it . the meat was chewy succulent to the point that i gave up on
325
+
326
+ Figure 3: Examples of adversarial text generated for Sentiment Analysis
327
+
328
+ Classifier: Naive Bayes. Original label: $9 9 \%$ Spam. New label: $0 \%$ Spam.
329
+
330
+ Text: wondercum is a wonderful combination of fine herbs weed extract that are well known for centuries we do not have any branched or stores storing located anywhere whenever . http : oov
331
+
332
+ Classifier: LSTM. Original label: $73 \%$ Spam. New label: $0 \%$ Spam.
333
+
334
+ Text: view viewpoint pics images of christian protestant singles in your area realm meet cater christian protestant singles with oov values in your area realm . oov this email mailroom is a commercial advertisement publicity sent forwarded in compliance with the oov act of 2003. we have no desire volition to send you information that is not wanted , therefore similarly , if you wish to be excluded from future mailings , please use the link at the bottom of the page
335
+
336
+ Task: Spam Classification. Classifier: WordCNN. Original label: $89 \%$ Spam. New label: $0 \%$ Spam.
337
+
338
+ Text: your loan borrower application apps is waiting hoping dear pricey homeowner landowner are you still paying too much for your current mortgage subprime ? refinaance us best rate cadence . your approval ratification is waiting expecting . please respond cater oov http myspace $:$ oov helen edith gay lendingtree department administration
339
+
340
+ # Task: Spam Classification. Classifier: NB. Original label: $9 8 \%$ Spam. New label: $0 \%$ Spam.
341
+
342
+ Text: urgent : your paypal account has expired ! paypal body , td protect your account $\mathrm { i } 0 0 \mathrm { v } \dot { z }$ sure you never provide your password to fraudulent bogus websites . for more information on protecting yourself from fraud , please review our security tips at https : ¡oov¿ your $\mathrm { i } 0 0 \mathrm { v } \dot { z }$ should never give your paypal password to anyone , including paypal employees gov . upgrade your information dear member lawmakers , it has come to our attention that your paypal billing legislation information is out of date . therefore we have had to put a limit your paypal account . we require you to update your billing legislation information on or before 4th june 2007. failure to update your records may result in a suspension of your account . to update your paypal billing invoices information click the link below , login to your account with your email address and password and read the on screen instructions $:$ http $:$ //www.paypal.com/cgi-bin/webscr ? ¡oov¿ this security measure helps us continue to offer paypal as a secure and cost-effective payment service . we appreciate your cooperation and assistance . sincerely , the paypal team please do not reply to this email . this mailbox is not monitored oversight and you will not
343
+
344
+ # Task: Spam Classification. Classifier: WordCNN. Original label: $9 8 \%$ Spam. New label: $68 \%$ Spam.
345
+
346
+ Text: this job offer is just for you ! dear pricey sirs gentlemen , aegis sponsorship capital group llc ( aegis ) is a specialty expert investment capital firm managing private equity fairness and venture enterprise capital funds with into a national nationalist focus on small businesses and the social benefits advantages of supporting entrepreneurs corporations and enhancing reinforcing local job creation introduction . we would should like to stress , that our company enterprise pays special peculiar attention concentration to customer support of private particular customers subscribers , though we also have the corresponding business plans for the bigger companies as well correctly . a more wider detailed information about our company enterprise you may obtain at our official formal website venue . due to the necessity for expansion enlargement of our company enterprise , we have announced some additional openings for new employees officials . we are glad contented to offer supply you one of the vacant positions in our company business team a position stance of the ; account accountant manager admin .you will have the responsibility for the following duties obligations : fulfillment implementation of orders commandments given by the company enterprise , operations with the bank banco transfers assignments ( direct deposits filings and wires threads ) from into customers subscribers , implementation of calculations computations
md/train/r1laEnA5Ym/r1laEnA5Ym.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/rkaqxm-0b/rkaqxm-0b.md ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL COMPOSITIONAL DENOTATIONAL SEMANTICS FOR QUESTION ANSWERING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Answering compositional questions requiring multi-step reasoning is challenging for current models. We introduce an end-to-end differentiable model for interpreting questions, which is inspired by formal approaches to semantics. Each span of text is represented by a denotation in a knowledge graph, together with a vector that captures ungrounded aspects of meaning. Learned composition modules recursively combine constituents, culminating in a grounding for the complete sentence which is an answer to the question. For example, to interpret not green, the model will represent green as a set of entities, not as a trainable ungrounded vector, and then use this vector to parametrize a composition function to perform a complement operation. For each sentence, we build a parse chart subsuming all possible parses, allowing the model to jointly learn both the composition operators and output structure by gradient descent. We show the model can learn to represent a variety of challenging semantic operators, such as quantifiers, negation, disjunctions and composed relations on a synthetic question answering task. The model also generalizes well to longer sentences than seen in its training data, in contrast to LSTM and RelNet baselines. We will release our code.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Compositionality is a mechanism by which the meanings of complex expressions are systematically determined from the meanings of their parts, and has been widely assumed in the study of both natural languages (Montague, 1973), as well as programming and logical languages, as a means for allowing speakers to generalize to understanding an infinite number of sentences. Popular neural network approaches to question answering use a restricted form of compositionality, typically encoding a sentence word-by-word from left-to-right, and finally executing the complete sentence encoding against a knowledge source (Perez et al., 2017). Such models can fail to generalize from training sentences in surprising ways. Inspired by linguistic theories of compositional semantics, we instead build a latent tree of interpretable expressions over a sentence, recursively combining constituents using a small set of neural modules. When tested on longer questions than are found in the training data, we find that our model achieves higher performance than baselines using LSTMs and RelNets.
12
+
13
+ Our approach resembles Montague semantics, in which a tree of interpretable expressions is built over the sentence, with nodes combined by a small set of composition functions. However, both the structure of the sentence and the neural modules that handle composition are learned by end-to-end gradient descent. To achieve this, we define the parametric form of small set of neural modules, and then build a parse chart over each sentence subsuming all possible trees. Each node in the chart represents a span of text with a distribution over groundings (in terms of booleans and knowledge base nodes and edges), as well as a vector representing aspects of the meaning that have not yet been grounded. The representation for a node is built by taking a weighted sum over different ways of building the node (similarly to Maillard et al. (2017)).
14
+
15
+ Typical neural network approaches to grounded question answering first encode a question from left-to-right with a recurrent neural network (RNNs), and then evaluate the encoding against an encoding of the knowledge source (for example, a knowledge base or image) (Santoro et al., 2017). In contrast to classical approaches to compositionality, constituents of complex expressions are not given explicit interpretations in isolation. For example, in Which cubes are large or green?, an RNN encoder will not explicitly build an interpretation for the expression large or green. We show that such approaches can generalize poorly when tested on more complex sentences than they were trained on. In contrast, our approach imposes strong independence assumptions that give a linguistically motivated inductive bias. In particular, it enforces that phrases are interpreted independently of surrounding words, allowing the model to generalize naturally to interpreting phrases in different contexts. In the previous example, large or green will be represented as a particular set of entities in a knowledge graph, and be intersected with the set of entities represented by the cubes node.
16
+
17
+ ![](images/3e5ee45df3806e70730c7a946cf9d9784259baa6a59de50b2aaa5a49ac02fbfd.jpg)
18
+ Figure 1: A correct parse for a question given the knowledge graph on the right, using our model. We show the type for each node, and its denotation in terms of the knowledge graph. The words or and not are represented by vectors, which parameterize composition modules. The denotation for the complete question represents the answer to the question. Nodes here have types $E$ for sets of entities, $R$ for relations, $V$ for ungrounded vectors, $E V$ for a combination of entities and a vector, and $\phi$ for semantically vacuous nodes. While we show only one parse tree here, our model builds a parse chart subsuming all trees.
19
+
20
+ Another perspective on our work is as a method for learning the layouts of Neural Module Networks (NMNs) (Andreas et al., 2016b). Work on NMNs has focused on how to construct the structure of the network, variously using rules, parsers and reinforcement learning (Andreas et al., 2016a; Hu et al., 2017). Our end-to-end differentiable model jointly learns structures and modules by gradient descent.
21
+
22
+ # 2 MODEL OVERVIEW
23
+
24
+ Our task is to answer a question $q = w _ { 1 \ldots | q | }$ , with respect to a Knowledge Graph (KG) consisting of nodes $\mathcal { E }$ (representing entities) and labelled directed edges $\mathcal { R }$ (representing relationship between entities). In our task, answers are either booleans, or specific subsets of nodes from the KG.
25
+
26
+ Our model builds a parse for the sentence, in which phrases are grounded in the KG, and a small set of composition modules are used to combine phrases, resulting in a grounding for the complete question sentence that answers the question. For example, in Figure 1, the phrases not and cylindrical are interpreted as a function word and an entity set, and then not cylindrical is interpreted by computing the complement of the entity set. The node at the root of the parse tree is the answer to the question.
27
+
28
+ We describe a compositional neural model that answers such questions by:
29
+
30
+ 1. Grounding individual tokens in a Knowledge Graph. Tokens can either be grounded as particular sets of entities and relations in the KG, as ungrounded vectors, or marked as being semantically vacuous. For each word, we learn parameters that are used to compute a distribution over semantic types and corresponding denotations in a KG (§ 4.1).
31
+ 2. Combining representations for adjacent phrases into representations for larger phrases, using trainable neural composition modules $( \ S 3 . 2 )$ . This produces a denotation for the phrase.
32
+ 3. Assigning a binary-tree structure to the question sentence, which determines how words are grounded, and which phrases are combined using which modules. We build a parse chart subsuming all possible structures, and train a parsing model to increase the likelihood of structures leading to the correct answer to questions. Different parses leading to a denotation for a phrase of type $t$ are merged into an expected denotation, allowing dynamic programming $( \ S 4 )$ .
33
+ 4. Answering the question, with the most likely grounding of the phrase spanning the sentence.
34
+
35
+ # 3 COMPOSITIONAL SEMANTICS
36
+
37
+ # 3.1 SEMANTIC TYPES
38
+
39
+ Our model classifies spans of text into different semantic types to represent their meaning as explicit denotations or ungrounded vectors. All phrases are assigned a distribution over semantic types. The semantic type determines how a phrase is grounded, and which composition modules can be used to combine it with other phrases. A phrase spanning $w _ { i \ldots j }$ has a denotation $[ [ w _ { i . . j } ] ] _ { K G } ^ { t }$ for each semantic type $t$ J K. For example, in Figure 1, red thing corresponds to a set of entities, left corresponds to a set of relations, and not is treated as an ungrounded vector.
40
+
41
+ The semantic types we define can be classified into the three different categories. Below we describe these semantic types and their corresponding representations.
42
+
43
+ Grounded Semantic Types: Spans of text that can be fully grounded in the KG.
44
+
45
+ 1. Entity $\mathbf { ( E ) }$ : Spans of text that can be grounded to a set of entities in the KG, for example: red sphere or large cube. $\mathbf { E }$ -type span grounding is represented as a soft-attention value for each entity, $[ p _ { e _ { 1 } } , \dotsc , p _ { e _ { | \varepsilon | } } ]$ , where $0 \leq p _ { e _ { i } } \leq 1$ . This can be viewed as a soft version of a logical set-valued denotation, which we refer to as a ‘soft entity set’.
46
+
47
+ 2. Relation $\mathbf { ( R ) }$ : Spans of text that can be grounded to a set of relations from the KG, for example: left of or not right of or above. R-type span grounding is represented by a soft adjacency matrix $A \in \mathbb { R } ^ { | \mathcal { E } | \times | \mathcal { E } | }$ where $A _ { i j } = 1$ denotes a directed edge from $e _ { i } \to e _ { j }$ .
48
+
49
+ 3. Truth (T): Spans of text that can be interpreted as having a True/False denotation, for example: Is anything red?, $I s$ one ball green and are no cubes red? T-type span grounding is represented using a real-value $p _ { t r u e }$ , $0 \leq p _ { t r u e } \leq 1$ , that denotes the probability of the span being True.
50
+
51
+ Ungrounded Semantic Types: Spans of text whose meaning cannot be grounded in the KG.
52
+
53
+ 1. Vector (V): This type is used for spans representing functions that cannot yet be grounded in the KG, for example words such as and or every. These spans are represented using 4 different real-valued vectors $v _ { 1 } \in \mathbb { R } ^ { 2 } , v _ { 2 } \in \mathbb { R } ^ { 3 } , v _ { 3 } \in \mathbb { R } ^ { 4 } , v _ { 4 } \in \mathbb { R } ^ { 5 }$ that are used to parameterize different composition modules described below in $\ S 3 . 2$ .
54
+
55
+ 2. Vacuous $( \phi )$ : Spans that are considered semantically vacuous, but are necessary syntactically, e.g. of in left of a cube. During composition, these nodes act as identity functions.
56
+
57
+ Partially-Grounded Semantic Types: Spans of text that can only be partially grounded in the knowledge graph, such as and red or are four spheres. Here, we represent the span by a combination of a grounding and vectors, representing grounded and ungrounded aspects of meaning respectively. The grounded component of the representation will typically combine with another fully grounded representation, and the ungrounded vectors will parameterize the composition module. We define 3 semantic types of this kind: EV, RV and TV, corresponding to the combination of entities, relations and boolean groundings with an ungrounded vector. Here, the word represented by the vectors can be viewed as a binary function, one of whose arguments has been supplied.
58
+
59
+ # 3.2 COMPOSITION MODULES
60
+
61
+ Next, we describe how we compose phrase representations (from $\ S 3 . 1 )$ to create representations for larger phrases. We define a small number of generic composition modules, that take as input two constituents of text with their corresponding semantic representations (grounded representations and ungrounded vectors), and outputs the semantic type and corresponding representation of the larger constituent. The composition modules are parameterized by the trainable word vectors.
62
+
63
+ These can be divided into several categories:
64
+
65
+ Composition modules resulting in fully grounded denotations: Described in Figure 2.
66
+
67
+ ![](images/ef3ce494ebce8a87057633fea6542442deb0c6193fcdd67293d68026bd3be4a5.jpg)
68
+
69
+ $$
70
+ \begin{array} { r l } & { \quad \ ' \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \cup _ { e _ { i } } = \sigma \Bigl ( \mathbf { v _ { 1 } } \cdot \left[ \begin{array} { l } { p _ { e _ { i } } ^ { R } } \\ { 1 } \end{array} \right] \Bigr ) } \\ & { \underset { \ @ \ @ } { \mathsf { V } } \quad \mathsf { c y l i n d r i c a l } } \\ & { \underset { \bigodot \updownarrow } { \mathsf { C y l i n d r i c a l } } } \end{array}
71
+ $$
72
+
73
+ $\mathbf { E } + \mathbf { E } \mathbf { E }$ : This module performs a function on a pair of soft entity sets, parameterized by the model’s global parameter vector $[ w _ { 1 } , w _ { 2 } , b ]$ to produce a new soft entity set. The composition function for a single entity’s resulting attention value is shown. Such a composition module can be used to interpret compound nouns and entity appositions. For example, the composition module shown above learns to output the intersection of two entity sets.
74
+
75
+ $$
76
+ \begin{array} { r } { \begin{array} { c } { \bullet _ { \boxtimes \mathbf { E } } ^ { \cup } } \\ { \hfill \phantom { \sum } _ { \begin{array} { c } { \prime } \\ { \prime } \\ { \mathbf { E } } \\ { \mathbf { E } } \end{array} } \setminus \begin{array} { r } { p _ { e _ { i } } = \sigma \left( \mathbf { v _ { 2 } } \cdot \left[ \begin{array} { l } { p _ { e _ { i } } ^ { L } } \\ { p _ { e _ { i } } ^ { R } } \\ { 1 } \end{array} \right] \right.} \\ { \vdots \hfill \mathrm { ~ s u r ~ o r ~ p u r p 1 e } } \\ { \mathbf { \bigoplus } _ { \mathbf { 0 } } \mathbf { E } } \end{array} } \end{array} } \end{array}
77
+ $$
78
+
79
+ $\mathbf { V } + \mathbf { E } \mathbf { E }$ : This module performs a function on a soft entity set, parameterized by a word vector, to produce a new soft entity set. For example, the word not learns to take the complement of a set of entities. The entity attention representation of the resulting span is computed by using the indicated function that takes the $\boldsymbol { v } _ { 1 } \in \mathbb { R } ^ { 2 }$ vector of the $\mathbf { V }$ constituent as a parameter argument and the entity attention vector of the $\mathbf { E }$ constituent as a function argument.
80
+
81
+ ![](images/5ce6a0e45402c1bb7b4dbe583d64a0e14efc9b650262ab7a978f2824679378bf.jpg)
82
+
83
+ $\mathbf { E V + E E }$ : This module combines two soft entity sets into a third set, parameterized by the $v _ { 2 }$ word vector. This composition function is similar to a linear threshold unit and is capable of modeling various mathematical operations such as logical conjunctions, disjunctions, differences etc. for different values of $v _ { 2 }$ . For example, the word or learns to model set union.
84
+
85
+ $$
86
+ \begin{array}{c} \begin{array} { r l } & { \overline { { \mathrm { I } \mathrm { \tiny ~ T r u e } } } } \\ & { \qquad \boldsymbol { \Bigg / } ^ { \mathsf { T } } \setminus \underbrace { p _ { t r u e } } _ { \mathsf { E } } = \sigma ( v _ { 3 } ^ { 1 } \Bigg [ \sum _ { e _ { i } } \sigma ( [ v _ { 3 } ^ { 3 } ] \cdot [ \begin{array} { l } { p _ { e _ { i } } ^ { R } } \\ { 1 } \end{array} ] } \end{array} ) ] + v _ { 3 } ^ { 2 } ) \\ & { \qquad \mathsf { V } } \\ & { \textsf { s } \underset { \ @ \boldsymbol { \Psi } } { \mathsf { a n y t h i n g ~ c y l } } \mathrm { i n d r ~ i c a l } } \\ & { \qquad \boldsymbol { \Theta } \stackrel { \qquad } { \Pi } \overleftrightarrow { \boldsymbol { \Psi } } \big \square } \end{array}
87
+ $$
88
+
89
+ $\mathbf { R } + \mathbf { E } \mathbf { E }$ : This module composes a set of relations (represented as a single soft adjacency matrix) and a soft entity set to produce an output soft entity set. The composition function uses the adjacency matrix representation of the $\mathbf { R }$ -span and the soft entity set representation of the E-span.
90
+
91
+ $\mathbf { V } + \mathbf { E } \mathbf { T }$ : This module maps a soft entity set onto a soft boolean, parameterized by word vector $( v _ { 3 } )$ . The module counts whether a sufficient number of elements are in (or out) of the set. For example, the word any should test if a set is non-empty.
92
+
93
+ $$
94
+ \begin{array} { r l } & { \underbrace { \overline { { \left[ \mathsf { F a l s e } \right] } } } _ { \displaystyle { \int } } \mathsf { T } _ { \mathrm { \normalfont ~ \ " ~ \ " ~ } } p _ { t r u e } = \sigma \left( v _ { 4 } ^ { 1 } \left[ \sum _ { e _ { i } } \sigma \left( \begin{array} { c } { \left[ v _ { 4 } ^ { 3 } \right] } \\ { v _ { 4 } ^ { 4 } } \\ { \left[ v _ { 5 } ^ { 5 } \right] } \end{array} \cdot \left[ \begin{array} { c } { p _ { e _ { i } } ^ { L } } \\ { p _ { e _ { i } } ^ { R } } \\ { 1 } \end{array} \right] \right) \right] + v _ { 4 } ^ { 5 } \right) } \\ & { \vdots \begin{array} { l } { \mathsf { E V } } \\ { \mathrm { e v e r y ~ c y ~ l ~ i n d e r ~ \quad ~ b ~ l ~ u e } } \\ { \bigoplus } \end{array} } \end{array}
95
+ $$
96
+
97
+ $\mathbf { E V + E } \mathbf { T }$ : This module combines two soft entity sets into a soft boolean, which is useful for modelling generalized quantifiers. For example, in is every cylinder blue, the module can use the inner sigmoid to test if an element $e _ { i }$ is in the set of cylinders $( p _ { e _ { i } } ^ { L } \approx 1 )$ ) but not in the set of blue things $( p _ { e _ { i } } ^ { R } \approx 0 )$ ), and then use the outer sigmoid to return a value close to 1 if the sum of elements matching this property is close to 0.
98
+
99
+ $$
100
+ \begin{array} { c } { { { \underbrace { \left[ \mathsf { F a l s e } \right] } } _ { \displaystyle { \mathsf { T } } } _ { \displaystyle { \mathrm { s } } _ { t r u e } } = \sigma \left( \mathbf { v } _ { 2 } \cdot \left[ \begin{array} { l } { p _ { t r u e } ^ { L } } \\ { p _ { t r u e } ^ { R } } \\ { 1 } \end{array} \right] \right) } } \\ { { { \mathsf { T } } } } \\ { { { \mathsf { Z } } \mathsf { b a l l s ~ r e d ~ a n d ~ } } } \\ { { { \underbrace { \left[ \mathsf { F a l s e } \right] \ @ { \mathsf { o D } } } } _ { \displaystyle { \left[ \mathsf { T r u e } \right] } } \in { \mathsf { S l u e } } } } \end{array}
101
+ $$
102
+
103
+ ![](images/46ffd5f89b90e1ffa26a1bc73dbbdc87f2868559651ed96abd911bbd6be36748.jpg)
104
+
105
+ $\mathbf { T V } + \mathbf { T } \mathbf { T }$ : This module maps a pair of soft booleans into a soft boolean using the $v _ { 2 }$ word vector to parameterize the composition function. Similar to $\mathbf { E V + E } \mathbf { E }$ , this module facilitates modeling a range of boolean set operations. Using the same functional form for different composition functions, allows our model to use the same ungrounded word vector $\left( v _ { 2 } \right)$ for compositions that are semantically analogous.
106
+
107
+ $\mathbf { R } \mathbf { V } + \mathbf { R } \mathbf { R }$ : This module composes a pair of soft set of relations to a produce an output soft set of relations. For example, the relations left and above are composed by the word $o r$ to produce a set of relations such that entities $e _ { i }$ and $e _ { j }$ are related if either of the two relations exists between them. The functional form for this composition is similar to $\mathbf { E V + E } \mathbf { E }$ and $\mathbf { T V } + \mathbf { T } \mathbf { T }$ modules.
108
+
109
+ Figure 2: Composition Modules that compose two constituent span representations into the representation for the combined larger span, using the indicated equations.
110
+
111
+ Composition with $\phi$ -typed nodes: Phrases with type $\phi$ are treated as being semantically transparent identity functions. Phrases of any other type can combined with these with no change to their type or representation.
112
+
113
+ Composition modules resulting in partially grounded denotations: We define several simple modules that combine fully grounded phrases with ungrounded phrases, by deterministically taking the union of the representations, giving phrases with partially grounded representations $( \ S \ 3 . 1 )$ . These modules are useful for when words act as binary functions; here they combine with their first argument. For example, in Figure 1, or and not cylindrical combine to make a phrase containing both the vectors for or and the entity set for not cylindrical.
114
+
115
+ # 4 PARSING MODEL
116
+
117
+ Here, we describe how our model classifies question tokens into different semantic type spans and compute their representations $( \ S 4 . 1 )$ , recursively uses the composition modules defined above to parse the question appropriately into a soft latent tree that provides the answer $( \ S 4 . 2 )$ . The model is trained end-to-end using only question-answer supervision $( \ S 4 . 3 )$ .
118
+
119
+ # 4.1 LEXICAL REPRESENTATION ASSIGNMENT
120
+
121
+ Each token in the question sentence is assigned a distribution over the semantic types, and given a grounding for each type. Tokens can only be assigned the E, R, V, and $\phi$ semantic types. For example, the token cylindrical in the question in Fig. 1 is assigned a distribution over the 4 semantic types (one shown) and for the $\mathbf { E }$ type, the representation computed is the set of cylindrical entities.
122
+
123
+ Semantic Type Distribution for Tokens: To compute the semantic type distribution, our model represents each word $w$ in the word vocabulary $\nu$ , and each semantic type $t$ using an embedding vector; $v _ { w } , v _ { t } \in \mathbb { R } ^ { d }$ . The semantic type distribution is assigned with a softmax:
124
+
125
+ $$
126
+ p ( t | w _ { i } ) \propto \exp ( v _ { t } \cdot v _ { w _ { i } } )
127
+ $$
128
+
129
+ Grounding for Tokens: For each of the four semantic type assignments for question tokens, we need to compute/assign their corresponding representations.
130
+
131
+ 1. E-Type Representation: Each entity $e \in { \mathcal { E } }$ , is represented using an embedding vector $v _ { e } \in \mathbb { R } ^ { d }$ based on the concatenation of vectors for its properties. For each token $w$ , we use its word vector to find the probability of each entity being part of the $\mathbf { E }$ -Type grounding:
132
+
133
+ $$
134
+ p _ { e _ { i } } ^ { w } = \sigma ( v _ { e _ { i } } \cdot v _ { w } ) ~ \forall e _ { i } \in \mathcal { E }
135
+ $$
136
+
137
+ For example, in Fig. 1, the word red will be grounded as all the red entities.
138
+
139
+ 2. R-Type Representation: Each relation $r \in \mathcal { R }$ , is represented using an embedding vector $v _ { r } \in \mathbb { R } ^ { d }$ . For each token $w _ { i }$ in the question, we first compute a distribution over relations it could refer to, and then use this distribution to compute the expected adjacency matrix that forms the $\mathbf { R }$ -type representation for this token.
140
+
141
+ $$
142
+ p ( r | w _ { i } ) \propto \exp ( v _ { r } \cdot v _ { w _ { i } } )
143
+ $$
144
+
145
+ $$
146
+ A ^ { w _ { i } } = \sum _ { r \in \mathcal { R } } p ( r | w _ { i } ) \cdot A _ { r }
147
+ $$
148
+
149
+ For example, the word left in Fig. 1 is grounded as the subset of edges with the label ‘left’.
150
+
151
+ 3. V-Type Representation: For each word $w \in \mathcal { V }$ , we learn four vectors $v _ { 1 } \in \mathbb { R } ^ { 2 } , v _ { 2 } \in$ $\mathbb { R } ^ { 3 } , \tilde { v _ { 3 } } \in \mathbb { R } ^ { \bar { 4 } } , v _ { 4 } \in \mathbb { R } ^ { 5 }$ , and use these as the representation for words with the $\mathbf { V }$ -Type.
152
+
153
+ 4. $\phi$ -Type Representation: This type is used for semantically vacuous words, which do not require a representation.
154
+
155
+ # 4.2 PARSING QUESTIONS
156
+
157
+ To learn the correct structure for applying composition modules, we use a simple parsing model. We build a parse-chart over the question encompassing all possible trees by applying all composition modules, similar to a standard CRF-based PCFG parser using the CKY algorithm. Each node in the parse-chart, for each span $w _ { i \ldots j }$ of the question, is represented as a distribution over different semantic types with their corresponding representations. This distribution is computed by weighing the different ways of composing the span’s constituents.
158
+
159
+ Phrase Semantic Type Potential: Each node in the parse-chart is associated with a potential value $\psi ( i , j , t )$ , that is the score assigned by the model to the t semantic type for the $w _ { i \ldots j }$ span. This is computed from all possible ways to form the span $w _ { i \ldots j }$ with type t. For a particular composition of span $w _ { i \dots k }$ of type $\mathbf { t _ { 1 } }$ and $w _ { k + 1 \ldots j }$ of type $\mathbf { t _ { 2 } }$ , using the $\mathbf { t _ { 1 } } + \mathbf { t _ { 2 } } \mathbf { t }$ module, the score is:
160
+
161
+ $$
162
+ \psi ( i , j , k , t _ { 1 } + t _ { 2 } t ) = [ \psi ( i , k , t _ { 1 } ) \cdot \psi ( k + 1 , j , t _ { 2 } ) \cdot \exp ( \sum _ { x } f _ { x } ^ { ( t _ { 1 } + t _ { 2 } t ) } ( i , j , k | q ) ) ]
163
+ $$
164
+
165
+ where, $f _ { x } ^ { ( t _ { 1 } + t _ { 2 } t ) } ( i , j , k | q )$ are six feature functions; a trainable weight for each word per module in the vocabulary, that correspond to: $f _ { 1 }$ : word that appears before the start of the span $w _ { i - 1 }$ ; $f _ { 2 }$ : first word in the span $w _ { i }$ ; $f _ { 3 }$ : last word in the left constituent $w _ { k }$ ; $f _ { 4 }$ : first word in the right constituent $w _ { k + 1 }$ ; $f _ { 5 }$ : last word in the right constituent $w _ { j }$ ; and $f _ { 6 }$ : word that appears after the span $w _ { j + 1 }$ .
166
+
167
+ The token semantic type potential of $w _ { i }$ , $\psi ( i , i , i , t _ { 1 } + t _ { 2 } t )$ , is the same as $p ( t | w _ { i } )$ (Eq. 1).
168
+
169
+ The final t-type potential of $w _ { i \ldots j }$ is computed by summing over scores from all possible compositions:
170
+
171
+ $$
172
+ \psi ( i , j , t ) = \sum _ { k = i } ^ { j - 1 } \sum _ { \stackrel { \scriptstyle ( t _ { 1 } + t _ { 2 } \to t ) } { \scriptstyle \in \mathrm { M o d u l e s } } } \psi ( i , j , k , t _ { 1 } + t _ { 2 } \to t )
173
+ $$
174
+
175
+ Combining Phrase Representations: To compute the span $w _ { i \ldots j }$ ’s denotation with type t, $[ [ w _ { i . . j } ] ] _ { K G } ^ { t }$ , we compute an expected output representation from all possible compositions.
176
+
177
+ $$
178
+ [ w _ { i \cdot . . j } ] _ { K G } ^ { t } = \frac { 1 } { \psi ( i , j , t ) } \sum _ { \stackrel { k = i } { \epsilon \mathrm { \bf ~ ( } t _ { 1 } + t _ { 2 } t \mathrm { \bf ~ ) } } } ^ { j - 1 } \psi ( i , j , k , t _ { 1 } + t _ { 2 } t ) \ast [ [ w _ { i \cdot . . k . . j } ] ] _ { K G } ^ { t _ { 1 } + t _ { 2 } t }
179
+ $$
180
+
181
+ where resulti $[ [ w _ { i . . j } ] ] _ { K G } ^ { t }$ , is the t-type repre composition of ationwith pan usi $w _ { i \ldots j }$ , e $\mathbb { [ } w _ { i \dots k \dots j } ] _ { K G } ^ { t _ { 1 } + t _ { 2 } t }$ is the representationcomposition module. $w _ { i , k }$ $w _ { k + 1 \ldots j }$ $\mathbf { t _ { 1 } } ~ + ~ \mathbf { t _ { 2 } } ~ ~ \mathbf { t }$
182
+
183
+ Answer Grounding: By recursively computing the phrase semantic-type potentials and representations, we can infer the semantic type distribution of the complete question sentence (Eq. 8) and the resulting grounding for different semantic type $t$ , $[ [ w _ { 1 . . | q | } ] ] _ { K G } ^ { t }$ .
184
+
185
+ $$
186
+ p ( t | q ) \propto \psi ( 1 , | q | , t )
187
+ $$
188
+
189
+ The answer-type (boolean or subset of entities) for the question is computed using:
190
+
191
+ $$
192
+ t ^ { * } = \underset { t \in \mathbf { T } , \mathbf { E } } { \mathrm { a r g m a x } } \ p ( t | q )
193
+ $$
194
+
195
+ The corresponding grounding is $[ [ w _ { 1 . . | q | } ] ] _ { K G } ^ { t ^ { * } }$ , which answers the question.
196
+
197
+ # 4.3 TRAINING OBJECTIVE
198
+
199
+ Given a dataset D of (question, answer, knowledge-graph) tuples, {qi, ai, KGi}i=|D|i=1 , we train our model to maximize the log-likelihood of the correct answers. Answers are either booleans, or specific subsets of entities from the KG. We denote the semantic type of the answer as $a _ { t }$ . If the answer is boolean, $a \in \{ 0 , 1 \}$ , otherwise is a subset of entities from the KG, i.e. $a = \{ e _ { j } \}$ . The model’s answer to a question is found by taking its representation of the complete question, containing a distribution over types and the representation for each type. We maximize the following objective:
200
+
201
+ $$
202
+ \begin{array} { r l } & { \hat { \mathbf { \xi } } = \displaystyle \sum _ { i } \log p ( \boldsymbol { a } ^ { i } | \mathbf { q } ^ { i } , \mathbf { K G } ^ { i } ) \quad \quad \quad \quad ( 1 0 ) } \\ & { = \displaystyle \sum _ { i } \left[ \underbrace { \left( 1 _ { a _ { i } ^ { i } = \mathbf { r } } \left[ \log ( p _ { t r u e } ) ^ { a ^ { i } } ( 1 - p _ { t r u e } ) ^ { ( 1 - a ^ { i } ) } \right] \right) } _ { e _ { j } ^ { i } \in a ^ { i } } + \left( \frac { 1 _ { a _ { i } ^ { i } = \mathbf { E } } } { | \mathcal { E } ^ { i } | } \left[ \log \prod _ { e _ { j } ^ { i } \in a ^ { i } } p _ { e _ { j } ^ { i } } \prod _ { e _ { j } ^ { i } } ( 1 - p _ { e _ { j } ^ { i } } ) \right] \right) \right] } \end{array}
203
+ $$
204
+
205
+ We also add $L _ { 2 }$ -regularization for the scalar parsing features introduced in $\ S 4 . 2$ .
206
+
207
+ # 5 DATASET
208
+
209
+ We generate a dataset of question-answers based on the CLEVR dataset (Johnson et al., 2017), which contains knowledge graphs containing attribute information of objects and relations between them.
210
+
211
+ We generate a new set of questions for this data, as existing questions contain some biases that can be exploited by models (Johnson et al. (2017) found that many spatial relation questions can be answered only using absolute spatial information and many long questions can be answered correctly without performing all steps of reasoning), and many questions are over 40 words long, which is intractable given that the size of our computation graph is cubic in the question length. Future work should explore scaling our approach to longer questions. We generate 75K questions for training and 37.5K for validation.
212
+
213
+ Our question set tests various challenging semantic operators. These include conjunctions (e.g. Is anything red or is anything large?), negations (e.g. What is not spherical?), counts (e.g. Are five spheres green?), quantifiers (e.g. Is every red thing cylindrical?), and relations (e.g. What is left of and above a cube?). We employ some simple tests to remove trivial biases from the dataset.
214
+
215
+ We create two test sets: one drawn from the same distribution as the training data (37.5K), and another containing longer questions than the training data (22.5K).
216
+
217
+ Our COMPLEX QUESTIONS test set contains the same words and constructions, but chained into longer questions. For example, it contains questions such as What is a cube that is right of a metallic thing that is beneath a blue thing? and Are two red things that are above a sphere metallic?. These questions require more multi-step reasoning to solve.
218
+
219
+ # 6 EXPERIMENTS
220
+
221
+ In this section we describe our experimentation setting, the baseline models we compare to, and the various experiments demonstrating the ability of our model to answer compositional questions referring to KG and its ability to generalize to unseen longer questions and new attribute combinations.
222
+
223
+ # 6.1 EXPERIMENTATION SETTING
224
+
225
+ Here we describe the training details of our model and the baseline models.
226
+
227
+ Representing Entities: Each entity in the CLEVR dataset consists of 4 attributes. For each attribute-value, we learn an embedding vector and concatenate the 4-embedding vectors to form the representation for the entity.
228
+
229
+ Training Details: Training the model is complicated by the large number of poor local minima, as the model needs to learn both good syntactic structures and the complex semantics of neural modules.
230
+
231
+ To simplify training, we use Curriculum Learning (Bengio et al., 2009) to pre-train the model on an easier subset of questions. We use a 2-step schedule where we first train our model on simple attribute match (What is a red sphere?), attribute existence (Is anything blue?) and boolean composition $I s$ anything green and is anything purple?) questions and in the second step on all questions jointly.
232
+
233
+ Table 1: Results for Short Questions: Performance of our model compared to baseline models on the Short Questions test set. The LSTM (NO KG) has accuracy close to chance, showing that the questions lack trivial biases.Our model almost perfectly solves all questions showing its ability to learn challenging semantic operators, and parse questions only using weak end-to-end supervision.
234
+
235
+ <table><tr><td>Model</td><td>Boolean Questions</td><td>Entity Set Questions</td><td>Relation Questions</td><td>Overall</td></tr><tr><td>LSTM (No KG)</td><td>50.7</td><td>14.4</td><td>17.5</td><td>27.2</td></tr><tr><td>LSTM (NO RELATION)</td><td>88.5</td><td>99.9</td><td>15.7</td><td>84.9</td></tr><tr><td>RELATION NETWORK</td><td>85.6</td><td>89.7</td><td>97.6</td><td>89.4</td></tr><tr><td>Our Model</td><td>99.9</td><td>100</td><td>100.0</td><td>99.9</td></tr></table>
236
+
237
+ We tune the hyper-parameters using validation accuracy. We train using SGD with learning rate of 0.5 and mini-batch size of 4, regularization constant of 0.3. When assigning the semantic type distribution to the words at the leaves, we add a small positive bias of $+ 1$ for $\phi$ -type and a small negative bias of $- 1$ for the $\mathbf { E }$ -type score before the softmax. Our trainable parameters are: question word embeddings (64-dimensional), relation embeddings (64-dimensional), entity attribute-value embeddings (16-dimensional), four vectors per word for $\mathbf { V }$ -type representations, six scalar feature scores per module per word for the parsing model, and the global parameter vector for the $\mathbf { E + E { } E }$ module.
238
+
239
+ Baseline Models: We use three baseline models for comparison. A simple LSTM (NO KG) model that encodes the question using an LSTM network and answers questions without access to the KG. Another LSTM based model, LSTM (NO RELATION), that has access only to the entities of the KG but not the relationship information between them. Finally, we train a RELATION NETWORK (Santoro et al., 2017) augmented model, which achieved state-of-the-art performance on the CLEVR dataset using image state descriptions. Details about the baseline models are given in the Appendix section.
240
+
241
+ # 6.2 EXPERIMENTS
242
+
243
+ Short Questions Performance: In Table 1, we see that our model is able to perfectly answer all the questions in the test set. This demonstrates our model can learn challenging semantic operators using composition modules, as well as learn to parse the questions from only using weak endto-end supervision. The RELATION NETWORK also achieves good performance, particularly on questions involving relations, but is weaker than our model on some question types. The LSTM (NO RELATION) model also achieves good performance on questions not involving relations, which are out of scope for the model.
244
+
245
+ Complex Question Performance: Table 2 shows results on complex questions, which are constructed by combining components of shorter questions. We use the same models as in Table 1, which were trained and developed only on shorter questions. Answering longer questions requires complex multi-hop reasoning, and the ability to generalize from the language seen in its training data to new types of questions. Results show that all baselines achieve close to random performance on this task, despite high accuracy for shorter questions. This shows the challenges in generalizing RNN encoders beyond their training data. In contrast, the strong inductive bias from our model structure allows the model to generalize to complex questions much more easily than RNN encoders.
246
+
247
+ Generalization to Unseen Attribute Combination: We also measure how well models generalize to unseen attribute combinations in knowledge graphs (using the COGENT subset of CLEVR). For example, the test set contains ‘blue spheres’ that are not found in the training set. None of the models showed a significant reduction in performance in this setting.
248
+
249
+ Error Analysis: Analyzing the errors of our model, we find that most errors are due to incorrect assignments of structure, rather than semantic errors from the modules. For example, in the question Are four red spheres beneath a metallic thing small?, our model produces a parse where it composes metallic thing small into a single node instead of composing red spheres beneath a metallic thing into a single node. Future work should use more sophisticated parsing models.
250
+
251
+ <table><tr><td>Model</td><td>Non-Relation Questions</td><td>Relation Questions</td><td>Overall</td></tr><tr><td>LSTM (NO KG)</td><td>46.0</td><td>39.6</td><td>41.4</td></tr><tr><td>LSTM(NO RELATION)</td><td>62.2</td><td>49.2</td><td>52.2</td></tr><tr><td>RELATION NETWORK</td><td>51.1</td><td>38.9</td><td>41.5</td></tr><tr><td>Our Model</td><td>81.8</td><td>85.4</td><td>84.6</td></tr></table>
252
+
253
+ Table 2: Results for Complex Questions: All baseline models fail to generalize to questions requiring longer chains of reasoning than seen during training. Our model substantially outperforms the baselines, showing its ability to perform complex multi-hop reasoning, and generalize from its training data. Analysis suggests that most errors from our model are due to assigning incorrect structures, not mistakes by the composition modules.
254
+
255
+ # 7 RELATED WORK
256
+
257
+ Many approaches have been proposed to perform question-answering against structured knowledge sources. Semantic parsing models have attempted to learn structures over pre-defined discrete operators, to produce logical forms that can be executed to answer the question. Early work trained using gold-standard logical forms (Zettlemoyer & Collins, 2005; Kwiatkowski et al., 2010), whereas later efforts have only used answers to questions (Liang et al., 2011; Krishnamurthy & Kollar, 2013; Pasupat & Liang, 2015). A key difference is that our model must learn semantic operators from data, which may be necessary to model the fuzzy interpretations of some function words like many or few.
258
+
259
+ Another similar line of work is neural program induction models, such as Neural Programmer (Neelakantan et al., 2016) and Neural Symbolic Machine (Liang et al., 2017). These models learn to produce programs composed of predefined operators using weak supervision to answer questions against semi-structured tables.
260
+
261
+ Neural module networks have recently been proposed for learning semantic operators (Andreas et al., 2016b) for question answering. This model assumes that the structure of the semantic parse is given, and must only learn a set of operators. Dynamic Neural Module Networks (D-NMN) extend this approach by selecting from a small set of candidate module structures (Andreas et al., 2016a). In contrast, our approach learns a model over all possible structures for interpreting a question.
262
+
263
+ Our work is most similar to the most recently proposed N2NMN (Hu et al., 2017) model, an end-toend version of D-NMN. This model learns both semantic operators and the layout in which to compose them. However, optimizing the layouts requires reinforcement learning, which is challenging due to the high variance of policy gradients, whereas our approach is end-to-end differentiable.
264
+
265
+ # 8 CONCLUSION
266
+
267
+ We have introduced a model for answering questions requiring compositional reasoning that combines ideas from compositional semantics with end-to-end learning of composition operators and structure. We demonstrated that the model is able to learn a number of complex composition operators from end task supervision, and have shown that the linguistically motivated inductive bias imposed by the structure of the model allows it to generalize well beyond its training data. Future work should explore scaling the model to other question answering tasks.
268
+
269
+ # REFERENCES
270
+
271
+ Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Learning to compose neural networks for question answering. In HLT-NAACL, 2016a.
272
+
273
+ Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural module networks. In CVPR, pp. 39–48, 2016b.
274
+
275
+ Yoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ˆ Proceedings of the 26th annual international conference on machine learning, pp. 41–48. ACM, 2009.
276
+
277
+ Ronghang Hu, Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Kate Saenko. Learning to reason: End-to-end module networks for visual question answering. CoRR, abs/1704.05526, 2017.
278
+
279
+ Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C. Lawrence Zitnick, and Ross Girshick. Clevr: A diagnostic dataset for compositional language and elementary visual reasoning. In CVPR, July 2017.
280
+
281
+ Jayant Krishnamurthy and Thomas Kollar. Jointly learning to parse and perceive: Connecting natural language to the physical world. TACL, 1:193–206, 2013.
282
+
283
+ Tom Kwiatkowski, Luke S. Zettlemoyer, Sharon Goldwater, and Mark Steedman. Inducing probabilistic ccg grammars from logical form with higher-order unification. In EMNLP, 2010.
284
+
285
+ Chen Liang, Jonathan Berant, Quoc Le, Kenneth D. Forbus, and Ni Lao. Neural symbolic machines: Learning semantic parsers on freebase with weak supervision. In ACL, 2017.
286
+
287
+ Percy Liang, Michael I Jordan, and Dan Klein. Learning dependency-based compositional semantics. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies-Volume 1, pp. 590–599. Association for Computational Linguistics, 2011.
288
+
289
+ Jean Maillard, Stephen Clark, and Dani Yogatama. Jointly learning sentence embeddings and syntax with unsupervised tree-lstms. CoRR, abs/1705.09189, 2017. URL http://arxiv.org/abs/ 1705.09189.
290
+
291
+ Richard Montague. The proper treatment of quantification in ordinary English. In K. J. J. Hintikka, J. Moravcsic, and P. Suppes (eds.), Approaches to Natural Language, pp. 221–242. Reidel, Dordrecht, 1973.
292
+
293
+ Arvind Neelakantan, Quoc V. Le, Mart´ın Abadi, Andrew McCallum, and Dario Amodei. Learning a natural language interface with neural programmer. CoRR, abs/1611.08945, 2016.
294
+
295
+ Panupong Pasupat and Percy Liang. Compositional semantic parsing on semi-structured tables. In ACL, 2015.
296
+
297
+ Ethan Perez, Harm de Vries, Florian Strub, Vincent Dumoulin, and Aaron C. Courville. Learning visual reasoning without strong priors. CoRR, abs/1707.03017, 2017. URL http://arxiv. org/abs/1707.03017.
298
+
299
+ Adam Santoro, David Raposo, David G. T. Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy P. Lillicrap. A simple neural network module for relational reasoning. CoRR, abs/1706.01427, 2017. URL http://arxiv.org/abs/1706.01427.
300
+
301
+ Luke S Zettlemoyer and Michael Collins. Learning to map sentences to logical form: Structured classification with probabilistic categorial grammars. UAI, 2005.
302
+
303
+ # APPENDIX
304
+
305
+ BASELINE MODELS
306
+
307
+ LSTM (NO KG)
308
+
309
+ We use a LSTM network to encode the question as a vector $q$ . We also define three other parameter vectors, $t , e$ and $b$ that are used to predict the answer-type $P ( \bar { a } = \mathbf { T } ) = \sigma ( \boldsymbol { q } \cdot \boldsymbol { t } )$ , entity attention value $p _ { e _ { i } } = \sigma ( q \cdot e )$ , and the probability of the answer being True $p _ { t r u e } = \sigma ( q \cdot b )$ .
310
+
311
+ LSTM (NO RELATION)
312
+
313
+ Similar to LSTM (NO RELATION), the question is encoded using a LSTM network as vector $q$ . Similar to our model, we learn entity attribute-value embeddings and represent each entity as the concatenation of the 4 attribute-value embeddings, $\boldsymbol { v } _ { e _ { i } }$ . Similar to LSTM (NO RELATION), we also define the $t$ parameter vector to predict the answer-type. The entity-attention values are predicted as $p _ { e _ { i } } = \sigma ( v _ { e _ { i } } \cdot q )$ . To predict the probability of the boolean-type answer being true, we first add the entity representations to form $b { \bar { \mathbf { \theta } } } = \sum _ { e _ { i } } v _ { e _ { i } }$ , then make the prediction as $p _ { t r u e } = \sigma ( q \cdot b )$ .
314
+
315
+ # RELATION NETWORK AUGMENTED MODEL
316
+
317
+ The original formulation of the relation network module is as follows:
318
+
319
+ $$
320
+ R N ( q , K G ) = f _ { \phi } \left( \sum _ { i , j } g _ { \theta } ( e _ { i } , e _ { j } , q ) \right)
321
+ $$
322
+
323
+ where $e _ { i } , e _ { j }$ are the representations of the entities and $q$ is the question representation from an LSTM network. The output of the Relation Network module is a scalar score value for the elements in the answer vocabulary. Since our dataset contains entity-set valued answers, we modified the module in the following manner.
324
+
325
+ We concatenate the object pair representations with the representations of the pair of directed relationships between them1. We then use the Relation Network module to produce an output representation for each entity in the KB, in the following manner:
326
+
327
+ $$
328
+ R N _ { e _ { i } } = f _ { \phi } \Bigg ( \sum _ { j } g _ { \theta } ( e _ { i } , e _ { j } , r _ { i j } ^ { 1 } , r _ { i j } ^ { 2 } , q ) \Bigg )
329
+ $$
330
+
331
+ Similar to the LSTM baselines, we define a parameter vector $t$ to predict the answer-type as:
332
+
333
+ $$
334
+ P ( a = \mathbf { T } ) = \sigma ( q \cdot t )
335
+ $$
336
+
337
+ $$
338
+ P ( a = \mathbf { E } ) = 1 - P ( a = \mathbf { T } )
339
+ $$
340
+
341
+ To predict the probability of the boolean type answer being true, we define a parameter vector $b$ and predict as following:
342
+
343
+ $$
344
+ p _ { t r u e } = \sigma \bigg ( b \cdot \sum _ { e _ { i } } R N _ { e _ { i } } \bigg )
345
+ $$
346
+
347
+ To predict the entity-attention values, we use a separate attribute-embedding matrix to first generate the output representation for each entity, $e _ { i } ^ { o u t }$ , then predict the output attention values as follows:
348
+
349
+ $$
350
+ p _ { e _ { i } } = \sigma \bigg ( R N _ { e _ { i } } \cdot e _ { i } ^ { o u t } \bigg )
351
+ $$
352
+
353
+ We tried other architectures as well, but this modification provided the best performance on the validation set. We also tuned the hyper-parameters and found the setting from Santoro et al. (2017) to work the best based on validation accuracy. We used a different 2-step curriculum to train the RELATION NETWORK module, in which we replace the Boolean questions with the relation questions in the first-schedule and jointly train on all questions in the subsequent schedule.
md/train/rkfOvGbCW/rkfOvGbCW.md ADDED
@@ -0,0 +1,378 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MEMORY-BASED PARAMETER ADAPTATION
2
+
3
+ Pablo Sprechmann\*, Siddhant M. Jayakumar\*, Jack W. Rae, Alexander Pritzel
4
+ Adria Puigdom \` enech Badia, Benigno Uria, Oriol Vinyals \`
5
+ Demis Hassabis, Razvan Pascanu, Charles Blundell
6
+ DeepMind
7
+ London, UK
8
+ {psprechmann, sidmj, jwrae, apritzel,
9
+ adriap, buria, vinyals,
10
+ dhcontact, razp, cblundell}@google.com
11
+
12
+ # ABSTRACT
13
+
14
+ Deep neural networks have excelled on a wide range of problems, from vision to language and game playing. Neural networks very gradually incorporate information into weights as they process data, requiring very low learning rates. If the training distribution shifts, the network is slow to adapt, and when it does adapt, it typically performs badly on the training distribution before the shift. Our method, Memory-based Parameter Adaptation, stores examples in memory and then uses a context-based lookup to directly modify the weights of a neural network. Much higher learning rates can be used for this local adaptation, reneging the need for many iterations over similar data before good predictions can be made. As our method is memory-based, it alleviates several shortcomings of neural networks, such as catastrophic forgetting, fast, stable acquisition of new knowledge, learning with an imbalanced class labels, and fast learning during evaluation. We demonstrate this on a range of supervised tasks: large-scale image classification and language modelling.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Neural networks have been proven to be powerful function approximators, as shown in a long list of successful applications: image classification (e.g. Krizhevsky et al., 2012), audio processing (e.g. Oord et al., 2016), game playing (e.g. Mnih et al., 2015; Silver et al., 2017), and machine translation (e.g. Wu et al., 2016). Typically these applications apply batch training to large or near-infinite data sets, requiring many iterations to obtain satisfactory performance.
19
+
20
+ Humans and animals are able to incorporate new knowledge quickly from single examples, continually throughout much of their lifetime. In contrast, neural network-based models rely on the data distribution being stationary and the training procedure using low learning rates and many passes through the training data to obtain good generalisation. This limits their application to life-long learning or dynamic environments and tasks.
21
+
22
+ Problems in continual learning with neural networks commonly manifest as the phenomenon of catastrophic forgetting (McCloskey & Cohen, 1989; French, 1999): a neural network performs badly on old tasks having been trained to perform well on a new task. Several recent approaches have proven promising at overcoming this, such as elastic weight consolidation (Kirkpatrick et al., 2017). Recent work in language modelling has demonstrated how popular neural language models may appropriately be adapted to take advantage of rare, recently seen words, as in the neural cache (Grave et al., 2016), pointer sentinel networks (Merity et al., 2016) and learning to remember rare events (Kaiser et al., 2017). Our work generalises these approaches and we present experimental results where we apply our model to both continual or incremental learning tasks, as well as language modelling.
23
+
24
+ We propose Memory-based Parameter Adaptation (MbPA), a method for augmenting neural networks with an episodic memory to allow for rapid acquisition of new knowledge while preserving the high performance and good generalisation of standard deep models. It combines desirable properties of many existing few-shot, continual learning and language models. We draw inspiration from the theory of complementary learning systems (CLS: McClelland et al., 1995; Leibo et al., 2015; Kumaran et al., 2016), where effective continual, life-long learning necessitates two complementary systems: one that allows for the gradual acquisition of structured knowledge, and another that allows rapid learning of the specifics of individual experiences. As such, MbPA consists of two components: a parametric component (a standard neural network) and a non-parametric component (a neural network augmented with a memory containing previous problem instances). The parametric component learns slowly but generalises well, whereas the non-parametric component rapidly adapts the weights of the parametric component. The non-parametric, instance-based adaptation of the weights is local, in the sense the modification is directly dictated by the inputs to the parametric component. The local adaptation is discarded after the model produces its output, avoiding long term consequences of strong local adaptation (such as overfitting), allowing the weights of the parametric model to learn slowly leading to strong performance and generalisation.
25
+
26
+ ![](images/bf5b55954aebbcf68a9dff8d751a4460e5d644785664fd22a45c2c3cf7131728.jpg)
27
+ Figure 1: Architecture for the MbPA model. Left: Training usage. The parametric network is used directly and experiences are stored in the memory. Right: Testing setting. The embedding is used to query the episodic memory, the retrieved context is used to adapt the parameters of the output network.
28
+
29
+ The contributions of our work are: $( i )$ proposing an architecture for enhancing powerful parametric models with a fast adaptation mechanism to efficiently cope with changes in the task at hand; (ii) establish connections between our method and attention mechanisms frequently used for querying memories; (iii) present a Bayesian interpretation of the method allowing a principled form of regularisation; $( i \nu )$ evaluating the method on a range of different tasks: continual learning, incremental learning and data distribution shifts, obtaining promising results.
30
+
31
+ # 2 MODEL-BASED PARAMETER ADAPTATION
32
+
33
+ Our models consist of three components: an embedding network, $f _ { \gamma }$ , a memory $M$ and an output network $g _ { \theta }$ . The embedding network, $f _ { \gamma }$ , and the output network, $g _ { \theta }$ , are standard parametric (feed forward or recurrent) neural networks with parameters $\gamma$ and $\theta$ , respectively. The memory $M$ is a dynamically-sized memory module that stores key and value pairs, $M = \{ ( h _ { i } , v _ { i } ) \}$ . Keys $\{ h _ { i } \}$ are given by the embedding network. The values $\dot { \{ { v } _ { i } \} }$ correspond to the desired output $y _ { i }$ . For classification, $y _ { i }$ would simply be the true class label, whereas for regression, $y _ { i }$ would be the true regression target. Hence, upon observing the $j$ -th example, we append the pair $( h _ { j } , v _ { j } )$ to the memory $M$ , where:
34
+
35
+ $$
36
+ \begin{array} { l } { h _ { j } f _ { \gamma } ( x _ { j } ) , } \\ { v _ { j } y _ { j } . } \end{array}
37
+ $$
38
+
39
+ The memory has a fixed size and acts as a circular buffer: when it is full, the oldest data is overwritten first. Retrieval from the memory $M$ uses $K$ -nearest neighbour search on the keys $\{ h _ { i } \}$ with Euclidean distance to obtain the $K$ most similar keys and associated values.
40
+
41
+ Our model is used differently in the training and testing phases. During training, for a given input $x$ , we parametrise the conditional likelihood with a deep neural network given by the composition
42
+
43
+ # Algorithm 1 Model-based Parameter Adaptation
44
+
45
+ <table><tr><td>Aigoritnm1Model-basedParameterAdaptation procedure MBPA-TRAIN</td></tr><tr><td>Sample mini-batch of training examples B = {(xb, yb)}b from training data.</td></tr><tr><td>Calculate the embedded mini-batch B&#x27;= {(fγ(xb),yb) : xb,yb ∈B}.</td></tr><tr><td>Update 0,γ by maximising the likelihood (1) of θ and γ with respect to mini-batch B</td></tr><tr><td>Add the embedded mini-batch examples B&#x27; to memory M: M ← MU B&#x27;.</td></tr><tr><td>procedure MBPA-TEST(test input: x, output prediction: y)</td></tr><tr><td>Calculate embedding q = fγ(x),and △total ← 0.</td></tr><tr><td>(x) ,(x) )k=1</td></tr><tr><td>for each step of MbPA do</td></tr><tr><td>Calculate △m(x,θ +△total) according to (4)</td></tr><tr><td>△total ←△total +△M(x).</td></tr><tr><td>Output prediction y = g0+△tota (h)</td></tr></table>
46
+
47
+ of the embedding and output networks. Namely,
48
+
49
+ $$
50
+ p _ { \mathrm { t r a i n } } ( y | x , \gamma , \theta ) = g _ { \theta } ( f _ { \gamma } ( x ) ) .
51
+ $$
52
+
53
+ In the case of classification, the last layer of $g _ { \theta }$ is a softmax layer. The parameters $\{ \theta , \gamma \}$ are estimated by maximum likelihood estimation. The memory is updated with new entries, as they are seen, however no local adaptation is performed on the model. Figure 1 (left) shows a diagram of the training setting and Algorithm 1 (MbPA-Train) shows the algorithm for updating MbPA during training.
54
+
55
+ On the other hand, at test time, it temporarily adapts the parameters of the output network based upon the current input and the contents of the memory $M$ . That is, it uses the exact same parametrisation as (1), but with a different set of parameters in the output network.
56
+
57
+ Let the context $C$ of an input $x$ be the keys, values and associated weights of the $K$ nearest neighbours to query $q \ = \ f _ { \gamma } ( x )$ in the memory $M$ : $C = \{ ( h _ { k } ^ { ( x ) } , v _ { k } ^ { ( x ) } , \bar { w } _ { k } ^ { ( x ) } ) \} _ { k = 1 } ^ { K }$ The coefficients $w _ { k } ^ { ( x ) } \propto \ker ( h _ { k } ^ { ( x ) } , q )$ are weightings of each of the retrieved neighbours according to their closeness to the query $f _ { \gamma } ( { \boldsymbol { x } } ) . \operatorname { k e r n } ( h , q )$ is a kernel function which, following (Pritzel et al., 2017), we choose as $\begin{array} { r } { \ker ( h , q ) = \frac { 1 } { \epsilon + \lVert h - q \rVert _ { 2 } ^ { 2 } } } \end{array}$ . The parametrisation of the likelihood takes the form,
58
+
59
+ $$
60
+ \begin{array} { r } { p ( y | x , \theta ^ { x } ) = p ( y | x , \theta ^ { x } , C ) = g _ { \theta ^ { x } } ( f _ { \gamma } ( x ) ) , } \end{array}
61
+ $$
62
+
63
+ as opposed to the standard parametric approach $g _ { \theta } ( f _ { \gamma } ( x ) )$ , where $\theta ^ { x } \ = \ \theta + \Delta _ { M } ( x , \theta )$ with $\Delta _ { M } \bar { ( \boldsymbol { x } , \boldsymbol { \theta } ) }$ being a contextual (it is based upon the input $x$ ) update of the parameters of the output network. The MbPA adaptation corresponds to decreasing the weighted average negative loglikelihood over the retrieved neighbours in $C$ . Figure 1 (right) shows a diagram of the testing setting and Algorithm 1(MbPA-Test) shows the algorithm for using MbPA during testing.
64
+
65
+ An interesting property of the model is that the correction $\Delta _ { M } ( x , \theta )$ is such that, as the parametric model becomes better at fitting the training data (and consequently the episodic memories), it selfregulates and diminishes. In the CLS theory, this process is referred to as consolidation, when the parametric model can reliably perform predictions without relying on episodic memories.
66
+
67
+ # 2.1 MAXIMUM A POSTERIORI INTERPRETATION OF MBPA
68
+
69
+ We can now derive $\Delta _ { M } ( x , \theta )$ , motivated by considering the posterior distribution on the parameters $\theta ^ { x }$ . Let $x$ correspond to the input with context $C = \{ h _ { k } , v _ { k } , w _ { k } ^ { ( x ) } \} _ { k = 1 } ^ { K }$ w(x)k }Kk=1. The maximum a posteriori over the context $C$ , given the parameters obtained after training $\theta$ , can be written as:
70
+
71
+ $$
72
+ \operatorname* { m a x } _ { \theta ^ { x } } \log p ( \theta ^ { x } | \theta ) + \sum _ { k = 1 } ^ { K } w _ { k } ^ { ( x ) } \log p ( v _ { k } ^ { ( x ) } | h _ { k } ^ { ( x ) } , \theta ^ { x } , x ) ,
73
+ $$
74
+
75
+ where the second term is a weighted likelihood of the data in C and log p(θx|θ) ∝ − ||θx−θ||222αM ( i.e. a Gaussian prior on $\theta ^ { x }$ centred at $\theta$ ) can be thought as a regularisation term that prevents overfitting. See Appendix $\mathrm { D }$ for details of this derivation.
76
+
77
+ ![](images/49827038181af68573ad0a8242f56be9014f4ca296954e0177473e0a3499cf4b.jpg)
78
+ Figure 2: Illustrative diagram of the local fitting on a regression task. Given a query (blue), we retrieve the context from memory showed in red.
79
+
80
+ Equation (3) does not have a closed form solution, and requires fitting a large number of parameters at inference time. This can be costly and susceptible to overfitting. We can avoid this problem by adapting the reference parameters $\theta$ . Specifically, we perform a fixed number of gradient descent steps to minimise (3). One step of gradient descent to the loss in (3) with respect to $\theta ^ { x }$ yields
81
+
82
+ $$
83
+ { \Delta } _ { M } ( x , \theta ) = - \alpha _ { M } \left. \nabla _ { \theta } \sum _ { k = 1 } ^ { K } w _ { k } ^ { ( x ) } \log p ( v _ { k } ^ { ( x ) } | h _ { k } ^ { ( x ) } , \theta ^ { x } , x ) \right| _ { \theta } - \beta ( \theta - \theta ^ { x } ) ,
84
+ $$
85
+
86
+ where $\beta$ is a scalar hyper-parameter. These adapted parameters are used for output computation but discarded thereafter, as described in Algorithm 1.
87
+
88
+ # 2.2 FROM ATTENTION TO LOCAL FITTING
89
+
90
+ A standard formulation of memory augmented networks is in the form of attention (Bahdanau et al., 2014), i.e. query memory to use a weighted average based on some similarity metric.
91
+
92
+ We can now show that an attention-based procedure is a particular case of local adaptation or MbPA. The details of this are discussed in Appendix E. Effectively, attention can be viewed as fitting a constant function the neighbourhood of memories, whereas MbPA generalises to fit a function parameterised by the output network of our model.
93
+
94
+ The diagram in Figure 2 illustrates an example in a regression task for simplicity. Given a query (blue), the retrieved memories and their corresponding values are depicted in red. The predictions of an attention based model are shown in orange. We can see that the prediction is biased towards the value of the neighbours with higher functional value. In magenta we represent the predictions made by the model $g _ { \theta }$ . We can see that it is not able to explain all memories equally well. This could be either because the problem is too difficult, poor training, or because the a prediction needs to be made while assimilating new information. The green curve show the prediction obtained after adapting the parameters to better explain the episodic memories.
95
+
96
+ # 3 RELATED WORK
97
+
98
+ A key component of MbPA is the non-parametric, episodic memory. Many recent works have looked at augmenting neural network systems with memories to allow for fast adaptation or incorporation of new knowledge. Variants of this architecture have been successfully used in the context of classification (Vinyals et al., 2016; Santoro et al., 2016; Kaiser et al., 2017), language modelling (Merity et al., 2016; Grave et al., 2016), reinforcement learning (Blundell et al., 2016; Pritzel et al., 2017), machine translation (Bahdanau et al., 2014), and question answering (Weston et al., 2014), to name a few. For the MbPA experiments below, we use a memory architecture similar to the Differentiable Neural Dictionary (DND) used in Neural Episodic Control (NEC) (Pritzel et al., 2017). One key difference is that we do not train the embedding network through the gradients from the memories (as they are not used at training time).
99
+
100
+ While many of these approaches share a contextual memory lookup system, MbPA is distinct in the method by which the memories are used. Matching Networks (Vinyals et al., 2016) use a nonparametric network to map from a few examples to a target class via a kernel weighted average. Prototypical Networks (Snell et al., 2017) extend this and use a linear model instead of a nearest neighbour method.
101
+
102
+ MbPA is further related to meta-learning approaches for few shot learning. In the context of learning invariant representations for object recognition, Anselmi et al. (2014) proposed a method that can invariantly and discriminatively represent objects using a single sample, even of a new class. In their method, instead of training via gradient descent, image templates are stored in the weights of simple-complex cell networks while objects undergo transformations. Optimisation as a model of few shot learning (Ravi & Larochelle, 2016) proposes using a meta-learner LSTM to control the gradient updates of another network, while Model-Agnostic Meta-Learning (MAML Finn et al. (2017)) proposes a way of doing meta-learning over a distribution of tasks. These methods extend the classic fine-tuning technique used in domain adaptation type of ideas (e.g. fit a given neural network to a small set of new data). The MAML algorithm (particularly related to our work) aims at learning an easily adaptable set of weights, such that given a small amount of training data for a given task following the training distribution, the fine-tuning procedure would effectively adapt the weights to this particular task. Their work does not use any memory or per-example adaptation and is not based on a continual (life-long) learning setting. In contrast, our work, aims at augmenting a powerful neural network with a fine-tuning procedure that is used at inference only. The idea is to enhance the performance of the parametric model while maintaining its full training.
103
+
104
+ Recent approaches to addressing the continual learning problem have included elastic weight consolidation (Kirkpatrick et al., 2017), where a penalty term is added to the loss for deviations far from previous weights, and learning without forgetting (Li & Hoiem, 2016; Furlanello et al., 2016), where distillation (Hinton et al., 2015) from previously trained models is used to keep old knowledge available. Gradient Episodic Memory for Continual Learning (Lopez-Paz & Ranzato, 2017) attempts to solve the problem by storing data from previous tasks and taking gradient updates when learning new tasks that do not increase the training loss on examples stored in memory.
105
+
106
+ There has been recent work in applying attention to quickly adapt a subset of fast weights (Ba et al., 2016). A number of recent works in language modelling have augmented prediction with attention over recent examples to account for the distributional shift between training and testing settings. Works in this direction include neural cache (Grave et al., 2016) and pointer sentinel networks (Merity et al., 2016). Learning to remember rare events (Kaiser et al., 2017) augments an LSTM with a key-value memory structure, and meta networks (Munkhdalai & Yu, 2017) combines fast weights with regular weights. Our model shares this flavour of attention and fast weights, while providing a model agnostic memory-based method that applies beyond language modelling.
107
+
108
+ Works in the context of machine translation relate to MbPA. Gu et al. (2017) explore how to incorporate information from memory into the final model predictions. The authors find that shallow mixing works best. We show in this paper that MbPA is another competitive strategy to shallow mixing, and often working better (PTB for language modelling, ImageNet for image classification). The work by Li et al. (2016) shares the focus on fast-adaptation during inference with our work. Given a test example, the translation model is fine-tuned by fitting similar sentences from the training set. MbPA can be viewed as a generalisation of such approach: it relies on an episodic memory (rather than the training set), contextual lookup and similarity based weighting scheme to fine-tune the original model. Collectively, these allow MbPA to be a powerful domain-agnostic algorithm, which allows it to handle continual and incremental learning.
109
+
110
+ Finally, we mention that our work is closely related to the local regression and adaptive coefficient models literature, see Loader (2006) and references therein. Locally adaptive methods achieved relatively modest success in high-dimensional classification problems, as fitting many parameters to a few neighbours often leads to over fitting. We attempt to counter this with contextual lookups and a local modification of only a subset of model parameters.
111
+
112
+ # 4 EXPERIMENTS AND RESULTS
113
+
114
+ Our scheme unifies elements from traditional approaches to continual, one-shot, and incremental or life-long learning. Models that solve these problems must have certain fundamental attributes in common: the ability to negate the effects of catastrophic forgetting, unbalanced and scarce data, while displaying rapid acquisition of knowledge and good generalisation.
115
+
116
+ In essence, these problems require the ability to deal with changes and shifts in data distributions. We demonstrate that MbPA provides a way to address this. More concretely, due to the robustness of the local adaptation, the model can deal with shifts in domain distribution (e.g. train vs test set in language), the task label set (e.g. incremental learning) or sequential distributional shifts (e.g. continual learning). Further, MbPA is agnostic to both task domain (e.g. image or language) and choice of underlying parametric model, e.g. convolutional neural networks (LeCun et al., 1998) or LSTM (Hochreiter & Schmidhuber, 1997).
117
+
118
+ To this end, our experiments focus on displaying the advantages of MbPA on widely used tasks and datasets, comparing with competing deep learning methods and baselines. We start by looking at the continual learning framework, followed by incremental learning, the problems of unbalanced data and test time distributional changes.
119
+
120
+ # 4.1 CONTINUAL LEARNING: SEQUENTIAL DISTRIBUTIONAL SHIFT
121
+
122
+ In this set of experiments, we explored the effects of MbPA on continual learning, i.e. when dealing with the problem of sequentially learning multiple tasks without the ability to revisit a task.
123
+
124
+ We considered the permuted MNIST setup (Goodfellow et al., 2013). In this setting, each task was given by a different random permutation of the pixels of the MNIST dataset. We explored a chaining of 20 different tasks (20 different permutations) trained sequentially. The model was tested on all tasks it had been trained on thus far.
125
+
126
+ We trained all models using 10,000 examples per task, comparing to elastic weight consolidation (EWC; Kirkpatrick et al., 2017) and regular gradient descent training. In all cases we rely on a two layer MLP and use Adam (Kingma & Ba, 2014) as the optimiser. The EWC penalty cost was chosen using a grid search, as was the local MbPA learning rate (between 0.0 and 1.0) and number of optimisation steps for MbPA (between 1 and 20).
127
+
128
+ Figure 3 compares our approach with that of the baselines. For this particular task we worked directly on pixels as our embedding, i.e. $f _ { \gamma }$ is the identity function, and explored regimes where the episodic memory is small. A key takeaway of this experiment is that once a task is catastrophically forgotten, we find that only a few gradient steps on carefully selected data from memory are sufficient to recover performance, as MbPA does. Considering the number of updates required to reach the solution from random initialisation, this fact itself might seem surprising. MbPA provides a principled and effective way of performing these updates. The naive approach of performing updates on memories chosen at random from the entire memory is considerably less useful.
129
+
130
+ We outperformed the MLP, and were superior to EWC for all but one memory size (when storing only a 100 examples per task). Further, the performance of our model grew with the number of examples stored, ceteris paribus. Crucially, our memory requirements are much lower than that of EWC, which requires storing model parameters and Fisher matrices for all tasks seen so far. Unlike EWC we do not store any tasks identifiers, merely appending the memory with a few examples. Further, MbPA does not use knowledge of exact task boundaries or identities of tasks switched to, unlike EWC and other methods. This allows for frequent switches that would otherwise hamper the Fisher calculations needed for models like EWC.
131
+
132
+ Our method can be combined with any other algorithm such as standard replay from the memory buffer or EWC, providing further improvement. In Figure 3 (right) we combine MbPA and EWC.
133
+
134
+ 4.2 INCREMENTAL LEARNING: SHIFTS IN TASK LABEL DISTRIBUTIONS
135
+
136
+ The goal of this section was to evaluate the model in the context of incremental learning. We considered a classification scenario where a model pre-trained on a subset of classes, was introduced to novel, previously unseen classes. The aim was to incorporate the new related knowledge, as quickly as possible, while preserving knowledge from the previous set. This was as opposed to the continual learning problem where there are distinct tasks without the ability to revisit old data.
137
+
138
+ ![](images/2cbcd709adb66ca8bb71574fd1fa498a3aa36147913e630b30df692412fe95b6.jpg)
139
+ Figure 3: (Left) Results on Permuted MNIST comparing baselines with MbPA using different memory sizes. (Right) Results augmenting MbPA with EWC, showing the flexibility and complementarity of MbPA.
140
+
141
+ Specifically we considered the problem of image classification on the ImageNet dataset (Russakovsky et al., 2015). As a parametric model we used a ResnetV1 model (He et al., 2016). This was pre-trained on a random subset of the ImageNet dataset containing half of the classes. We then presented all 1000 classes and evaluated how quickly the network can acquire this knowledge (i.e. perform well across all 1000 classes).
142
+
143
+ For MbPA, we used the penultimate layer of the network as the embedding network $f _ { \gamma }$ , forming the key $h$ and query $q$ for our episodic memory $M$ . The last fully connected layer was used to initialise the parametric model $g _ { \theta }$ . MbPA was applied at test time, using RMSprop with a local learning rate $\alpha _ { M }$ and the number of optimisation steps (as in Algorithm 1) tuned as hyper-parameters.
144
+
145
+ A natural baseline was to simply fine-tune the last layer of the parametric model with the new training set. We also evaluated a mixture model, combining the classifications of the parametric model and the non-parametric model at decision level in the following manner:
146
+
147
+ $$
148
+ p ( y | q ) = \lambda p _ { \mathrm { p a r a m } } ( y | q ) + ( 1 - \lambda ) p _ { \mathrm { m e m } } ( y | q ) ,
149
+ $$
150
+
151
+ where the parameter $\lambda \in [ 0 , 1 ]$ controls the contribution of each model (this model was proposed by Grave et al. (2016) in the context of language modelling). We created five random splits in new and old classes. Hyperparameters were tuned for all models using the first split and the validation set, and we report the average performance on the remaining splits evaluated on the test set.
152
+
153
+ Figure 4 shows the test set performance for all models, split by new and old classes.
154
+
155
+ While the mixture model provides a large improvement over the plain parametric model, MbPA significantly outperforms both of them both in speed and performance. This is particularly noticeable in the new classes, where MbPA acquires knowledge from very few examples. Table 1 shows a quantitative analysis of these observations. After around 30 epoches the parametric model matches the performance of MbPA. In the appendix we explore sensitivity of MbPA on this task to various hyperparameters (memory size, learning rate).
156
+
157
+ # 4.2.1 UNBALANCED DATASETS
158
+
159
+ We further explored the incremental introduction of new classes, specifically in the context of unbalanced datasets. Most real world data are unbalanced, whereas standard datasets (like ImageNet) are artificially balanced to play well with deep learning methods.
160
+
161
+ We replicated the setting from the ImageNet experiments in the previous section, where new classes were introduced to a pre-trained model. However, we only showed a tenth of the data for half the new classes and all data for the other half. We report performance on the full balanced validation set. Once again, we compared the parametric model with MbPA and a memory based mixture model.
162
+
163
+ Results are summarised in Figure 5 (left). After 20 epochs of training, MbPA outperformed both baselines, with a wider gap in performance than the previous experiment. Further, the mixture model, though equipped with memory, did significantly worse than MbPA, leading us to conclude that the inductive bias in the local adaptation process was well suited to deal with data scarcity.
164
+
165
+ Table 1: Quantitative evaluation of the learning dynamics for the Imagenet experiment. We compare a parametric model, non-parametric model (prediction based on memory only (9)), a mixture model and MbPA. We report the top 1 accuracy as well as the area under the curve (AUC) at different points in training.
166
+
167
+ <table><tr><td rowspan="2">Subset</td><td rowspan="2">Model</td><td colspan="3">Top 1 (at epochs)</td><td colspan="3">AUC (at epochs)</td></tr><tr><td>0.1</td><td>1</td><td>3</td><td>0.1</td><td>1</td><td>3</td></tr><tr><td rowspan="4">Novel</td><td>MbPA</td><td>46.2 %</td><td>64.5 %</td><td>65.7 %</td><td>27.4 %</td><td>57.7 %</td><td>63.0 %</td></tr><tr><td>Non-Parametric</td><td>40.0 %</td><td>53.3 %</td><td>52.9 %</td><td>28.3 %</td><td>47.9 %</td><td>51.8 %</td></tr><tr><td>Mixture</td><td>31.6 %</td><td>56.0 %</td><td>59.1 %</td><td>18.6 %</td><td>47.4 %</td><td>54.7 %</td></tr><tr><td>Parametric</td><td>16.2 %</td><td>53.6 %</td><td>57.9 %</td><td>5.7 %</td><td>41.7 %</td><td>51.9 %</td></tr><tr><td rowspan="4">Pre Trained</td><td>MbPA</td><td>68.5 %</td><td>70.9 %</td><td>70.9 %</td><td>71.4 %</td><td>70.3 %</td><td>70.3 %</td></tr><tr><td>Non-Parametric</td><td>62.7 %</td><td>69.4 %</td><td>70.0 %</td><td>45.9 %</td><td>65.8 %</td><td>68.7 %</td></tr><tr><td>Mixture</td><td>71.9 %</td><td>70.3 %</td><td>70.2 %</td><td>74.8 %</td><td>70.6 %</td><td>70.1 %</td></tr><tr><td>Parametric</td><td>71.4 %</td><td>68.1 %</td><td>68.8 %</td><td>76.0 %</td><td>68.6 %</td><td>68.3 %</td></tr></table>
168
+
169
+ ![](images/c5cc3b65b2160373872d43edecda7c4405134c93ce04e390e100a6f22e2a9201.jpg)
170
+ Figure 4: The figure compares the performance of MbPA (blue) against two baselines: the parametric model (green) and the mixture of experts (red). (Left) Aggregated performance (Right) disentangled performance evaluated on new (dashed) and old (solid) classes.
171
+
172
+ # 4.3 LANGUAGE MODELLING: DOMAIN SHIFTS
173
+
174
+ Finally we considered how MbPA can be used at test time to further improve the performance of language modelling. Given the general formulation of MbPA, this could be applied to any problem where there is a shift in distribution at test time — we focus on language modelling, where using recent information has proved promising, such as neural cache and dynamic evaluation (Grave et al., 2016; Krause et al., 2017).
175
+
176
+ We considered two datasets with established performance benchmarks, Penn Treebank (PTB; Marcus et al., 1993) and WikiText-2 (Merity et al., 2016). We pre-trained an LSTM and apply MbPA to the weights and biases of the output softmax layer. The memory stores the past LSTM outputs and associated class labels observed during evaluation. Full model details and hyper-parameters are detailed in Appendix B.
177
+
178
+ Penn Treebank is a small text corpus containing 887,521 train tokens, 70,390 validation tokens, and 78,669 test tokens; with a vocabulary size of 10,000. The LSTM obtained a test perplexity of 59.6 and this dropped by 4.3 points when interpolated with the neural cache. When we interpolated an LSTM with MbPA we were able to improve on the LSTM baseline by 5.3 points (an additional one from the cache model). We also attempted a dynamic evaluation scheme in a similar style to Krause et al. (2017), where we loaded the Adam optimisation parameters obtained during training and evaluated with training of the LSTM enabled, using a BPTT window of 5 steps. However we did not manage to obtain gains above 1 perplexity from baseline, and so we did not try it for WikiText-2.
179
+
180
+ WikiText-2 is a larger text corpus than PTB, derived from Wikipedia articles. It contains 2,088,628 train tokens, 217,646 validation tokens, and 245,569 test tokens, with a vocabulary of 33,278. Our LSTM baseline obtained a test perplexity of 65.9, and this is improved by 14.6 points when mixed with a neural cache. Combining the baseline LSTM with an LSTM fit with MbPA we see a drop of 9.9 points, however the combination of all three models (LSTM baseline $+ \mathrm { M b P A } +$ cache) produced
181
+
182
+ ![](images/c41b5c92fb5bee6179520c30df8f051177432b71df5f70a6ac505a33db4aacce.jpg)
183
+ Figure 5: (Left) MbPA outperformed both parametric and memory-based mixture baselines, in the presence of unbalanced data on previously unseen classes (dashed lines). (Right) Example of MbPA. Query (shown larger in the top-right corner) of class “TV” and neighbourhood (all other images) for a specific case. Mixture and parametric models fail to classify the image while MbPA succeeds. 8 different classes in the closest 20 neighbours (e.g. “desktop computer”, “monitor”, “CRT screen”). Accuracy went from $2 5 \%$ to $7 5 \%$ after local adaptation.
184
+
185
+ the largest drop of 15.9 points. Comparing the perplexity word-by-word between LSTM $^ +$ cache and LSTM $^ +$ cache $^ +$ MbPA, we see that MbPA improves predictions for rarer words (Figure 8).
186
+
187
+ <table><tr><td></td><td>Valid</td><td>PTB Test △Test</td><td></td><td>WikiText-2 Valid Test</td><td></td><td>△Test</td></tr><tr><td>CharCNN (Zhang et al., 2015) Variational LSTM (Aharoni et al., 2017) LSTM + cache (Grave et al., 2016) LSTM (Melis et al., 2017) AWD-LSTM (Merity et al., 2017) AWD-LSTM + cache (Merity et al., 2017) AWD-LSTM (reprod.) (Krause et al., 2017) AWD-LSTM+ dyn eval (Krause et al., 2017)</td><td>74.6 60.9 60.0 53.9 59.8 51.6</td><td>78.9 61.7 72.1 58.3 57.3 52.8 57.7 51.1</td><td>- 4.5 - 6.6</td><td>72.1 69.1 68.6 53.8 68.9 46.4</td><td>68.9 65.9 65.8 52.0 66.1 44.3</td><td>- 13.8 - 21.8</td></tr><tr><td>LSTM (ours) LSTM + cache (ours) LSTM+MbPA LSTM+MbPA+cache</td><td>61.8 55.7 54.8 54.8</td><td>59.6 55.3 54.3 54.4</td><td>-4.3 -5.3 -5.2</td><td>69.3 53.2 58.4 51.8</td><td>65.9 51.3 56.0 49.4</td><td>-14.6 -9.9 -16.5</td></tr></table>
188
+
189
+ Table 2: Table with PTB and WikiText-2 perplexities. $\Delta$ Test denotes improvement of model on the test set relative to the corresponding baseline.
190
+
191
+ # 5 CONCLUSION
192
+
193
+ We have described Memory-based Parameter Adaptation (MbPA), a scheme for using an episodic memory structure to locally adapt the parameters of a neural network based upon the current input context. MbPA works well on a wide range of supervised learning tasks in several incremental, lifelong learning settings: image classification, language modelling. Our experiments show that MbPA improves performance in continual learning experiments, comparable to or in many cases exceeding the performance of EWC. We also demonstrated that MbPA allows neural networks to rapidly adapt to previously unseen classes in large-scale image classification problems using the ImageNet dataset. Furthermore, MbPA can use the local, contextual updates from memory to counter and alleviate the effect of imbalanced classification data, where some new classes are over-represented at train time whilst others are underrepresented. Finally we demonstrated on two language modelling tasks that MbPA is able to adapts to shifts in word distribution common in language modelling tasks, achieving significant improvements in performance compared to LSTMs and building on methods like neural cache (Grave et al., 2016).
194
+
195
+ # ACKNOWLEDGMENTS
196
+
197
+ We would like to thank Gabor Melis for providing the LSTM baselines on the language tasks. We would also like to thank Dharshan Kumaran, Jonathan Hunt, Olivier Tieleman, Koray Kavukcuoglu, Daan Wierstra, Sam Ritter, Jane Wang, Alistair Muldal, Nando de Frietas, Tim Harley, Jacob Menick and Steven Hansen for many helpful comments and invigorating discussions.
198
+
199
+ # REFERENCES
200
+
201
+ Aharoni, Ziv, Rattner, Gal, and Permuter, Haim. Gradual learning of deep recurrent neural networks. arXiv preprint arXiv:1708.08863, 2017.
202
+
203
+ Anselmi, Fabio, Leibo, Joel Z, Rosasco, Lorenzo, Mutch, Jim, Tacchetti, Andrea, and Poggio, Tomaso. Unsupervised learning of invariant representations with low sample complexity: the magic of sensory cortex or a new framework for machine learning? 2014.
204
+
205
+ Ba, Jimmy, Hinton, Geoffrey E, Mnih, Volodymyr, Leibo, Joel Z, and Ionescu, Catalin. Using fast weights to attend to the recent past. In Advances In Neural Information Processing Systems, pp. 4331–4339, 2016.
206
+
207
+ Bahdanau, Dzmitry, Cho, Kyunghyun, and Bengio, Yoshua. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
208
+
209
+ Blundell, Charles, Uria, Benigno, Pritzel, Alexander, Li, Yazhe, Ruderman, Avraham, Leibo, Joel Z, Rae, Jack, Wierstra, Daan, and Hassabis, Demis. Model-free episodic control. arXiv preprint arXiv:1606.04460, 2016.
210
+
211
+ Finn, Chelsea, Abbeel, Pieter, and Levine, Sergey. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017.
212
+
213
+ Fortunato, Meire, Blundell, Charles, and Vinyals, Oriol. Bayesian recurrent neural networks. arXiv preprint arXiv:1704.02798, 2017.
214
+
215
+ French, Robert M. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences, 3(4):128–135, 1999.
216
+
217
+ Furlanello, Tommaso, Zhao, Jiaping, Saxe, Andrew M, Itti, Laurent, and Tjan, Bosco S. Active long term memory networks. arXiv preprint arXiv:1606.02355, 2016.
218
+
219
+ Goodfellow, Ian J, Warde-Farley, David, Mirza, Mehdi, Courville, Aaron, and Bengio, Yoshua. Maxout networks. arXiv preprint arXiv:1302.4389, 2013.
220
+
221
+ Grave, Edouard, Joulin, Armand, and Usunier, Nicolas. Improving neural language models with a continuous cache. arXiv preprint arXiv:1612.04426, 2016.
222
+
223
+ Gu, Jiatao, Wang, Yong, Cho, Kyunghyun, and Li, Victor OK. Search engine guided non-parametric neural machine translation. arXiv preprint arXiv:1705.07267, 2017.
224
+
225
+ He, Kaiming, Zhang, Xiangyu, Ren, Shaoqing, and Sun, Jian. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
226
+
227
+ Hinton, Geoffrey, Vinyals, Oriol, and Dean, Jeff. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
228
+
229
+ Hochreiter, Sepp and Schmidhuber, Jurgen. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
230
+
231
+ Kaiser, Łukasz, Nachum, Ofir, Roy, Aurko, and Bengio, Samy. Learning to remember rare events. arXiv preprint arXiv:1703.03129, 2017.
232
+
233
+ Kingma, Diederik and Ba, Jimmy. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
234
+
235
+ Kirkpatrick, James, Pascanu, Razvan, Rabinowitz, Neil, Veness, Joel, Desjardins, Guillaume, Rusu, Andrei A, Milan, Kieran, Quan, John, Ramalho, Tiago, Grabska-Barwinska, Agnieszka, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, pp. 201611835, 2017.
236
+
237
+ Krause, Ben, Kahembwe, Emmanuel, Murray, Iain, and Renals, Steve. Dynamic evaluation of neural sequence models. arXiv preprint arXiv:1709.07432, 2017.
238
+
239
+ Krizhevsky, Alex, Sutskever, Ilya, and Hinton, Geoffrey E. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
240
+
241
+ Kumaran, Dharshan, Hassabis, Demis, and McClelland, James L. What learning systems do intelligent agents need? complementary learning systems theory updated. Trends in cognitive sciences, 20(7):512–534, 2016.
242
+
243
+ LeCun, Yann, Bottou, Leon, Bengio, Yoshua, and Haffner, Patrick. Gradient-based learning applied ´ to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
244
+
245
+ Leibo, Joel Z, Cornebise, Julien, Gomez, Sergio, and Hassabis, Demis. Approximate hubel-wiesel ´ modules and the data structures of neural computation. arXiv preprint arXiv:1512.08457, 2015.
246
+
247
+ Li, Xiaoqing, Zhang, Jiajun, and Zong, Chengqing. One sentence one model for neural machine translation. CoRR, abs/1609.06490, 2016. URL http://arxiv.org/abs/1609.06490.
248
+
249
+ Li, Zhizhong and Hoiem, Derek. Learning Without Forgetting, pp. 614–629. 2016.
250
+
251
+ Loader, Clive. Local regression and likelihood. Springer Science & Business Media, 2006.
252
+
253
+ Lopez-Paz, David and Ranzato, Marc’Aurelio. Gradient episodic memory for continuum learning. arXiv preprint arXiv:1706.08840, 2017.
254
+
255
+ Marcus, Mitchell P, Marcinkiewicz, Mary Ann, and Santorini, Beatrice. Building a large annotated corpus of english: The penn treebank. Computational linguistics, 19(2):313–330, 1993.
256
+
257
+ McClelland, James L, McNaughton, Bruce L, and O’reilly, Randall C. Why there are complementary learning systems in the hippocampus and neocortex: insights from the successes and failures of connectionist models of learning and memory. Psychological review, 102(3):419, 1995.
258
+
259
+ McCloskey, Michael and Cohen, Neal J. Catastrophic interference in connectionist networks: The sequential learning problem. Psychology of learning and motivation, 24:109–165, 1989.
260
+
261
+ Melis, Gabor, Dyer, Chris, and Blunsom, Phil. On the state of the art of evaluation in neural language ´ models. arXiv preprint arXiv:1707.05589, 2017.
262
+
263
+ Merity, Stephen, Xiong, Caiming, Bradbury, James, and Socher, Richard. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843, 2016.
264
+
265
+ Merity, Stephen, Keskar, Nitish Shirish, and Socher, Richard. Regularizing and optimizing lstm language models. arXiv preprint arXiv:1708.02182, 2017.
266
+
267
+ Mnih, Volodymyr, Kavukcuoglu, Koray, Silver, David, Rusu, Andrei A, Veness, Joel, Bellemare, Marc G, Graves, Alex, Riedmiller, Martin, Fidjeland, Andreas K, Ostrovski, Georg, et al. Humanlevel control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
268
+
269
+ Munkhdalai, Tsendsuren and Yu, Hong. Meta networks. arXiv preprint arXiv:1703.00837, 2017.
270
+
271
+ Oord, Aaron van den, Dieleman, Sander, Zen, Heiga, Simonyan, Karen, Vinyals, Oriol, Graves, Alex, Kalchbrenner, Nal, Senior, Andrew, and Kavukcuoglu, Koray. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
272
+
273
+ Pritzel, Alexander, Uria, Benigno, Srinivasan, Sriram, Puigdomenech, Adri \` a, Vinyals, Oriol, Hass-\` abis, Demis, Wierstra, Daan, and Blundell, Charles. Neural episodic control. ICML, 2017.
274
+
275
+ Ravi, Sachin and Larochelle, Hugo. Optimization as a model for few-shot learning. ICLR, 2016.
276
+
277
+ Russakovsky, Olga, Deng, Jia, Su, Hao, Krause, Jonathan, Satheesh, Sanjeev, Ma, Sean, Huang, Zhiheng, Karpathy, Andrej, Khosla, Aditya, Bernstein, Michael, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
278
+
279
+ Santoro, Adam, Bartunov, Sergey, Botvinick, Matthew, Wierstra, Daan, and Lillicrap, Timothy. One-shot learning with memory-augmented neural networks. arXiv preprint arXiv:1605.06065, 2016.
280
+
281
+ Silver, David, Schrittwieser, Julian, Simonyan, Karen, Antonoglou, Ioannis, Huang, Aja, Guez, Arthur, Hubert, Thomas, Baker, Lucas, Lai, Matthew, Bolton, Adrian, Chen, Yutian Chen, Lillicrap, Timothy, Hui, Fan Hui, Sifre, Laurent, van den Driessche, George, Graepel, Thore, and Hassabis, Demis. Mastering the game of go without human knowledge. Nature, 550(7676): 354–359, 2017.
282
+
283
+ Snell, Jake, Swersky, Kevin, and Zemel, Richard S. Prototypical networks for few-shot learning. arXiv preprint arXiv:1703.05175, 2017.
284
+
285
+ Vinyals, Oriol, Blundell, Charles, Lillicrap, Tim, Wierstra, Daan, et al. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, pp. 3630–3638, 2016.
286
+
287
+ Weston, Jason, Chopra, Sumit, and Bordes, Antoine. Memory networks. arXiv preprint arXiv:1410.3916, 2014.
288
+
289
+ Wu, Yonghui, Schuster, Mike, Chen, Zhifeng, Le, Quoc V, Norouzi, Mohammad, Macherey, Wolfgang, Krikun, Maxim, Cao, Yuan, Gao, Qin, Macherey, Klaus, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016.
290
+
291
+ Zhang, Xiang, Zhao, Junbo, and LeCun, Yann. Character-level convolutional networks for text classification. In Advances in neural information processing systems, pp. 649–657, 2015.
292
+
293
+ # A MBPA HYPERPARAMETERS FOR INCREMENTAL LEARNING IMAGENET TASK
294
+
295
+ MbPA was robust and the inductive bias of the MbPA correction adapts the performance of the model on novel classes. This is shown in Figure 6 (right) where MbPA manages to achieve high performance almost at the same rate, regardless of the learning rate of the underlying parametric component.
296
+
297
+ In Figure 6 (left) we explore the influence in performance when changing the size of the episodic memory. We can see that the performance on the new classes is more sensitive to this parameter but it quickly saturates after about 400,000 entries. We repeat the above experiment by changing now the number of neighbours retrieved. The results are shown in Figure 7. We can observe that using more neighbours is better, but again, performance saturates quickly after 50 neighbours.
298
+
299
+ ![](images/ab01ba261a99d787dd0def5a6ca5ee84d38dade4234cd054cb9fc310f6986fc4.jpg)
300
+ Figure 6: Left: Performance of MbPA when varying the dictionary size. Right: Performance of the parametric, mixture and MbPA models varying the learning rate of the parametric model. The colour code is the same as in Figure 4 and the thickness of the lines indicate the learning rate used.
301
+
302
+ ![](images/be4e608fd488811d04262abc34f0deb32ad3937ac3b4f8fbba0d1e59efe44179.jpg)
303
+ Figure 7: Performance of MbPA when varying the number of nearest neighours used for performing the local adaptation.
304
+
305
+ # B MODEL DETAILS LANGUAGE MODELLING TASKS
306
+
307
+ For both datasets we used a single-layer LSTM baseline trained with Adam (Kingma & Ba, 2014) using the regularisation techniques described in Melis et al. (2017).
308
+
309
+ In this application of MbPA the test set is small (e.g. $< 8 0 { , } 0 0 0$ words for PTB), and so it was easy to overfit to the retrieved points. To remedy this, we tuned an L2 penalty $\beta | | \theta ^ { x } - \theta | | _ { 2 }$ term in our MbPA loss (7), where $\theta$ were the parameters derived from the training set and $\beta$ was a scalar hyper-parameter.
310
+
311
+ We swept over the following hyper-parameters:
312
+
313
+ • Memory size: $N \in \{ 5 0 0 , 1 0 0 0 , 5 0 0 0 \}$ • Nearest neighbours: $K \in \{ 2 5 6 , 5 1 2 \}$ • Cache interpolation: $\lambda _ { c a c h e } \in \{ 0 , 0 . 0 5 , 0 . 1 , 0 . 1 5 \}$ • MbPA interpolation: $\lambda _ { m b p a } \in \{ 0 , 0 . 0 5 , 0 . 1 , 0 . 1 5 \}$ • Number of MbPA optimisation steps: $T \in \{ 1 , 5 , 1 0 \}$ • MbPA optimization learning rate: $\alpha \in \{ 0 . 0 1 , 0 . 1 , 0 . 1 5 , 0 . 2 , 0 . 5 , 1 \}$
314
+
315
+ Where memory size refers to both the MbPA memory size, and the size of the neural cache for comparison, and the $\lambda$ interpolation parameters refer to the mixing of model outputs, alike to Eq. 5. The optimal parameters were: $N = 5 0 0 0$ , $K = 2 5 6$ , $\lambda _ { c a c h e } = 0 . 1 5$ , $\lambda _ { m b p a } = 0 . 1$ , $T = 1$ , $\alpha =$ 0.15.
316
+
317
+ For Penn Treebank, we used a pre-trained LSTM baseline containing roughly $1 0 M$ parameters with a hidden size of 1194 and a word embedding size of 268. For WikiText-2, we used a pretrained LSTM baseline containing roughly 24M parameters with a hidden size of 1,853 and a word embedding size of 241.
318
+
319
+ # C COMPARISON OF CACHE VS MBPA FOR WIKITEXT-2
320
+
321
+ The comparative benefit of MbPA is investigated, when combined with the $\mathrm { L S T M + }$ cache model. By computing the perplexity on a per-word basis and comparing whether the inclusion of MbPA improves (lowers) the perplexity, we can understand what types of words are better predicted. Anecdotal samples were not sufficient to understand the trend, however when the words were bucketed by their training frequency, we see a tend of improved performance for less frequent words.
322
+
323
+ This improved performance for rare words may be because the cache model has a prior to boost all recent words. Specifically, the cache probabilities are obtained from summing the attention for each instance of a word in memory, and so frequently occurring recent words that are not very contextually relevant will still be boosted. As MbPA does not do this, it appears to be more sensitive to infrequently occurring words.
324
+
325
+ ![](images/838d5f5049ec97c6771c3354bf946be0c2a2c765025d883590e0205c1abe7b0e.jpg)
326
+ Figure 8: Percent improvement when MbPA is included with the LSTM baseline and neural cache, split by training word frequency into five equally sized buckets. The bucket 1 contains the most frequent words, and bucket 5 contains the least frequent words. The average improvement $\pm 1$ standard deviation are shown. MbPA provides a directional improvement for less frequent words.
327
+
328
+ # D MAP INTERPRETATION OF MBPA AND DERIVATION OF CONTEXTUAL UPDATE
329
+
330
+ Let $x _ { c }$ correspond to the input of the $h _ { c } , v _ { c }$ key-value pair in the context $C$ of a given input $x$ . In other words, $h _ { c }$ was computed by feeding $x _ { c }$ to the embedding network. Then the posterior given
331
+
332
+ this pair and the parameter obtained after training $\theta$ , can be written as:
333
+
334
+ $$
335
+ p ( \theta ^ { x } | \theta , x _ { c } , v _ { c } , x ) = \frac { p ( v _ { c } | x _ { c } , \theta ^ { x } , x ) p ( \theta ^ { x } | \theta ) } { p ( v _ { c } | \theta , x _ { c } , x ) } .
336
+ $$
337
+
338
+ If we maximise the posterior over the context $C$ with respect to $\theta ^ { x }$ .
339
+
340
+ $$
341
+ \begin{array} { r l } { \arg \underset { \theta ^ { \alpha } } { \operatorname* { m a x } } \mathbb { E } _ { C } \left\{ \log p ( \theta ^ { x } | \theta , x _ { c } , v _ { c } , x ) \right\} = \arg \underset { \theta ^ { x } } { \operatorname* { m a x } } } & { \log p ( \theta ^ { x } | \theta ) + \mathbb { E } _ { C } \left\{ \log p ( v _ { c } | x _ { c } , \theta ^ { x } , x ) \right\} } \\ & { \qquad = \arg \underset { \theta ^ { \alpha } } { \operatorname* { m a x } } \log p ( \theta ^ { x } | \theta ) + \displaystyle \sum _ { k = 1 } ^ { K } w _ { k } ^ { ( x ) } \log p ( v _ { k } ^ { ( x ) } | h _ { k } ^ { ( x ) } , \theta ^ { x } , x ) . } \end{array}
342
+ $$
343
+
344
+ Let $\begin{array} { r } { \log p ( \theta ^ { x } | \theta ) \propto - \frac { | | \theta ^ { x } - \theta | | _ { 2 } ^ { 2 } } { 2 \alpha _ { M } } } \end{array}$ (i.e. a Gaussian prior on $\theta ^ { x }$ centred at $\theta$ ) be thought as a regularisation term that prevents the local adaptation to move $\theta ^ { x }$ too far from $\theta$ , preventing overfitting.
345
+
346
+ Another interpretation of (7) is that when the prior is taken to be a Gaussian, it is a form of elastic weight regularisation (similar to Kirkpatrick et al. (2017)) and the second term corresponds to the log likelihood of $\theta ^ { x }$ on the data in the context $C$ . This can also be seen as posterior sharpening (Fortunato et al., 2017), where we can think of the second term as an approximation of log $p ( \boldsymbol { y } _ { t } | \boldsymbol { x } _ { t } , \boldsymbol { \theta } )$ . Thus a view of MbPA is it is a form of local elastic weight consolidation on a context dataset $C$ .
347
+
348
+ Equation (7) does not have a closed form solution, and requires fitting a large number of parameters at inference time. This can be costly and susceptible to overfitting. We can avoid this problem by simply adapting the reference parameters $\theta$ . Specifically, we perform a fixed number of gradient descent steps (or any of its popular variants) to minimise (7). One step of gradient descent to the loss in (7) with respect to $\theta ^ { x }$ yields
349
+
350
+ $$
351
+ { \Delta } _ { M } ( x , \theta ) = - \alpha _ { M } \left. \nabla _ { \theta } \sum _ { k = 1 } ^ { K } w _ { k } ^ { ( x ) } \log p ( v _ { k } ^ { ( x ) } | h _ { k } ^ { ( x ) } , \theta ^ { x } , x ) \right| _ { \theta } - \beta ( \theta - \theta ^ { x } ) ,
352
+ $$
353
+
354
+ where $\beta$ is a scalar hyper-parameter. These adapted parameters are used for output computation but discarded thereafter.
355
+
356
+ # E ATTENTION AS A SPECIAL CASE OF MBPA
357
+
358
+ Let $C = \{ ( w _ { i } , h _ { i } , v _ { i } ) \} _ { i = 1 } ^ { k }$ be the neighbourhood retrieved from memory given a query $q$ . The likelihood prediction based on attention is given by
359
+
360
+ $$
361
+ p _ { \mathrm { m e m } } ( y = j | q ) = \frac { \sum _ { i = 1 } ^ { k } w _ { i } \delta ( v _ { i } = j ) } { \sum _ { i = 1 } ^ { k } w _ { i } } ,
362
+ $$
363
+
364
+ where the Kronecker $\delta$ is one when the equality holds and zero otherwise. We now show how the attention-based prediction given in (9) can be seen as particular case of local adaptation.
365
+
366
+ For classification with $c$ classes, we parameterise $p _ { \mathrm { m e m } }$ via its logits, $z \in \mathbb { R } ^ { c }$ , with $p _ { \mathrm { m e m } } ( v | q ) =$ softmax $( z )$ . One good candidate $z$ is the one that is the most consistent with context $C$ . Specifically, the logit vector that minimises the weighted average negative log-likelihood (NLL) of the memories in context $C$ :
367
+
368
+ $$
369
+ z _ { q } = \underset { z } { \operatorname { a r g m i n } } \sum _ { i = 1 } ^ { N } w _ { i } \left( z _ { v _ { i } } - \log ( \sum _ { k = 1 } ^ { c } e ^ { z _ { k } } ) \right) .
370
+ $$
371
+
372
+ The attention weights scale the importance of each memory in the neighbour given its similarity to the query. This matches the loss (7) (ignoring the prior term). If we differentiate the above equation with respect to a $z _ { j }$ and set to zero, we obtain exactly the same expression as in (9).
373
+
374
+ Effectively, in (10) we are fitting a constant function to the context retrieved from the episodic memory. This is a particular case of a local likelihood model (Loader, 2006). The update also is the same as applying a k-nn, see Figure 2.
375
+
376
+ Note that this interpretation is not limited to classification tasks, the exact same reasoning (and result) could be done for a regression task, simply by changing the loss function to be Mean Squared Error (MSE).
377
+
378
+ In this context, we can think of MbPA as a generalisation of the attention mechanism, in which the function used for the local fitting is given by the output network. Moreover, the parameters of the model are used as a prior for solving the local fitting problem and only change slightly to prevent overfitting.
md/train/yhjpeuWepoj/yhjpeuWepoj.md ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation
2
+
3
+ Shiqi Yang1, Yaxing Wang1,2∗, Joost van de Weijer1, Luis Herranz1, Shangling Jui3 1 Computer Vision Center, Universitat Autonoma de Barcelona, Barcelona, Spain 2 PCALab, Nanjing University of Science and Technology, China 3 Huawei Kirin Solution, Shanghai, China
4
+ {syang,yaxing,joost,lherranz}@cvc.uab.es, jui.shangling@huawei.com
5
+
6
+ # Abstract
7
+
8
+ Domain adaptation (DA) aims to alleviate the domain shift between source domain and target domain. Most DA methods require access to the source data, but often that is not possible (e.g. due to data privacy or intellectual property). In this paper, we address the challenging source-free domain adaptation (SFDA) problem, where the source pretrained model is adapted to the target domain in the absence of source data. Our method is based on the observation that target data, which might no longer align with the source domain classifier, still forms clear clusters. We capture this intrinsic structure by defining local affinity of the target data, and encourage label consistency among data with high local affinity. We observe that higher affinity should be assigned to reciprocal neighbors, and propose a self regularization loss to decrease the negative impact of noisy neighbors. Furthermore, to aggregate information with more context, we consider expanded neighborhoods with small affinity values. In the experimental results we verify that the inherent structure of the target features is an important source of information for domain adaptation. We demonstrate that this local structure can be efficiently captured by considering the local neighbors, the reciprocal neighbors, and the expanded neighborhood. Finally, we achieve state-of-the-art performance on several 2D image and 3D point cloud recognition datasets. Code is available in https://github.com/Albert0147/SFDA_neighbors.
9
+
10
+ # 1 Introduction
11
+
12
+ Most deep learning methods rely on training on large amount of labeled data, while they cannot generalize well to a related yet different domain. One research direction to address this issue is Domain Adaptation (DA), which aims to transfer learned knowledge from a source to a target domain. Most existing DA methods demand labeled source data during the adaptation period, however, it is often not practical that source data are always accessible, such as when applied on data with privacy or property restrictions. Therefore, recently, there have emerged a few works [16, 17, 20, 21] tackling a new challenging DA scenario where instead of source data only the source pretrained model is available for adapting, i.e., source-free domain adaptation (SFDA). Among these methods, USFDA [16] addresses universal DA [57] and SF [17] addresses open-set DA [36]. In both universal and open-set DA the label set is different for source and target domains. SHOT [21] and 3C-GAN [20] are for closed-set DA where source and target domains have the same categories. 3C-GAN [20] is based on target-style image generation with a conditional GAN, and SHOT [21] is based on mutual information maximization and pseudo labeling. Finally, BAIT [56] extends MCD [35] to the SFDA setting. However, these methods ignore the intrinsic neighborhood structure of the target data in feature space which can be very valuable to tackle SFDA.
13
+
14
+ ![](images/343b4b429f7a34d25d762b61bf6977f13ba8eaac4be276860b5d2170fa2f18be.jpg)
15
+ Figure 1: (a) t-SNE visualization of target features by source model. (b) Ratio of different type of nearest neighbor features of which: the predicted label is the same as the feature, K is the number of nearest neighbors. The features in (a) and (b) are on task $\mathrm { A r } { } \mathrm { R w }$ of Office-Home. (c) Illustration of our method. In the left shows we distinguish reciprocal and non-reciprocal neighbors. The adaptation is achieved by pushed the features towards reciprocal neighbors heavily.
16
+
17
+ In this paper, we focus on closed-set source-free domain adaptation. Our main observation is that current DA methods do not exploit the intrinsic neighborhood structure of the target data. We use this term to refer to the fact that, even though the target data might have shifted in the feature space (due to the covariance shift), target data of the same class is still expected to form a cluster in the embedding space. This can be implied to some degree from the t-SNE visualization of target features on the source model which suggests that significant cluster structure is preserved (see Fig. 1 (a)). This assumption is implicitly adopted by most DA methods, as instantiated by a recent DA work [42]. A well-established way to assess the structure of points in high-dimensional spaces is by considering the nearest neighbors of points, which are expected to belong to the same class. However, this assumption is not true for all points; the blue curve in Figure 1(b) shows that around $7 5 \%$ of the nearest neighbors has the correct label. In this paper, we observe that this problem can be mitigated by considering reciprocal nearest neighbors (RNN); the reciprocal neighbors of a point have the point as their neighbor. Reciprocal neighbors have been studied before in different contexts [14, 31, 60]. The reason why reciprocal neighbors are more trustworthy is illustrated in Fig. 1(c). Fig. 1(b) shows the ratio of neighbors which have the correct prediction for different kinds of nearest neighbors. The curves show that reciprocal neighbors indeed have more chances to predict the true label than non-reciprocal nearest neighbors (nRNN).
18
+
19
+ The above observation and analysis motivate us to assign different weights to the supervision from nearest neighbors. Our method, called Neighborhood Reciprocity Clustering (NRC), achieves sourcefree domain adaptation by encouraging reciprocal neighbors to concord in their label prediction. In addition, we will also consider a weaker connection to the non-reciprocal neighbors. We define affinity values to describe the degree of connectivity between each data point and its neighbors, which is also utilized to encourage class-consistency between neighbors, and we propose to use a self-regularization to decrease the negative impact of potential noisy neighbors. Furthermore, inspired by recent graph based methods [1, 3, 61] which show that the higher order neighbors can provide relevant context, and also considering neighbors of neighbors is more likely to provide datapoints that are close on the data manifold [43]. Thus, to aggregate wider local information, we further retrieve the expanded neighbors, i.e, neighbor of the nearest neighbors, for auxiliary supervision.
20
+
21
+ Our contributions can be summarized as follows, to achieve source-free domain adaptation: (i) we explicitly exploit the fact that same-class data forms cluster in the target embedding space, we do this by considering the predictions of neighbors and reciprocal neighbors, (ii) we further show that considering an extended neighborhood of data points further improves results (iii) the experiments results on three 2D image datasets and one 3D point cloud dataset show that our method achieves state-of-the-art performance compared with related methods.
22
+
23
+ # 2 Related Work
24
+
25
+ Domain Adaptation. Most DA methods tackle domain shift by aligning the feature distributions. Early DA methods such as [23, 41, 45] adopt moment matching to align feature distributions. And in recent years, plenty of works have emerged that achieve alignment by adversarial training. DANN [7] formulates domain adaptation as an adversarial two-player game. The adversarial training of CDAN [24] is conditioned on several sources of information. DIRT-T [40] performs domain adversarial training with an added term that penalizes violations of the cluster assumption. Additionally, [18, 26, 35] adopts prediction diversity between multiple learnable classifiers to achieve local or category-level feature alignment between source and target domains. AFN [52] shows that the erratic discrimination of target features stems from much smaller norms than those found in the source features. SRDC [42] proposes to directly uncover the intrinsic target discrimination via discriminative clustering to achieve adaptation. More related, [27] resorts to K-means clustering for open-set adaptation while considering global structure. Our method instead only focuses on nearest neighbors (local structure) for source-free adaptation.
26
+
27
+ Source-free Domain Adaptation. Source-present methods need supervision from the source domain during adaptation. Recently, there are several methods investigating source-free domain adaptation. USFDA [16] and FS [17] explore source-free universal DA [57] and open-set DA [36], and they propose to synthesize extra training samples to make the decision boundary compact, thereby allowing to recognise the open classes. For closed-set DA setting. SHOT [21] proposes to fix the source classifier and match the target features to the fixed classifier by maximizing mutual information and a proposed pseudo label strategy which considers global structure. 3C-GAN [20] synthesizes labeled target-style training images based on the conditional GAN to provide supervision for adaptation. Finally, SFDA [22] is for segmentation based on synthesizing fake source samples.
28
+
29
+ Graph Clustering. Our method shares some similarities with graph clustering work such as [38, 48, 54, 55] by utilizing neighborhood information. However, our methods are fundamentally different. Unlike those works which require labeled data to train the graph network for estimating the affinity, we instead adopt reciprocity to assign affinity.
30
+
31
+ # 3 Method
32
+
33
+ Notation. We denote the labeled source domain data with $n _ { s }$ samples as $\mathcal { D } _ { s } = \{ ( x _ { i } ^ { s } , y _ { i } ^ { s } ) \} _ { i = 1 } ^ { n _ { s } }$ , where $y _ { i } ^ { s }$ orresponding label of . Both domains have t $x _ { i } ^ { s }$ , andsame e unlabeled target domain data with classes (closed-set setting). Under the $n _ { t }$ samples asFDA setting $\mathcal { D } _ { t } \overset { \vartriangle } { = } \{ x _ { j } ^ { t } \} _ { j = 1 } ^ { n _ { t } }$ $C$ $\mathcal { D } _ { s }$ is only available for model pretraining. Our method is based on a neural network, which we split into two parts: a feature extractor $f$ , and a classifier $g$ . The feature output by the feature extractor is denoted as $z ( x ) = f \left( x \right)$ , the output of network is denoted as $p ( x ) = \bar { \delta } ( g ( \dot { z } ) ) \in \mathcal { R } ^ { C }$ where $\delta$ is the softmax function, for readability we will abandon the input and use $z , p$ in the following sections.
34
+
35
+ Overview. We assume that the source pretrained model has already been trained. As discusses in the introduction, the target features output by the source model form clusters. We exploit this intrinsic structure of the target data for SFDA by considering the neighborhood information, and the adaptation is achieved with the following objective:
36
+
37
+ $$
38
+ \mathcal { L } = - \frac { 1 } { n _ { t } } \sum _ { x _ { i } \in \mathcal { D } _ { t } } \sum _ { x _ { j } \in \mathrm { N e i g h } ( x _ { i } ) } \frac { D _ { s i m } ( p _ { i } , p _ { j } ) } { D _ { d i s } ( x _ { i } , x _ { j } ) }
39
+ $$
40
+
41
+ where the $\mathrm { { N e i g h } } ( x _ { i } )$ means the nearest neighbors of $x _ { i }$ , $D _ { s i m }$ computes the similarity between predictions, and $D _ { d i s }$ is a constant measuring the semantic distance (dissimilarity) between data. The principle behind the objective is to push the data towards their semantically close neighbors by encouraging similar predictions. In the next sections, we will define $D _ { s i m }$ and $D _ { d i s }$ .
42
+
43
+ # 3.1 Encouraging Class-Consistency with Neighborhood Affinity
44
+
45
+ To achieve adaptation without source data, we use the prediction of the nearest neighbor to encourage prediction consistency. While the target features from the source model are not necessarily totally intrinsic discriminative, meaning some neighbors belong to different class and will provide the wrong supervision. To decrease the potentially negative impact of those neighbors, we propose to weigh the supervision from neighbors according to the connectivity (semantic similarity). We define affinity values to signify the connectivity between the neighbor and the feature, which corresponds to the $\frac { 1 } { D _ { d i s } }$ in Eq. 1 indicating the semantic similarity.
46
+
47
+ To retrieve the nearest neighbors for batch training, similar to [33, 50, 62], we build two memory banks: $\mathcal { F }$ stores all target features, and $s$ stores corresponding prediction scores:
48
+
49
+ $$
50
+ \mathcal { F } = [ z _ { 1 } , z _ { 2 } , \dotsc , z _ { n _ { t } } ] \mathrm { a n d } \ S = [ p _ { 1 } , p _ { 2 } , \dotsc , p _ { n _ { t } } ]
51
+ $$
52
+
53
+ We use the cosine similarity for nearest neighbors retrieving. The difference between ours and [33, 50] lies in the fact that we utilize the memory bank to retrieve nearest neighbors while [33, 50] adopts the memory bank to compute the instance discrimination loss. Before every mini-batch training, we simply update the old items in the memory banks corresponding to current mini-batch. Note that updating the memory bank is only done to replace the old low-dimension vectors with new ones computed by the model, and does not require any additional computation.
54
+
55
+ We then use the prediction of the neighbors to supervise the training weighted by the affinity values, with the following objective adapted from Eq. 1:
56
+
57
+ $$
58
+ \mathcal { L } _ { \mathcal { N } } = - \frac { 1 } { n _ { t } } \sum _ { i } \sum _ { k \in \mathcal { N } _ { K } ^ { i } } A _ { i k } \boldsymbol { S } _ { k } ^ { \top } \boldsymbol { p } _ { i }
59
+ $$
60
+
61
+ where we use the dot product to compute the similarity between predictions, corresponding to $D _ { s i m }$ in Eq.1, the $k$ is the index of the $k$ -th nearest neighbors of $z _ { i }$ , $\scriptstyle { S _ { k } }$ is the $k$ -th item in memory bank $s$ , $A _ { i k }$ is the affinity value of $k$ -th nearest neighbors of feature $z _ { i }$ . Here the $\mathcal { N } _ { K } ^ { i }$ is the index $\mathrm { { \dot { s e t } } } ^ { 2 }$ of the $K$ -nearest neighbors of feature $z _ { i }$ . Note that all neighbors are retrieved from the feature bank $\mathcal { F }$ . With the affinity value as weight, this objective pushes the features to their neighbors with strong connectivity and to a lesser degree to those with weak connectivity.
62
+
63
+ To assign larger affinity values to semantic similar neighbors, we divide the nearest neighbors retrieved into two groups: reciprocal nearest neighbors (RNN) and non-reciprocal nearest neighbors (nRNN). The feature $z _ { j }$ is regarded as the RNN of the feature $z _ { i }$ if it meets the following condition:
64
+
65
+ $$
66
+ j \in \mathcal { N } _ { K } ^ { i } \wedge i \in \mathcal { N } _ { M } ^ { j }
67
+ $$
68
+
69
+ Other neighbors which do not meet the above condition are nRNN. Note that the normal definition of reciprocal nearest neighbors [31] applies $K = M$ , while in this paper $K$ and $M$ can be different. We find that reciprocal neighbors have a higher potential to belong to the same cluster as the feature (Fig. 1(b)). Thus, we assign a high affinity value to the RNN features. Specifically for feature $z _ { i }$ , the affinity value of its $j$ -th $\mathrm { K }$ -nearest neighbor is defined as:
70
+
71
+ $$
72
+ A _ { i , j } = { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { i f ~ } } j \in { \mathcal { N } } _ { K } ^ { i } \land i \in { \mathcal { N } } _ { M } ^ { j } } \\ { r } & { { \mathrm { o t h e r w i s e . } } } \end{array} \right. }
73
+ $$
74
+
75
+ where $r$ is a hyperparameter. If not specified $r$ is set to 0.1.
76
+
77
+ To further reduce the potential impact of noisy neighbors in $\mathcal { N } _ { K }$ , which belong to the different class but still are RNN, we propose a simply yet effective way dubbed self-regularization, that is, to not ignore the current prediction of ego feature:
78
+
79
+ $$
80
+ \mathcal { L } _ { s e l f } = - \frac { 1 } { n _ { t } } \sum _ { i } ^ { n _ { t } } S _ { i } ^ { \top } p _ { i }
81
+ $$
82
+
83
+ where $s _ { i }$ means the stored prediction in the memory bank, note this term is a constant vector and is identical to the $p _ { i }$ since we update the memory banks before the training, here the loss is only back-propagated for variable $p _ { i }$ .
84
+
85
+ Require: $\mathcal { D } _ { s }$ (only for source model training), $\mathcal { D } _ { t }$
86
+
87
+ 1: Pre-train model on $\mathcal { D } _ { s }$
88
+ 2: Build feature bank $\mathcal { F }$ and score bank $s$ for $\mathcal { D } _ { t }$
89
+ 3: while Adaptation do
90
+ 4: Sample batch $\tau$ from $\mathcal { D } _ { t }$
91
+ 5: Update $\mathcal { F }$ and $s$ corresponding to current batch $\tau$
92
+ 6: Retrieve nearest neighbors $\mathcal { N }$ for each of $\tau$
93
+ 7: Compute affinity value $A$
94
+ 8: Retrieve expanded neighborhoods $E$ for each of $\mathcal { N }$
95
+ 9: Compute loss and update the model
96
+ 10: end while
97
+
98
+ . Eq.5 . Eq. 9
99
+
100
+ To avoid the degenerated solution [8, 39] where the model predicts all data as some specific classes (and does not predict other classes for any of the target data), we encourage the prediction to be balanced. We adopt the prediction diversity loss which is widely used in clustering [8, 9, 13] and also in several domain adaptation works [21, 39, 42]:
101
+
102
+ $$
103
+ \mathcal { L } _ { d i v } = \sum _ { c = 1 } ^ { C } \mathrm { K L } ( \bar { p } _ { c } | | q _ { c } ) , \mathrm { w i t h } \bar { p } _ { c } = \frac { 1 } { n _ { t } } \sum _ { i } p _ { i } ^ { ( c ) } , \mathrm { a n d } q _ { \{ c = 1 , . . , C \} } = \frac { 1 } { C }
104
+ $$
105
+
106
+ where the $p _ { i } ^ { ( c ) }$ is the score of the $c$ -th class and $\bar { p } _ { c }$ is the empirical label distribution, it represents the predicted possibility of class $c$ and q is a uniform distribution.
107
+
108
+ # 3.2 Expanded Neighborhood Affinity
109
+
110
+ As mentioned in Sec. 1, a simple way to achieve the aggregation of more information is by considering more nearest neighbors. However, a drawback is that larger neighborhoods are expected to contain more datapoint from multiple classes, defying the purpose of class consistency. A better way to include more target features is by considering the $M$ -nearest neighbor of each neighbor in $\mathcal { N } _ { K }$ of $z _ { i }$ in Eq. 4, i.e., the expanded neighbors. These target features are expected to be closer on the target data manifold than the features that are included by considering a larger number of nearest neighbors [43]. The expanded neighbors of feature $z _ { i }$ are defined as $\bar { E _ { M } } ( z _ { i } ) \bar { = } \mathcal { N } _ { M } ( z _ { j } ) \forall j \in \mathcal { N } _ { K } ( z _ { i } \bar { ) }$ , note that $E _ { M } ( z _ { i } )$ is still an index set and $i$ (ego feature) $\not \in E _ { M } ( z _ { i } )$ . We directly assign a small affinity value $r$ to those expanded neighbors, since they are further than nearest neighbors and may contain noise. We utilize the prediction of those expanded neighborhoods for training:
111
+
112
+ $$
113
+ \mathcal { L } _ { E } = - \frac { 1 } { n _ { t } } \sum _ { i } \sum _ { k \in \mathcal { N } _ { K } ^ { i } } \sum _ { m \in E _ { M } ^ { k } } r \mathcal { S } _ { m } ^ { \top } p _ { i }
114
+ $$
115
+
116
+ where $E _ { M } ^ { k }$ contain the $M$ -nearest neighbors of neighbor $k$ in $\mathcal { N } _ { K }$
117
+
118
+ Although the affinity values of all expanded neighbors are the same, it does not necessarily mean that they have equal importance. Taking a closer look at the expanded neighbors $E _ { M } ( z _ { i } )$ , some neighbors will show up more than once, for example $z _ { m }$ can be the nearest neighbor of both $z _ { h }$ and $z _ { j }$ where $h , j \in \mathcal N _ { K } ( \bar { z } _ { i } )$ , and the nearest neighbors can also serve as expanded neighbor. It implies that those neighbors form compact cluster, and we posit that those duplicated expanded neighbors have potential to be semantically closer to the ego-feature $z _ { i }$ . Thus, we do not remove duplicated features in $E _ { M } ( z _ { i } )$ , as those can lead to actually larger affinity value for those expanded neighbors. This is one advantage of utilizing expanded neighbors instead of more nearest neighbors, we will verify the importance of maintaining the duplicated features in the experimental section.
119
+
120
+ Final objective. Our method, called Neighborhood Reciprocity Clustering (NRC), is illustrated in Algorithm. 1. The final objective for adaptation is:
121
+
122
+ $$
123
+ \mathcal { L } = \mathcal { L } _ { d i v } + \mathcal { L } _ { \mathcal { N } } + \mathcal { L } _ { E } + \mathcal { L } _ { s e l f } .
124
+ $$
125
+
126
+ # 4 Experiments
127
+
128
+ Datasets. We use three 2D image benchmark datasets and a 3D point cloud recognition dataset.
129
+ Office-31 [32] contains 3 domains (Amazon, Webcam, DSLR) with 31 classes and 4,652 images.
130
+
131
+ Table 1: Accuracies $( \% )$ on Office-31 for ResNet50-based methods.
132
+
133
+ <table><tr><td>Method</td><td>SF</td><td>A→D</td><td>A→W</td><td>D→W</td><td>W→D</td><td>D→A</td><td>W→A</td><td>Avg</td></tr><tr><td>MCD [35]</td><td>X</td><td>92.2</td><td>88.6</td><td>98.5</td><td>100.0</td><td>69.5</td><td>69.7</td><td>86.5</td></tr><tr><td>CDAN [24]</td><td>X</td><td>92.9</td><td>94.1</td><td>98.6</td><td>100.0</td><td>71.0</td><td>69.3</td><td>87.7</td></tr><tr><td>MDD [59]</td><td>X</td><td>90.4</td><td>90.4</td><td>98.7</td><td>99.9</td><td>75.0</td><td>73.7</td><td>88.0</td></tr><tr><td>BNM[4]</td><td>X</td><td>90.3</td><td>91.5</td><td>98.5</td><td>100.0</td><td>70.9</td><td>71.6</td><td>87.1</td></tr><tr><td>DMRL [49]</td><td>X</td><td>93.4</td><td>90.8</td><td>99.0</td><td>100.0</td><td>73.0</td><td>71.2</td><td>87.9</td></tr><tr><td>BDG[53]</td><td>X</td><td>93.6</td><td>93.6</td><td>99.0</td><td>100.0</td><td>73.2</td><td>72.0</td><td>88.5</td></tr><tr><td>MCC[15]</td><td>X</td><td>95.6</td><td>95.4</td><td>98.6</td><td>100.0</td><td>72.6</td><td>73.9</td><td>89.4</td></tr><tr><td>SRDC[42]</td><td>X</td><td>95.8</td><td>95.7</td><td>99.2</td><td>100.0</td><td>76.7</td><td>77.1</td><td>90.8</td></tr><tr><td>RWOT[51]</td><td>X</td><td>94.5</td><td>95.1</td><td>99.5</td><td>100.0</td><td>77.5</td><td>77.9</td><td>90.8</td></tr><tr><td>RSDA-MSTN[10]</td><td>X</td><td>95.8</td><td>96.1</td><td>99.3</td><td>100.0</td><td>77.4</td><td>78.9</td><td>91.1</td></tr><tr><td>SHOT [21]</td><td>√</td><td>94.0</td><td>90.1</td><td>98.4</td><td>99.9</td><td>74.7</td><td>74.3</td><td>88.6</td></tr><tr><td>3C-GAN[20]</td><td>【</td><td>92.7</td><td>93.7</td><td>98.5</td><td>99.8</td><td>75.3</td><td>77.8</td><td>89.6</td></tr><tr><td>NRC</td><td></td><td>96.0</td><td>90.8</td><td>99.0</td><td>100.0</td><td>75.3</td><td>75.0</td><td>89.4</td></tr></table>
134
+
135
+ Table 2: Accuracies $( \% )$ on Office-Home for ResNet50-based methods.
136
+
137
+ <table><tr><td>Method</td><td></td><td>SFAr-&gt;CIAr-→PrAr-→RwC1-→ArCI-→PrCI-→&gt;RwPr-→ArPr-→&gt;CIPr-→RwRw-→ArRw-→CIRw-→PrAvg</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>MCD [35]</td><td>xxxxxxxxxx</td><td>48.9 68.3</td><td>74.6</td><td>61.3</td><td>67.6</td><td>68.8</td><td>57.0</td><td>47.1</td><td>75.1</td><td>69.1</td><td>52.2</td><td>79.6</td><td>64.1</td></tr><tr><td>CDAN [24]</td><td></td><td>50.7</td><td>70.6 76.0</td><td>57.6</td><td>70.0</td><td>70.0</td><td>57.4</td><td>50.9</td><td>77.3</td><td>70.9</td><td>56.7</td><td>81.6</td><td>65.8</td></tr><tr><td>SAFN [52]</td><td></td><td>52.0</td><td>71.7 76.3</td><td>64.2</td><td>69.9</td><td>71.9</td><td>63.7</td><td>51.4</td><td>77.1</td><td>70.9</td><td>57.1</td><td>81.5</td><td>67.3</td></tr><tr><td>Symnets [58]</td><td></td><td>47.7 72.9</td><td>78.5</td><td>64.2</td><td>71.3</td><td>74.2</td><td>64.2</td><td>48.8</td><td>79.5</td><td>74.5</td><td>52.6</td><td>82.7</td><td>67.6</td></tr><tr><td>MDD [59]</td><td></td><td>54.9 73.7</td><td>77.8</td><td>60.0</td><td>71.4</td><td>71.8</td><td>61.2</td><td>53.6</td><td>78.1</td><td>72.5</td><td>60.2</td><td>82.3</td><td>68.1</td></tr><tr><td>TADA [47]</td><td></td><td>53.1</td><td>72.3 77.2</td><td>59.1</td><td>71.2</td><td>72.1</td><td>59.7</td><td>53.1</td><td>78.4</td><td>72.4</td><td>60.0</td><td>82.9</td><td>67.6</td></tr><tr><td>BNM[4]</td><td></td><td>52.3</td><td>73.9 80.0</td><td>63.3</td><td>72.9</td><td>74.9</td><td>61.7</td><td>49.5</td><td>79.7</td><td>70.5</td><td>53.6</td><td>82.2</td><td>67.9</td></tr><tr><td>BDG [53]</td><td></td><td>51.5 73.4</td><td>78.7</td><td>65.3</td><td>71.5</td><td>73.7</td><td>65.1</td><td>49.7</td><td>81.1</td><td>74.6</td><td>55.1</td><td>84.8</td><td>68.7</td></tr><tr><td>SRDC [42]</td><td></td><td>52.3 76.3</td><td>81.0</td><td>69.5</td><td>76.2</td><td>78.0</td><td>68.7</td><td>53.8</td><td>81.7</td><td>76.3</td><td>57.1</td><td>85.0</td><td>71.3</td></tr><tr><td>RSDA-MSTN[10]</td><td></td><td>53.2</td><td>77.7 81.3</td><td>66.4</td><td>74.0</td><td>76.5</td><td>67.9</td><td>53.0</td><td>82.0</td><td>75.8</td><td>57.8</td><td>85.4</td><td>70.9</td></tr><tr><td>SHOT [21]</td><td></td><td>57.1</td><td>78.1 81.5</td><td>68.0</td><td>78.2</td><td>78.1</td><td>67.4</td><td>54.9</td><td>82.2</td><td>73.3</td><td>58.8</td><td>84.3</td><td>71.8</td></tr><tr><td>NRC</td><td>区</td><td>57.7</td><td>80.3 82.0</td><td>68.1</td><td>79.8</td><td>78.6</td><td>65.3</td><td>56.4</td><td>83.0</td><td>71.0</td><td>58.6</td><td>85.6</td><td>72.2</td></tr></table>
138
+
139
+ Office-Home [46] contains 4 domains (Real, Clipart, Art, Product) with 65 classes and a total of 15,500 images. VisDA [28] is a more challenging dataset, with 12-class synthetic-to-real object recognition tasks, its source domain contains of $1 5 2 \mathrm { k }$ synthetic images while the target domain has 55k real object images. PointDA-10 [30] is the first 3D point cloud benchmark specifically designed for domain adaptation, it has 3 domains with 10 classes, denoted as ModelNet-10, ShapeNet-10 and ScanNet-10, containing approximately $2 7 . 7 \mathrm { k }$ training and 5.1k testing images together.
140
+
141
+ Evaluation. We compare with existing source-present and source-free DA methods. All results are the average on three random runs. SF in the tables denotes source-free.
142
+
143
+ Model details. For fair comparison with related methods, we also adopt the backbone of ResNet-50 [11] for Office-Home and ResNet-101 for VisDA, and PointNet [29] for PointDA10. Specifically, for 2D image datasets, we use the same network architecture as SHOT [21], i.e., the final part of the network is: fully connected layer − Batch Normalization [12] − fully connected layer with weight normalization [37]. And for PointDA-10 [29], we use the code released by the authors for fair comparison with PointDAN [29], and only use the backbone without any of their proposed modules. To train the source model, we also adopt label smoothing as SHOT does. We adopt SGD with momentum 0.9 and batch size of 64 for all 2D datasets, and Adam for PointDA-10. The learning rate for Office-31 and Office-Home is set to 1e-3 for all layers, except for the last two newly added fc layers, where we apply 1e-2. Learning rates are set 10 times smaller for VisDA. Learning rate for PointDA-10 is set to 1e-6. We train 30 epochs for Office-31 and OfficeHome while 15 epochs for VisDA, and 100 for PointDA-10. For the number of nearest neighbors (K) and expanded neighborhoods (M), we use 3,2 for Office-31, Office-Home and PointDA-10, since VisDA is much larger we set K, M to 5. Experiments are conducted on a TITAN Xp.
144
+
145
+ # 4.1 Results
146
+
147
+ 2D image datasets. We first evaluate the target performance of our method compared with existing DA and SFDA methods on three 2D image datasets. As shown in Table 1-3, the top part shows results for the source-present methods with access to source data during adaptation. The bottom shows results for the source-free DA methods. On Office-31, our method gets similar results compared with source-free method 3C-GAN and lower than source-present method RSDA-MSTN. And our method achieves state-of-the-art performance on Office-Home and VisDA, especially on VisDA our method surpasses the source-free method SHOT and source-present method RWOT by a wide margin $3 \%$ and $1 . 9 \%$ respectively). The reported results clearly demonstrate the efficiency of the proposed method for source-free domain adaptation. Interestingly, like already observed in the SHOT paper, source-free methods outperform methods that have access to source data during adaptation.
148
+
149
+ Table 3: Accuracies $( \% )$ on VisDA-C (Synthesis Real) for ResNet101-based methods.
150
+
151
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>SF</td><td rowspan=1 colspan=1>[SF|plane bcycl bus car horse knife mcycl person plant sktbrd train truck Per-class</td></tr><tr><td rowspan=5 colspan=1>ADR [34]CDAN [24]CDAN+BSP[2]SAFN [52]SWD[19]MDD [59]DMRL [49]MCC[15]STAR [26]RWOT[51]</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>94.248.584.0 72.990.174.292.6 72.580.861.882.2 28.8 73.5</td></tr><tr><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>85.266.983.0 50.884.274.988.1 74.583.476.081.9 38.0 73.9</td></tr><tr><td rowspan=3 colspan=1>×</td><td rowspan=2 colspan=1>61.081.0 57.5 89.080.690.1 77.084.277.982.1 38.4 75.9</td></tr><tr><td rowspan=1 colspan=1>92.493.690.8</td></tr><tr><td rowspan=1 colspan=1>93.661.384.1 70.6 94.179.091.8 79.689.955.689.0 24.4 76.190.882.5 81.7 70.5 91.769.586.3 77.587.463.685.6 29.2 76.4- 1 1 1 1 1 1 1 1 - 1 1 74.6- = = = = = = = = 75.588.780.3 80.5 71.5 90.1 93.285.0 71.689.473.8 85.0 36.9 78.895.084.084.6 73.0 91.691.885.9 78.494.484.787.0 42.2 82.795.180.383.7 90.092.468.092.5 82.287.978.490.4 68.2 84.0</td></tr><tr><td rowspan=3 colspan=1>3C-GAN [20]SHOT[21]NRC</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>94.873.468.8 74.893.195.488.6 84.7 89.184.783.5 48.1 81.6</td></tr><tr><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>94.388.580.1 57.3 93.194.980.7 80.391.589.186.3 58.2 82.9</td></tr><tr><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>96.891.382.4 62.4 96.295.986.1 80.694.894.190.4 59.7 85.9</td></tr></table>
152
+
153
+ Table 4: Accuracies $( \% )$ on PointDA-10. The results except ours are from PointDAN [30].
154
+
155
+ <table><tr><td colspan="2"></td><td colspan="4">|SF|Model-→Shape Model-→Scan Shape-→Model Shape-&gt;Scan Scan→Model Scan-→Shape Avg</td></tr><tr><td>MMD [25]</td><td></td><td>57.5 27.9</td><td>40.7</td><td>26.7</td><td>47.3</td><td>54.8</td><td>42.5</td></tr><tr><td>DANN [6]</td><td>xxxxx</td><td>58.7 29.4</td><td>42.3</td><td>30.5</td><td>48.1</td><td>56.7</td><td>44.2</td></tr><tr><td>ADDA [44]</td><td></td><td>61.0 30.5</td><td>40.4</td><td>29.3</td><td>48.9</td><td>51.1</td><td>43.5</td></tr><tr><td>MCD [35]</td><td></td><td>62.0 31.0</td><td>41.4</td><td>31.3</td><td>46.8</td><td>59.3</td><td>45.3</td></tr><tr><td>PointDAN [30]</td><td></td><td>64.2 33.0</td><td>47.6</td><td>33.9</td><td>49.1</td><td>64.1</td><td>48.7</td></tr><tr><td>Source-only</td><td></td><td>43.1</td><td>17.3 40.0</td><td>15.0</td><td>33.9</td><td>47.1</td><td>32.7</td></tr><tr><td>NRC</td><td>&lt;</td><td>64.8</td><td>25.8 59.8</td><td>26.9</td><td>70.1</td><td>68.1</td><td>52.6</td></tr></table>
156
+
157
+ 3D point cloud dataset. We also report the result for the PointDA-10. As shown in Table 4, our method outperforms PointDA [30], which demands source data for adaptation and is specifically tailored for point cloud data with extra attention modules, by a large margin $(4 \% )$ .
158
+
159
+ # 4.2 Analysis
160
+
161
+ Ablation study on neighbors $\mathcal { N }$ , $E$ and affinity $A$ . In the first two tables of Table 5, we conduct the ablation study on Office-Home and VisDA. The 1-st row contains results from the source model and the 2-nd row from only training with the diversity loss $\mathcal { L } _ { d i v }$ . From the remaining rows, several conclusions can be drawn.
162
+
163
+ First, the original supervision, which considers all neighbors equally can lead to a decent performance (67.1 on Office-Home). Second, considering higher affinity values for reciprocal neighbors leads to a large performance gain (69.1 on Office-Home). Last but not the least, the expanded neighborhoods can also be helpful, but only when combined with the affinity values $A$ (72.2 on Office-Home). Using expanded neighborhoods without affinity obtains bad performance (65,2 on Office-Home). We conjecture that those expanded neighborhoods, especially those neighbors of nRNN, may be noisy as discussed in Sec. 3.2. Removing the affinity $A$ means we treat all those neighbors equally, which is not reasonable.
164
+
165
+ Table 5: Ablation study of different modules on Office-Home (left) and VisDA (middle), comparison between using expanded neighbors and larger nearest neighbors (right).
166
+
167
+ <table><tr><td>Ldiv</td><td>LN</td><td>LE LEA</td><td>Avg</td><td>Ldiv</td><td>LN</td><td></td><td>LE LEA</td><td></td><td>Acc</td></tr><tr><td></td><td></td><td></td><td>59.5</td><td></td><td></td><td></td><td></td><td></td><td>44.6</td></tr><tr><td></td><td></td><td></td><td>62.1</td><td></td><td></td><td></td><td></td><td></td><td>47.8</td></tr><tr><td></td><td></td><td></td><td>67.1</td><td></td><td></td><td></td><td></td><td></td><td>74.6</td></tr><tr><td></td><td></td><td></td><td>√ 69.1</td><td></td><td></td><td></td><td></td><td>√</td><td>81.5</td></tr><tr><td></td><td></td><td></td><td>65.2</td><td></td><td></td><td></td><td></td><td></td><td>61.2</td></tr><tr><td></td><td></td><td></td><td>72.2</td><td></td><td></td><td></td><td></td><td>!</td><td>85.9</td></tr><tr><td></td><td></td><td></td><td>69.1 [</td><td></td><td></td><td></td><td></td><td></td><td>82.0</td></tr></table>
168
+
169
+ <table><tr><td rowspan=1 colspan=1>Method&amp;Dataset</td><td rowspan=1 colspan=1>Acc</td></tr><tr><td rowspan=1 colspan=1>VisDA (K=M=5)VisDA w/o E (K=30)</td><td rowspan=1 colspan=1>85.984.0</td></tr><tr><td rowspan=1 colspan=1>OH(K=3,M=2)OH w/o E (K=9)</td><td rowspan=1 colspan=1>72.269.5</td></tr></table>
170
+
171
+ Table 6: Runtime analysis on SHOT and our method. For SHOT, pseudo labels are computed at each epoch. $20 \%$ , $10 \%$ and $5 \%$ denote the percentage of target features which are stored in the memory bank.
172
+
173
+ <table><tr><td>VisDA</td><td colspan="2">Runtime (s/epoch)Per-class (%)</td></tr><tr><td>SHOT</td><td>618.82</td><td>82.9</td></tr><tr><td>NRC</td><td>540.89</td><td>85.9</td></tr><tr><td>NRC(20%) 6formemorybank)</td><td>507.15</td><td>85.3</td></tr><tr><td>NRC(10% for memory bank)</td><td>499.49</td><td>85.2</td></tr><tr><td>NRC(5% for memory bank)</td><td>499.28</td><td>85.1</td></tr></table>
174
+
175
+ ![](images/e1748829bba37f8f3b6d43d90dfdbea6be91a7b5cbb5e87bd18f0bf9bd522aa6.jpg)
176
+ Figure 2: (Left and middle) Ablation study of $\mathcal { L } _ { s e l f }$ on Office-Home and VisDA respectively. (Right) Performance with different $r$ on VisDA.
177
+
178
+ We also show that duplication in the expanded neighbors is important in the last row of Table 5, where the $\mathcal { L } _ { \hat { E } }$ means we remove duplication in Eq. 8. The results show that the performance will degrade significantly when removing them, implying that the duplicated expanded neighbors are indeed more important than others.
179
+
180
+ Next we ablate the importance of the expanded neighborhood in the right of Table5. We show that if we increase the number of datapoints considered for class-consistency by simply considering a larger K, we obtain significantly lower scores. We have chosen $K$ so that the total number of points considered is equal to our method (i.e. $5 { + } 5 ^ { * } 5 { = } 3 0$ and $3 + 3 ^ { * } 2 { = } 9 ,$ ). Considering neighbors of neighbors is more likely to provide datapoints that are close on the data manifold [43], and are therefore more likely to share the class label with the ego feature.
181
+
182
+ Runtime analysis. Instead of storing all feature vectors in the memory bank, we follow the same memory bank setting as in [5] which is for nearest neighbor retrieval. The method only stores a fixed number of target features, we update the memory bank at the end of each iteration by taking the $n$ (batch size) embeddings from the current training iteration and concatenating them at the end of the memory bank, and discard the oldest $n$ elements from the memory bank. We report the results with this type of memory bank of different buffer size in the Table 6. The results show that indeed this could be an efficient way to reduce computation on very large datasets.
183
+
184
+ Ablation study on self-regularization. In the left and middle of Fig 2, we show the results with and without self-regularization $\mathcal { L } _ { s e l f }$ . The $\mathcal { L } _ { s e l f }$ can improve the performance when adopting only nearest neighbors $\mathcal { N }$ or all neighbors $\mathcal { N } + E$ . The results imply that self-regularization can effectively reduce the negative impact of the potential noisy neighbors, especially on the Office-Home dataset.
185
+
186
+ Sensitivity to hyperparameter. There are three hyperparameters in our method: K and M which are the number of nearest neighbors and expanded neighbors, $r$ which is the affinity value assigned to nRNN. We show the results with different $r$ in the right of Fig. 2. Note we keep the affinity of expanded neighbors as 0.1. $r = 1$ means no affinity. $r = - 1$ means treating supervision of nRNN feature as totally wrong, which is not always the case and will lead to quite lower result. $r = 0$ can also achieve good performance, signifying RNN can already work well. Results with $r = 0 . 1 / 0 . 1 5 / 0 . 2$ show that our method is not sensitive to the choice of a reasonable $r$ . Note in DA, there is no validation set for hyperparameter tuning, we show the results varying the number of neighbors in the right of Tab. 3, demonstrating the robustness to the choice of $K$ and $M$ .
187
+
188
+ ![](images/52c51cde4275a75094e8c62c8d4fd77f70977cdffb6dcc8e5fcf1796cfa99e42.jpg)
189
+ Figure 3: (Left) The three curves are (on VisDA): target accuracy (Blue), ratio of features which have 5-nearest neighbors all sharing the same predicted label (dashed Red), and ratio of features which have 5-nearest neighbors all sharing the same and correct predicted label (dashed Black). (Right) Ablation study on choice of K and M on VisDA.
190
+
191
+ ![](images/fd8c9cc81f0a4968ed7f3124861b6deeb77a38f4952bd4cbfedaa30cfe215f98.jpg)
192
+ Figure 4: (Left) Ratio of different type of nearest neighbor features which have the correct predicted label, before and after adaptation. (Right) Visualization of target features after adaptation.
193
+
194
+ Training curve. We show the evolution of several statistics during adaptation on VisDA in the left of Tab. 3. The blue curve is the target accuracy. The dashed red and black curves are the ratio of features which have 5-nearest neighbors all sharing the same (dashed Red), or the same and also correct (dashed Black) predicted label. The curves show that the target features are clustering during the training. Another interesting finding is that the curve ’Per Shared’ correlates with the accuracy curve, which might therefore be used to determine training convergence.
195
+
196
+ Accuracy of supervision from neighbors. We also show the accuracy of supervision from neighbors on task $\mathrm { A r } { } \mathrm { R w }$ of Office-Home in Fig. 4(left). It shows that after adaptation, the ratio of all types of neighbors having more correct predicted label, proving the effectiveness of the method.
197
+
198
+ t-SNE visualization. We show the t-SNE feature visualization on task $\mathrm { A r } { } \mathrm { R w }$ of target features before (Fig. 1(a)) and after (Fig. 4(right)) adaptation. After adaptation, the features are more compactly clustered.
199
+
200
+ # 5 Conclusions
201
+
202
+ We introduce a source-free domain adaptation (SFDA) method by uncovering the intrinsic target data structure. We propose to achieve the adaptation by encouraging label consistency among local target features. We differentiate between nearest neighbors, reciprocal neighbors and expanded neighborhood. Experimental results verify the importance of considering the local structure of the target features. Finally, our experimental results on both 2D image and 3D point cloud datasets testify the efficacy of our method.
203
+
204
+ Acknowledgement We acknowledge the support from Huawei Kirin Solution, and the project PID2019-104174GB-I00 (MINECO, Spain) and RTI2018-102285-A-I00 (MICINN, Spain), Ramón y Cajal fellowship RYC2019-027020-I, and the CERCA Programme of Generalitat de Catalunya.
205
+
206
+ # References
207
+
208
+ [1] Kristen M Altenburger and Johan Ugander. Monophily in social networks introduces similarity among friends-of-friends. Nature human behaviour, 2(4):284–290, 2018.
209
+ [2] Xinyang Chen, Sinan Wang, Mingsheng Long, and Jianmin Wang. Transferability vs. discriminability: Batch spectral penalization for adversarial domain adaptation. In International Conference on Machine Learning, pages 1081–1090, 2019.
210
+ [3] Alex Chin, Yatong Chen, Kristen M. Altenburger, and Johan Ugander. Decoupled smoothing on graphs. In The World Wide Web Conference, pages 263–272, 2019.
211
+ [4] Shuhao Cui, Shuhui Wang, Junbao Zhuo, Liang Li, Qingming Huang, and Qi Tian. Towards discriminability and diversity: Batch nuclear-norm maximization under label insufficient situations. CVPR, 2020.
212
+ [5] Debidatta Dwibedi, Yusuf Aytar, Jonathan Tompson, Pierre Sermanet, and Andrew Zisserman. With a little help from my friends: Nearest-neighbor contrastive learning of visual representations. ICCV, 2021.
213
+ [6] Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. arXiv preprint arXiv:1409.7495, 2014.
214
+ [7] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 17(1):2096–2030, 2016.
215
+ [8] Kamran Ghasedi Dizaji, Amirhossein Herandi, Cheng Deng, Weidong Cai, and Heng Huang. Deep clustering via joint convolutional autoencoder embedding and relative entropy minimization. In Proceedings of the IEEE international conference on computer vision, pages 5736–5745, 2017.
216
+ [9] Ryan Gomes, Andreas Krause, and Pietro Perona. Discriminative clustering by regularized information maximization. 2010.
217
+ [10] Xiang Gu, Jian Sun, and Zongben Xu. Spherical space domain adaptation with robust pseudo-label loss. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9101–9110, 2020.
218
+ [11] 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.
219
+ [12] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
220
+ [13] Mohammed Jabi, Marco Pedersoli, Amar Mitiche, and Ismail Ben Ayed. Deep clustering: On the link between discriminative models and k-means. IEEE transactions on pattern analysis and machine intelligence, 2019.
221
+ [14] Herve Jegou, Hedi Harzallah, and Cordelia Schmid. A contextual dissimilarity measure for accurate and efficient image search. In 2007 IEEE Conference on Computer Vision and Pattern Recognition, pages 1–8. IEEE, 2007.
222
+ [15] Ying Jin, Ximei Wang, Mingsheng Long, and Jianmin Wang. Minimum class confusion for versatile domain adaptation. ECCV, 2020.
223
+ [16] Jogendra Nath Kundu, Naveen Venkat, and R Venkatesh Babu. Universal source-free domain adaptation. CVPR, 2020.
224
+ [17] Jogendra Nath Kundu, Naveen Venkat, Ambareesh Revanur, R Venkatesh Babu, et al. Towards inheritable models for open-set domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12376–12385, 2020.
225
+ [18] Chen-Yu Lee, Tanmay Batra, Mohammad Haris Baig, and Daniel Ulbricht. Sliced wasserstein discrepancy for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
226
+ [19] Chen-Yu Lee, Tanmay Batra, Mohammad Haris Baig, and Daniel Ulbricht. Sliced wasserstein discrepancy for unsupervised domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 10285–10295, 2019.
227
+ [20] Rui Li, Qianfen Jiao, Wenming Cao, Hau-San Wong, and Si Wu. Model adaptation: Unsupervised domain adaptation without source data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9641–9650, 2020.
228
+ [21] Jian Liang, Dapeng Hu, and Jiashi Feng. Do we really need to access the source data? source hypothesis transfer for unsupervised domain adaptation. ICML, 2020.
229
+ [22] Yuang Liu, Wei Zhang, and Jun Wang. Source-free domain adaptation for semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1215–1224, 2021.
230
+ [23] Mingsheng Long, Yue Cao, Jianmin Wang, and Michael I Jordan. Learning transferable features with deep adaptation networks. ICML, 2015.
231
+ [24] Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Conditional adversarial domain adaptation. In Advances in Neural Information Processing Systems, pages 1647–1657, 2018.
232
+ [25] Mingsheng Long, Jianmin Wang, Guiguang Ding, Jiaguang Sun, and Philip S Yu. Transfer feature learning with joint distribution adaptation. In Proceedings of the IEEE international conference on computer vision, pages 2200–2207, 2013.
233
+ [26] Zhihe Lu, Yongxin Yang, Xiatian Zhu, Cong Liu, Yi-Zhe Song, and Tao Xiang. Stochastic classifiers for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9111–9120, 2020.
234
+ [27] Yingwei Pan, Ting Yao, Yehao Li, Chong-Wah Ngo, and Tao Mei. Exploring category-agnostic clusters for open-set domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13867–13875, 2020.
235
+ [28] Xingchao Peng, Ben Usman, Neela Kaushik, Judy Hoffman, Dequan Wang, and Kate Saenko. Visda: The visual domain adaptation challenge. arXiv preprint arXiv:1710.06924, 2017.
236
+ [29] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 652–660, 2017.
237
+ [30] Can Qin, Haoxuan You, Lichen Wang, C-C Jay Kuo, and Yun Fu. Pointdan: A multi-scale 3d domain adaption network for point cloud representation. Advances in Neural Information Processing Systems, 32:7192–7203, 2019.
238
+ [31] Danfeng Qin, Stephan Gammeter, Lukas Bossard, Till Quack, and Luc Van Gool. Hello neighbor: Accurate object retrieval with k-reciprocal nearest neighbors. In CVPR 2011, pages 777–784. IEEE, 2011.
239
+ [32] 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.
240
+ [33] Kuniaki Saito, Donghyun Kim, Stan Sclaroff, and Kate Saenko. Universal domain adaptation through self supervision. Advances in Neural Information Processing Systems, 33, 2020.
241
+ [34] Kuniaki Saito, Yoshitaka Ushiku, Tatsuya Harada, and Kate Saenko. Adversarial dropout regularization. ICLR, 2018.
242
+ [35] Kuniaki Saito, Kohei Watanabe, Yoshitaka Ushiku, and Tatsuya Harada. Maximum classifier discrepancy for unsupervised domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3723–3732, 2018.
243
+ [36] Kuniaki Saito, Shohei Yamamoto, Yoshitaka Ushiku, and Tatsuya Harada. Open set domain adaptation by backpropagation. In Proceedings of the European Conference on Computer Vision (ECCV), pages 153–168, 2018.
244
+ [37] Tim Salimans and Diederik P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. arXiv preprint arXiv:1602.07868, 2016.
245
+ [38] Saquib Sarfraz, Vivek Sharma, and Rainer Stiefelhagen. Efficient parameter-free clustering using first neighbor relations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8934–8943, 2019.
246
+ [39] Yuan Shi and Fei Sha. Information-theoretical learning of discriminative clusters for unsupervised domain adaptation. In Proceedings of the 29th International Coference on International Conference on Machine Learning, pages 1275–1282, 2012.
247
+ [40] Rui Shu, Hung H Bui, Hirokazu Narui, and Stefano Ermon. A dirt-t approach to unsupervised domain adaptation. ICLR, 2018.
248
+ [41] Baochen Sun, Jiashi Feng, and Kate Saenko. Return of frustratingly easy domain adaptation. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
249
+ [42] Hui Tang, Ke Chen, and Kui Jia. Unsupervised domain adaptation via structurally regularized deep clustering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8725–8735, 2020.
250
+ [43] Joshua B Tenenbaum, Vin De Silva, and John C Langford. A global geometric framework for nonlinear dimensionality reduction. science, 290(5500):2319–2323, 2000.
251
+ [44] Eric Tzeng, Judy Hoffman, Kate Saenko, and Trevor Darrell. Adversarial discriminative domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7167–7176, 2017.
252
+ [45] Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014.
253
+ [46] Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5018–5027, 2017.
254
+ [47] Ximei Wang, Liang Li, Weirui Ye, Mingsheng Long, and Jianmin Wang. Transferable attention for domain adaptation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 5345–5352, 2019.
255
+ [48] Zhongdao Wang, Liang Zheng, Yali Li, and Shengjin Wang. Linkage based face clustering via graph convolution network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1117–1125, 2019.
256
+ [49] Yuan Wu, Diana Inkpen, and Ahmed El-Roby. Dual mixup regularized learning for adversarial domain adaptation. ECCV, 2020.
257
+ [50] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3733–3742, 2018.
258
+ [51] Renjun Xu, Pelen Liu, Liyan Wang, Chao Chen, and Jindong Wang. Reliable weighted optimal transport for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4394–4403, 2020.
259
+ [52] Ruijia Xu, Guanbin Li, Jihan Yang, and Liang Lin. Larger norm more transferable: An adaptive feature norm approach for unsupervised domain adaptation. In The IEEE International Conference on Computer Vision (ICCV), October 2019.
260
+ [53] Guanglei Yang, Haifeng Xia, Mingli Ding, and Zhengming Ding. Bi-directional generation for unsupervised domain adaptation. In AAAI, pages 6615–6622, 2020.
261
+ [54] Lei Yang, Dapeng Chen, Xiaohang Zhan, Rui Zhao, Chen Change Loy, and Dahua Lin. Learning to cluster faces via confidence and connectivity estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13369–13378, 2020.
262
+ [55] Lei Yang, Xiaohang Zhan, Dapeng Chen, Junjie Yan, Chen Change Loy, and Dahua Lin. Learning to cluster faces on an affinity graph. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2298–2306, 2019.
263
+ [56] Shiqi Yang, Yaxing Wang, Joost van de Weijer, Luis Herranz, and Shangling Jui. Unsupervised domain adaptation without source data by casting a bait. arXiv preprint arXiv:2010.12427, 2020.
264
+ [57] Kaichao You, Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Universal domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2720–2729, 2019.
265
+ [58] Yabin Zhang, Hui Tang, Kui Jia, and Mingkui Tan. Domain-symmetric networks for adversarial domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5031–5040, 2019.
266
+ [59] Yuchen Zhang, Tianle Liu, Mingsheng Long, and Michael Jordan. Bridging theory and algorithm for domain adaptation. In International Conference on Machine Learning, pages 7404–7413, 2019.
267
+ [60] Zhun Zhong, Liang Zheng, Donglin Cao, and Shaozi Li. Re-ranking person re-identification with kreciprocal encoding. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1318–1327, 2017.
268
+ [61] Jiong Zhu, Yujun Yan, Lingxiao Zhao, Mark Heimann, Leman Akoglu, and Danai Koutra. Beyond homophily in graph neural networks: Current limitations and effective designs. Advances in Neural Information Processing Systems, 33, 2020.
269
+ [62] Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6002–6012, 2019.
270
+
271
+ # Checklist
272
+
273
+ 1. For all authors...
274
+
275
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
276
+ (b) Did you describe the limitations of your work? [No]
277
+ (c) Did you discuss any potential negative societal impacts of your work? [No]
278
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
279
+
280
+ 2. If you are including theoretical results...
281
+
282
+ (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]
283
+
284
+ 3. If you ran experiments...
285
+
286
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We attach the code in the supplemental material.
287
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] As in the model details in Sec.4
288
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] All main results are average over three running with random seeds.
289
+ (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]
290
+
291
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
292
+
293
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
294
+ (b) Did you mention the license of the assets? [No]
295
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
296
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
297
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
298
+
299
+ 5. If you used crowdsourcing or conducted research with human subjects...
300
+
301
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
302
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
303
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]